From 43d36dee7deccb69710f5540c812af2c7121a301 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Mar 2026 15:47:18 +0000 Subject: [PATCH 01/25] Initial plan From 75dfc4e70b5b08e7d314a325e1321b34abb3cf17 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Mar 2026 15:54:53 +0000 Subject: [PATCH 02/25] Add polyglot TypeScript apphost files for .NET Aspire samples Create TypeScript equivalents of C# AppHost.cs files using the Aspire polyglot apphost SDK for 14 samples. Each file uses the createBuilder pattern with camelCase method names and includes POLYGLOT GAP comments for features not yet available in the TypeScript SDK. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- samples/Metrics/MetricsApp.AppHost/apphost.ts | 33 +++++++++++++ .../aspire-shop/AspireShop.AppHost/apphost.ts | 49 +++++++++++++++++++ .../ImageGallery.AppHost/apphost.ts | 31 ++++++++++++ .../AspireJavaScript.AppHost/apphost.ts | 34 +++++++++++++ .../AspireWithNode.AppHost/apphost.ts | 21 ++++++++ samples/aspire-with-python/apphost.ts | 15 ++++++ .../ClientAppsIntegration.AppHost/apphost.ts | 19 +++++++ samples/container-build/apphost.ts | 33 +++++++++++++ .../CustomResources.AppHost/apphost.ts | 13 +++++ .../DatabaseContainers.AppHost/apphost.ts | 47 ++++++++++++++++++ .../DatabaseMigrations.AppHost/apphost.ts | 22 +++++++++ .../HealthChecksUI.AppHost/apphost.ts | 34 +++++++++++++ .../OrleansVoting.AppHost/apphost.ts | 23 +++++++++ .../VolumeMount.AppHost/apphost.ts | 22 +++++++++ 14 files changed, 396 insertions(+) create mode 100644 samples/Metrics/MetricsApp.AppHost/apphost.ts create mode 100644 samples/aspire-shop/AspireShop.AppHost/apphost.ts create mode 100644 samples/aspire-with-azure-functions/ImageGallery.AppHost/apphost.ts create mode 100644 samples/aspire-with-javascript/AspireJavaScript.AppHost/apphost.ts create mode 100644 samples/aspire-with-node/AspireWithNode.AppHost/apphost.ts create mode 100644 samples/aspire-with-python/apphost.ts create mode 100644 samples/client-apps-integration/ClientAppsIntegration.AppHost/apphost.ts create mode 100644 samples/container-build/apphost.ts create mode 100644 samples/custom-resources/CustomResources.AppHost/apphost.ts create mode 100644 samples/database-containers/DatabaseContainers.AppHost/apphost.ts create mode 100644 samples/database-migrations/DatabaseMigrations.AppHost/apphost.ts create mode 100644 samples/health-checks-ui/HealthChecksUI.AppHost/apphost.ts create mode 100644 samples/orleans-voting/OrleansVoting.AppHost/apphost.ts create mode 100644 samples/volume-mount/VolumeMount.AppHost/apphost.ts diff --git a/samples/Metrics/MetricsApp.AppHost/apphost.ts b/samples/Metrics/MetricsApp.AppHost/apphost.ts new file mode 100644 index 00000000..63e04d55 --- /dev/null +++ b/samples/Metrics/MetricsApp.AppHost/apphost.ts @@ -0,0 +1,33 @@ +import { createBuilder } from "./.modules/aspire.js"; + +const builder = await createBuilder(); + +// POLYGLOT GAP: AddOpenTelemetryCollector() is a custom AppHost extension method (from MetricsApp.AppHost.OpenTelemetryCollector) +// and is not available in the TypeScript polyglot SDK. + +const prometheus = await builder.addContainer("prometheus", "prom/prometheus", "v3.2.1") + .withBindMount("../prometheus", "/etc/prometheus", true) + .withArgs("--web.enable-otlp-receiver", "--config.file=/etc/prometheus/prometheus.yml") + .withHttpEndpoint({ targetPort: 9090 }); +// POLYGLOT GAP: .WithUrlForEndpoint("http", u => u.DisplayText = "Prometheus Dashboard") — lambda URL customization is not available in the TypeScript SDK. + +const prometheusHttpEndpoint = prometheus.getEndpoint("http"); + +const grafana = await builder.addContainer("grafana", "grafana/grafana") + .withBindMount("../grafana/config", "/etc/grafana", true) + .withBindMount("../grafana/dashboards", "/var/lib/grafana/dashboards", true) + .withEnvironment("PROMETHEUS_ENDPOINT", prometheusHttpEndpoint) + .withHttpEndpoint({ targetPort: 3000 }); +// POLYGLOT GAP: .WithUrlForEndpoint("http", u => u.DisplayText = "Grafana Dashboard") — lambda URL customization is not available in the TypeScript SDK. + +// POLYGLOT GAP: builder.AddOpenTelemetryCollector("otelcollector", "../otelcollector/config.yaml") +// .WithEnvironment("PROMETHEUS_ENDPOINT", `${prometheus.GetEndpoint("http")}/api/v1/otlp`) +// AddOpenTelemetryCollector is a custom extension method not available in the TypeScript SDK. + +const app = builder.addProject("app") + .withEnvironment("GRAFANA_URL", grafana.getEndpoint("http")); +// POLYGLOT GAP: AddProject("app") — generic type parameter for project reference is not available; use addProject("name") instead. +// POLYGLOT GAP: .WithUrlForEndpoint("https", u => u.DisplayText = "Instrumented App") — lambda URL customization is not available. +// POLYGLOT GAP: .WithUrlForEndpoint("http", u => u.DisplayLocation = UrlDisplayLocation.DetailsOnly) — lambda URL customization is not available. + +await builder.build().run(); diff --git a/samples/aspire-shop/AspireShop.AppHost/apphost.ts b/samples/aspire-shop/AspireShop.AppHost/apphost.ts new file mode 100644 index 00000000..6900fb49 --- /dev/null +++ b/samples/aspire-shop/AspireShop.AppHost/apphost.ts @@ -0,0 +1,49 @@ +import { createBuilder, ContainerLifetime } from "./.modules/aspire.js"; + +const builder = await createBuilder(); + +const postgres = await builder.addPostgres("postgres") + .withPgAdmin() + .withLifetime(ContainerLifetime.Persistent); + +const execCtx = await builder.executionContext.get(); +const isRunMode = await execCtx.isRunMode.get(); +if (isRunMode) { + await postgres.withDataVolume(); +} + +const catalogDb = postgres.addDatabase("catalogdb"); + +const basketCache = await builder.addRedis("basketcache") + .withDataVolume() + .withRedisCommander(); + +const catalogDbManager = builder.addProject("catalogdbmanager") + .withReference(catalogDb) + .waitFor(catalogDb) + .withHttpHealthCheck("/health"); +// POLYGLOT GAP: AddProject("catalogdbmanager") — generic type parameter for project reference is not available; use addProject("name") instead. +// POLYGLOT GAP: .WithHttpCommand("/reset-db", "Reset Database", commandOptions: new() { IconName = "DatabaseLightning" }) — custom HTTP commands are not available in the TypeScript SDK. + +const catalogService = builder.addProject("catalogservice") + .withReference(catalogDb) + .waitFor(catalogDbManager) + .withHttpHealthCheck("/health"); +// POLYGLOT GAP: AddProject("catalogservice") — generic type parameter for project reference is not available. + +const basketService = builder.addProject("basketservice") + .withReference(basketCache) + .waitFor(basketCache); +// POLYGLOT GAP: AddProject("basketservice") — generic type parameter for project reference is not available. + +const frontend = builder.addProject("frontend") + .withExternalHttpEndpoints() + .withHttpHealthCheck("/health") + .withReference(basketService) + .withReference(catalogService) + .waitFor(catalogService); +// POLYGLOT GAP: AddProject("frontend") — generic type parameter for project reference is not available. +// POLYGLOT GAP: .WithUrlForEndpoint("https", url => url.DisplayText = "Online Store (HTTPS)") — lambda URL customization is not available. +// POLYGLOT GAP: .WithUrlForEndpoint("http", url => url.DisplayText = "Online Store (HTTP)") — lambda URL customization is not available. + +await builder.build().run(); diff --git a/samples/aspire-with-azure-functions/ImageGallery.AppHost/apphost.ts b/samples/aspire-with-azure-functions/ImageGallery.AppHost/apphost.ts new file mode 100644 index 00000000..91bffc82 --- /dev/null +++ b/samples/aspire-with-azure-functions/ImageGallery.AppHost/apphost.ts @@ -0,0 +1,31 @@ +import { createBuilder } from "./.modules/aspire.js"; + +const builder = await createBuilder(); + +// POLYGLOT GAP: AddAzureContainerAppEnvironment("env") — Azure Container App environment is not available in the TypeScript polyglot SDK. +// builder.addAzureContainerAppEnvironment("env"); + +// POLYGLOT GAP: AddAzureStorage("storage").RunAsEmulator() — Azure Storage emulator integration is not available. +// POLYGLOT GAP: .ConfigureInfrastructure(infra => { ... }) — Bicep infrastructure configuration with +// Azure.Provisioning.Storage.StorageAccount and BlobService properties is not available. +// const storage = builder.addAzureStorage("storage").runAsEmulator(); + +// POLYGLOT GAP: storage.AddBlobs("blobs") — Azure Blob storage integration is not available. +// POLYGLOT GAP: storage.AddQueues("queues") — Azure Queue storage integration is not available. +// const blobs = storage.addBlobs("blobs"); +// const queues = storage.addQueues("queues"); + +// POLYGLOT GAP: AddAzureFunctionsProject("functions") — Azure Functions project integration is not available. +// POLYGLOT GAP: .WithRoleAssignments(storage, StorageBuiltInRole.StorageBlobDataContributor, ...) — Azure role assignments are not available. +// POLYGLOT GAP: .WithHostStorage(storage) — host storage configuration is not available. +// const functions = builder.addAzureFunctionsProject("functions") +// .withReference(queues).withReference(blobs).waitFor(storage) +// .withRoleAssignments(storage, ...).withHostStorage(storage); + +// POLYGLOT GAP: AddProject("frontend") — generic type parameter for project reference is not available. +// POLYGLOT GAP: Full functionality requires Azure Storage, Queues, Blobs, and Functions project references above. +const frontend = builder.addProject("frontend") + .withExternalHttpEndpoints(); +// POLYGLOT GAP: .withReference(queues).withReference(blobs).waitFor(functions) — cannot reference Azure resources (see gaps above). + +await builder.build().run(); diff --git a/samples/aspire-with-javascript/AspireJavaScript.AppHost/apphost.ts b/samples/aspire-with-javascript/AspireJavaScript.AppHost/apphost.ts new file mode 100644 index 00000000..1d90df8e --- /dev/null +++ b/samples/aspire-with-javascript/AspireJavaScript.AppHost/apphost.ts @@ -0,0 +1,34 @@ +import { createBuilder } from "./.modules/aspire.js"; + +const builder = await createBuilder(); + +// POLYGLOT GAP: AddProject("weatherapi") — generic type parameter for project reference is not available. +const weatherApi = builder.addProject("weatherapi") + .withExternalHttpEndpoints(); + +// POLYGLOT GAP: AddJavaScriptApp() is not available in the TypeScript polyglot SDK. +// The following Angular, React, and Vue apps cannot be added directly. + +// POLYGLOT GAP: builder.AddJavaScriptApp("angular", "../AspireJavaScript.Angular", runScriptName: "start") +// .WithReference(weatherApi).WaitFor(weatherApi).WithHttpEndpoint(env: "PORT") +// .WithExternalHttpEndpoints().PublishAsDockerFile() +// AddJavaScriptApp, WithHttpEndpoint with env parameter, and PublishAsDockerFile are not available. + +// POLYGLOT GAP: builder.AddJavaScriptApp("react", "../AspireJavaScript.React", runScriptName: "start") +// .WithReference(weatherApi).WaitFor(weatherApi).WithEnvironment("BROWSER", "none") +// .WithHttpEndpoint(env: "PORT").WithExternalHttpEndpoints().PublishAsDockerFile() +// AddJavaScriptApp, WithHttpEndpoint with env parameter, and PublishAsDockerFile are not available. + +// POLYGLOT GAP: builder.AddJavaScriptApp("vue", "../AspireJavaScript.Vue").WithRunScript("start").WithNpm(installCommand: "ci") +// .WithReference(weatherApi).WaitFor(weatherApi).WithHttpEndpoint(env: "PORT") +// .WithExternalHttpEndpoints().PublishAsDockerFile() +// AddJavaScriptApp, WithRunScript, WithNpm, WithHttpEndpoint with env parameter, and PublishAsDockerFile are not available. + +// POLYGLOT GAP: builder.AddViteApp("reactvite", "../AspireJavaScript.Vite") +// .WithReference(weatherApi).WithEnvironment("BROWSER", "none") +// AddViteApp is not available in the TypeScript polyglot SDK. + +// POLYGLOT GAP: weatherApi.PublishWithContainerFiles(reactVite, "./wwwroot") +// PublishWithContainerFiles is not available in the TypeScript polyglot SDK. + +await builder.build().run(); diff --git a/samples/aspire-with-node/AspireWithNode.AppHost/apphost.ts b/samples/aspire-with-node/AspireWithNode.AppHost/apphost.ts new file mode 100644 index 00000000..213a1699 --- /dev/null +++ b/samples/aspire-with-node/AspireWithNode.AppHost/apphost.ts @@ -0,0 +1,21 @@ +import { createBuilder } from "./.modules/aspire.js"; + +const builder = await createBuilder(); + +const cache = await builder.addRedis("cache") + .withRedisInsight(); + +// POLYGLOT GAP: AddProject("weatherapi") — generic type parameter for project reference is not available. +const weatherapi = builder.addProject("weatherapi") + .withHttpHealthCheck("/health"); + +// POLYGLOT GAP: AddNodeApp("frontend", "../NodeFrontend", "./app.js") is not available in the TypeScript polyglot SDK. +// POLYGLOT GAP: .WithNpm() — npm configuration is not available. +// POLYGLOT GAP: .WithRunScript("dev") — run script configuration is not available. +// POLYGLOT GAP: .WithHttpEndpoint(port: 5223, env: "PORT") — WithHttpEndpoint with env parameter is not available. +// The following Node.js app cannot be added directly: +// builder.AddNodeApp("frontend", "../NodeFrontend", "./app.js").WithNpm().WithRunScript("dev") +// .WithHttpEndpoint(port: 5223, env: "PORT").WithExternalHttpEndpoints().WithHttpHealthCheck("/health") +// .WithReference(weatherapi).WaitFor(weatherapi).WithReference(cache).WaitFor(cache) + +await builder.build().run(); diff --git a/samples/aspire-with-python/apphost.ts b/samples/aspire-with-python/apphost.ts new file mode 100644 index 00000000..86a2de32 --- /dev/null +++ b/samples/aspire-with-python/apphost.ts @@ -0,0 +1,15 @@ +import { createBuilder } from "./.modules/aspire.js"; + +const builder = await createBuilder(); + +const cache = builder.addRedis("cache"); + +// POLYGLOT GAP: AddUvicornApp("app", "./app", "main:app") is not available in the TypeScript polyglot SDK. +// POLYGLOT GAP: .WithUv() — UV package manager configuration is not available. +// POLYGLOT GAP: .WithExternalHttpEndpoints().WithReference(cache).WaitFor(cache).WithHttpHealthCheck("/health") +// The Python/Uvicorn app cannot be added directly. + +// POLYGLOT GAP: AddViteApp("frontend", "./frontend") is not available in the TypeScript polyglot SDK. +// POLYGLOT GAP: app.PublishWithContainerFiles(frontend, "./static") — PublishWithContainerFiles is not available. + +await builder.build().run(); diff --git a/samples/client-apps-integration/ClientAppsIntegration.AppHost/apphost.ts b/samples/client-apps-integration/ClientAppsIntegration.AppHost/apphost.ts new file mode 100644 index 00000000..4566a6e0 --- /dev/null +++ b/samples/client-apps-integration/ClientAppsIntegration.AppHost/apphost.ts @@ -0,0 +1,19 @@ +import { createBuilder } from "./.modules/aspire.js"; + +const builder = await createBuilder(); + +// POLYGLOT GAP: AddProject("apiservice") — generic type parameter for project reference is not available. +const apiService = builder.addProject("apiservice"); + +// POLYGLOT GAP: OperatingSystem.IsWindows() — platform check is not available in the TypeScript apphost context. +// The following Windows-only projects cannot be conditionally added: +// if (OperatingSystem.IsWindows()) { +// builder.AddProject("winformsclient") +// .WithReference(apiService).WaitFor(apiService).WithExplicitStart().ExcludeFromManifest(); +// builder.AddProject("wpfclient") +// .WithReference(apiService).WaitFor(apiService).WithExplicitStart().ExcludeFromManifest(); +// } +// POLYGLOT GAP: .WithExplicitStart() — explicit start configuration is not available. +// POLYGLOT GAP: .ExcludeFromManifest() — manifest exclusion is not available. + +await builder.build().run(); diff --git a/samples/container-build/apphost.ts b/samples/container-build/apphost.ts new file mode 100644 index 00000000..ad913160 --- /dev/null +++ b/samples/container-build/apphost.ts @@ -0,0 +1,33 @@ +import { createBuilder } from "./.modules/aspire.js"; + +const builder = await createBuilder(); + +// POLYGLOT GAP: builder.AddParameter("goversion", "1.25.4", publishValueAsDefault: true) — AddParameter with publishValueAsDefault is not available in the TypeScript SDK. +// Using a plain string as a workaround for the parameter value. +const goVersion = "1.25.4"; + +const execCtx = await builder.executionContext.get(); +const isRunMode = await execCtx.isRunMode.get(); +const isPublishMode = !isRunMode; + +// POLYGLOT GAP: AddDockerfile("ginapp", "./ginapp") and AddDockerfile("ginapp", "./ginapp", "Dockerfile.dev") — AddDockerfile is not available in the TypeScript polyglot SDK. +// POLYGLOT GAP: .WithBuildArg("GO_VERSION", goVersion) — WithBuildArg is not available. +// POLYGLOT GAP: .WithOtlpExporter() — OTLP exporter configuration is not available. +// POLYGLOT GAP: .WithDeveloperCertificateTrust(trust: true) — developer certificate trust is not available. +// +// The following Dockerfile-based container cannot be added directly: +// let ginapp; +// if (isPublishMode) { +// ginapp = builder.addDockerfile("ginapp", "./ginapp").withBuildArg("GO_VERSION", goVersion); +// } else { +// ginapp = builder.addDockerfile("ginapp", "./ginapp", "Dockerfile.dev") +// .withBuildArg("GO_VERSION", goVersion).withBindMount("./ginapp", "/app"); +// } +// ginapp.withHttpEndpoint({ targetPort: 5555, env: "PORT" }) +// .withHttpHealthCheck("/").withExternalHttpEndpoints() +// .withOtlpExporter().withDeveloperCertificateTrust(true); +// if (isPublishMode) { +// ginapp.withEnvironment("GIN_MODE", "release").withEnvironment("TRUSTED_PROXIES", "all"); +// } + +await builder.build().run(); diff --git a/samples/custom-resources/CustomResources.AppHost/apphost.ts b/samples/custom-resources/CustomResources.AppHost/apphost.ts new file mode 100644 index 00000000..9f4df246 --- /dev/null +++ b/samples/custom-resources/CustomResources.AppHost/apphost.ts @@ -0,0 +1,13 @@ +import { createBuilder } from "./.modules/aspire.js"; + +const builder = await createBuilder(); + +// POLYGLOT GAP: AddTalkingClock("talking-clock") is a custom resource extension (from CustomResources.AppHost) +// and is not available in the TypeScript polyglot SDK. +// builder.AddTalkingClock("talking-clock"); + +// POLYGLOT GAP: AddTestResource("test") is a custom resource extension (from CustomResources.AppHost) +// and is not available in the TypeScript polyglot SDK. +// builder.AddTestResource("test"); + +await builder.build().run(); diff --git a/samples/database-containers/DatabaseContainers.AppHost/apphost.ts b/samples/database-containers/DatabaseContainers.AppHost/apphost.ts new file mode 100644 index 00000000..112dc9c0 --- /dev/null +++ b/samples/database-containers/DatabaseContainers.AppHost/apphost.ts @@ -0,0 +1,47 @@ +import { createBuilder, ContainerLifetime } from "./.modules/aspire.js"; + +const builder = await createBuilder(); + +const todosDbName = "Todos"; + +const postgres = await builder.addPostgres("postgres") + .withEnvironment("POSTGRES_DB", todosDbName) + .withBindMount("../DatabaseContainers.ApiService/data/postgres", "/docker-entrypoint-initdb.d") + .withDataVolume() + .withLifetime(ContainerLifetime.Persistent); +// POLYGLOT GAP: .WithPgWeb() — PgWeb integration is not available in the TypeScript polyglot SDK. + +const todosDb = postgres.addDatabase(todosDbName); + +const catalogDbName = "catalog"; + +const mysql = await builder.addMySql("mysql") + .withEnvironment("MYSQL_DATABASE", catalogDbName) + .withBindMount("../DatabaseContainers.ApiService/data/mysql", "/docker-entrypoint-initdb.d") + .withDataVolume() + .withLifetime(ContainerLifetime.Persistent); + +const catalogDb = mysql.addDatabase(catalogDbName); + +const sqlserver = await builder.addSqlServer("sqlserver") + .withDataVolume() + .withLifetime(ContainerLifetime.Persistent); + +// POLYGLOT GAP: WithCreationScript(File.ReadAllText(initScriptPath)) — reading a file and passing its content +// via WithCreationScript is not available in the TypeScript polyglot SDK. +// In C#: var initScriptPath = Path.Join(Path.GetDirectoryName(typeof(Program).Assembly.Location), "init.sql"); +// var addressBookDb = sqlserver.AddDatabase("AddressBook").WithCreationScript(File.ReadAllText(initScriptPath)); +const addressBookDb = sqlserver.addDatabase("AddressBook"); + +// POLYGLOT GAP: AddProject("apiservice") — generic type parameter for project reference is not available. +const apiservice = builder.addProject("apiservice") + .withReference(todosDb) + .waitFor(todosDb) + .withReference(catalogDb) + .waitFor(catalogDb) + .withReference(addressBookDb) + .waitFor(addressBookDb) + .withHttpHealthCheck("/alive") + .withHttpHealthCheck("/health"); + +await builder.build().run(); diff --git a/samples/database-migrations/DatabaseMigrations.AppHost/apphost.ts b/samples/database-migrations/DatabaseMigrations.AppHost/apphost.ts new file mode 100644 index 00000000..469d5650 --- /dev/null +++ b/samples/database-migrations/DatabaseMigrations.AppHost/apphost.ts @@ -0,0 +1,22 @@ +import { createBuilder, ContainerLifetime } from "./.modules/aspire.js"; + +const builder = await createBuilder(); + +const sqlserver = await builder.addSqlServer("sqlserver") + .withDataVolume() + .withLifetime(ContainerLifetime.Persistent); + +const db1 = sqlserver.addDatabase("db1"); + +// POLYGLOT GAP: AddProject("migration") — generic type parameter for project reference is not available. +const migrationService = builder.addProject("migration") + .withReference(db1) + .waitFor(db1); + +// POLYGLOT GAP: AddProject("api") — generic type parameter for project reference is not available. +// POLYGLOT GAP: .WaitForCompletion(migrationService) — WaitForCompletion is not available in the TypeScript polyglot SDK; only WaitFor is available. +const api = builder.addProject("api") + .withReference(db1) + .waitFor(migrationService); + +await builder.build().run(); diff --git a/samples/health-checks-ui/HealthChecksUI.AppHost/apphost.ts b/samples/health-checks-ui/HealthChecksUI.AppHost/apphost.ts new file mode 100644 index 00000000..0588914d --- /dev/null +++ b/samples/health-checks-ui/HealthChecksUI.AppHost/apphost.ts @@ -0,0 +1,34 @@ +import { createBuilder } from "./.modules/aspire.js"; + +const builder = await createBuilder(); + +// POLYGLOT GAP: AddDockerComposeEnvironment("compose") — Docker Compose integration is not available in the TypeScript polyglot SDK. +// builder.AddDockerComposeEnvironment("compose"); + +const cache = builder.addRedis("cache"); + +// POLYGLOT GAP: AddProject("apiservice") — generic type parameter for project reference is not available. +// POLYGLOT GAP: .WithHttpProbe(ProbeType.Liveness, "/alive") — probe configuration is not available. +// POLYGLOT GAP: .WithFriendlyUrls(displayText: "API") — WithFriendlyUrls is a custom extension method not available in the TypeScript SDK. +const apiService = builder.addProject("apiservice") + .withHttpHealthCheck("/health"); + +// POLYGLOT GAP: AddProject("webfrontend") — generic type parameter for project reference is not available. +// POLYGLOT GAP: .WithHttpProbe(ProbeType.Liveness, "/alive") — probe configuration is not available. +// POLYGLOT GAP: .WithFriendlyUrls("Web Frontend") — WithFriendlyUrls is a custom extension method not available. +const webFrontend = builder.addProject("webfrontend") + .withReference(cache) + .waitFor(cache) + .withReference(apiService) + .waitFor(apiService) + .withHttpHealthCheck("/health") + .withExternalHttpEndpoints(); + +// POLYGLOT GAP: AddHealthChecksUI("healthchecksui") — HealthChecks UI integration is not available in the TypeScript polyglot SDK. +// POLYGLOT GAP: .WithReference(apiService).WithReference(webFrontend) — references for health checks UI. +// POLYGLOT GAP: .WithFriendlyUrls("HealthChecksUI Dashboard", "http") — custom extension method not available. +// POLYGLOT GAP: .WithHttpProbe(ProbeType.Liveness, "/") — probe configuration is not available. +// POLYGLOT GAP: .WithExternalHttpEndpoints() — for the health checks UI resource. +// POLYGLOT GAP: .WithHostPort(7230) — conditional host port in run mode for health checks UI. + +await builder.build().run(); diff --git a/samples/orleans-voting/OrleansVoting.AppHost/apphost.ts b/samples/orleans-voting/OrleansVoting.AppHost/apphost.ts new file mode 100644 index 00000000..554e555e --- /dev/null +++ b/samples/orleans-voting/OrleansVoting.AppHost/apphost.ts @@ -0,0 +1,23 @@ +import { createBuilder } from "./.modules/aspire.js"; + +const builder = await createBuilder(); + +const redis = builder.addRedis("voting-redis"); + +// POLYGLOT GAP: AddOrleans("voting-cluster") — Orleans integration is not available in the TypeScript polyglot SDK. +// POLYGLOT GAP: .WithClustering(redis) — Orleans clustering configuration is not available. +// POLYGLOT GAP: .WithGrainStorage("votes", redis) — Orleans grain storage configuration is not available. +// const orleans = builder.addOrleans("voting-cluster").withClustering(redis).withGrainStorage("votes", redis); + +// POLYGLOT GAP: AddProject("voting-fe") — generic type parameter for project reference is not available. +// POLYGLOT GAP: .WithReference(orleans) — Orleans resource reference is not available. +// POLYGLOT GAP: .WithUrlForEndpoint("https", u => u.DisplayText = "Voting App") — lambda URL customization is not available. +// POLYGLOT GAP: .WithUrlForEndpoint("http", u => u.DisplayLocation = UrlDisplayLocation.DetailsOnly) — lambda URL customization is not available. +// POLYGLOT GAP: .WithUrlForEndpoint("orleans-gateway", ...) — lambda URL customization is not available. +// POLYGLOT GAP: .WithUrlForEndpoint("orleans-silo", ...) — lambda URL customization is not available. +const votingFe = builder.addProject("voting-fe") + .waitFor(redis) + .withReplicas(3) + .withExternalHttpEndpoints(); + +await builder.build().run(); diff --git a/samples/volume-mount/VolumeMount.AppHost/apphost.ts b/samples/volume-mount/VolumeMount.AppHost/apphost.ts new file mode 100644 index 00000000..19cb1fe2 --- /dev/null +++ b/samples/volume-mount/VolumeMount.AppHost/apphost.ts @@ -0,0 +1,22 @@ +import { createBuilder, ContainerLifetime } from "./.modules/aspire.js"; + +const builder = await createBuilder(); + +const sqlserver = await builder.addSqlServer("sqlserver") + .withDataVolume() + .withLifetime(ContainerLifetime.Persistent); + +const sqlDatabase = sqlserver.addDatabase("sqldb"); + +// POLYGLOT GAP: AddAzureStorage("Storage").RunAsEmulator(emulator => emulator.WithDataVolume()) — Azure Storage emulator +// with callback configuration is not available in the TypeScript polyglot SDK. +// POLYGLOT GAP: .AddBlobs("BlobConnection") — Azure Blob storage integration is not available. +// const blobs = builder.addAzureStorage("Storage").runAsEmulator(...).addBlobs("BlobConnection"); + +// POLYGLOT GAP: AddProject("blazorweb") — generic type parameter for project reference is not available. +const blazorweb = builder.addProject("blazorweb") + .withReference(sqlDatabase) + .waitFor(sqlDatabase); +// POLYGLOT GAP: .withReference(blobs).waitFor(blobs) — Azure Blob resource reference cannot be added (see Azure Storage gap above). + +await builder.build().run(); From 47fe94b629f8e47f80056f6ea152f99d14d83cc2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Mar 2026 15:59:06 +0000 Subject: [PATCH 03/25] Add polyglot apphost.ts TypeScript conversions for all samples with gap analysis Create apphost.ts files for 14 samples, converting C# AppHost.cs to TypeScript polyglot apphost SDK equivalents. Each file uses the Aspire polyglot SDK pattern (createBuilder/build/run) and documents all POLYGLOT GAP items where C# features are not available in the TypeScript SDK. Add comprehensive POLYGLOT_NOTES.md documenting per-sample gap analysis, cross-cutting issues, feature availability matrix, and recommendations. Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> --- samples/POLYGLOT_NOTES.md | 442 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 442 insertions(+) create mode 100644 samples/POLYGLOT_NOTES.md diff --git a/samples/POLYGLOT_NOTES.md b/samples/POLYGLOT_NOTES.md new file mode 100644 index 00000000..9482a2cb --- /dev/null +++ b/samples/POLYGLOT_NOTES.md @@ -0,0 +1,442 @@ +# Polyglot AppHost TypeScript Conversion Notes + +This document logs all issues, gaps, limitations, and errors discovered while attempting to rewrite +each sample's `AppHost.cs` as a polyglot `apphost.ts` using the Aspire TypeScript SDK. + +## Overview + +Each sample directory now contains an `apphost.ts` file alongside the existing `AppHost.cs`. The +TypeScript versions use the Aspire polyglot apphost SDK (`createBuilder()` from `.modules/aspire.js`) +which communicates with a .NET AppHost Server via JSON-RPC. + +### Prerequisites + +To run the polyglot TypeScript apphosts: + +1. Install the staging Aspire CLI: + ```powershell + iex "& { $(irm https://aspire.dev/install.ps1) } -Quality staging" + ``` +2. Node.js (v18+) or Bun must be installed +3. Run `aspire run` from the sample directory containing `apphost.ts` + +The CLI will: +- Scaffold an AppHost server project +- Generate the TypeScript SDK in `.modules/` +- Start the .NET AppHost server + Node.js/Bun guest runtime +- The generated SDK provides typed builder classes for all available capabilities + +### Skipped Sample + +- **standalone-dashboard**: This is a standalone console application, not an Aspire AppHost sample. It + configures OpenTelemetry directly and does not use `DistributedApplication.CreateBuilder()`. + +--- + +## Per-Sample Gap Analysis + +### 1. Metrics (`samples/Metrics/MetricsApp.AppHost/apphost.ts`) + +**Convertible:** Partially +**Status:** Container resources work, but custom extension and URL customization do not. + +| Feature | C# API | TypeScript Status | +|---------|--------|-------------------| +| Add container with image/tag | `AddContainer("prometheus", "prom/prometheus", "v3.2.1")` | ✅ Available | +| Bind mount (read-only) | `.WithBindMount("../prometheus", "/etc/prometheus", isReadOnly: true)` | ✅ Available | +| Container args | `.WithArgs("--web.enable-otlp-receiver", ...)` | ✅ Available | +| HTTP endpoint | `.WithHttpEndpoint(targetPort: 9090)` | ✅ Available | +| URL display customization | `.WithUrlForEndpoint("http", u => u.DisplayText = "...")` | ❌ Lambda callback not available | +| Custom extension method | `AddOpenTelemetryCollector(...)` | ❌ Custom C# extension — not exported to ATS | +| Project reference (generic) | `AddProject("app")` | ⚠️ `addProject("app")` (no type-safe project binding) | +| Environment from endpoint | `.WithEnvironment("GRAFANA_URL", grafana.GetEndpoint("http"))` | ✅ Available | + +**Key Limitation:** The `AddOpenTelemetryCollector` is a custom extension method defined in the sample's +AppHost project. Custom C# extensions require `[AspireExport]` attributes to be available in the +polyglot SDK, which this sample does not have. + +--- + +### 2. aspire-shop (`samples/aspire-shop/AspireShop.AppHost/apphost.ts`) + +**Convertible:** Mostly +**Status:** Core resource orchestration works. HTTP commands and URL customization are gaps. + +| Feature | C# API | TypeScript Status | +|---------|--------|-------------------| +| Postgres + PgAdmin | `AddPostgres("postgres").WithPgAdmin()` | ✅ Available | +| Container lifetime | `.WithLifetime(ContainerLifetime.Persistent)` | ✅ Available | +| Conditional data volume | `if (IsRunMode) postgres.WithDataVolume()` | ✅ Available (via `executionContext`) | +| Add database | `postgres.AddDatabase("catalogdb")` | ✅ Available | +| Redis + Commander | `AddRedis("basketcache").WithDataVolume().WithRedisCommander()` | ✅ Available | +| Project references | `AddProject("name")` | ⚠️ `addProject("name")` — no generic type | +| HTTP health check | `.WithHttpHealthCheck("/health")` | ✅ Available | +| HTTP command | `.WithHttpCommand("/reset-db", "Reset Database", ...)` | ❌ Not available | +| URL display customization | `.WithUrlForEndpoint("https", url => url.DisplayText = "...")` | ❌ Lambda callback not available | +| External HTTP endpoints | `.WithExternalHttpEndpoints()` | ✅ Available | +| Resource references | `.WithReference(resource).WaitFor(resource)` | ✅ Available | + +**Key Limitation:** `WithHttpCommand` is an advanced feature for adding custom dashboard commands. +This is not exposed through ATS capabilities. + +--- + +### 3. aspire-with-javascript (`samples/aspire-with-javascript/AspireJavaScript.AppHost/apphost.ts`) + +**Convertible:** Minimally +**Status:** Almost entirely blocked — JavaScript/Node.js hosting APIs are not available. + +| Feature | C# API | TypeScript Status | +|---------|--------|-------------------| +| Project reference | `AddProject("weatherapi")` | ⚠️ `addProject("weatherapi")` | +| JavaScript app | `AddJavaScriptApp("angular", "../path", runScriptName: "start")` | ❌ Not available | +| Vite app | `AddViteApp("reactvite", "../path")` | ❌ Not available | +| Run script | `.WithRunScript("start")` | ❌ Not available | +| npm configuration | `.WithNpm(installCommand: "ci")` | ❌ Not available | +| Publish as Dockerfile | `.PublishAsDockerFile()` | ❌ Not available | +| Publish container files | `weatherApi.PublishWithContainerFiles(reactVite, "./wwwroot")` | ❌ Not available | +| HTTP endpoint with env | `.WithHttpEndpoint(env: "PORT")` | ❌ env parameter not available | + +**Key Limitation:** The entire `Aspire.Hosting.JavaScript` package (AddJavaScriptApp, AddViteApp, +WithNpm, WithRunScript, PublishAsDockerFile) is not available in the polyglot SDK. This sample +is fundamentally about JavaScript hosting, making it almost entirely unconvertible. + +--- + +### 4. aspire-with-node (`samples/aspire-with-node/AspireWithNode.AppHost/apphost.ts`) + +**Convertible:** Partially +**Status:** Redis and project resources work, but Node.js app hosting is not available. + +| Feature | C# API | TypeScript Status | +|---------|--------|-------------------| +| Redis + Insight | `AddRedis("cache").WithRedisInsight()` | ✅ Available | +| Project reference | `AddProject("weatherapi")` | ⚠️ `addProject("weatherapi")` | +| Node.js app | `AddNodeApp("frontend", "../NodeFrontend", "./app.js")` | ❌ Not available | +| npm config | `.WithNpm()` | ❌ Not available | +| Run script | `.WithRunScript("dev")` | ❌ Not available | +| HTTP endpoint with env | `.WithHttpEndpoint(port: 5223, env: "PORT")` | ❌ env parameter not available | + +**Key Limitation:** `AddNodeApp` from `Aspire.Hosting.NodeJs` is not available. The Node.js +frontend cannot be orchestrated. + +--- + +### 5. aspire-with-python (`samples/aspire-with-python/apphost.ts`) + +**Convertible:** Minimally +**Status:** Almost entirely blocked — Python and Vite hosting APIs are not available. + +| Feature | C# API | TypeScript Status | +|---------|--------|-------------------| +| Redis | `AddRedis("cache")` | ✅ Available | +| Uvicorn app | `AddUvicornApp("app", "./app", "main:app")` | ❌ Not available | +| UV package manager | `.WithUv()` | ❌ Not available | +| Vite app | `AddViteApp("frontend", "./frontend")` | ❌ Not available | +| Publish container files | `app.PublishWithContainerFiles(frontend, "./static")` | ❌ Not available | + +**Key Limitation:** Both `Aspire.Hosting.Python` (AddUvicornApp, WithUv) and +`Aspire.Hosting.JavaScript` (AddViteApp) packages are not available in the polyglot SDK. + +--- + +### 6. client-apps-integration (`samples/client-apps-integration/ClientAppsIntegration.AppHost/apphost.ts`) + +**Convertible:** Partially +**Status:** API service project works, but Windows platform checks and desktop app features don't. + +| Feature | C# API | TypeScript Status | +|---------|--------|-------------------| +| Project reference | `AddProject("apiservice")` | ⚠️ `addProject("apiservice")` | +| Platform check | `OperatingSystem.IsWindows()` | ❌ Not available in TS context | +| Explicit start | `.WithExplicitStart()` | ❌ Not available | +| Exclude from manifest | `.ExcludeFromManifest()` | ❌ Not available | + +**Key Limitation:** `OperatingSystem.IsWindows()` has no equivalent in the TypeScript SDK. +Desktop apps (WinForms, WPF) are Windows-only and their conditional inclusion cannot be expressed. + +--- + +### 7. container-build (`samples/container-build/apphost.ts`) + +**Convertible:** Minimally +**Status:** Almost entirely blocked — Dockerfile build APIs are not available. + +| Feature | C# API | TypeScript Status | +|---------|--------|-------------------| +| Parameter with default | `AddParameter("goversion", "1.25.4", publishValueAsDefault: true)` | ❌ Not available | +| Dockerfile build | `AddDockerfile("ginapp", "./ginapp")` | ❌ Not available | +| Build arg | `.WithBuildArg("GO_VERSION", goVersion)` | ❌ Not available | +| OTLP exporter | `.WithOtlpExporter()` | ❌ Not available | +| Certificate trust | `.WithDeveloperCertificateTrust(trust: true)` | ❌ Not available | +| Execution context | `builder.ExecutionContext.IsPublishMode` | ✅ Available (via `executionContext`) | + +**Key Limitation:** `AddDockerfile` and `WithBuildArg` from `Aspire.Hosting` are not available. +This sample is fundamentally about building containers from Dockerfiles. + +--- + +### 8. custom-resources (`samples/custom-resources/CustomResources.AppHost/apphost.ts`) + +**Convertible:** Not convertible +**Status:** Entirely blocked — custom resource types require C# implementation. + +| Feature | C# API | TypeScript Status | +|---------|--------|-------------------| +| Custom resource | `AddTalkingClock("talking-clock")` | ❌ Custom C# extension | +| Custom resource | `AddTestResource("test")` | ❌ Custom C# extension | + +**Key Limitation:** This sample demonstrates creating custom resource types in C#. These are +implemented as C# classes and extension methods. The polyglot SDK can only access capabilities +from NuGet packages with `[AspireExport]` attributes — custom project-level extensions are not +available. + +--- + +### 9. database-containers (`samples/database-containers/DatabaseContainers.AppHost/apphost.ts`) + +**Convertible:** Mostly +**Status:** Core database hosting works with minor gaps. + +| Feature | C# API | TypeScript Status | +|---------|--------|-------------------| +| Postgres | `AddPostgres("postgres")` | ✅ Available | +| MySQL | `AddMySql("mysql")` | ✅ Available | +| SQL Server | `AddSqlServer("sqlserver")` | ✅ Available | +| Environment variable | `.WithEnvironment("POSTGRES_DB", todosDbName)` | ✅ Available | +| Bind mount | `.WithBindMount(source, target)` | ✅ Available | +| Data volume | `.WithDataVolume()` | ✅ Available | +| Container lifetime | `.WithLifetime(ContainerLifetime.Persistent)` | ✅ Available | +| Add database | `.AddDatabase("name")` | ✅ Available | +| PgWeb | `.WithPgWeb()` | ❌ Not available | +| Creation script | `.WithCreationScript(File.ReadAllText(path))` | ❌ Not available (file I/O + API) | +| HTTP health check | `.WithHttpHealthCheck("/health")` | ✅ Available | + +**Key Limitation:** `WithCreationScript` requires reading a SQL file from disk and passing its +content. The polyglot SDK doesn't have a `File.ReadAllText` equivalent, and `WithCreationScript` +itself may not be exported. `WithPgWeb` is also not available. + +--- + +### 10. database-migrations (`samples/database-migrations/DatabaseMigrations.AppHost/apphost.ts`) + +**Convertible:** Mostly +**Status:** Works with minor API gap for WaitForCompletion. + +| Feature | C# API | TypeScript Status | +|---------|--------|-------------------| +| SQL Server + volume | `AddSqlServer("sqlserver").WithDataVolume()` | ✅ Available | +| Container lifetime | `.WithLifetime(ContainerLifetime.Persistent)` | ✅ Available | +| Add database | `.AddDatabase("db1")` | ✅ Available | +| Project references | `AddProject("name")` | ⚠️ `addProject("name")` | +| Wait for completion | `.WaitForCompletion(migrationService)` | ❌ Only `waitFor` available | +| Resource references | `.WithReference(db1)` | ✅ Available | + +**Key Limitation:** `WaitForCompletion` (wait for a service to finish, not just start) is not +available. This is semantically different from `WaitFor` — it waits for the migration service to +complete its work before starting the API. + +--- + +### 11. health-checks-ui (`samples/health-checks-ui/HealthChecksUI.AppHost/apphost.ts`) + +**Convertible:** Partially +**Status:** Core project orchestration works, but specialized features don't. + +| Feature | C# API | TypeScript Status | +|---------|--------|-------------------| +| Docker Compose | `AddDockerComposeEnvironment("compose")` | ❌ Not available | +| Redis | `AddRedis("cache")` | ✅ Available | +| Project references | `AddProject("name")` | ⚠️ `addProject("name")` | +| Health checks UI | `AddHealthChecksUI("healthchecksui")` | ❌ Not available | +| HTTP probe | `.WithHttpProbe(ProbeType.Liveness, "/alive")` | ❌ Not available | +| Custom URL helper | `.WithFriendlyUrls(...)` | ❌ Custom extension method | +| Host port | `.WithHostPort(7230)` | ❌ Not available | +| Execution context | `builder.ExecutionContext.IsRunMode` | ✅ Available | + +**Key Limitation:** `AddDockerComposeEnvironment`, `AddHealthChecksUI`, and `WithHttpProbe` are +specialized integrations not available in the polyglot SDK. The `WithFriendlyUrls` is a custom +extension method defined in the same AppHost.cs file. + +--- + +### 12. orleans-voting (`samples/orleans-voting/OrleansVoting.AppHost/apphost.ts`) + +**Convertible:** Minimally +**Status:** Redis works, but Orleans integration is entirely unavailable. + +| Feature | C# API | TypeScript Status | +|---------|--------|-------------------| +| Redis | `AddRedis("voting-redis")` | ✅ Available | +| Orleans cluster | `AddOrleans("voting-cluster")` | ❌ Not available | +| Orleans clustering | `.WithClustering(redis)` | ❌ Not available | +| Orleans grain storage | `.WithGrainStorage("votes", redis)` | ❌ Not available | +| Project with replicas | `.WithReplicas(3)` | ✅ Available | +| Orleans reference | `.WithReference(orleans)` | ❌ Orleans resource not available | +| URL customization | `.WithUrlForEndpoint(...)` | ❌ Lambda callback not available | + +**Key Limitation:** The entire `Aspire.Hosting.Orleans` package (AddOrleans, WithClustering, +WithGrainStorage) is not available in the polyglot SDK. + +--- + +### 13. volume-mount (`samples/volume-mount/VolumeMount.AppHost/apphost.ts`) + +**Convertible:** Partially +**Status:** SQL Server works, but Azure Storage emulator does not. + +| Feature | C# API | TypeScript Status | +|---------|--------|-------------------| +| SQL Server + volume | `AddSqlServer("sqlserver").WithDataVolume()` | ✅ Available | +| Container lifetime | `.WithLifetime(ContainerLifetime.Persistent)` | ✅ Available | +| Add database | `.AddDatabase("sqldb")` | ✅ Available | +| Azure Storage emulator | `AddAzureStorage("Storage").RunAsEmulator(...)` | ❌ Not available | +| Emulator callback | `.RunAsEmulator(emulator => emulator.WithDataVolume())` | ❌ Lambda not available | +| Azure Blobs | `.AddBlobs("BlobConnection")` | ❌ Not available | +| Project reference | `AddProject("blazorweb")` | ⚠️ `addProject("blazorweb")` | + +**Key Limitation:** `AddAzureStorage` and `RunAsEmulator` with callback configuration are not +available. Azure storage integration is a major gap. + +--- + +### 14. aspire-with-azure-functions (`samples/aspire-with-azure-functions/ImageGallery.AppHost/apphost.ts`) + +**Convertible:** Minimally +**Status:** Almost entirely blocked — Azure-specific APIs are not available. + +| Feature | C# API | TypeScript Status | +|---------|--------|-------------------| +| Azure Container App Env | `AddAzureContainerAppEnvironment("env")` | ❌ Not available | +| Azure Storage | `AddAzureStorage("storage").RunAsEmulator()` | ❌ Not available | +| Configure infrastructure | `.ConfigureInfrastructure(...)` | ❌ Not available | +| URL display customization | `.WithUrls(...)` | ❌ Lambda callback not available | +| Azure Blobs | `storage.AddBlobs("blobs")` | ❌ Not available | +| Azure Queues | `storage.AddQueues("queues")` | ❌ Not available | +| Azure Functions project | `AddAzureFunctionsProject("name")` | ❌ Not available | +| Role assignments | `.WithRoleAssignments(storage, ...)` | ❌ Not available | +| Host storage | `.WithHostStorage(storage)` | ❌ Not available | +| Project reference | `AddProject("frontend")` | ⚠️ `addProject("frontend")` | + +**Key Limitation:** This sample is entirely Azure-focused. None of the Azure-specific hosting +packages (Azure Storage, Functions, Container Apps) are available in the polyglot SDK. + +--- + +## Cross-Cutting Issues Summary + +### Universally Available Features ✅ +These features work across all samples in the TypeScript polyglot SDK: +- `createBuilder()` — Create the distributed application builder +- `addRedis("name")` — Add Redis container resource +- `addPostgres("name")` — Add PostgreSQL container resource +- `addMySql("name")` — Add MySQL container resource +- `addSqlServer("name")` — Add SQL Server container resource +- `addContainer("name", "image", "tag")` — Add generic container resource +- `.addDatabase("name")` — Add database to a database server +- `.withDataVolume()` — Add data volume to container +- `.withLifetime(ContainerLifetime.Persistent)` — Set container lifetime +- `.withBindMount(source, target, isReadOnly)` — Add bind mount +- `.withEnvironment("key", "value")` — Set environment variable +- `.withArgs(...)` — Set container arguments +- `.withHttpEndpoint({ targetPort: N })` — Add HTTP endpoint +- `.withHttpHealthCheck("/path")` — Add HTTP health check +- `.withExternalHttpEndpoints()` — Expose endpoints externally +- `.withReference(resource)` — Add resource reference +- `.waitFor(resource)` — Wait for resource to be ready +- `.withReplicas(N)` — Set replica count +- `.withRedisCommander()` / `.withRedisInsight()` — Redis admin tools +- `.withPgAdmin()` — PostgreSQL admin tool +- `getEndpoint("name")` — Get endpoint reference +- `builder.executionContext` — Access execution context (run vs publish mode) +- `builder.build().run()` — Build and run the application + +### Universally Unavailable Features ❌ +These features are NOT available in any sample: +1. **`AddProject("name")` generic type parameter** — The TypeScript SDK uses `addProject("name")` without type-safe project binding. This means the AppHost server needs another mechanism to discover and bind .NET project references. +2. **`WithUrlForEndpoint` with lambda callback** — URL display customization (display text, display location) requires callbacks that aren't available in the polyglot SDK. +3. **Custom C# extension methods** — Any extension method defined in the sample's AppHost project (e.g., `AddOpenTelemetryCollector`, `AddTalkingClock`, `WithFriendlyUrls`) requires `[AspireExport]` annotation and NuGet packaging to be available. + +### Major Feature Category Gaps ❌ +1. **JavaScript/Node.js hosting** (`Aspire.Hosting.JavaScript`): `AddJavaScriptApp`, `AddViteApp`, `AddNodeApp`, `WithNpm`, `WithRunScript`, `PublishAsDockerFile` +2. **Python hosting** (`Aspire.Hosting.Python`): `AddUvicornApp`, `WithUv` +3. **Azure integrations** (`Aspire.Hosting.Azure.*`): `AddAzureStorage`, `AddAzureFunctionsProject`, `AddAzureContainerAppEnvironment`, `RunAsEmulator`, `ConfigureInfrastructure`, `WithRoleAssignments` +4. **Orleans** (`Aspire.Hosting.Orleans`): `AddOrleans`, `WithClustering`, `WithGrainStorage` +5. **Docker Compose** (`Aspire.Hosting.Docker`): `AddDockerComposeEnvironment` +6. **Dockerfile builds**: `AddDockerfile`, `WithBuildArg` +7. **HealthChecks UI**: `AddHealthChecksUI`, `WithHttpProbe` +8. **Parameters**: `AddParameter` with `publishValueAsDefault` +9. **Completion waiting**: `WaitForCompletion` (different from `WaitFor`) +10. **Dashboard features**: `WithHttpCommand`, `WithHostPort`, `WithExplicitStart`, `ExcludeFromManifest` + +### Sample Conversion Feasibility Matrix + +| Sample | Feasibility | Notes | +|--------|-------------|-------| +| Metrics | ⚠️ Partial | Container resources work; custom OTel collector extension missing | +| aspire-shop | ✅ Mostly | Core orchestration works; HTTP commands, URL customization missing | +| aspire-with-javascript | ❌ Minimal | JS/Vite hosting entirely unavailable | +| aspire-with-node | ⚠️ Partial | Redis works; Node.js app hosting unavailable | +| aspire-with-python | ❌ Minimal | Python/Vite hosting entirely unavailable | +| client-apps-integration | ⚠️ Partial | API project works; platform checks, desktop apps unavailable | +| container-build | ❌ Minimal | Dockerfile builds entirely unavailable | +| custom-resources | ❌ None | Custom resources require C# implementation | +| database-containers | ✅ Mostly | Core DB hosting works; PgWeb, creation scripts missing | +| database-migrations | ✅ Mostly | Works except WaitForCompletion | +| health-checks-ui | ⚠️ Partial | Core projects work; Compose, HealthChecks UI, probes missing | +| orleans-voting | ❌ Minimal | Redis works; Orleans entirely unavailable | +| volume-mount | ⚠️ Partial | SQL Server works; Azure Storage unavailable | +| aspire-with-azure-functions | ❌ Minimal | Azure integrations entirely unavailable | + +### Recommendations for Aspire Team + +1. **Priority: Export JavaScript/Node.js hosting** — `AddJavaScriptApp`, `AddNodeApp`, `AddViteApp` should be annotated with `[AspireExport]` to enable polyglot samples involving JS frontends. +2. **Priority: Export Dockerfile builds** — `AddDockerfile` and `WithBuildArg` are fundamental container capabilities that should be available in all languages. +3. **Add `WithUrlForEndpoint` with simple string overload** — Instead of requiring a lambda, provide `withUrlForEndpoint("http", { displayText: "My App" })` as a simpler API. +4. **Export Azure integrations** — Azure Storage, Functions, and Container Apps are common enough to warrant ATS export. +5. **Add `WaitForCompletion`** — This is a commonly used capability for migration/init patterns. +6. **Document `addProject` limitations** — Clarify how TypeScript apphosts discover and reference .NET projects without generic type parameters. +7. **Support `AddParameter`** — Parameters with default values are important for publish-mode configuration. +8. **Consider custom resource extensibility** — Provide a mechanism for TypeScript apphosts to define custom resource types or interact with custom C# extensions. + +--- + +## Environment and Testing Notes + +### Running Polyglot AppHosts + +To test any of these TypeScript apphosts: + +```bash +# Install staging Aspire CLI +# On Windows: +iex "& { $(irm https://aspire.dev/install.ps1) } -Quality staging" + +# On Linux/macOS: +curl -fsSL https://aspire.dev/install.sh | bash -s -- --quality staging + +# Navigate to sample directory and run +cd samples/ +aspire run +``` + +### Expected Behavior + +When running `aspire run` with an `apphost.ts` present: +1. The CLI detects the TypeScript apphost +2. It scaffolds a .NET AppHost server project +3. It generates the TypeScript SDK in `.modules/` +4. It starts both the .NET server and Node.js guest +5. The Aspire dashboard shows all declared resources +6. Resources start in dependency order (via `waitFor`) + +### Known Runtime Issues + +1. **`.modules/` not pre-generated**: The TypeScript SDK is generated at runtime by the CLI. The + `import ... from "./.modules/aspire.js"` will fail if run directly with `node` or `ts-node`. + Always use `aspire run`. +2. **Project discovery**: `addProject("name")` may not automatically discover .NET project files. + The CLI may need additional configuration or a manifest to map project names to paths. +3. **Async chaining**: The TypeScript SDK uses `Thenable` wrappers for fluent async chaining. + Single `await` at the end of a chain is the expected pattern, but complex branching (like + conditional `withDataVolume`) may require intermediate `await` calls. From 781e1e0941123216dda99f29cc9d0bb3f623fcbc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Mar 2026 17:24:57 +0000 Subject: [PATCH 04/25] Add aspire add setup commands and use package APIs in apphost.ts files Address review feedback: each apphost.ts now includes setup comments listing which aspire add commands to run for integration packages. Previously commented-out code (marked as POLYGLOT GAP) is now active code that uses APIs available after running aspire add. Updated POLYGLOT_NOTES.md with per-sample setup instructions and revised feasibility matrix. Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> --- samples/Metrics/MetricsApp.AppHost/apphost.ts | 22 +- samples/POLYGLOT_NOTES.md | 497 +++++++----------- .../aspire-shop/AspireShop.AppHost/apphost.ts | 13 +- .../ImageGallery.AppHost/apphost.ts | 48 +- .../AspireJavaScript.AppHost/apphost.ts | 52 +- .../AspireWithNode.AppHost/apphost.ts | 23 +- samples/aspire-with-python/apphost.ts | 23 +- .../ClientAppsIntegration.AppHost/apphost.ts | 28 +- samples/container-build/apphost.ts | 47 +- .../CustomResources.AppHost/apphost.ts | 16 +- .../DatabaseContainers.AppHost/apphost.ts | 21 +- .../DatabaseMigrations.AppHost/apphost.ts | 8 +- .../HealthChecksUI.AppHost/apphost.ts | 40 +- .../OrleansVoting.AppHost/apphost.ts | 19 +- .../VolumeMount.AppHost/apphost.ts | 17 +- 15 files changed, 420 insertions(+), 454 deletions(-) diff --git a/samples/Metrics/MetricsApp.AppHost/apphost.ts b/samples/Metrics/MetricsApp.AppHost/apphost.ts index 63e04d55..905651c8 100644 --- a/samples/Metrics/MetricsApp.AppHost/apphost.ts +++ b/samples/Metrics/MetricsApp.AppHost/apphost.ts @@ -1,15 +1,17 @@ +// Setup: No additional packages required (uses core container and project APIs). +// +// AddOpenTelemetryCollector is a custom AppHost extension method defined in the C# project +// (MetricsApp.AppHost.OpenTelemetryCollector) and requires [AspireExport] to be available here. + import { createBuilder } from "./.modules/aspire.js"; const builder = await createBuilder(); -// POLYGLOT GAP: AddOpenTelemetryCollector() is a custom AppHost extension method (from MetricsApp.AppHost.OpenTelemetryCollector) -// and is not available in the TypeScript polyglot SDK. - const prometheus = await builder.addContainer("prometheus", "prom/prometheus", "v3.2.1") .withBindMount("../prometheus", "/etc/prometheus", true) .withArgs("--web.enable-otlp-receiver", "--config.file=/etc/prometheus/prometheus.yml") .withHttpEndpoint({ targetPort: 9090 }); -// POLYGLOT GAP: .WithUrlForEndpoint("http", u => u.DisplayText = "Prometheus Dashboard") — lambda URL customization is not available in the TypeScript SDK. +// POLYGLOT GAP: .WithUrlForEndpoint("http", u => u.DisplayText = "Prometheus Dashboard") — lambda URL customization is not available. const prometheusHttpEndpoint = prometheus.getEndpoint("http"); @@ -18,16 +20,14 @@ const grafana = await builder.addContainer("grafana", "grafana/grafana") .withBindMount("../grafana/dashboards", "/var/lib/grafana/dashboards", true) .withEnvironment("PROMETHEUS_ENDPOINT", prometheusHttpEndpoint) .withHttpEndpoint({ targetPort: 3000 }); -// POLYGLOT GAP: .WithUrlForEndpoint("http", u => u.DisplayText = "Grafana Dashboard") — lambda URL customization is not available in the TypeScript SDK. +// POLYGLOT GAP: .WithUrlForEndpoint("http", u => u.DisplayText = "Grafana Dashboard") — lambda URL customization is not available. -// POLYGLOT GAP: builder.AddOpenTelemetryCollector("otelcollector", "../otelcollector/config.yaml") -// .WithEnvironment("PROMETHEUS_ENDPOINT", `${prometheus.GetEndpoint("http")}/api/v1/otlp`) -// AddOpenTelemetryCollector is a custom extension method not available in the TypeScript SDK. +// POLYGLOT GAP: AddOpenTelemetryCollector("otelcollector", ...) is a custom C# extension +// method from MetricsApp.AppHost.OpenTelemetryCollector. To use it here, it would need +// [AspireExport] annotation and to be distributed as a NuGet package. const app = builder.addProject("app") .withEnvironment("GRAFANA_URL", grafana.getEndpoint("http")); -// POLYGLOT GAP: AddProject("app") — generic type parameter for project reference is not available; use addProject("name") instead. -// POLYGLOT GAP: .WithUrlForEndpoint("https", u => u.DisplayText = "Instrumented App") — lambda URL customization is not available. -// POLYGLOT GAP: .WithUrlForEndpoint("http", u => u.DisplayLocation = UrlDisplayLocation.DetailsOnly) — lambda URL customization is not available. +// POLYGLOT GAP: .WithUrlForEndpoint callbacks for display text/location are not available. await builder.build().run(); diff --git a/samples/POLYGLOT_NOTES.md b/samples/POLYGLOT_NOTES.md index 9482a2cb..25fcdc5b 100644 --- a/samples/POLYGLOT_NOTES.md +++ b/samples/POLYGLOT_NOTES.md @@ -17,14 +17,34 @@ To run the polyglot TypeScript apphosts: ```powershell iex "& { $(irm https://aspire.dev/install.ps1) } -Quality staging" ``` + Or on Linux/macOS: + ```bash + curl -fsSL https://aspire.dev/install.sh | bash -s -- --quality staging + ``` 2. Node.js (v18+) or Bun must be installed -3. Run `aspire run` from the sample directory containing `apphost.ts` +3. **Add integration packages** using `aspire add {package}` for each sample (see per-sample setup below) +4. Run `aspire run` from the sample directory containing `apphost.ts` + +### Adding Integrations with `aspire add` + +The `aspire add` command adds NuGet hosting packages to the backing .NET AppHost server project. +This triggers code generation that makes the integration APIs available in the TypeScript SDK +(`.modules/aspire.js`). **You must run `aspire add` for each integration before the TypeScript +APIs become available.** + +For example: +```bash +aspire add redis # Makes builder.addRedis() available +aspire add postgres # Makes builder.addPostgres() available +aspire add javascript # Makes builder.addJavaScriptApp(), addNodeApp(), addViteApp() available +aspire add orleans # Makes builder.addOrleans() available +``` The CLI will: -- Scaffold an AppHost server project -- Generate the TypeScript SDK in `.modules/` -- Start the .NET AppHost server + Node.js/Bun guest runtime -- The generated SDK provides typed builder classes for all available capabilities +- Scaffold an AppHost server project (if not already present) +- Add the NuGet package to the server project +- Regenerate the TypeScript SDK in `.modules/` with the new capabilities +- Start the .NET AppHost server + Node.js/Bun guest runtime on `aspire run` ### Skipped Sample @@ -33,371 +53,247 @@ The CLI will: --- -## Per-Sample Gap Analysis +## Per-Sample Setup and Gap Analysis + +Each sample requires specific `aspire add` commands to install its integration packages. Run these +commands from the sample directory before using `aspire run`. ### 1. Metrics (`samples/Metrics/MetricsApp.AppHost/apphost.ts`) +**Setup:** No additional packages required (uses core container and project APIs). + **Convertible:** Partially -**Status:** Container resources work, but custom extension and URL customization do not. - -| Feature | C# API | TypeScript Status | -|---------|--------|-------------------| -| Add container with image/tag | `AddContainer("prometheus", "prom/prometheus", "v3.2.1")` | ✅ Available | -| Bind mount (read-only) | `.WithBindMount("../prometheus", "/etc/prometheus", isReadOnly: true)` | ✅ Available | -| Container args | `.WithArgs("--web.enable-otlp-receiver", ...)` | ✅ Available | -| HTTP endpoint | `.WithHttpEndpoint(targetPort: 9090)` | ✅ Available | -| URL display customization | `.WithUrlForEndpoint("http", u => u.DisplayText = "...")` | ❌ Lambda callback not available | -| Custom extension method | `AddOpenTelemetryCollector(...)` | ❌ Custom C# extension — not exported to ATS | -| Project reference (generic) | `AddProject("app")` | ⚠️ `addProject("app")` (no type-safe project binding) | -| Environment from endpoint | `.WithEnvironment("GRAFANA_URL", grafana.GetEndpoint("http"))` | ✅ Available | - -**Key Limitation:** The `AddOpenTelemetryCollector` is a custom extension method defined in the sample's -AppHost project. Custom C# extensions require `[AspireExport]` attributes to be available in the -polyglot SDK, which this sample does not have. +**Remaining Gaps:** +- `AddOpenTelemetryCollector(...)` — Custom C# extension method from `MetricsApp.AppHost.OpenTelemetryCollector`. Would need `[AspireExport]` and NuGet packaging. +- `.WithUrlForEndpoint` lambda callbacks — URL display text/location customization not available. --- ### 2. aspire-shop (`samples/aspire-shop/AspireShop.AppHost/apphost.ts`) +**Setup:** +```bash +aspire add postgres +aspire add redis +``` + **Convertible:** Mostly -**Status:** Core resource orchestration works. HTTP commands and URL customization are gaps. - -| Feature | C# API | TypeScript Status | -|---------|--------|-------------------| -| Postgres + PgAdmin | `AddPostgres("postgres").WithPgAdmin()` | ✅ Available | -| Container lifetime | `.WithLifetime(ContainerLifetime.Persistent)` | ✅ Available | -| Conditional data volume | `if (IsRunMode) postgres.WithDataVolume()` | ✅ Available (via `executionContext`) | -| Add database | `postgres.AddDatabase("catalogdb")` | ✅ Available | -| Redis + Commander | `AddRedis("basketcache").WithDataVolume().WithRedisCommander()` | ✅ Available | -| Project references | `AddProject("name")` | ⚠️ `addProject("name")` — no generic type | -| HTTP health check | `.WithHttpHealthCheck("/health")` | ✅ Available | -| HTTP command | `.WithHttpCommand("/reset-db", "Reset Database", ...)` | ❌ Not available | -| URL display customization | `.WithUrlForEndpoint("https", url => url.DisplayText = "...")` | ❌ Lambda callback not available | -| External HTTP endpoints | `.WithExternalHttpEndpoints()` | ✅ Available | -| Resource references | `.WithReference(resource).WaitFor(resource)` | ✅ Available | - -**Key Limitation:** `WithHttpCommand` is an advanced feature for adding custom dashboard commands. -This is not exposed through ATS capabilities. +**Remaining Gaps:** +- `.WithHttpCommand("/reset-db", ...)` — Custom dashboard commands not available. +- `.WithUrlForEndpoint` lambda callbacks — URL display text customization not available. --- ### 3. aspire-with-javascript (`samples/aspire-with-javascript/AspireJavaScript.AppHost/apphost.ts`) -**Convertible:** Minimally -**Status:** Almost entirely blocked — JavaScript/Node.js hosting APIs are not available. - -| Feature | C# API | TypeScript Status | -|---------|--------|-------------------| -| Project reference | `AddProject("weatherapi")` | ⚠️ `addProject("weatherapi")` | -| JavaScript app | `AddJavaScriptApp("angular", "../path", runScriptName: "start")` | ❌ Not available | -| Vite app | `AddViteApp("reactvite", "../path")` | ❌ Not available | -| Run script | `.WithRunScript("start")` | ❌ Not available | -| npm configuration | `.WithNpm(installCommand: "ci")` | ❌ Not available | -| Publish as Dockerfile | `.PublishAsDockerFile()` | ❌ Not available | -| Publish container files | `weatherApi.PublishWithContainerFiles(reactVite, "./wwwroot")` | ❌ Not available | -| HTTP endpoint with env | `.WithHttpEndpoint(env: "PORT")` | ❌ env parameter not available | +**Setup:** +```bash +aspire add javascript +``` -**Key Limitation:** The entire `Aspire.Hosting.JavaScript` package (AddJavaScriptApp, AddViteApp, -WithNpm, WithRunScript, PublishAsDockerFile) is not available in the polyglot SDK. This sample -is fundamentally about JavaScript hosting, making it almost entirely unconvertible. +**Convertible:** Mostly (after `aspire add javascript`) +**Remaining Gaps:** +- `.PublishAsDockerFile()` — Publish-time Dockerfile generation may not be available. +- `publishWithContainerFiles(reactVite, "./wwwroot")` — Bundling Vite output into a project's wwwroot may not be available. --- ### 4. aspire-with-node (`samples/aspire-with-node/AspireWithNode.AppHost/apphost.ts`) -**Convertible:** Partially -**Status:** Redis and project resources work, but Node.js app hosting is not available. - -| Feature | C# API | TypeScript Status | -|---------|--------|-------------------| -| Redis + Insight | `AddRedis("cache").WithRedisInsight()` | ✅ Available | -| Project reference | `AddProject("weatherapi")` | ⚠️ `addProject("weatherapi")` | -| Node.js app | `AddNodeApp("frontend", "../NodeFrontend", "./app.js")` | ❌ Not available | -| npm config | `.WithNpm()` | ❌ Not available | -| Run script | `.WithRunScript("dev")` | ❌ Not available | -| HTTP endpoint with env | `.WithHttpEndpoint(port: 5223, env: "PORT")` | ❌ env parameter not available | +**Setup:** +```bash +aspire add javascript +aspire add redis +``` -**Key Limitation:** `AddNodeApp` from `Aspire.Hosting.NodeJs` is not available. The Node.js -frontend cannot be orchestrated. +**Convertible:** Fully (after `aspire add javascript` + `aspire add redis`) +**Remaining Gaps:** None expected. --- ### 5. aspire-with-python (`samples/aspire-with-python/apphost.ts`) -**Convertible:** Minimally -**Status:** Almost entirely blocked — Python and Vite hosting APIs are not available. - -| Feature | C# API | TypeScript Status | -|---------|--------|-------------------| -| Redis | `AddRedis("cache")` | ✅ Available | -| Uvicorn app | `AddUvicornApp("app", "./app", "main:app")` | ❌ Not available | -| UV package manager | `.WithUv()` | ❌ Not available | -| Vite app | `AddViteApp("frontend", "./frontend")` | ❌ Not available | -| Publish container files | `app.PublishWithContainerFiles(frontend, "./static")` | ❌ Not available | +**Setup:** +```bash +aspire add javascript +aspire add python +aspire add redis +``` -**Key Limitation:** Both `Aspire.Hosting.Python` (AddUvicornApp, WithUv) and -`Aspire.Hosting.JavaScript` (AddViteApp) packages are not available in the polyglot SDK. +**Convertible:** Mostly (after adding packages) +**Remaining Gaps:** +- `publishWithContainerFiles(frontend, "./static")` — May not be available. --- ### 6. client-apps-integration (`samples/client-apps-integration/ClientAppsIntegration.AppHost/apphost.ts`) -**Convertible:** Partially -**Status:** API service project works, but Windows platform checks and desktop app features don't. - -| Feature | C# API | TypeScript Status | -|---------|--------|-------------------| -| Project reference | `AddProject("apiservice")` | ⚠️ `addProject("apiservice")` | -| Platform check | `OperatingSystem.IsWindows()` | ❌ Not available in TS context | -| Explicit start | `.WithExplicitStart()` | ❌ Not available | -| Exclude from manifest | `.ExcludeFromManifest()` | ❌ Not available | +**Setup:** No additional packages required. -**Key Limitation:** `OperatingSystem.IsWindows()` has no equivalent in the TypeScript SDK. -Desktop apps (WinForms, WPF) are Windows-only and their conditional inclusion cannot be expressed. +**Convertible:** Mostly +**Notes:** Uses `process.platform === "win32"` instead of `OperatingSystem.IsWindows()`. +**Remaining Gaps:** +- `.withExplicitStart()` / `.excludeFromManifest()` — May not be available as capabilities. --- ### 7. container-build (`samples/container-build/apphost.ts`) -**Convertible:** Minimally -**Status:** Almost entirely blocked — Dockerfile build APIs are not available. +**Setup:** No additional packages required (uses core Dockerfile and parameter APIs). -| Feature | C# API | TypeScript Status | -|---------|--------|-------------------| -| Parameter with default | `AddParameter("goversion", "1.25.4", publishValueAsDefault: true)` | ❌ Not available | -| Dockerfile build | `AddDockerfile("ginapp", "./ginapp")` | ❌ Not available | -| Build arg | `.WithBuildArg("GO_VERSION", goVersion)` | ❌ Not available | -| OTLP exporter | `.WithOtlpExporter()` | ❌ Not available | -| Certificate trust | `.WithDeveloperCertificateTrust(trust: true)` | ❌ Not available | -| Execution context | `builder.ExecutionContext.IsPublishMode` | ✅ Available (via `executionContext`) | - -**Key Limitation:** `AddDockerfile` and `WithBuildArg` from `Aspire.Hosting` are not available. -This sample is fundamentally about building containers from Dockerfiles. +**Convertible:** Mostly +**Remaining Gaps:** +- `.withDeveloperCertificateTrust(true)` — Developer certificate trust may not be available. --- ### 8. custom-resources (`samples/custom-resources/CustomResources.AppHost/apphost.ts`) -**Convertible:** Not convertible -**Status:** Entirely blocked — custom resource types require C# implementation. +**Setup:** N/A — This sample uses custom C# resource extensions (`AddTalkingClock`, `AddTestResource`). -| Feature | C# API | TypeScript Status | -|---------|--------|-------------------| -| Custom resource | `AddTalkingClock("talking-clock")` | ❌ Custom C# extension | -| Custom resource | `AddTestResource("test")` | ❌ Custom C# extension | - -**Key Limitation:** This sample demonstrates creating custom resource types in C#. These are -implemented as C# classes and extension methods. The polyglot SDK can only access capabilities -from NuGet packages with `[AspireExport]` attributes — custom project-level extensions are not -available. +**Convertible:** Not convertible +**Remaining Gaps:** +- Custom resource types (`AddTalkingClock`, `AddTestResource`) are C# classes defined in the project. They would need `[AspireExport]` attributes and NuGet distribution to be accessible from TypeScript. --- ### 9. database-containers (`samples/database-containers/DatabaseContainers.AppHost/apphost.ts`) -**Convertible:** Mostly -**Status:** Core database hosting works with minor gaps. - -| Feature | C# API | TypeScript Status | -|---------|--------|-------------------| -| Postgres | `AddPostgres("postgres")` | ✅ Available | -| MySQL | `AddMySql("mysql")` | ✅ Available | -| SQL Server | `AddSqlServer("sqlserver")` | ✅ Available | -| Environment variable | `.WithEnvironment("POSTGRES_DB", todosDbName)` | ✅ Available | -| Bind mount | `.WithBindMount(source, target)` | ✅ Available | -| Data volume | `.WithDataVolume()` | ✅ Available | -| Container lifetime | `.WithLifetime(ContainerLifetime.Persistent)` | ✅ Available | -| Add database | `.AddDatabase("name")` | ✅ Available | -| PgWeb | `.WithPgWeb()` | ❌ Not available | -| Creation script | `.WithCreationScript(File.ReadAllText(path))` | ❌ Not available (file I/O + API) | -| HTTP health check | `.WithHttpHealthCheck("/health")` | ✅ Available | - -**Key Limitation:** `WithCreationScript` requires reading a SQL file from disk and passing its -content. The polyglot SDK doesn't have a `File.ReadAllText` equivalent, and `WithCreationScript` -itself may not be exported. `WithPgWeb` is also not available. +**Setup:** +```bash +aspire add postgres +aspire add mysql +aspire add sqlserver +``` + +**Convertible:** Fully (after adding packages) +**Notes:** Uses Node.js `readFileSync` to read `init.sql` and pass it to `withCreationScript()`. +**Remaining Gaps:** None expected. --- ### 10. database-migrations (`samples/database-migrations/DatabaseMigrations.AppHost/apphost.ts`) -**Convertible:** Mostly -**Status:** Works with minor API gap for WaitForCompletion. - -| Feature | C# API | TypeScript Status | -|---------|--------|-------------------| -| SQL Server + volume | `AddSqlServer("sqlserver").WithDataVolume()` | ✅ Available | -| Container lifetime | `.WithLifetime(ContainerLifetime.Persistent)` | ✅ Available | -| Add database | `.AddDatabase("db1")` | ✅ Available | -| Project references | `AddProject("name")` | ⚠️ `addProject("name")` | -| Wait for completion | `.WaitForCompletion(migrationService)` | ❌ Only `waitFor` available | -| Resource references | `.WithReference(db1)` | ✅ Available | +**Setup:** +```bash +aspire add sqlserver +``` -**Key Limitation:** `WaitForCompletion` (wait for a service to finish, not just start) is not -available. This is semantically different from `WaitFor` — it waits for the migration service to -complete its work before starting the API. +**Convertible:** Fully (after adding package) +**Notes:** Uses `waitForCompletion()` which should be available via core capabilities. +**Remaining Gaps:** None expected. --- ### 11. health-checks-ui (`samples/health-checks-ui/HealthChecksUI.AppHost/apphost.ts`) -**Convertible:** Partially -**Status:** Core project orchestration works, but specialized features don't. - -| Feature | C# API | TypeScript Status | -|---------|--------|-------------------| -| Docker Compose | `AddDockerComposeEnvironment("compose")` | ❌ Not available | -| Redis | `AddRedis("cache")` | ✅ Available | -| Project references | `AddProject("name")` | ⚠️ `addProject("name")` | -| Health checks UI | `AddHealthChecksUI("healthchecksui")` | ❌ Not available | -| HTTP probe | `.WithHttpProbe(ProbeType.Liveness, "/alive")` | ❌ Not available | -| Custom URL helper | `.WithFriendlyUrls(...)` | ❌ Custom extension method | -| Host port | `.WithHostPort(7230)` | ❌ Not available | -| Execution context | `builder.ExecutionContext.IsRunMode` | ✅ Available | - -**Key Limitation:** `AddDockerComposeEnvironment`, `AddHealthChecksUI`, and `WithHttpProbe` are -specialized integrations not available in the polyglot SDK. The `WithFriendlyUrls` is a custom -extension method defined in the same AppHost.cs file. +**Setup:** +```bash +aspire add redis +aspire add docker +``` + +**Convertible:** Mostly (after adding packages) +**Remaining Gaps:** +- `.WithFriendlyUrls(...)` — Custom C# extension method defined in the AppHost project. Needs `[AspireExport]` and NuGet packaging. --- ### 12. orleans-voting (`samples/orleans-voting/OrleansVoting.AppHost/apphost.ts`) -**Convertible:** Minimally -**Status:** Redis works, but Orleans integration is entirely unavailable. - -| Feature | C# API | TypeScript Status | -|---------|--------|-------------------| -| Redis | `AddRedis("voting-redis")` | ✅ Available | -| Orleans cluster | `AddOrleans("voting-cluster")` | ❌ Not available | -| Orleans clustering | `.WithClustering(redis)` | ❌ Not available | -| Orleans grain storage | `.WithGrainStorage("votes", redis)` | ❌ Not available | -| Project with replicas | `.WithReplicas(3)` | ✅ Available | -| Orleans reference | `.WithReference(orleans)` | ❌ Orleans resource not available | -| URL customization | `.WithUrlForEndpoint(...)` | ❌ Lambda callback not available | +**Setup:** +```bash +aspire add redis +aspire add orleans +``` -**Key Limitation:** The entire `Aspire.Hosting.Orleans` package (AddOrleans, WithClustering, -WithGrainStorage) is not available in the polyglot SDK. +**Convertible:** Mostly (after adding packages) +**Remaining Gaps:** +- `.WithUrlForEndpoint` lambda callbacks — URL display text/location customization not available. --- ### 13. volume-mount (`samples/volume-mount/VolumeMount.AppHost/apphost.ts`) -**Convertible:** Partially -**Status:** SQL Server works, but Azure Storage emulator does not. - -| Feature | C# API | TypeScript Status | -|---------|--------|-------------------| -| SQL Server + volume | `AddSqlServer("sqlserver").WithDataVolume()` | ✅ Available | -| Container lifetime | `.WithLifetime(ContainerLifetime.Persistent)` | ✅ Available | -| Add database | `.AddDatabase("sqldb")` | ✅ Available | -| Azure Storage emulator | `AddAzureStorage("Storage").RunAsEmulator(...)` | ❌ Not available | -| Emulator callback | `.RunAsEmulator(emulator => emulator.WithDataVolume())` | ❌ Lambda not available | -| Azure Blobs | `.AddBlobs("BlobConnection")` | ❌ Not available | -| Project reference | `AddProject("blazorweb")` | ⚠️ `addProject("blazorweb")` | +**Setup:** +```bash +aspire add sqlserver +aspire add azure-storage +``` -**Key Limitation:** `AddAzureStorage` and `RunAsEmulator` with callback configuration are not -available. Azure storage integration is a major gap. +**Convertible:** Fully (after adding packages) +**Remaining Gaps:** None expected. --- ### 14. aspire-with-azure-functions (`samples/aspire-with-azure-functions/ImageGallery.AppHost/apphost.ts`) -**Convertible:** Minimally -**Status:** Almost entirely blocked — Azure-specific APIs are not available. - -| Feature | C# API | TypeScript Status | -|---------|--------|-------------------| -| Azure Container App Env | `AddAzureContainerAppEnvironment("env")` | ❌ Not available | -| Azure Storage | `AddAzureStorage("storage").RunAsEmulator()` | ❌ Not available | -| Configure infrastructure | `.ConfigureInfrastructure(...)` | ❌ Not available | -| URL display customization | `.WithUrls(...)` | ❌ Lambda callback not available | -| Azure Blobs | `storage.AddBlobs("blobs")` | ❌ Not available | -| Azure Queues | `storage.AddQueues("queues")` | ❌ Not available | -| Azure Functions project | `AddAzureFunctionsProject("name")` | ❌ Not available | -| Role assignments | `.WithRoleAssignments(storage, ...)` | ❌ Not available | -| Host storage | `.WithHostStorage(storage)` | ❌ Not available | -| Project reference | `AddProject("frontend")` | ⚠️ `addProject("frontend")` | - -**Key Limitation:** This sample is entirely Azure-focused. None of the Azure-specific hosting -packages (Azure Storage, Functions, Container Apps) are available in the polyglot SDK. +**Setup:** +```bash +aspire add azure-appcontainers +aspire add azure-storage +aspire add azure-functions +``` + +**Convertible:** Mostly (after adding packages) +**Remaining Gaps:** +- `.ConfigureInfrastructure(...)` — Bicep infrastructure configuration using C# lambdas is not directly available. Default settings will be used. +- `.WithUrlForEndpoint` lambda callbacks — URL display text customization not available. --- ## Cross-Cutting Issues Summary -### Universally Available Features ✅ -These features work across all samples in the TypeScript polyglot SDK: -- `createBuilder()` — Create the distributed application builder -- `addRedis("name")` — Add Redis container resource -- `addPostgres("name")` — Add PostgreSQL container resource -- `addMySql("name")` — Add MySQL container resource -- `addSqlServer("name")` — Add SQL Server container resource -- `addContainer("name", "image", "tag")` — Add generic container resource -- `.addDatabase("name")` — Add database to a database server -- `.withDataVolume()` — Add data volume to container -- `.withLifetime(ContainerLifetime.Persistent)` — Set container lifetime -- `.withBindMount(source, target, isReadOnly)` — Add bind mount -- `.withEnvironment("key", "value")` — Set environment variable -- `.withArgs(...)` — Set container arguments -- `.withHttpEndpoint({ targetPort: N })` — Add HTTP endpoint -- `.withHttpHealthCheck("/path")` — Add HTTP health check -- `.withExternalHttpEndpoints()` — Expose endpoints externally -- `.withReference(resource)` — Add resource reference -- `.waitFor(resource)` — Wait for resource to be ready -- `.withReplicas(N)` — Set replica count -- `.withRedisCommander()` / `.withRedisInsight()` — Redis admin tools -- `.withPgAdmin()` — PostgreSQL admin tool -- `getEndpoint("name")` — Get endpoint reference -- `builder.executionContext` — Access execution context (run vs publish mode) -- `builder.build().run()` — Build and run the application - -### Universally Unavailable Features ❌ -These features are NOT available in any sample: -1. **`AddProject("name")` generic type parameter** — The TypeScript SDK uses `addProject("name")` without type-safe project binding. This means the AppHost server needs another mechanism to discover and bind .NET project references. -2. **`WithUrlForEndpoint` with lambda callback** — URL display customization (display text, display location) requires callbacks that aren't available in the polyglot SDK. -3. **Custom C# extension methods** — Any extension method defined in the sample's AppHost project (e.g., `AddOpenTelemetryCollector`, `AddTalkingClock`, `WithFriendlyUrls`) requires `[AspireExport]` annotation and NuGet packaging to be available. - -### Major Feature Category Gaps ❌ -1. **JavaScript/Node.js hosting** (`Aspire.Hosting.JavaScript`): `AddJavaScriptApp`, `AddViteApp`, `AddNodeApp`, `WithNpm`, `WithRunScript`, `PublishAsDockerFile` -2. **Python hosting** (`Aspire.Hosting.Python`): `AddUvicornApp`, `WithUv` -3. **Azure integrations** (`Aspire.Hosting.Azure.*`): `AddAzureStorage`, `AddAzureFunctionsProject`, `AddAzureContainerAppEnvironment`, `RunAsEmulator`, `ConfigureInfrastructure`, `WithRoleAssignments` -4. **Orleans** (`Aspire.Hosting.Orleans`): `AddOrleans`, `WithClustering`, `WithGrainStorage` -5. **Docker Compose** (`Aspire.Hosting.Docker`): `AddDockerComposeEnvironment` -6. **Dockerfile builds**: `AddDockerfile`, `WithBuildArg` -7. **HealthChecks UI**: `AddHealthChecksUI`, `WithHttpProbe` -8. **Parameters**: `AddParameter` with `publishValueAsDefault` -9. **Completion waiting**: `WaitForCompletion` (different from `WaitFor`) -10. **Dashboard features**: `WithHttpCommand`, `WithHostPort`, `WithExplicitStart`, `ExcludeFromManifest` - -### Sample Conversion Feasibility Matrix - -| Sample | Feasibility | Notes | -|--------|-------------|-------| -| Metrics | ⚠️ Partial | Container resources work; custom OTel collector extension missing | -| aspire-shop | ✅ Mostly | Core orchestration works; HTTP commands, URL customization missing | -| aspire-with-javascript | ❌ Minimal | JS/Vite hosting entirely unavailable | -| aspire-with-node | ⚠️ Partial | Redis works; Node.js app hosting unavailable | -| aspire-with-python | ❌ Minimal | Python/Vite hosting entirely unavailable | -| client-apps-integration | ⚠️ Partial | API project works; platform checks, desktop apps unavailable | -| container-build | ❌ Minimal | Dockerfile builds entirely unavailable | -| custom-resources | ❌ None | Custom resources require C# implementation | -| database-containers | ✅ Mostly | Core DB hosting works; PgWeb, creation scripts missing | -| database-migrations | ✅ Mostly | Works except WaitForCompletion | -| health-checks-ui | ⚠️ Partial | Core projects work; Compose, HealthChecks UI, probes missing | -| orleans-voting | ❌ Minimal | Redis works; Orleans entirely unavailable | -| volume-mount | ⚠️ Partial | SQL Server works; Azure Storage unavailable | -| aspire-with-azure-functions | ❌ Minimal | Azure integrations entirely unavailable | - -### Recommendations for Aspire Team - -1. **Priority: Export JavaScript/Node.js hosting** — `AddJavaScriptApp`, `AddNodeApp`, `AddViteApp` should be annotated with `[AspireExport]` to enable polyglot samples involving JS frontends. -2. **Priority: Export Dockerfile builds** — `AddDockerfile` and `WithBuildArg` are fundamental container capabilities that should be available in all languages. -3. **Add `WithUrlForEndpoint` with simple string overload** — Instead of requiring a lambda, provide `withUrlForEndpoint("http", { displayText: "My App" })` as a simpler API. -4. **Export Azure integrations** — Azure Storage, Functions, and Container Apps are common enough to warrant ATS export. -5. **Add `WaitForCompletion`** — This is a commonly used capability for migration/init patterns. -6. **Document `addProject` limitations** — Clarify how TypeScript apphosts discover and reference .NET projects without generic type parameters. -7. **Support `AddParameter`** — Parameters with default values are important for publish-mode configuration. -8. **Consider custom resource extensibility** — Provide a mechanism for TypeScript apphosts to define custom resource types or interact with custom C# extensions. +### Features Available After `aspire add` ✅ +These features work after adding the appropriate integration packages: +- `createBuilder()` — Create the distributed application builder (core) +- `addRedis("name")` — `aspire add redis` +- `addPostgres("name")` / `.withPgAdmin()` / `.withPgWeb()` — `aspire add postgres` +- `addMySql("name")` — `aspire add mysql` +- `addSqlServer("name")` — `aspire add sqlserver` +- `addJavaScriptApp()` / `addNodeApp()` / `addViteApp()` — `aspire add javascript` +- `addUvicornApp()` / `.withUv()` — `aspire add python` +- `addOrleans()` / `.withClustering()` / `.withGrainStorage()` — `aspire add orleans` +- `addDockerComposeEnvironment()` — `aspire add docker` +- `addHealthChecksUI()` / `.withHttpProbe()` — `aspire add docker` (or dedicated package) +- `addAzureStorage()` / `.addBlobs()` / `.addQueues()` — `aspire add azure-storage` +- `addAzureContainerAppEnvironment()` — `aspire add azure-appcontainers` +- `addAzureFunctionsProject()` — `aspire add azure-functions` +- Core capabilities (always available): `addContainer()`, `addProject()`, `addDockerfile()`, `addParameter()`, `.withBindMount()`, `.withEnvironment()`, `.withArgs()`, `.withHttpEndpoint()`, `.withHttpHealthCheck()`, `.withExternalHttpEndpoints()`, `.withReference()`, `.waitFor()`, `.waitForCompletion()`, `.withReplicas()`, `.withDataVolume()`, `.withLifetime()`, `.withOtlpExporter()`, `.withBuildArg()`, `getEndpoint()`, `builder.executionContext`, `builder.build().run()` + +### Remaining Gaps ❌ +These features have no polyglot equivalent regardless of packages: +1. **`.WithUrlForEndpoint` with lambda callback** — URL display customization (display text, display location) requires C# callbacks that can't be expressed in TypeScript. +2. **`.ConfigureInfrastructure` with lambda** — Bicep infrastructure configuration requires C# lambdas for accessing provisioning types. +3. **Custom C# extension methods** — Any extension method defined in the sample's AppHost project (e.g., `AddOpenTelemetryCollector`, `AddTalkingClock`, `WithFriendlyUrls`) requires `[AspireExport]` annotation and NuGet packaging. +4. **`.WithHttpCommand`** — Custom dashboard commands are not exposed through ATS capabilities. +5. **`.PublishAsDockerFile` / `.publishWithContainerFiles`** — Publish-time behaviors may not be available. + +### Sample Conversion Feasibility Matrix (with `aspire add`) + +| Sample | `aspire add` Commands | Feasibility | Remaining Gaps | +|--------|----------------------|-------------|----------------| +| Metrics | (none) | ⚠️ Partial | Custom OTel collector extension, URL callbacks | +| aspire-shop | `postgres`, `redis` | ✅ Mostly | HTTP commands, URL callbacks | +| aspire-with-javascript | `javascript` | ✅ Mostly | `PublishAsDockerFile`, `publishWithContainerFiles` | +| aspire-with-node | `javascript`, `redis` | ✅ Full | — | +| aspire-with-python | `javascript`, `python`, `redis` | ✅ Mostly | `publishWithContainerFiles` | +| client-apps-integration | (none) | ✅ Mostly | `withExplicitStart`, `excludeFromManifest` | +| container-build | (none) | ✅ Mostly | `withDeveloperCertificateTrust` | +| custom-resources | N/A | ❌ None | Custom C# resource types | +| database-containers | `postgres`, `mysql`, `sqlserver` | ✅ Full | — | +| database-migrations | `sqlserver` | ✅ Full | — | +| health-checks-ui | `redis`, `docker` | ✅ Mostly | Custom `WithFriendlyUrls` extension | +| orleans-voting | `redis`, `orleans` | ✅ Mostly | URL callbacks | +| volume-mount | `sqlserver`, `azure-storage` | ✅ Full | — | +| aspire-with-azure-functions | `azure-appcontainers`, `azure-storage`, `azure-functions` | ✅ Mostly | `ConfigureInfrastructure` lambda, URL callbacks | + +### Recommendations + +1. **Add `[AspireExport]` to `WithUrlForEndpoint`** — Provide a non-lambda overload (e.g., `withUrlForEndpoint("http", { displayText: "My App" })`) for display customization. +2. **Add `[AspireExport]` to `WithHttpCommand`** — Dashboard commands are useful for operations like database resets. +3. **Document `addProject` behavior** — Clarify how TypeScript apphosts discover and reference .NET projects without generic type parameters. +4. **Consider custom resource extensibility** — Provide a mechanism for TypeScript apphosts to interact with custom C# extensions that have `[AspireExport]` attributes. --- @@ -415,8 +311,15 @@ iex "& { $(irm https://aspire.dev/install.ps1) } -Quality staging" # On Linux/macOS: curl -fsSL https://aspire.dev/install.sh | bash -s -- --quality staging -# Navigate to sample directory and run +# Navigate to sample directory cd samples/ + +# Add required integration packages (see per-sample setup above) +aspire add redis +aspire add postgres +# ... etc. + +# Run the polyglot apphost aspire run ``` @@ -424,19 +327,23 @@ aspire run When running `aspire run` with an `apphost.ts` present: 1. The CLI detects the TypeScript apphost -2. It scaffolds a .NET AppHost server project -3. It generates the TypeScript SDK in `.modules/` -4. It starts both the .NET server and Node.js guest -5. The Aspire dashboard shows all declared resources -6. Resources start in dependency order (via `waitFor`) +2. It scaffolds a .NET AppHost server project (if not already present) +3. `aspire add` installs NuGet packages and triggers SDK regeneration +4. It generates the TypeScript SDK in `.modules/` with all available capabilities +5. It starts both the .NET server and Node.js guest +6. The Aspire dashboard shows all declared resources +7. Resources start in dependency order (via `waitFor`) ### Known Runtime Issues 1. **`.modules/` not pre-generated**: The TypeScript SDK is generated at runtime by the CLI. The `import ... from "./.modules/aspire.js"` will fail if run directly with `node` or `ts-node`. Always use `aspire run`. -2. **Project discovery**: `addProject("name")` may not automatically discover .NET project files. - The CLI may need additional configuration or a manifest to map project names to paths. -3. **Async chaining**: The TypeScript SDK uses `Thenable` wrappers for fluent async chaining. +2. **Must run `aspire add` first**: Integration APIs (like `addRedis`, `addPostgres`) are only + available after adding the corresponding packages with `aspire add`. Without them, the generated + SDK won't include those capabilities. +3. **Project discovery**: `addProject("name")` discovers .NET projects via the Aspire CLI's + project detection. Ensure project files are in the expected directory structure. +4. **Async chaining**: The TypeScript SDK uses `Thenable` wrappers for fluent async chaining. Single `await` at the end of a chain is the expected pattern, but complex branching (like conditional `withDataVolume`) may require intermediate `await` calls. diff --git a/samples/aspire-shop/AspireShop.AppHost/apphost.ts b/samples/aspire-shop/AspireShop.AppHost/apphost.ts index 6900fb49..b33268e0 100644 --- a/samples/aspire-shop/AspireShop.AppHost/apphost.ts +++ b/samples/aspire-shop/AspireShop.AppHost/apphost.ts @@ -1,3 +1,7 @@ +// Setup: Run the following commands to add required integrations: +// aspire add postgres +// aspire add redis + import { createBuilder, ContainerLifetime } from "./.modules/aspire.js"; const builder = await createBuilder(); @@ -22,19 +26,16 @@ const catalogDbManager = builder.addProject("catalogdbmanager") .withReference(catalogDb) .waitFor(catalogDb) .withHttpHealthCheck("/health"); -// POLYGLOT GAP: AddProject("catalogdbmanager") — generic type parameter for project reference is not available; use addProject("name") instead. -// POLYGLOT GAP: .WithHttpCommand("/reset-db", "Reset Database", commandOptions: new() { IconName = "DatabaseLightning" }) — custom HTTP commands are not available in the TypeScript SDK. +// POLYGLOT GAP: .WithHttpCommand("/reset-db", "Reset Database", ...) — custom HTTP commands are not available. const catalogService = builder.addProject("catalogservice") .withReference(catalogDb) .waitFor(catalogDbManager) .withHttpHealthCheck("/health"); -// POLYGLOT GAP: AddProject("catalogservice") — generic type parameter for project reference is not available. const basketService = builder.addProject("basketservice") .withReference(basketCache) .waitFor(basketCache); -// POLYGLOT GAP: AddProject("basketservice") — generic type parameter for project reference is not available. const frontend = builder.addProject("frontend") .withExternalHttpEndpoints() @@ -42,8 +43,6 @@ const frontend = builder.addProject("frontend") .withReference(basketService) .withReference(catalogService) .waitFor(catalogService); -// POLYGLOT GAP: AddProject("frontend") — generic type parameter for project reference is not available. -// POLYGLOT GAP: .WithUrlForEndpoint("https", url => url.DisplayText = "Online Store (HTTPS)") — lambda URL customization is not available. -// POLYGLOT GAP: .WithUrlForEndpoint("http", url => url.DisplayText = "Online Store (HTTP)") — lambda URL customization is not available. +// POLYGLOT GAP: .WithUrlForEndpoint callbacks for display text are not available. await builder.build().run(); diff --git a/samples/aspire-with-azure-functions/ImageGallery.AppHost/apphost.ts b/samples/aspire-with-azure-functions/ImageGallery.AppHost/apphost.ts index 91bffc82..04da61e0 100644 --- a/samples/aspire-with-azure-functions/ImageGallery.AppHost/apphost.ts +++ b/samples/aspire-with-azure-functions/ImageGallery.AppHost/apphost.ts @@ -1,31 +1,39 @@ -import { createBuilder } from "./.modules/aspire.js"; +// Setup: Run the following commands to add required integrations: +// aspire add azure-appcontainers +// aspire add azure-storage +// aspire add azure-functions + +import { createBuilder, StorageBuiltInRole } from "./.modules/aspire.js"; const builder = await createBuilder(); -// POLYGLOT GAP: AddAzureContainerAppEnvironment("env") — Azure Container App environment is not available in the TypeScript polyglot SDK. -// builder.addAzureContainerAppEnvironment("env"); +builder.addAzureContainerAppEnvironment("env"); -// POLYGLOT GAP: AddAzureStorage("storage").RunAsEmulator() — Azure Storage emulator integration is not available. -// POLYGLOT GAP: .ConfigureInfrastructure(infra => { ... }) — Bicep infrastructure configuration with -// Azure.Provisioning.Storage.StorageAccount and BlobService properties is not available. -// const storage = builder.addAzureStorage("storage").runAsEmulator(); +const storage = builder.addAzureStorage("storage") + .runAsEmulator(); +// POLYGLOT GAP: .ConfigureInfrastructure(infra => { ... }) — Bicep infrastructure configuration +// with Azure.Provisioning.Storage.StorageAccount is a C# lambda and not directly available. +// The storage account will use default settings. -// POLYGLOT GAP: storage.AddBlobs("blobs") — Azure Blob storage integration is not available. -// POLYGLOT GAP: storage.AddQueues("queues") — Azure Queue storage integration is not available. -// const blobs = storage.addBlobs("blobs"); -// const queues = storage.addQueues("queues"); +const blobs = storage.addBlobs("blobs"); +const queues = storage.addQueues("queues"); -// POLYGLOT GAP: AddAzureFunctionsProject("functions") — Azure Functions project integration is not available. -// POLYGLOT GAP: .WithRoleAssignments(storage, StorageBuiltInRole.StorageBlobDataContributor, ...) — Azure role assignments are not available. -// POLYGLOT GAP: .WithHostStorage(storage) — host storage configuration is not available. -// const functions = builder.addAzureFunctionsProject("functions") -// .withReference(queues).withReference(blobs).waitFor(storage) -// .withRoleAssignments(storage, ...).withHostStorage(storage); +const functions = builder.addAzureFunctionsProject("functions") + .withReference(queues) + .withReference(blobs) + .waitFor(storage) + .withRoleAssignments(storage, + StorageBuiltInRole.StorageAccountContributor, + StorageBuiltInRole.StorageBlobDataOwner, + StorageBuiltInRole.StorageQueueDataContributor) + .withHostStorage(storage); +// POLYGLOT GAP: .WithUrlForEndpoint("http", u => u.DisplayText = "Functions App") — lambda URL customization is not available. -// POLYGLOT GAP: AddProject("frontend") — generic type parameter for project reference is not available. -// POLYGLOT GAP: Full functionality requires Azure Storage, Queues, Blobs, and Functions project references above. const frontend = builder.addProject("frontend") + .withReference(queues) + .withReference(blobs) + .waitFor(functions) .withExternalHttpEndpoints(); -// POLYGLOT GAP: .withReference(queues).withReference(blobs).waitFor(functions) — cannot reference Azure resources (see gaps above). +// POLYGLOT GAP: .WithUrlForEndpoint callbacks for display text are not available. await builder.build().run(); diff --git a/samples/aspire-with-javascript/AspireJavaScript.AppHost/apphost.ts b/samples/aspire-with-javascript/AspireJavaScript.AppHost/apphost.ts index 1d90df8e..adb0d1fc 100644 --- a/samples/aspire-with-javascript/AspireJavaScript.AppHost/apphost.ts +++ b/samples/aspire-with-javascript/AspireJavaScript.AppHost/apphost.ts @@ -1,34 +1,42 @@ +// Setup: Run the following commands to add required integrations: +// aspire add javascript + import { createBuilder } from "./.modules/aspire.js"; const builder = await createBuilder(); -// POLYGLOT GAP: AddProject("weatherapi") — generic type parameter for project reference is not available. const weatherApi = builder.addProject("weatherapi") .withExternalHttpEndpoints(); -// POLYGLOT GAP: AddJavaScriptApp() is not available in the TypeScript polyglot SDK. -// The following Angular, React, and Vue apps cannot be added directly. - -// POLYGLOT GAP: builder.AddJavaScriptApp("angular", "../AspireJavaScript.Angular", runScriptName: "start") -// .WithReference(weatherApi).WaitFor(weatherApi).WithHttpEndpoint(env: "PORT") -// .WithExternalHttpEndpoints().PublishAsDockerFile() -// AddJavaScriptApp, WithHttpEndpoint with env parameter, and PublishAsDockerFile are not available. - -// POLYGLOT GAP: builder.AddJavaScriptApp("react", "../AspireJavaScript.React", runScriptName: "start") -// .WithReference(weatherApi).WaitFor(weatherApi).WithEnvironment("BROWSER", "none") -// .WithHttpEndpoint(env: "PORT").WithExternalHttpEndpoints().PublishAsDockerFile() -// AddJavaScriptApp, WithHttpEndpoint with env parameter, and PublishAsDockerFile are not available. +const angular = builder.addJavaScriptApp("angular", "../AspireJavaScript.Angular", "start") + .withReference(weatherApi) + .waitFor(weatherApi) + .withHttpEndpoint({ env: "PORT" }) + .withExternalHttpEndpoints(); +// POLYGLOT GAP: .PublishAsDockerFile() — publish-time Dockerfile generation may not be available. -// POLYGLOT GAP: builder.AddJavaScriptApp("vue", "../AspireJavaScript.Vue").WithRunScript("start").WithNpm(installCommand: "ci") -// .WithReference(weatherApi).WaitFor(weatherApi).WithHttpEndpoint(env: "PORT") -// .WithExternalHttpEndpoints().PublishAsDockerFile() -// AddJavaScriptApp, WithRunScript, WithNpm, WithHttpEndpoint with env parameter, and PublishAsDockerFile are not available. +const react = builder.addJavaScriptApp("react", "../AspireJavaScript.React", "start") + .withReference(weatherApi) + .waitFor(weatherApi) + .withEnvironment("BROWSER", "none") + .withHttpEndpoint({ env: "PORT" }) + .withExternalHttpEndpoints(); +// POLYGLOT GAP: .PublishAsDockerFile() — publish-time Dockerfile generation may not be available. + +const vue = builder.addJavaScriptApp("vue", "../AspireJavaScript.Vue") + .withRunScript("start") + .withNpm({ installCommand: "ci" }) + .withReference(weatherApi) + .waitFor(weatherApi) + .withHttpEndpoint({ env: "PORT" }) + .withExternalHttpEndpoints(); +// POLYGLOT GAP: .PublishAsDockerFile() — publish-time Dockerfile generation may not be available. -// POLYGLOT GAP: builder.AddViteApp("reactvite", "../AspireJavaScript.Vite") -// .WithReference(weatherApi).WithEnvironment("BROWSER", "none") -// AddViteApp is not available in the TypeScript polyglot SDK. +const reactVite = builder.addViteApp("reactvite", "../AspireJavaScript.Vite") + .withReference(weatherApi) + .withEnvironment("BROWSER", "none"); -// POLYGLOT GAP: weatherApi.PublishWithContainerFiles(reactVite, "./wwwroot") -// PublishWithContainerFiles is not available in the TypeScript polyglot SDK. +// POLYGLOT GAP: weatherApi.publishWithContainerFiles(reactVite, "./wwwroot") — bundling Vite +// output into a project's wwwroot may not be available. await builder.build().run(); diff --git a/samples/aspire-with-node/AspireWithNode.AppHost/apphost.ts b/samples/aspire-with-node/AspireWithNode.AppHost/apphost.ts index 213a1699..65eaa20f 100644 --- a/samples/aspire-with-node/AspireWithNode.AppHost/apphost.ts +++ b/samples/aspire-with-node/AspireWithNode.AppHost/apphost.ts @@ -1,3 +1,7 @@ +// Setup: Run the following commands to add required integrations: +// aspire add javascript +// aspire add redis + import { createBuilder } from "./.modules/aspire.js"; const builder = await createBuilder(); @@ -5,17 +9,18 @@ const builder = await createBuilder(); const cache = await builder.addRedis("cache") .withRedisInsight(); -// POLYGLOT GAP: AddProject("weatherapi") — generic type parameter for project reference is not available. const weatherapi = builder.addProject("weatherapi") .withHttpHealthCheck("/health"); -// POLYGLOT GAP: AddNodeApp("frontend", "../NodeFrontend", "./app.js") is not available in the TypeScript polyglot SDK. -// POLYGLOT GAP: .WithNpm() — npm configuration is not available. -// POLYGLOT GAP: .WithRunScript("dev") — run script configuration is not available. -// POLYGLOT GAP: .WithHttpEndpoint(port: 5223, env: "PORT") — WithHttpEndpoint with env parameter is not available. -// The following Node.js app cannot be added directly: -// builder.AddNodeApp("frontend", "../NodeFrontend", "./app.js").WithNpm().WithRunScript("dev") -// .WithHttpEndpoint(port: 5223, env: "PORT").WithExternalHttpEndpoints().WithHttpHealthCheck("/health") -// .WithReference(weatherapi).WaitFor(weatherapi).WithReference(cache).WaitFor(cache) +const frontend = builder.addNodeApp("frontend", "../NodeFrontend", "./app.js") + .withNpm() + .withRunScript("dev") + .withHttpEndpoint({ port: 5223, env: "PORT" }) + .withExternalHttpEndpoints() + .withHttpHealthCheck("/health") + .withReference(weatherapi) + .waitFor(weatherapi) + .withReference(cache) + .waitFor(cache); await builder.build().run(); diff --git a/samples/aspire-with-python/apphost.ts b/samples/aspire-with-python/apphost.ts index 86a2de32..039b0a5e 100644 --- a/samples/aspire-with-python/apphost.ts +++ b/samples/aspire-with-python/apphost.ts @@ -1,15 +1,26 @@ +// Setup: Run the following commands to add required integrations: +// aspire add javascript +// aspire add python +// aspire add redis + import { createBuilder } from "./.modules/aspire.js"; const builder = await createBuilder(); const cache = builder.addRedis("cache"); -// POLYGLOT GAP: AddUvicornApp("app", "./app", "main:app") is not available in the TypeScript polyglot SDK. -// POLYGLOT GAP: .WithUv() — UV package manager configuration is not available. -// POLYGLOT GAP: .WithExternalHttpEndpoints().WithReference(cache).WaitFor(cache).WithHttpHealthCheck("/health") -// The Python/Uvicorn app cannot be added directly. +const app = builder.addUvicornApp("app", "./app", "main:app") + .withUv() + .withExternalHttpEndpoints() + .withReference(cache) + .waitFor(cache) + .withHttpHealthCheck("/health"); + +const frontend = builder.addViteApp("frontend", "./frontend") + .withReference(app) + .waitFor(app); -// POLYGLOT GAP: AddViteApp("frontend", "./frontend") is not available in the TypeScript polyglot SDK. -// POLYGLOT GAP: app.PublishWithContainerFiles(frontend, "./static") — PublishWithContainerFiles is not available. +// POLYGLOT GAP: app.publishWithContainerFiles(frontend, "./static") — bundling Vite output +// into the Python app's static directory may not be available. await builder.build().run(); diff --git a/samples/client-apps-integration/ClientAppsIntegration.AppHost/apphost.ts b/samples/client-apps-integration/ClientAppsIntegration.AppHost/apphost.ts index 4566a6e0..baa54451 100644 --- a/samples/client-apps-integration/ClientAppsIntegration.AppHost/apphost.ts +++ b/samples/client-apps-integration/ClientAppsIntegration.AppHost/apphost.ts @@ -1,19 +1,25 @@ +// Setup: No additional packages required (uses core project APIs). + import { createBuilder } from "./.modules/aspire.js"; const builder = await createBuilder(); -// POLYGLOT GAP: AddProject("apiservice") — generic type parameter for project reference is not available. const apiService = builder.addProject("apiservice"); -// POLYGLOT GAP: OperatingSystem.IsWindows() — platform check is not available in the TypeScript apphost context. -// The following Windows-only projects cannot be conditionally added: -// if (OperatingSystem.IsWindows()) { -// builder.AddProject("winformsclient") -// .WithReference(apiService).WaitFor(apiService).WithExplicitStart().ExcludeFromManifest(); -// builder.AddProject("wpfclient") -// .WithReference(apiService).WaitFor(apiService).WithExplicitStart().ExcludeFromManifest(); -// } -// POLYGLOT GAP: .WithExplicitStart() — explicit start configuration is not available. -// POLYGLOT GAP: .ExcludeFromManifest() — manifest exclusion is not available. +// The C# version conditionally adds WinForms/WPF projects on Windows using OperatingSystem.IsWindows(). +// In TypeScript, we can use process.platform for the equivalent check. +if (process.platform === "win32") { + builder.addProject("winformsclient") + .withReference(apiService) + .waitFor(apiService) + .withExplicitStart() + .excludeFromManifest(); + + builder.addProject("wpfclient") + .withReference(apiService) + .waitFor(apiService) + .withExplicitStart() + .excludeFromManifest(); +} await builder.build().run(); diff --git a/samples/container-build/apphost.ts b/samples/container-build/apphost.ts index ad913160..c6a2ee1d 100644 --- a/samples/container-build/apphost.ts +++ b/samples/container-build/apphost.ts @@ -1,33 +1,36 @@ +// Setup: No additional packages required (uses core container and Dockerfile APIs). + import { createBuilder } from "./.modules/aspire.js"; const builder = await createBuilder(); -// POLYGLOT GAP: builder.AddParameter("goversion", "1.25.4", publishValueAsDefault: true) — AddParameter with publishValueAsDefault is not available in the TypeScript SDK. -// Using a plain string as a workaround for the parameter value. -const goVersion = "1.25.4"; +const goVersion = builder.addParameter("goversion", { default: "1.25.4" }); const execCtx = await builder.executionContext.get(); const isRunMode = await execCtx.isRunMode.get(); const isPublishMode = !isRunMode; -// POLYGLOT GAP: AddDockerfile("ginapp", "./ginapp") and AddDockerfile("ginapp", "./ginapp", "Dockerfile.dev") — AddDockerfile is not available in the TypeScript polyglot SDK. -// POLYGLOT GAP: .WithBuildArg("GO_VERSION", goVersion) — WithBuildArg is not available. -// POLYGLOT GAP: .WithOtlpExporter() — OTLP exporter configuration is not available. -// POLYGLOT GAP: .WithDeveloperCertificateTrust(trust: true) — developer certificate trust is not available. -// -// The following Dockerfile-based container cannot be added directly: -// let ginapp; -// if (isPublishMode) { -// ginapp = builder.addDockerfile("ginapp", "./ginapp").withBuildArg("GO_VERSION", goVersion); -// } else { -// ginapp = builder.addDockerfile("ginapp", "./ginapp", "Dockerfile.dev") -// .withBuildArg("GO_VERSION", goVersion).withBindMount("./ginapp", "/app"); -// } -// ginapp.withHttpEndpoint({ targetPort: 5555, env: "PORT" }) -// .withHttpHealthCheck("/").withExternalHttpEndpoints() -// .withOtlpExporter().withDeveloperCertificateTrust(true); -// if (isPublishMode) { -// ginapp.withEnvironment("GIN_MODE", "release").withEnvironment("TRUSTED_PROXIES", "all"); -// } +let ginapp; +if (isPublishMode) { + ginapp = builder.addDockerfile("ginapp", "./ginapp") + .withBuildArg("GO_VERSION", goVersion); +} else { + ginapp = builder.addDockerfile("ginapp", "./ginapp", "Dockerfile.dev") + .withBuildArg("GO_VERSION", goVersion) + .withBindMount("./ginapp", "/app"); +} + +ginapp + .withHttpEndpoint({ targetPort: 5555, env: "PORT" }) + .withHttpHealthCheck("/") + .withExternalHttpEndpoints() + .withOtlpExporter(); +// POLYGLOT GAP: .withDeveloperCertificateTrust(true) — developer certificate trust may not be available. + +if (isPublishMode) { + ginapp + .withEnvironment("GIN_MODE", "release") + .withEnvironment("TRUSTED_PROXIES", "all"); +} await builder.build().run(); diff --git a/samples/custom-resources/CustomResources.AppHost/apphost.ts b/samples/custom-resources/CustomResources.AppHost/apphost.ts index 9f4df246..ba5f749a 100644 --- a/samples/custom-resources/CustomResources.AppHost/apphost.ts +++ b/samples/custom-resources/CustomResources.AppHost/apphost.ts @@ -1,13 +1,15 @@ +// Setup: No standard packages — this sample uses custom C# resource extensions. +// +// POLYGLOT GAP: AddTalkingClock and AddTestResource are custom C# resource extensions +// defined in CustomResources.AppHost. To use them from TypeScript, they would need +// [AspireExport] attributes and distribution as a NuGet package, then added via: +// aspire add + import { createBuilder } from "./.modules/aspire.js"; const builder = await createBuilder(); -// POLYGLOT GAP: AddTalkingClock("talking-clock") is a custom resource extension (from CustomResources.AppHost) -// and is not available in the TypeScript polyglot SDK. -// builder.AddTalkingClock("talking-clock"); - -// POLYGLOT GAP: AddTestResource("test") is a custom resource extension (from CustomResources.AppHost) -// and is not available in the TypeScript polyglot SDK. -// builder.AddTestResource("test"); +// builder.addTalkingClock("talking-clock"); +// builder.addTestResource("test"); await builder.build().run(); diff --git a/samples/database-containers/DatabaseContainers.AppHost/apphost.ts b/samples/database-containers/DatabaseContainers.AppHost/apphost.ts index 112dc9c0..99b6f9dd 100644 --- a/samples/database-containers/DatabaseContainers.AppHost/apphost.ts +++ b/samples/database-containers/DatabaseContainers.AppHost/apphost.ts @@ -1,4 +1,12 @@ +// Setup: Run the following commands to add required integrations: +// aspire add postgres +// aspire add mysql +// aspire add sqlserver + import { createBuilder, ContainerLifetime } from "./.modules/aspire.js"; +import { readFileSync } from "node:fs"; +import { join, dirname } from "node:path"; +import { fileURLToPath } from "node:url"; const builder = await createBuilder(); @@ -8,8 +16,8 @@ const postgres = await builder.addPostgres("postgres") .withEnvironment("POSTGRES_DB", todosDbName) .withBindMount("../DatabaseContainers.ApiService/data/postgres", "/docker-entrypoint-initdb.d") .withDataVolume() + .withPgWeb() .withLifetime(ContainerLifetime.Persistent); -// POLYGLOT GAP: .WithPgWeb() — PgWeb integration is not available in the TypeScript polyglot SDK. const todosDb = postgres.addDatabase(todosDbName); @@ -27,13 +35,12 @@ const sqlserver = await builder.addSqlServer("sqlserver") .withDataVolume() .withLifetime(ContainerLifetime.Persistent); -// POLYGLOT GAP: WithCreationScript(File.ReadAllText(initScriptPath)) — reading a file and passing its content -// via WithCreationScript is not available in the TypeScript polyglot SDK. -// In C#: var initScriptPath = Path.Join(Path.GetDirectoryName(typeof(Program).Assembly.Location), "init.sql"); -// var addressBookDb = sqlserver.AddDatabase("AddressBook").WithCreationScript(File.ReadAllText(initScriptPath)); -const addressBookDb = sqlserver.addDatabase("AddressBook"); +// Read the SQL creation script and apply it to the database +const __dirname = dirname(fileURLToPath(import.meta.url)); +const initSql = readFileSync(join(__dirname, "init.sql"), "utf-8"); +const addressBookDb = sqlserver.addDatabase("AddressBook") + .withCreationScript(initSql); -// POLYGLOT GAP: AddProject("apiservice") — generic type parameter for project reference is not available. const apiservice = builder.addProject("apiservice") .withReference(todosDb) .waitFor(todosDb) diff --git a/samples/database-migrations/DatabaseMigrations.AppHost/apphost.ts b/samples/database-migrations/DatabaseMigrations.AppHost/apphost.ts index 469d5650..d04f54aa 100644 --- a/samples/database-migrations/DatabaseMigrations.AppHost/apphost.ts +++ b/samples/database-migrations/DatabaseMigrations.AppHost/apphost.ts @@ -1,3 +1,6 @@ +// Setup: Run the following commands to add required integrations: +// aspire add sqlserver + import { createBuilder, ContainerLifetime } from "./.modules/aspire.js"; const builder = await createBuilder(); @@ -8,15 +11,12 @@ const sqlserver = await builder.addSqlServer("sqlserver") const db1 = sqlserver.addDatabase("db1"); -// POLYGLOT GAP: AddProject("migration") — generic type parameter for project reference is not available. const migrationService = builder.addProject("migration") .withReference(db1) .waitFor(db1); -// POLYGLOT GAP: AddProject("api") — generic type parameter for project reference is not available. -// POLYGLOT GAP: .WaitForCompletion(migrationService) — WaitForCompletion is not available in the TypeScript polyglot SDK; only WaitFor is available. const api = builder.addProject("api") .withReference(db1) - .waitFor(migrationService); + .waitForCompletion(migrationService); await builder.build().run(); diff --git a/samples/health-checks-ui/HealthChecksUI.AppHost/apphost.ts b/samples/health-checks-ui/HealthChecksUI.AppHost/apphost.ts index 0588914d..28effa7e 100644 --- a/samples/health-checks-ui/HealthChecksUI.AppHost/apphost.ts +++ b/samples/health-checks-ui/HealthChecksUI.AppHost/apphost.ts @@ -1,34 +1,42 @@ -import { createBuilder } from "./.modules/aspire.js"; +// Setup: Run the following commands to add required integrations: +// aspire add redis +// aspire add docker + +import { createBuilder, ProbeType } from "./.modules/aspire.js"; const builder = await createBuilder(); -// POLYGLOT GAP: AddDockerComposeEnvironment("compose") — Docker Compose integration is not available in the TypeScript polyglot SDK. -// builder.AddDockerComposeEnvironment("compose"); +builder.addDockerComposeEnvironment("compose"); const cache = builder.addRedis("cache"); -// POLYGLOT GAP: AddProject("apiservice") — generic type parameter for project reference is not available. -// POLYGLOT GAP: .WithHttpProbe(ProbeType.Liveness, "/alive") — probe configuration is not available. -// POLYGLOT GAP: .WithFriendlyUrls(displayText: "API") — WithFriendlyUrls is a custom extension method not available in the TypeScript SDK. const apiService = builder.addProject("apiservice") - .withHttpHealthCheck("/health"); + .withHttpHealthCheck("/health") + .withHttpProbe(ProbeType.Liveness, "/alive"); +// POLYGLOT GAP: .WithFriendlyUrls(displayText: "API") — WithFriendlyUrls is a custom C# extension +// method defined in the AppHost project. It needs [AspireExport] to be available here. -// POLYGLOT GAP: AddProject("webfrontend") — generic type parameter for project reference is not available. -// POLYGLOT GAP: .WithHttpProbe(ProbeType.Liveness, "/alive") — probe configuration is not available. -// POLYGLOT GAP: .WithFriendlyUrls("Web Frontend") — WithFriendlyUrls is a custom extension method not available. const webFrontend = builder.addProject("webfrontend") .withReference(cache) .waitFor(cache) .withReference(apiService) .waitFor(apiService) + .withHttpProbe(ProbeType.Liveness, "/alive") .withHttpHealthCheck("/health") .withExternalHttpEndpoints(); +// POLYGLOT GAP: .WithFriendlyUrls("Web Frontend") — custom C# extension method. + +const healthChecksUI = builder.addHealthChecksUI("healthchecksui") + .withReference(apiService) + .withReference(webFrontend) + .withHttpProbe(ProbeType.Liveness, "/") + .withExternalHttpEndpoints(); +// POLYGLOT GAP: .WithFriendlyUrls("HealthChecksUI Dashboard", "http") — custom C# extension method. -// POLYGLOT GAP: AddHealthChecksUI("healthchecksui") — HealthChecks UI integration is not available in the TypeScript polyglot SDK. -// POLYGLOT GAP: .WithReference(apiService).WithReference(webFrontend) — references for health checks UI. -// POLYGLOT GAP: .WithFriendlyUrls("HealthChecksUI Dashboard", "http") — custom extension method not available. -// POLYGLOT GAP: .WithHttpProbe(ProbeType.Liveness, "/") — probe configuration is not available. -// POLYGLOT GAP: .WithExternalHttpEndpoints() — for the health checks UI resource. -// POLYGLOT GAP: .WithHostPort(7230) — conditional host port in run mode for health checks UI. +const execCtx = await builder.executionContext.get(); +const isRunMode = await execCtx.isRunMode.get(); +if (isRunMode) { + healthChecksUI.withHostPort(7230); +} await builder.build().run(); diff --git a/samples/orleans-voting/OrleansVoting.AppHost/apphost.ts b/samples/orleans-voting/OrleansVoting.AppHost/apphost.ts index 554e555e..5f0fbe18 100644 --- a/samples/orleans-voting/OrleansVoting.AppHost/apphost.ts +++ b/samples/orleans-voting/OrleansVoting.AppHost/apphost.ts @@ -1,23 +1,22 @@ +// Setup: Run the following commands to add required integrations: +// aspire add redis +// aspire add orleans + import { createBuilder } from "./.modules/aspire.js"; const builder = await createBuilder(); const redis = builder.addRedis("voting-redis"); -// POLYGLOT GAP: AddOrleans("voting-cluster") — Orleans integration is not available in the TypeScript polyglot SDK. -// POLYGLOT GAP: .WithClustering(redis) — Orleans clustering configuration is not available. -// POLYGLOT GAP: .WithGrainStorage("votes", redis) — Orleans grain storage configuration is not available. -// const orleans = builder.addOrleans("voting-cluster").withClustering(redis).withGrainStorage("votes", redis); +const orleans = builder.addOrleans("voting-cluster") + .withClustering(redis) + .withGrainStorage("votes", redis); -// POLYGLOT GAP: AddProject("voting-fe") — generic type parameter for project reference is not available. -// POLYGLOT GAP: .WithReference(orleans) — Orleans resource reference is not available. -// POLYGLOT GAP: .WithUrlForEndpoint("https", u => u.DisplayText = "Voting App") — lambda URL customization is not available. -// POLYGLOT GAP: .WithUrlForEndpoint("http", u => u.DisplayLocation = UrlDisplayLocation.DetailsOnly) — lambda URL customization is not available. -// POLYGLOT GAP: .WithUrlForEndpoint("orleans-gateway", ...) — lambda URL customization is not available. -// POLYGLOT GAP: .WithUrlForEndpoint("orleans-silo", ...) — lambda URL customization is not available. const votingFe = builder.addProject("voting-fe") + .withReference(orleans) .waitFor(redis) .withReplicas(3) .withExternalHttpEndpoints(); +// POLYGLOT GAP: .WithUrlForEndpoint callbacks for display text/location are not available. await builder.build().run(); diff --git a/samples/volume-mount/VolumeMount.AppHost/apphost.ts b/samples/volume-mount/VolumeMount.AppHost/apphost.ts index 19cb1fe2..99794086 100644 --- a/samples/volume-mount/VolumeMount.AppHost/apphost.ts +++ b/samples/volume-mount/VolumeMount.AppHost/apphost.ts @@ -1,3 +1,7 @@ +// Setup: Run the following commands to add required integrations: +// aspire add sqlserver +// aspire add azure-storage + import { createBuilder, ContainerLifetime } from "./.modules/aspire.js"; const builder = await createBuilder(); @@ -8,15 +12,14 @@ const sqlserver = await builder.addSqlServer("sqlserver") const sqlDatabase = sqlserver.addDatabase("sqldb"); -// POLYGLOT GAP: AddAzureStorage("Storage").RunAsEmulator(emulator => emulator.WithDataVolume()) — Azure Storage emulator -// with callback configuration is not available in the TypeScript polyglot SDK. -// POLYGLOT GAP: .AddBlobs("BlobConnection") — Azure Blob storage integration is not available. -// const blobs = builder.addAzureStorage("Storage").runAsEmulator(...).addBlobs("BlobConnection"); +const blobs = builder.addAzureStorage("Storage") + .runAsEmulator(emulator => emulator.withDataVolume()) + .addBlobs("BlobConnection"); -// POLYGLOT GAP: AddProject("blazorweb") — generic type parameter for project reference is not available. const blazorweb = builder.addProject("blazorweb") .withReference(sqlDatabase) - .waitFor(sqlDatabase); -// POLYGLOT GAP: .withReference(blobs).waitFor(blobs) — Azure Blob resource reference cannot be added (see Azure Storage gap above). + .waitFor(sqlDatabase) + .withReference(blobs) + .waitFor(blobs); await builder.build().run(); From 8e2710f7d728cc3c677a37870b254ea75e6613e2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Mar 2026 17:27:40 +0000 Subject: [PATCH 05/25] Address code review: add error handling, clarifying notes, and format fixes Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> --- samples/POLYGLOT_NOTES.md | 8 +++++++- .../ImageGallery.AppHost/apphost.ts | 4 ++++ .../DatabaseContainers.AppHost/apphost.ts | 11 +++++++++-- .../HealthChecksUI.AppHost/apphost.ts | 4 ++++ samples/volume-mount/VolumeMount.AppHost/apphost.ts | 3 +++ 5 files changed, 27 insertions(+), 3 deletions(-) diff --git a/samples/POLYGLOT_NOTES.md b/samples/POLYGLOT_NOTES.md index 25fcdc5b..f3457ca2 100644 --- a/samples/POLYGLOT_NOTES.md +++ b/samples/POLYGLOT_NOTES.md @@ -259,7 +259,13 @@ These features work after adding the appropriate integration packages: - `addAzureStorage()` / `.addBlobs()` / `.addQueues()` — `aspire add azure-storage` - `addAzureContainerAppEnvironment()` — `aspire add azure-appcontainers` - `addAzureFunctionsProject()` — `aspire add azure-functions` -- Core capabilities (always available): `addContainer()`, `addProject()`, `addDockerfile()`, `addParameter()`, `.withBindMount()`, `.withEnvironment()`, `.withArgs()`, `.withHttpEndpoint()`, `.withHttpHealthCheck()`, `.withExternalHttpEndpoints()`, `.withReference()`, `.waitFor()`, `.waitForCompletion()`, `.withReplicas()`, `.withDataVolume()`, `.withLifetime()`, `.withOtlpExporter()`, `.withBuildArg()`, `getEndpoint()`, `builder.executionContext`, `builder.build().run()` +- Core capabilities (always available): + - `addContainer()`, `addProject()`, `addDockerfile()`, `addParameter()` + - `.withBindMount()`, `.withEnvironment()`, `.withArgs()` + - `.withHttpEndpoint()`, `.withHttpHealthCheck()`, `.withExternalHttpEndpoints()` + - `.withReference()`, `.waitFor()`, `.waitForCompletion()`, `.withReplicas()` + - `.withDataVolume()`, `.withLifetime()`, `.withOtlpExporter()`, `.withBuildArg()` + - `getEndpoint()`, `builder.executionContext`, `builder.build().run()` ### Remaining Gaps ❌ These features have no polyglot equivalent regardless of packages: diff --git a/samples/aspire-with-azure-functions/ImageGallery.AppHost/apphost.ts b/samples/aspire-with-azure-functions/ImageGallery.AppHost/apphost.ts index 04da61e0..2bdd4049 100644 --- a/samples/aspire-with-azure-functions/ImageGallery.AppHost/apphost.ts +++ b/samples/aspire-with-azure-functions/ImageGallery.AppHost/apphost.ts @@ -2,6 +2,10 @@ // aspire add azure-appcontainers // aspire add azure-storage // aspire add azure-functions +// +// Note: StorageBuiltInRole and withRoleAssignments are expected to be available +// after aspire add azure-storage. If StorageBuiltInRole is not exported in the +// generated SDK, the role assignment calls may need to be adjusted. import { createBuilder, StorageBuiltInRole } from "./.modules/aspire.js"; diff --git a/samples/database-containers/DatabaseContainers.AppHost/apphost.ts b/samples/database-containers/DatabaseContainers.AppHost/apphost.ts index 99b6f9dd..23daa65d 100644 --- a/samples/database-containers/DatabaseContainers.AppHost/apphost.ts +++ b/samples/database-containers/DatabaseContainers.AppHost/apphost.ts @@ -2,9 +2,12 @@ // aspire add postgres // aspire add mysql // aspire add sqlserver +// +// Note: This sample reads init.sql using Node.js fs APIs (the TypeScript +// equivalent of C#'s File.ReadAllText) and passes it to withCreationScript(). import { createBuilder, ContainerLifetime } from "./.modules/aspire.js"; -import { readFileSync } from "node:fs"; +import { readFileSync, existsSync } from "node:fs"; import { join, dirname } from "node:path"; import { fileURLToPath } from "node:url"; @@ -37,7 +40,11 @@ const sqlserver = await builder.addSqlServer("sqlserver") // Read the SQL creation script and apply it to the database const __dirname = dirname(fileURLToPath(import.meta.url)); -const initSql = readFileSync(join(__dirname, "init.sql"), "utf-8"); +const initSqlPath = join(__dirname, "init.sql"); +if (!existsSync(initSqlPath)) { + throw new Error(`SQL initialization script not found: ${initSqlPath}`); +} +const initSql = readFileSync(initSqlPath, "utf-8"); const addressBookDb = sqlserver.addDatabase("AddressBook") .withCreationScript(initSql); diff --git a/samples/health-checks-ui/HealthChecksUI.AppHost/apphost.ts b/samples/health-checks-ui/HealthChecksUI.AppHost/apphost.ts index 28effa7e..13c120d0 100644 --- a/samples/health-checks-ui/HealthChecksUI.AppHost/apphost.ts +++ b/samples/health-checks-ui/HealthChecksUI.AppHost/apphost.ts @@ -1,6 +1,10 @@ // Setup: Run the following commands to add required integrations: // aspire add redis // aspire add docker +// +// Note: ProbeType, addDockerComposeEnvironment, addHealthChecksUI, and withHttpProbe +// are expected to be available after aspire add docker. If ProbeType is not exported +// in the generated SDK, the withHttpProbe calls may need to be removed. import { createBuilder, ProbeType } from "./.modules/aspire.js"; diff --git a/samples/volume-mount/VolumeMount.AppHost/apphost.ts b/samples/volume-mount/VolumeMount.AppHost/apphost.ts index 99794086..1b08c6c9 100644 --- a/samples/volume-mount/VolumeMount.AppHost/apphost.ts +++ b/samples/volume-mount/VolumeMount.AppHost/apphost.ts @@ -15,6 +15,9 @@ const sqlDatabase = sqlserver.addDatabase("sqldb"); const blobs = builder.addAzureStorage("Storage") .runAsEmulator(emulator => emulator.withDataVolume()) .addBlobs("BlobConnection"); +// Note: The emulator callback pattern above assumes the SDK supports arrow function +// callbacks for RunAsEmulator. If not, you may need to call runAsEmulator() without +// arguments and configure the data volume separately. const blazorweb = builder.addProject("blazorweb") .withReference(sqlDatabase) From 69126edd6e970fd998b0a186b12371e9df410310 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Mar 2026 20:33:47 +0000 Subject: [PATCH 06/25] Document that gap analysis is unvalidated; staging CLI required for apphost.ts The stable Aspire CLI (13.1.2 from NuGet) does not include TypeScript polyglot apphost support. The native staging binary from aspire.dev is required to detect and run apphost.ts files. Updated POLYGLOT_NOTES.md to clearly document this, mark all feasibility ratings as expected rather than confirmed, add a validation checklist, and note the container runtime prerequisite. Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> --- samples/POLYGLOT_NOTES.md | 95 +++++++++++++++---- .../database-migrations/.aspire/settings.json | 2 +- 2 files changed, 75 insertions(+), 22 deletions(-) diff --git a/samples/POLYGLOT_NOTES.md b/samples/POLYGLOT_NOTES.md index f3457ca2..a92050a5 100644 --- a/samples/POLYGLOT_NOTES.md +++ b/samples/POLYGLOT_NOTES.md @@ -1,7 +1,14 @@ # Polyglot AppHost TypeScript Conversion Notes -This document logs all issues, gaps, limitations, and errors discovered while attempting to rewrite -each sample's `AppHost.cs` as a polyglot `apphost.ts` using the Aspire TypeScript SDK. +This document describes the conversion of each sample's `AppHost.cs` to a polyglot `apphost.ts` +using the Aspire TypeScript SDK, and documents expected gaps based on the +[Aspire Type System (ATS) spec](https://github.com/dotnet/aspire/blob/main/docs/specs/polyglot-apphost.md). + +> **⚠️ Validation Status:** These conversions have **not yet been validated** with `aspire run`. +> The gap analysis below is based on the ATS specification and the `[AspireExport]` attribute +> model. Actual API availability must be confirmed by running `aspire run` with the staging CLI, +> which generates the `.modules/aspire.js` SDK from the installed NuGet packages. Some APIs +> listed as available may not be exported yet, and some listed as gaps may already be supported. ## Overview @@ -13,17 +20,21 @@ which communicates with a .NET AppHost Server via JSON-RPC. To run the polyglot TypeScript apphosts: -1. Install the staging Aspire CLI: +1. **Install the staging Aspire CLI** (the stable NuGet CLI does not include TypeScript polyglot support): ```powershell + # Windows (PowerShell): iex "& { $(irm https://aspire.dev/install.ps1) } -Quality staging" ``` - Or on Linux/macOS: ```bash + # Linux/macOS: curl -fsSL https://aspire.dev/install.sh | bash -s -- --quality staging ``` + > The stable CLI (`dotnet tool install -g Aspire.Cli`) does **not** detect `apphost.ts` files. + > You must use the native staging binary from aspire.dev. 2. Node.js (v18+) or Bun must be installed -3. **Add integration packages** using `aspire add {package}` for each sample (see per-sample setup below) -4. Run `aspire run` from the sample directory containing `apphost.ts` +3. A container runtime (Docker or Podman) must be running — Aspire handles all container orchestration automatically +4. **Add integration packages** using `aspire add {package}` for each sample (see per-sample setup below) +5. Run `aspire run` from the sample directory containing `apphost.ts` ### Adding Integrations with `aspire add` @@ -46,6 +57,18 @@ The CLI will: - Regenerate the TypeScript SDK in `.modules/` with the new capabilities - Start the .NET AppHost server + Node.js/Bun guest runtime on `aspire run` +### How to Validate + +To confirm which APIs are actually available after `aspire add`, inspect the generated +`.modules/aspire.ts` file. It contains all exported builder classes, methods, enums, and DTOs. +Compare against the `apphost.ts` to identify any remaining gaps. + +```bash +cd samples// +# After aspire add and aspire run, check: +cat .modules/aspire.ts | grep -E "add(Redis|Postgres|MySql|SqlServer|Orleans|Container)" +``` + ### Skipped Sample - **standalone-dashboard**: This is a standalone console application, not an Aspire AppHost sample. It @@ -55,6 +78,10 @@ The CLI will: ## Per-Sample Setup and Gap Analysis +> **Note:** The per-sample gap analysis below is based on the ATS specification and has not been +> validated by running `aspire run` with the staging CLI. After validation with `aspire run`, +> the actual generated `.modules/aspire.ts` should be inspected to confirm which APIs are available. + Each sample requires specific `aspire add` commands to install its integration packages. Run these commands from the sample directory before using `aspire run`. @@ -244,8 +271,10 @@ aspire add azure-functions ## Cross-Cutting Issues Summary -### Features Available After `aspire add` ✅ -These features work after adding the appropriate integration packages: +### Features Available After `aspire add` (Expected) ✅ +These features are expected to work after adding the appropriate integration packages. +**This list has not been validated with `aspire run` — actual availability depends on which +C# APIs have `[AspireExport]` attributes in their NuGet packages.** - `createBuilder()` — Create the distributed application builder (core) - `addRedis("name")` — `aspire add redis` - `addPostgres("name")` / `.withPgAdmin()` / `.withPgWeb()` — `aspire add postgres` @@ -267,15 +296,19 @@ These features work after adding the appropriate integration packages: - `.withDataVolume()`, `.withLifetime()`, `.withOtlpExporter()`, `.withBuildArg()` - `getEndpoint()`, `builder.executionContext`, `builder.build().run()` -### Remaining Gaps ❌ -These features have no polyglot equivalent regardless of packages: +### Expected Remaining Gaps ❌ +These features are expected to have no polyglot equivalent regardless of packages +(based on the ATS spec — lambda callbacks and custom C# extensions cannot cross the JSON-RPC boundary): 1. **`.WithUrlForEndpoint` with lambda callback** — URL display customization (display text, display location) requires C# callbacks that can't be expressed in TypeScript. 2. **`.ConfigureInfrastructure` with lambda** — Bicep infrastructure configuration requires C# lambdas for accessing provisioning types. 3. **Custom C# extension methods** — Any extension method defined in the sample's AppHost project (e.g., `AddOpenTelemetryCollector`, `AddTalkingClock`, `WithFriendlyUrls`) requires `[AspireExport]` annotation and NuGet packaging. 4. **`.WithHttpCommand`** — Custom dashboard commands are not exposed through ATS capabilities. 5. **`.PublishAsDockerFile` / `.publishWithContainerFiles`** — Publish-time behaviors may not be available. -### Sample Conversion Feasibility Matrix (with `aspire add`) +### Sample Conversion Feasibility Matrix (Expected, with `aspire add`) + +> **Note:** These feasibility ratings are based on the ATS specification and have not been +> validated by running `aspire run`. After validation, some entries may change. | Sample | `aspire add` Commands | Feasibility | Remaining Gaps | |--------|----------------------|-------------|----------------| @@ -310,13 +343,17 @@ These features have no polyglot equivalent regardless of packages: To test any of these TypeScript apphosts: ```bash -# Install staging Aspire CLI -# On Windows: +# Install the STAGING Aspire CLI (required for TypeScript polyglot support) +# The stable CLI from NuGet (dotnet tool install -g Aspire.Cli) does NOT support apphost.ts. + +# On Windows (PowerShell): iex "& { $(irm https://aspire.dev/install.ps1) } -Quality staging" # On Linux/macOS: curl -fsSL https://aspire.dev/install.sh | bash -s -- --quality staging +# Ensure Docker (or Podman) is running — Aspire handles all container orchestration + # Navigate to sample directory cd samples/ @@ -331,25 +368,41 @@ aspire run ### Expected Behavior -When running `aspire run` with an `apphost.ts` present: -1. The CLI detects the TypeScript apphost -2. It scaffolds a .NET AppHost server project (if not already present) +When running `aspire run` with an `apphost.ts` present (staging CLI required): +1. The CLI detects the TypeScript apphost via its `apphost.ts` detection pattern +2. It scaffolds a .NET AppHost server project in a temp directory 3. `aspire add` installs NuGet packages and triggers SDK regeneration 4. It generates the TypeScript SDK in `.modules/` with all available capabilities -5. It starts both the .NET server and Node.js guest +5. It starts both the .NET server and Node.js guest (connected via JSON-RPC over Unix socket) 6. The Aspire dashboard shows all declared resources 7. Resources start in dependency order (via `waitFor`) +8. Containers are automatically pulled and started by the .NET AppHost server + +### Validation Checklist + +After running `aspire run` for each sample, update this section with results: + +- [ ] Verify `.modules/aspire.ts` is generated with expected builder classes +- [ ] Confirm each `aspire add` package produces the expected API methods +- [ ] Update per-sample gap analysis with actual findings +- [ ] Remove or update any `// POLYGLOT GAP:` comments that are resolved +- [ ] Note any new gaps discovered in the generated SDK ### Known Runtime Issues -1. **`.modules/` not pre-generated**: The TypeScript SDK is generated at runtime by the CLI. The +1. **Staging CLI required**: The stable Aspire CLI (`dotnet tool install -g Aspire.Cli@13.1.2`) + does **not** detect `apphost.ts` files. You must install the native staging binary from + `https://aspire.dev/install.sh` (or `.ps1`) with `--quality staging`. +2. **`.modules/` not pre-generated**: The TypeScript SDK is generated at runtime by the CLI. The `import ... from "./.modules/aspire.js"` will fail if run directly with `node` or `ts-node`. Always use `aspire run`. -2. **Must run `aspire add` first**: Integration APIs (like `addRedis`, `addPostgres`) are only +3. **Must run `aspire add` first**: Integration APIs (like `addRedis`, `addPostgres`) are only available after adding the corresponding packages with `aspire add`. Without them, the generated SDK won't include those capabilities. -3. **Project discovery**: `addProject("name")` discovers .NET projects via the Aspire CLI's +4. **Container runtime required**: Docker or Podman must be running. Aspire handles all container + orchestration automatically — no need to manually pull or start containers. +5. **Project discovery**: `addProject("name")` discovers .NET projects via the Aspire CLI's project detection. Ensure project files are in the expected directory structure. -4. **Async chaining**: The TypeScript SDK uses `Thenable` wrappers for fluent async chaining. +6. **Async chaining**: The TypeScript SDK uses `Thenable` wrappers for fluent async chaining. Single `await` at the end of a chain is the expected pattern, but complex branching (like conditional `withDataVolume`) may require intermediate `await` calls. diff --git a/samples/database-migrations/.aspire/settings.json b/samples/database-migrations/.aspire/settings.json index 6846cee4..0f241c2b 100644 --- a/samples/database-migrations/.aspire/settings.json +++ b/samples/database-migrations/.aspire/settings.json @@ -1,3 +1,3 @@ { "appHostPath": "../DatabaseMigrations.AppHost/DatabaseMigrations.AppHost.csproj" -} \ No newline at end of file +} From 66f81fef87259d3470872a1123dec5482530fc2f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Mar 2026 21:04:32 +0000 Subject: [PATCH 07/25] Document staging CLI requirement and sandbox limitation Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> --- .aspire/settings.json | 3 +++ nuget.config | 1 + 2 files changed, 4 insertions(+) create mode 100644 .aspire/settings.json diff --git a/.aspire/settings.json b/.aspire/settings.json new file mode 100644 index 00000000..b44b9596 --- /dev/null +++ b/.aspire/settings.json @@ -0,0 +1,3 @@ +{ + "polyglot": "true" +} \ No newline at end of file diff --git a/nuget.config b/nuget.config index 248a5bb5..6e3f1bc7 100644 --- a/nuget.config +++ b/nuget.config @@ -3,5 +3,6 @@ + \ No newline at end of file From 4718ce1fc90ac9efae40545af752aeb7fc1c3d30 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Mar 2026 21:05:11 +0000 Subject: [PATCH 08/25] Remove accidentally committed .aspire/settings.json; restore nuget.config Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> --- .aspire/settings.json | 3 --- nuget.config | 1 - 2 files changed, 4 deletions(-) delete mode 100644 .aspire/settings.json diff --git a/.aspire/settings.json b/.aspire/settings.json deleted file mode 100644 index b44b9596..00000000 --- a/.aspire/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "polyglot": "true" -} \ No newline at end of file diff --git a/nuget.config b/nuget.config index 6e3f1bc7..248a5bb5 100644 --- a/nuget.config +++ b/nuget.config @@ -3,6 +3,5 @@ - \ No newline at end of file From 91cd4a2aa5bdd2c63c0a7486ab760cae148446d7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Mar 2026 21:06:24 +0000 Subject: [PATCH 09/25] Fix CLI install command to use correct staging syntax: -q staging Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> --- samples/POLYGLOT_NOTES.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/samples/POLYGLOT_NOTES.md b/samples/POLYGLOT_NOTES.md index a92050a5..4135b038 100644 --- a/samples/POLYGLOT_NOTES.md +++ b/samples/POLYGLOT_NOTES.md @@ -21,16 +21,17 @@ which communicates with a .NET AppHost Server via JSON-RPC. To run the polyglot TypeScript apphosts: 1. **Install the staging Aspire CLI** (the stable NuGet CLI does not include TypeScript polyglot support): + ```bash + # Linux/macOS: + curl -sSL https://aspire.dev/install.sh | bash -s -- -q staging + ``` ```powershell # Windows (PowerShell): iex "& { $(irm https://aspire.dev/install.ps1) } -Quality staging" ``` - ```bash - # Linux/macOS: - curl -fsSL https://aspire.dev/install.sh | bash -s -- --quality staging - ``` > The stable CLI (`dotnet tool install -g Aspire.Cli`) does **not** detect `apphost.ts` files. > You must use the native staging binary from aspire.dev. + > See [Polyglot AppHost docs](https://aspiredev.netlify.app/app-host/polyglot-apphost/) for details. 2. Node.js (v18+) or Bun must be installed 3. A container runtime (Docker or Podman) must be running — Aspire handles all container orchestration automatically 4. **Add integration packages** using `aspire add {package}` for each sample (see per-sample setup below) @@ -346,12 +347,12 @@ To test any of these TypeScript apphosts: # Install the STAGING Aspire CLI (required for TypeScript polyglot support) # The stable CLI from NuGet (dotnet tool install -g Aspire.Cli) does NOT support apphost.ts. +# On Linux/macOS: +curl -sSL https://aspire.dev/install.sh | bash -s -- -q staging + # On Windows (PowerShell): iex "& { $(irm https://aspire.dev/install.ps1) } -Quality staging" -# On Linux/macOS: -curl -fsSL https://aspire.dev/install.sh | bash -s -- --quality staging - # Ensure Docker (or Podman) is running — Aspire handles all container orchestration # Navigate to sample directory @@ -391,8 +392,8 @@ After running `aspire run` for each sample, update this section with results: ### Known Runtime Issues 1. **Staging CLI required**: The stable Aspire CLI (`dotnet tool install -g Aspire.Cli@13.1.2`) - does **not** detect `apphost.ts` files. You must install the native staging binary from - `https://aspire.dev/install.sh` (or `.ps1`) with `--quality staging`. + does **not** detect `apphost.ts` files. You must install the native staging binary: + `curl -sSL https://aspire.dev/install.sh | bash -s -- -q staging` 2. **`.modules/` not pre-generated**: The TypeScript SDK is generated at runtime by the CLI. The `import ... from "./.modules/aspire.js"` will fail if run directly with `node` or `ts-node`. Always use `aspire run`. From 71b146fbb76b1abd8a6153ecb132a547e470a50a Mon Sep 17 00:00:00 2001 From: David Pine Date: Mon, 9 Mar 2026 20:58:36 -0500 Subject: [PATCH 10/25] Bifurcate samples into cs/ and ts/ AppHost subfolders Move each sample's AppHost into isolated cs/ and ts/ subdirectories to enable independent testing of C# and TypeScript AppHosts. For .csproj-based samples (12): - C# AppHost project moved to cs/SampleName.AppHost/ - TypeScript apphost.ts extracted to ts/apphost.ts - Updated .csproj ProjectReferences (../ -> ../../) - Updated AppHost.cs relative paths where needed - Updated .slnx AppHost project paths For file-based samples (container-build, aspire-with-python): - apphost.cs + settings moved to cs/ - apphost.ts moved to ts/ - Updated relative paths (./ -> ../) For standalone-dashboard: - ConsoleApp.cs + settings moved to cs/ Each cs/ and ts/ folder gets its own .aspire/settings.json. Shared service projects remain at the sample root level. Build system globs (**/) automatically discover at new depth. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- samples/Metrics/Metrics.slnx | 2 +- .../Metrics/{ => cs}/.aspire/settings.json | 0 .../{ => cs}/MetricsApp.AppHost/AppHost.cs | 8 ++-- .../MetricsApp.AppHost.csproj | 2 +- .../OpenTelemetryCollectorResource.cs | 0 ...metryCollectorResourceBuilderExtensions.cs | 0 .../OpenTelemetryCollector/README.md | 0 .../Properties/launchSettings.json | 0 .../MetricsApp.AppHost/appsettings.json | 0 samples/Metrics/ts/.aspire/settings.json | 3 ++ .../{MetricsApp.AppHost => ts}/apphost.ts | 0 samples/POLYGLOT_NOTES.md | 42 ++++++++++--------- samples/aspire-shop/AspireShop.slnx | 2 +- .../{ => cs}/.aspire/settings.json | 0 .../{ => cs}/AspireShop.AppHost/AppHost.cs | 0 .../AspireShop.AppHost.csproj | 8 ++-- .../Properties/launchSettings.json | 0 .../appsettings.Development.json | 0 .../AspireShop.AppHost/appsettings.json | 0 samples/aspire-shop/ts/.aspire/settings.json | 3 ++ .../{AspireShop.AppHost => ts}/apphost.ts | 0 .../ImageGallery.slnx | 2 +- .../{ => cs}/.aspire/settings.json | 0 .../{ => cs}/ImageGallery.AppHost/AppHost.cs | 0 .../ImageGallery.AppHost.csproj | 4 +- .../Properties/launchSettings.json | 0 .../appsettings.Development.json | 0 .../ImageGallery.AppHost/appsettings.json | 0 .../ts/.aspire/settings.json | 3 ++ .../{ImageGallery.AppHost => ts}/apphost.ts | 0 .../AspireJavaScript.slnx | 2 +- .../{ => cs}/.aspire/settings.json | 0 .../AspireJavaScript.AppHost/AppHost.cs | 8 ++-- .../AspireJavaScript.AppHost.csproj | 2 +- .../Properties/launchSettings.json | 0 .../appsettings.Development.json | 0 .../AspireJavaScript.AppHost/appsettings.json | 0 .../aspire-manifest.json | 0 .../ts/.aspire/settings.json | 3 ++ .../apphost.ts | 0 samples/aspire-with-node/AspireWithNode.slnx | 2 +- .../{ => cs}/.aspire/settings.json | 0 .../AspireWithNode.AppHost/AppHost.cs | 2 +- .../AspireWithNode.AppHost.csproj | 2 +- .../Properties/launchSettings.json | 0 .../appsettings.Development.json | 0 .../AspireWithNode.AppHost/appsettings.json | 0 .../aspire-manifest.json | 0 .../aspire-with-node/ts/.aspire/settings.json | 3 ++ .../{AspireWithNode.AppHost => ts}/apphost.ts | 0 .../aspire-with-python/.aspire/settings.json | 3 -- .../cs/.aspire/settings.json | 1 + .../aspire-with-python/{ => cs}/apphost.cs | 4 +- .../{ => cs}/apphost.run.json | 0 .../ts/.aspire/settings.json | 1 + .../aspire-with-python/{ => ts}/apphost.ts | 4 +- .../ClientAppsIntegration.slnx | 2 +- .../{ => cs}/.aspire/settings.json | 0 .../ClientAppsIntegration.AppHost/AppHost.cs | 0 .../ClientAppsIntegration.AppHost.csproj | 6 +-- .../Properties/launchSettings.json | 0 .../appsettings.Development.json | 0 .../appsettings.json | 0 .../ts/.aspire/settings.json | 3 ++ .../apphost.ts | 0 samples/container-build/.aspire/settings.json | 3 -- .../container-build/cs/.aspire/settings.json | 1 + samples/container-build/{ => cs}/apphost.cs | 6 +-- .../container-build/{ => cs}/apphost.run.json | 0 .../apphost.settings.Development.json | 0 .../{ => cs}/apphost.settings.json | 0 .../container-build/ts/.aspire/settings.json | 1 + samples/container-build/{ => ts}/apphost.ts | 6 +-- samples/custom-resources/CustomResources.slnx | 2 +- .../{ => cs}/.aspire/settings.json | 0 .../CustomResources.AppHost/AppHost.cs | 0 .../CustomResources.AppHost.csproj | 0 .../Properties/launchSettings.json | 0 .../TalkingClockResource.cs | 0 .../CustomResources.AppHost/TestResource.cs | 0 .../appsettings.Development.json | 0 .../CustomResources.AppHost/appsettings.json | 0 .../custom-resources/ts/.aspire/settings.json | 3 ++ .../apphost.ts | 0 .../DatabaseContainers.slnx | 2 +- .../{ => cs}/.aspire/settings.json | 0 .../DatabaseContainers.AppHost/AppHost.cs | 4 +- .../DatabaseContainers.AppHost.csproj | 4 +- .../Properties/launchSettings.json | 0 .../appsettings.Development.json | 0 .../appsettings.json | 0 .../ts/.aspire/settings.json | 3 ++ .../apphost.ts | 0 .../DatabaseMigrations.slnx | 2 +- .../{ => cs}/.aspire/settings.json | 2 +- .../DatabaseMigrations.AppHost/AppHost.cs | 0 .../DatabaseMigrations.AppHost.csproj | 4 +- .../Properties/launchSettings.json | 0 .../appsettings.Development.json | 0 .../appsettings.json | 0 .../ts/.aspire/settings.json | 3 ++ .../apphost.ts | 0 samples/health-checks-ui/HealthChecksUI.slnx | 2 +- .../{ => cs}/.aspire/settings.json | 0 .../HealthChecksUI.AppHost/AppHost.cs | 0 .../HealthChecksUI.AppHost.csproj | 4 +- .../HealthChecksUIExtensions.cs | 0 .../HealthChecksUIResource.cs | 0 .../Properties/launchSettings.json | 0 .../appsettings.Development.json | 0 .../HealthChecksUI.AppHost/appsettings.json | 0 .../aspire-manifest.json | 0 .../health-checks-ui/ts/.aspire/settings.json | 3 ++ .../{HealthChecksUI.AppHost => ts}/apphost.ts | 0 samples/orleans-voting/OrleansVoting.slnx | 2 +- .../{ => cs}/.aspire/settings.json | 0 .../{ => cs}/OrleansVoting.AppHost/AppHost.cs | 0 .../OrleansVoting.AppHost.csproj | 2 +- .../Properties/launchSettings.json | 0 .../appsettings.Development.json | 0 .../OrleansVoting.AppHost/appsettings.json | 0 .../orleans-voting/ts/.aspire/settings.json | 3 ++ .../{OrleansVoting.AppHost => ts}/apphost.ts | 0 .../{ => cs}/ConsoleApp.cs | 0 .../{ => cs}/ConsoleApp.run.json | 0 .../ConsoleApp.settings.Development.json | 0 .../{ => cs}/ConsoleApp.settings.json | 0 samples/volume-mount/VolumeMount.slnx | 2 +- .../{ => cs}/.aspire/settings.json | 0 .../{ => cs}/VolumeMount.AppHost/AppHost.cs | 0 .../Properties/launchSettings.json | 0 .../VolumeMount.AppHost.csproj | 2 +- .../appsettings.Development.json | 0 .../VolumeMount.AppHost/appsettings.json | 0 samples/volume-mount/ts/.aspire/settings.json | 3 ++ .../{VolumeMount.AppHost => ts}/apphost.ts | 0 136 files changed, 117 insertions(+), 79 deletions(-) rename samples/Metrics/{ => cs}/.aspire/settings.json (100%) rename samples/Metrics/{ => cs}/MetricsApp.AppHost/AppHost.cs (75%) rename samples/Metrics/{ => cs}/MetricsApp.AppHost/MetricsApp.AppHost.csproj (83%) rename samples/Metrics/{ => cs}/MetricsApp.AppHost/OpenTelemetryCollector/OpenTelemetryCollectorResource.cs (100%) rename samples/Metrics/{ => cs}/MetricsApp.AppHost/OpenTelemetryCollector/OpenTelemetryCollectorResourceBuilderExtensions.cs (100%) rename samples/Metrics/{ => cs}/MetricsApp.AppHost/OpenTelemetryCollector/README.md (100%) rename samples/Metrics/{ => cs}/MetricsApp.AppHost/Properties/launchSettings.json (100%) rename samples/Metrics/{ => cs}/MetricsApp.AppHost/appsettings.json (100%) create mode 100644 samples/Metrics/ts/.aspire/settings.json rename samples/Metrics/{MetricsApp.AppHost => ts}/apphost.ts (100%) rename samples/aspire-shop/{ => cs}/.aspire/settings.json (100%) rename samples/aspire-shop/{ => cs}/AspireShop.AppHost/AppHost.cs (100%) rename samples/aspire-shop/{ => cs}/AspireShop.AppHost/AspireShop.AppHost.csproj (56%) rename samples/aspire-shop/{ => cs}/AspireShop.AppHost/Properties/launchSettings.json (100%) rename samples/aspire-shop/{ => cs}/AspireShop.AppHost/appsettings.Development.json (100%) rename samples/aspire-shop/{ => cs}/AspireShop.AppHost/appsettings.json (100%) create mode 100644 samples/aspire-shop/ts/.aspire/settings.json rename samples/aspire-shop/{AspireShop.AppHost => ts}/apphost.ts (100%) rename samples/aspire-with-azure-functions/{ => cs}/.aspire/settings.json (100%) rename samples/aspire-with-azure-functions/{ => cs}/ImageGallery.AppHost/AppHost.cs (100%) rename samples/aspire-with-azure-functions/{ => cs}/ImageGallery.AppHost/ImageGallery.AppHost.csproj (75%) rename samples/aspire-with-azure-functions/{ => cs}/ImageGallery.AppHost/Properties/launchSettings.json (100%) rename samples/aspire-with-azure-functions/{ => cs}/ImageGallery.AppHost/appsettings.Development.json (100%) rename samples/aspire-with-azure-functions/{ => cs}/ImageGallery.AppHost/appsettings.json (100%) create mode 100644 samples/aspire-with-azure-functions/ts/.aspire/settings.json rename samples/aspire-with-azure-functions/{ImageGallery.AppHost => ts}/apphost.ts (100%) rename samples/aspire-with-javascript/{ => cs}/.aspire/settings.json (100%) rename samples/aspire-with-javascript/{ => cs}/AspireJavaScript.AppHost/AppHost.cs (75%) rename samples/aspire-with-javascript/{ => cs}/AspireJavaScript.AppHost/AspireJavaScript.AppHost.csproj (80%) rename samples/aspire-with-javascript/{ => cs}/AspireJavaScript.AppHost/Properties/launchSettings.json (100%) rename samples/aspire-with-javascript/{ => cs}/AspireJavaScript.AppHost/appsettings.Development.json (100%) rename samples/aspire-with-javascript/{ => cs}/AspireJavaScript.AppHost/appsettings.json (100%) rename samples/aspire-with-javascript/{ => cs}/AspireJavaScript.AppHost/aspire-manifest.json (100%) create mode 100644 samples/aspire-with-javascript/ts/.aspire/settings.json rename samples/aspire-with-javascript/{AspireJavaScript.AppHost => ts}/apphost.ts (100%) rename samples/aspire-with-node/{ => cs}/.aspire/settings.json (100%) rename samples/aspire-with-node/{ => cs}/AspireWithNode.AppHost/AppHost.cs (89%) rename samples/aspire-with-node/{ => cs}/AspireWithNode.AppHost/AspireWithNode.AppHost.csproj (82%) rename samples/aspire-with-node/{ => cs}/AspireWithNode.AppHost/Properties/launchSettings.json (100%) rename samples/aspire-with-node/{ => cs}/AspireWithNode.AppHost/appsettings.Development.json (100%) rename samples/aspire-with-node/{ => cs}/AspireWithNode.AppHost/appsettings.json (100%) rename samples/aspire-with-node/{ => cs}/AspireWithNode.AppHost/aspire-manifest.json (100%) create mode 100644 samples/aspire-with-node/ts/.aspire/settings.json rename samples/aspire-with-node/{AspireWithNode.AppHost => ts}/apphost.ts (100%) delete mode 100644 samples/aspire-with-python/.aspire/settings.json create mode 100644 samples/aspire-with-python/cs/.aspire/settings.json rename samples/aspire-with-python/{ => cs}/apphost.cs (80%) rename samples/aspire-with-python/{ => cs}/apphost.run.json (100%) create mode 100644 samples/aspire-with-python/ts/.aspire/settings.json rename samples/aspire-with-python/{ => ts}/apphost.ts (83%) rename samples/client-apps-integration/{ => cs}/.aspire/settings.json (100%) rename samples/client-apps-integration/{ => cs}/ClientAppsIntegration.AppHost/AppHost.cs (100%) rename samples/client-apps-integration/{ => cs}/ClientAppsIntegration.AppHost/ClientAppsIntegration.AppHost.csproj (51%) rename samples/client-apps-integration/{ => cs}/ClientAppsIntegration.AppHost/Properties/launchSettings.json (100%) rename samples/client-apps-integration/{ => cs}/ClientAppsIntegration.AppHost/appsettings.Development.json (100%) rename samples/client-apps-integration/{ => cs}/ClientAppsIntegration.AppHost/appsettings.json (100%) create mode 100644 samples/client-apps-integration/ts/.aspire/settings.json rename samples/client-apps-integration/{ClientAppsIntegration.AppHost => ts}/apphost.ts (100%) delete mode 100644 samples/container-build/.aspire/settings.json create mode 100644 samples/container-build/cs/.aspire/settings.json rename samples/container-build/{ => cs}/apphost.cs (86%) rename samples/container-build/{ => cs}/apphost.run.json (100%) rename samples/container-build/{ => cs}/apphost.settings.Development.json (100%) rename samples/container-build/{ => cs}/apphost.settings.json (100%) create mode 100644 samples/container-build/ts/.aspire/settings.json rename samples/container-build/{ => ts}/apphost.ts (84%) rename samples/custom-resources/{ => cs}/.aspire/settings.json (100%) rename samples/custom-resources/{ => cs}/CustomResources.AppHost/AppHost.cs (100%) rename samples/custom-resources/{ => cs}/CustomResources.AppHost/CustomResources.AppHost.csproj (100%) rename samples/custom-resources/{ => cs}/CustomResources.AppHost/Properties/launchSettings.json (100%) rename samples/custom-resources/{ => cs}/CustomResources.AppHost/TalkingClockResource.cs (100%) rename samples/custom-resources/{ => cs}/CustomResources.AppHost/TestResource.cs (100%) rename samples/custom-resources/{ => cs}/CustomResources.AppHost/appsettings.Development.json (100%) rename samples/custom-resources/{ => cs}/CustomResources.AppHost/appsettings.json (100%) create mode 100644 samples/custom-resources/ts/.aspire/settings.json rename samples/custom-resources/{CustomResources.AppHost => ts}/apphost.ts (100%) rename samples/database-containers/{ => cs}/.aspire/settings.json (100%) rename samples/database-containers/{ => cs}/DatabaseContainers.AppHost/AppHost.cs (93%) rename samples/database-containers/{ => cs}/DatabaseContainers.AppHost/DatabaseContainers.AppHost.csproj (72%) rename samples/database-containers/{ => cs}/DatabaseContainers.AppHost/Properties/launchSettings.json (100%) rename samples/database-containers/{ => cs}/DatabaseContainers.AppHost/appsettings.Development.json (100%) rename samples/database-containers/{ => cs}/DatabaseContainers.AppHost/appsettings.json (100%) create mode 100644 samples/database-containers/ts/.aspire/settings.json rename samples/database-containers/{DatabaseContainers.AppHost => ts}/apphost.ts (100%) rename samples/database-migrations/{ => cs}/.aspire/settings.json (97%) rename samples/database-migrations/{ => cs}/DatabaseMigrations.AppHost/AppHost.cs (100%) rename samples/database-migrations/{ => cs}/DatabaseMigrations.AppHost/DatabaseMigrations.AppHost.csproj (66%) rename samples/database-migrations/{ => cs}/DatabaseMigrations.AppHost/Properties/launchSettings.json (100%) rename samples/database-migrations/{ => cs}/DatabaseMigrations.AppHost/appsettings.Development.json (100%) rename samples/database-migrations/{ => cs}/DatabaseMigrations.AppHost/appsettings.json (100%) create mode 100644 samples/database-migrations/ts/.aspire/settings.json rename samples/database-migrations/{DatabaseMigrations.AppHost => ts}/apphost.ts (100%) rename samples/health-checks-ui/{ => cs}/.aspire/settings.json (100%) rename samples/health-checks-ui/{ => cs}/HealthChecksUI.AppHost/AppHost.cs (100%) rename samples/health-checks-ui/{ => cs}/HealthChecksUI.AppHost/HealthChecksUI.AppHost.csproj (74%) rename samples/health-checks-ui/{ => cs}/HealthChecksUI.AppHost/HealthChecksUIExtensions.cs (100%) rename samples/health-checks-ui/{ => cs}/HealthChecksUI.AppHost/HealthChecksUIResource.cs (100%) rename samples/health-checks-ui/{ => cs}/HealthChecksUI.AppHost/Properties/launchSettings.json (100%) rename samples/health-checks-ui/{ => cs}/HealthChecksUI.AppHost/appsettings.Development.json (100%) rename samples/health-checks-ui/{ => cs}/HealthChecksUI.AppHost/appsettings.json (100%) rename samples/health-checks-ui/{ => cs}/HealthChecksUI.AppHost/aspire-manifest.json (100%) create mode 100644 samples/health-checks-ui/ts/.aspire/settings.json rename samples/health-checks-ui/{HealthChecksUI.AppHost => ts}/apphost.ts (100%) rename samples/orleans-voting/{ => cs}/.aspire/settings.json (100%) rename samples/orleans-voting/{ => cs}/OrleansVoting.AppHost/AppHost.cs (100%) rename samples/orleans-voting/{ => cs}/OrleansVoting.AppHost/OrleansVoting.AppHost.csproj (85%) rename samples/orleans-voting/{ => cs}/OrleansVoting.AppHost/Properties/launchSettings.json (100%) rename samples/orleans-voting/{ => cs}/OrleansVoting.AppHost/appsettings.Development.json (100%) rename samples/orleans-voting/{ => cs}/OrleansVoting.AppHost/appsettings.json (100%) create mode 100644 samples/orleans-voting/ts/.aspire/settings.json rename samples/orleans-voting/{OrleansVoting.AppHost => ts}/apphost.ts (100%) rename samples/standalone-dashboard/{ => cs}/ConsoleApp.cs (100%) rename samples/standalone-dashboard/{ => cs}/ConsoleApp.run.json (100%) rename samples/standalone-dashboard/{ => cs}/ConsoleApp.settings.Development.json (100%) rename samples/standalone-dashboard/{ => cs}/ConsoleApp.settings.json (100%) rename samples/volume-mount/{ => cs}/.aspire/settings.json (100%) rename samples/volume-mount/{ => cs}/VolumeMount.AppHost/AppHost.cs (100%) rename samples/volume-mount/{ => cs}/VolumeMount.AppHost/Properties/launchSettings.json (100%) rename samples/volume-mount/{ => cs}/VolumeMount.AppHost/VolumeMount.AppHost.csproj (86%) rename samples/volume-mount/{ => cs}/VolumeMount.AppHost/appsettings.Development.json (100%) rename samples/volume-mount/{ => cs}/VolumeMount.AppHost/appsettings.json (100%) create mode 100644 samples/volume-mount/ts/.aspire/settings.json rename samples/volume-mount/{VolumeMount.AppHost => ts}/apphost.ts (100%) diff --git a/samples/Metrics/Metrics.slnx b/samples/Metrics/Metrics.slnx index 61aa4710..95abffb5 100644 --- a/samples/Metrics/Metrics.slnx +++ b/samples/Metrics/Metrics.slnx @@ -2,7 +2,7 @@ - + diff --git a/samples/Metrics/.aspire/settings.json b/samples/Metrics/cs/.aspire/settings.json similarity index 100% rename from samples/Metrics/.aspire/settings.json rename to samples/Metrics/cs/.aspire/settings.json diff --git a/samples/Metrics/MetricsApp.AppHost/AppHost.cs b/samples/Metrics/cs/MetricsApp.AppHost/AppHost.cs similarity index 75% rename from samples/Metrics/MetricsApp.AppHost/AppHost.cs rename to samples/Metrics/cs/MetricsApp.AppHost/AppHost.cs index 11e52727..bd2b42eb 100644 --- a/samples/Metrics/MetricsApp.AppHost/AppHost.cs +++ b/samples/Metrics/cs/MetricsApp.AppHost/AppHost.cs @@ -3,19 +3,19 @@ var builder = DistributedApplication.CreateBuilder(args); var prometheus = builder.AddContainer("prometheus", "prom/prometheus", "v3.2.1") - .WithBindMount("../prometheus", "/etc/prometheus", isReadOnly: true) + .WithBindMount("../../prometheus", "/etc/prometheus", isReadOnly: true) .WithArgs("--web.enable-otlp-receiver", "--config.file=/etc/prometheus/prometheus.yml") .WithHttpEndpoint(targetPort: 9090) .WithUrlForEndpoint("http", u => u.DisplayText = "Prometheus Dashboard"); var grafana = builder.AddContainer("grafana", "grafana/grafana") - .WithBindMount("../grafana/config", "/etc/grafana", isReadOnly: true) - .WithBindMount("../grafana/dashboards", "/var/lib/grafana/dashboards", isReadOnly: true) + .WithBindMount("../../grafana/config", "/etc/grafana", isReadOnly: true) + .WithBindMount("../../grafana/dashboards", "/var/lib/grafana/dashboards", isReadOnly: true) .WithEnvironment("PROMETHEUS_ENDPOINT", prometheus.GetEndpoint("http")) .WithHttpEndpoint(targetPort: 3000) .WithUrlForEndpoint("http", u => u.DisplayText = "Grafana Dashboard"); -builder.AddOpenTelemetryCollector("otelcollector", "../otelcollector/config.yaml") +builder.AddOpenTelemetryCollector("otelcollector", "../../otelcollector/config.yaml") .WithEnvironment("PROMETHEUS_ENDPOINT", $"{prometheus.GetEndpoint("http")}/api/v1/otlp"); builder.AddProject("app") diff --git a/samples/Metrics/MetricsApp.AppHost/MetricsApp.AppHost.csproj b/samples/Metrics/cs/MetricsApp.AppHost/MetricsApp.AppHost.csproj similarity index 83% rename from samples/Metrics/MetricsApp.AppHost/MetricsApp.AppHost.csproj rename to samples/Metrics/cs/MetricsApp.AppHost/MetricsApp.AppHost.csproj index e44750e0..f15cf2e4 100644 --- a/samples/Metrics/MetricsApp.AppHost/MetricsApp.AppHost.csproj +++ b/samples/Metrics/cs/MetricsApp.AppHost/MetricsApp.AppHost.csproj @@ -9,7 +9,7 @@ - + diff --git a/samples/Metrics/MetricsApp.AppHost/OpenTelemetryCollector/OpenTelemetryCollectorResource.cs b/samples/Metrics/cs/MetricsApp.AppHost/OpenTelemetryCollector/OpenTelemetryCollectorResource.cs similarity index 100% rename from samples/Metrics/MetricsApp.AppHost/OpenTelemetryCollector/OpenTelemetryCollectorResource.cs rename to samples/Metrics/cs/MetricsApp.AppHost/OpenTelemetryCollector/OpenTelemetryCollectorResource.cs diff --git a/samples/Metrics/MetricsApp.AppHost/OpenTelemetryCollector/OpenTelemetryCollectorResourceBuilderExtensions.cs b/samples/Metrics/cs/MetricsApp.AppHost/OpenTelemetryCollector/OpenTelemetryCollectorResourceBuilderExtensions.cs similarity index 100% rename from samples/Metrics/MetricsApp.AppHost/OpenTelemetryCollector/OpenTelemetryCollectorResourceBuilderExtensions.cs rename to samples/Metrics/cs/MetricsApp.AppHost/OpenTelemetryCollector/OpenTelemetryCollectorResourceBuilderExtensions.cs diff --git a/samples/Metrics/MetricsApp.AppHost/OpenTelemetryCollector/README.md b/samples/Metrics/cs/MetricsApp.AppHost/OpenTelemetryCollector/README.md similarity index 100% rename from samples/Metrics/MetricsApp.AppHost/OpenTelemetryCollector/README.md rename to samples/Metrics/cs/MetricsApp.AppHost/OpenTelemetryCollector/README.md diff --git a/samples/Metrics/MetricsApp.AppHost/Properties/launchSettings.json b/samples/Metrics/cs/MetricsApp.AppHost/Properties/launchSettings.json similarity index 100% rename from samples/Metrics/MetricsApp.AppHost/Properties/launchSettings.json rename to samples/Metrics/cs/MetricsApp.AppHost/Properties/launchSettings.json diff --git a/samples/Metrics/MetricsApp.AppHost/appsettings.json b/samples/Metrics/cs/MetricsApp.AppHost/appsettings.json similarity index 100% rename from samples/Metrics/MetricsApp.AppHost/appsettings.json rename to samples/Metrics/cs/MetricsApp.AppHost/appsettings.json diff --git a/samples/Metrics/ts/.aspire/settings.json b/samples/Metrics/ts/.aspire/settings.json new file mode 100644 index 00000000..a60c25b1 --- /dev/null +++ b/samples/Metrics/ts/.aspire/settings.json @@ -0,0 +1,3 @@ +{ + "appHostPath": "../apphost.ts" +} \ No newline at end of file diff --git a/samples/Metrics/MetricsApp.AppHost/apphost.ts b/samples/Metrics/ts/apphost.ts similarity index 100% rename from samples/Metrics/MetricsApp.AppHost/apphost.ts rename to samples/Metrics/ts/apphost.ts diff --git a/samples/POLYGLOT_NOTES.md b/samples/POLYGLOT_NOTES.md index 4135b038..18877856 100644 --- a/samples/POLYGLOT_NOTES.md +++ b/samples/POLYGLOT_NOTES.md @@ -12,8 +12,12 @@ using the Aspire TypeScript SDK, and documents expected gaps based on the ## Overview -Each sample directory now contains an `apphost.ts` file alongside the existing `AppHost.cs`. The -TypeScript versions use the Aspire polyglot apphost SDK (`createBuilder()` from `.modules/aspire.js`) +Each sample directory now contains a `cs/` and `ts/` subdirectory to isolate the C# and TypeScript +AppHosts respectively. The `cs/` folder contains the C# AppHost (either a `.csproj` project or +file-based `apphost.cs`), while `ts/` contains the TypeScript `apphost.ts`. Shared service projects +remain at the sample root. + +The TypeScript versions use the Aspire polyglot apphost SDK (`createBuilder()` from `.modules/aspire.js`) which communicates with a .NET AppHost Server via JSON-RPC. ### Prerequisites @@ -65,7 +69,7 @@ To confirm which APIs are actually available after `aspire add`, inspect the gen Compare against the `apphost.ts` to identify any remaining gaps. ```bash -cd samples// +cd samples//ts # After aspire add and aspire run, check: cat .modules/aspire.ts | grep -E "add(Redis|Postgres|MySql|SqlServer|Orleans|Container)" ``` @@ -86,7 +90,7 @@ cat .modules/aspire.ts | grep -E "add(Redis|Postgres|MySql|SqlServer|Orleans|Con Each sample requires specific `aspire add` commands to install its integration packages. Run these commands from the sample directory before using `aspire run`. -### 1. Metrics (`samples/Metrics/MetricsApp.AppHost/apphost.ts`) +### 1. Metrics (`samples/Metrics/ts/apphost.ts`) **Setup:** No additional packages required (uses core container and project APIs). @@ -97,7 +101,7 @@ commands from the sample directory before using `aspire run`. --- -### 2. aspire-shop (`samples/aspire-shop/AspireShop.AppHost/apphost.ts`) +### 2. aspire-shop (`samples/aspire-shop/ts/apphost.ts`) **Setup:** ```bash @@ -112,7 +116,7 @@ aspire add redis --- -### 3. aspire-with-javascript (`samples/aspire-with-javascript/AspireJavaScript.AppHost/apphost.ts`) +### 3. aspire-with-javascript (`samples/aspire-with-javascript/ts/apphost.ts`) **Setup:** ```bash @@ -126,7 +130,7 @@ aspire add javascript --- -### 4. aspire-with-node (`samples/aspire-with-node/AspireWithNode.AppHost/apphost.ts`) +### 4. aspire-with-node (`samples/aspire-with-node/ts/apphost.ts`) **Setup:** ```bash @@ -139,7 +143,7 @@ aspire add redis --- -### 5. aspire-with-python (`samples/aspire-with-python/apphost.ts`) +### 5. aspire-with-python (`samples/aspire-with-python/ts/apphost.ts`) **Setup:** ```bash @@ -154,7 +158,7 @@ aspire add redis --- -### 6. client-apps-integration (`samples/client-apps-integration/ClientAppsIntegration.AppHost/apphost.ts`) +### 6. client-apps-integration (`samples/client-apps-integration/ts/apphost.ts`) **Setup:** No additional packages required. @@ -165,7 +169,7 @@ aspire add redis --- -### 7. container-build (`samples/container-build/apphost.ts`) +### 7. container-build (`samples/container-build/ts/apphost.ts`) **Setup:** No additional packages required (uses core Dockerfile and parameter APIs). @@ -175,7 +179,7 @@ aspire add redis --- -### 8. custom-resources (`samples/custom-resources/CustomResources.AppHost/apphost.ts`) +### 8. custom-resources (`samples/custom-resources/ts/apphost.ts`) **Setup:** N/A — This sample uses custom C# resource extensions (`AddTalkingClock`, `AddTestResource`). @@ -185,7 +189,7 @@ aspire add redis --- -### 9. database-containers (`samples/database-containers/DatabaseContainers.AppHost/apphost.ts`) +### 9. database-containers (`samples/database-containers/ts/apphost.ts`) **Setup:** ```bash @@ -200,7 +204,7 @@ aspire add sqlserver --- -### 10. database-migrations (`samples/database-migrations/DatabaseMigrations.AppHost/apphost.ts`) +### 10. database-migrations (`samples/database-migrations/ts/apphost.ts`) **Setup:** ```bash @@ -213,7 +217,7 @@ aspire add sqlserver --- -### 11. health-checks-ui (`samples/health-checks-ui/HealthChecksUI.AppHost/apphost.ts`) +### 11. health-checks-ui (`samples/health-checks-ui/ts/apphost.ts`) **Setup:** ```bash @@ -227,7 +231,7 @@ aspire add docker --- -### 12. orleans-voting (`samples/orleans-voting/OrleansVoting.AppHost/apphost.ts`) +### 12. orleans-voting (`samples/orleans-voting/ts/apphost.ts`) **Setup:** ```bash @@ -241,7 +245,7 @@ aspire add orleans --- -### 13. volume-mount (`samples/volume-mount/VolumeMount.AppHost/apphost.ts`) +### 13. volume-mount (`samples/volume-mount/ts/apphost.ts`) **Setup:** ```bash @@ -254,7 +258,7 @@ aspire add azure-storage --- -### 14. aspire-with-azure-functions (`samples/aspire-with-azure-functions/ImageGallery.AppHost/apphost.ts`) +### 14. aspire-with-azure-functions (`samples/aspire-with-azure-functions/ts/apphost.ts`) **Setup:** ```bash @@ -355,8 +359,8 @@ iex "& { $(irm https://aspire.dev/install.ps1) } -Quality staging" # Ensure Docker (or Podman) is running — Aspire handles all container orchestration -# Navigate to sample directory -cd samples/ +# Navigate to sample's ts directory +cd samples//ts # Add required integration packages (see per-sample setup above) aspire add redis diff --git a/samples/aspire-shop/AspireShop.slnx b/samples/aspire-shop/AspireShop.slnx index ea25f59c..d37ad19d 100644 --- a/samples/aspire-shop/AspireShop.slnx +++ b/samples/aspire-shop/AspireShop.slnx @@ -3,7 +3,7 @@ - + diff --git a/samples/aspire-shop/.aspire/settings.json b/samples/aspire-shop/cs/.aspire/settings.json similarity index 100% rename from samples/aspire-shop/.aspire/settings.json rename to samples/aspire-shop/cs/.aspire/settings.json diff --git a/samples/aspire-shop/AspireShop.AppHost/AppHost.cs b/samples/aspire-shop/cs/AspireShop.AppHost/AppHost.cs similarity index 100% rename from samples/aspire-shop/AspireShop.AppHost/AppHost.cs rename to samples/aspire-shop/cs/AspireShop.AppHost/AppHost.cs diff --git a/samples/aspire-shop/AspireShop.AppHost/AspireShop.AppHost.csproj b/samples/aspire-shop/cs/AspireShop.AppHost/AspireShop.AppHost.csproj similarity index 56% rename from samples/aspire-shop/AspireShop.AppHost/AspireShop.AppHost.csproj rename to samples/aspire-shop/cs/AspireShop.AppHost/AspireShop.AppHost.csproj index 1d722cc7..5d130fa5 100644 --- a/samples/aspire-shop/AspireShop.AppHost/AspireShop.AppHost.csproj +++ b/samples/aspire-shop/cs/AspireShop.AppHost/AspireShop.AppHost.csproj @@ -11,10 +11,10 @@ - - - - + + + + diff --git a/samples/aspire-shop/AspireShop.AppHost/Properties/launchSettings.json b/samples/aspire-shop/cs/AspireShop.AppHost/Properties/launchSettings.json similarity index 100% rename from samples/aspire-shop/AspireShop.AppHost/Properties/launchSettings.json rename to samples/aspire-shop/cs/AspireShop.AppHost/Properties/launchSettings.json diff --git a/samples/aspire-shop/AspireShop.AppHost/appsettings.Development.json b/samples/aspire-shop/cs/AspireShop.AppHost/appsettings.Development.json similarity index 100% rename from samples/aspire-shop/AspireShop.AppHost/appsettings.Development.json rename to samples/aspire-shop/cs/AspireShop.AppHost/appsettings.Development.json diff --git a/samples/aspire-shop/AspireShop.AppHost/appsettings.json b/samples/aspire-shop/cs/AspireShop.AppHost/appsettings.json similarity index 100% rename from samples/aspire-shop/AspireShop.AppHost/appsettings.json rename to samples/aspire-shop/cs/AspireShop.AppHost/appsettings.json diff --git a/samples/aspire-shop/ts/.aspire/settings.json b/samples/aspire-shop/ts/.aspire/settings.json new file mode 100644 index 00000000..a60c25b1 --- /dev/null +++ b/samples/aspire-shop/ts/.aspire/settings.json @@ -0,0 +1,3 @@ +{ + "appHostPath": "../apphost.ts" +} \ No newline at end of file diff --git a/samples/aspire-shop/AspireShop.AppHost/apphost.ts b/samples/aspire-shop/ts/apphost.ts similarity index 100% rename from samples/aspire-shop/AspireShop.AppHost/apphost.ts rename to samples/aspire-shop/ts/apphost.ts diff --git a/samples/aspire-with-azure-functions/ImageGallery.slnx b/samples/aspire-with-azure-functions/ImageGallery.slnx index d07bde66..f172d264 100644 --- a/samples/aspire-with-azure-functions/ImageGallery.slnx +++ b/samples/aspire-with-azure-functions/ImageGallery.slnx @@ -2,7 +2,7 @@ - + diff --git a/samples/aspire-with-azure-functions/.aspire/settings.json b/samples/aspire-with-azure-functions/cs/.aspire/settings.json similarity index 100% rename from samples/aspire-with-azure-functions/.aspire/settings.json rename to samples/aspire-with-azure-functions/cs/.aspire/settings.json diff --git a/samples/aspire-with-azure-functions/ImageGallery.AppHost/AppHost.cs b/samples/aspire-with-azure-functions/cs/ImageGallery.AppHost/AppHost.cs similarity index 100% rename from samples/aspire-with-azure-functions/ImageGallery.AppHost/AppHost.cs rename to samples/aspire-with-azure-functions/cs/ImageGallery.AppHost/AppHost.cs diff --git a/samples/aspire-with-azure-functions/ImageGallery.AppHost/ImageGallery.AppHost.csproj b/samples/aspire-with-azure-functions/cs/ImageGallery.AppHost/ImageGallery.AppHost.csproj similarity index 75% rename from samples/aspire-with-azure-functions/ImageGallery.AppHost/ImageGallery.AppHost.csproj rename to samples/aspire-with-azure-functions/cs/ImageGallery.AppHost/ImageGallery.AppHost.csproj index e25bac04..9d08a512 100644 --- a/samples/aspire-with-azure-functions/ImageGallery.AppHost/ImageGallery.AppHost.csproj +++ b/samples/aspire-with-azure-functions/cs/ImageGallery.AppHost/ImageGallery.AppHost.csproj @@ -15,8 +15,8 @@ - - + + diff --git a/samples/aspire-with-azure-functions/ImageGallery.AppHost/Properties/launchSettings.json b/samples/aspire-with-azure-functions/cs/ImageGallery.AppHost/Properties/launchSettings.json similarity index 100% rename from samples/aspire-with-azure-functions/ImageGallery.AppHost/Properties/launchSettings.json rename to samples/aspire-with-azure-functions/cs/ImageGallery.AppHost/Properties/launchSettings.json diff --git a/samples/aspire-with-azure-functions/ImageGallery.AppHost/appsettings.Development.json b/samples/aspire-with-azure-functions/cs/ImageGallery.AppHost/appsettings.Development.json similarity index 100% rename from samples/aspire-with-azure-functions/ImageGallery.AppHost/appsettings.Development.json rename to samples/aspire-with-azure-functions/cs/ImageGallery.AppHost/appsettings.Development.json diff --git a/samples/aspire-with-azure-functions/ImageGallery.AppHost/appsettings.json b/samples/aspire-with-azure-functions/cs/ImageGallery.AppHost/appsettings.json similarity index 100% rename from samples/aspire-with-azure-functions/ImageGallery.AppHost/appsettings.json rename to samples/aspire-with-azure-functions/cs/ImageGallery.AppHost/appsettings.json diff --git a/samples/aspire-with-azure-functions/ts/.aspire/settings.json b/samples/aspire-with-azure-functions/ts/.aspire/settings.json new file mode 100644 index 00000000..a60c25b1 --- /dev/null +++ b/samples/aspire-with-azure-functions/ts/.aspire/settings.json @@ -0,0 +1,3 @@ +{ + "appHostPath": "../apphost.ts" +} \ No newline at end of file diff --git a/samples/aspire-with-azure-functions/ImageGallery.AppHost/apphost.ts b/samples/aspire-with-azure-functions/ts/apphost.ts similarity index 100% rename from samples/aspire-with-azure-functions/ImageGallery.AppHost/apphost.ts rename to samples/aspire-with-azure-functions/ts/apphost.ts diff --git a/samples/aspire-with-javascript/AspireJavaScript.slnx b/samples/aspire-with-javascript/AspireJavaScript.slnx index 2eee7817..da64311f 100644 --- a/samples/aspire-with-javascript/AspireJavaScript.slnx +++ b/samples/aspire-with-javascript/AspireJavaScript.slnx @@ -2,7 +2,7 @@ - + diff --git a/samples/aspire-with-javascript/.aspire/settings.json b/samples/aspire-with-javascript/cs/.aspire/settings.json similarity index 100% rename from samples/aspire-with-javascript/.aspire/settings.json rename to samples/aspire-with-javascript/cs/.aspire/settings.json diff --git a/samples/aspire-with-javascript/AspireJavaScript.AppHost/AppHost.cs b/samples/aspire-with-javascript/cs/AspireJavaScript.AppHost/AppHost.cs similarity index 75% rename from samples/aspire-with-javascript/AspireJavaScript.AppHost/AppHost.cs rename to samples/aspire-with-javascript/cs/AspireJavaScript.AppHost/AppHost.cs index e2f96f13..bfedb8c3 100644 --- a/samples/aspire-with-javascript/AspireJavaScript.AppHost/AppHost.cs +++ b/samples/aspire-with-javascript/cs/AspireJavaScript.AppHost/AppHost.cs @@ -3,14 +3,14 @@ var weatherApi = builder.AddProject("weatherapi") .WithExternalHttpEndpoints(); -builder.AddJavaScriptApp("angular", "../AspireJavaScript.Angular", runScriptName: "start") +builder.AddJavaScriptApp("angular", "../../AspireJavaScript.Angular", runScriptName: "start") .WithReference(weatherApi) .WaitFor(weatherApi) .WithHttpEndpoint(env: "PORT") .WithExternalHttpEndpoints() .PublishAsDockerFile(); -builder.AddJavaScriptApp("react", "../AspireJavaScript.React", runScriptName: "start") +builder.AddJavaScriptApp("react", "../../AspireJavaScript.React", runScriptName: "start") .WithReference(weatherApi) .WaitFor(weatherApi) .WithEnvironment("BROWSER", "none") // Disable opening browser on npm start @@ -18,7 +18,7 @@ .WithExternalHttpEndpoints() .PublishAsDockerFile(); -builder.AddJavaScriptApp("vue", "../AspireJavaScript.Vue") +builder.AddJavaScriptApp("vue", "../../AspireJavaScript.Vue") .WithRunScript("start") .WithNpm(installCommand: "ci") .WithReference(weatherApi) @@ -27,7 +27,7 @@ .WithExternalHttpEndpoints() .PublishAsDockerFile(); -var reactVite = builder.AddViteApp("reactvite", "../AspireJavaScript.Vite") +var reactVite = builder.AddViteApp("reactvite", "../../AspireJavaScript.Vite") .WithReference(weatherApi) .WithEnvironment("BROWSER", "none"); diff --git a/samples/aspire-with-javascript/AspireJavaScript.AppHost/AspireJavaScript.AppHost.csproj b/samples/aspire-with-javascript/cs/AspireJavaScript.AppHost/AspireJavaScript.AppHost.csproj similarity index 80% rename from samples/aspire-with-javascript/AspireJavaScript.AppHost/AspireJavaScript.AppHost.csproj rename to samples/aspire-with-javascript/cs/AspireJavaScript.AppHost/AspireJavaScript.AppHost.csproj index 957d4556..9d462327 100644 --- a/samples/aspire-with-javascript/AspireJavaScript.AppHost/AspireJavaScript.AppHost.csproj +++ b/samples/aspire-with-javascript/cs/AspireJavaScript.AppHost/AspireJavaScript.AppHost.csproj @@ -9,7 +9,7 @@ - + diff --git a/samples/aspire-with-javascript/AspireJavaScript.AppHost/Properties/launchSettings.json b/samples/aspire-with-javascript/cs/AspireJavaScript.AppHost/Properties/launchSettings.json similarity index 100% rename from samples/aspire-with-javascript/AspireJavaScript.AppHost/Properties/launchSettings.json rename to samples/aspire-with-javascript/cs/AspireJavaScript.AppHost/Properties/launchSettings.json diff --git a/samples/aspire-with-javascript/AspireJavaScript.AppHost/appsettings.Development.json b/samples/aspire-with-javascript/cs/AspireJavaScript.AppHost/appsettings.Development.json similarity index 100% rename from samples/aspire-with-javascript/AspireJavaScript.AppHost/appsettings.Development.json rename to samples/aspire-with-javascript/cs/AspireJavaScript.AppHost/appsettings.Development.json diff --git a/samples/aspire-with-javascript/AspireJavaScript.AppHost/appsettings.json b/samples/aspire-with-javascript/cs/AspireJavaScript.AppHost/appsettings.json similarity index 100% rename from samples/aspire-with-javascript/AspireJavaScript.AppHost/appsettings.json rename to samples/aspire-with-javascript/cs/AspireJavaScript.AppHost/appsettings.json diff --git a/samples/aspire-with-javascript/AspireJavaScript.AppHost/aspire-manifest.json b/samples/aspire-with-javascript/cs/AspireJavaScript.AppHost/aspire-manifest.json similarity index 100% rename from samples/aspire-with-javascript/AspireJavaScript.AppHost/aspire-manifest.json rename to samples/aspire-with-javascript/cs/AspireJavaScript.AppHost/aspire-manifest.json diff --git a/samples/aspire-with-javascript/ts/.aspire/settings.json b/samples/aspire-with-javascript/ts/.aspire/settings.json new file mode 100644 index 00000000..a60c25b1 --- /dev/null +++ b/samples/aspire-with-javascript/ts/.aspire/settings.json @@ -0,0 +1,3 @@ +{ + "appHostPath": "../apphost.ts" +} \ No newline at end of file diff --git a/samples/aspire-with-javascript/AspireJavaScript.AppHost/apphost.ts b/samples/aspire-with-javascript/ts/apphost.ts similarity index 100% rename from samples/aspire-with-javascript/AspireJavaScript.AppHost/apphost.ts rename to samples/aspire-with-javascript/ts/apphost.ts diff --git a/samples/aspire-with-node/AspireWithNode.slnx b/samples/aspire-with-node/AspireWithNode.slnx index e6c36a88..40939cca 100644 --- a/samples/aspire-with-node/AspireWithNode.slnx +++ b/samples/aspire-with-node/AspireWithNode.slnx @@ -1,5 +1,5 @@ - + diff --git a/samples/aspire-with-node/.aspire/settings.json b/samples/aspire-with-node/cs/.aspire/settings.json similarity index 100% rename from samples/aspire-with-node/.aspire/settings.json rename to samples/aspire-with-node/cs/.aspire/settings.json diff --git a/samples/aspire-with-node/AspireWithNode.AppHost/AppHost.cs b/samples/aspire-with-node/cs/AspireWithNode.AppHost/AppHost.cs similarity index 89% rename from samples/aspire-with-node/AspireWithNode.AppHost/AppHost.cs rename to samples/aspire-with-node/cs/AspireWithNode.AppHost/AppHost.cs index 109fdd6f..863b8c20 100644 --- a/samples/aspire-with-node/AspireWithNode.AppHost/AppHost.cs +++ b/samples/aspire-with-node/cs/AspireWithNode.AppHost/AppHost.cs @@ -6,7 +6,7 @@ var weatherapi = builder.AddProject("weatherapi") .WithHttpHealthCheck("/health"); -builder.AddNodeApp("frontend", "../NodeFrontend", "./app.js") +builder.AddNodeApp("frontend", "../../NodeFrontend", "./app.js") .WithNpm() .WithRunScript("dev") .WithHttpEndpoint(port: 5223, env: "PORT") diff --git a/samples/aspire-with-node/AspireWithNode.AppHost/AspireWithNode.AppHost.csproj b/samples/aspire-with-node/cs/AspireWithNode.AppHost/AspireWithNode.AppHost.csproj similarity index 82% rename from samples/aspire-with-node/AspireWithNode.AppHost/AspireWithNode.AppHost.csproj rename to samples/aspire-with-node/cs/AspireWithNode.AppHost/AspireWithNode.AppHost.csproj index 0a57b102..36e86d82 100644 --- a/samples/aspire-with-node/AspireWithNode.AppHost/AspireWithNode.AppHost.csproj +++ b/samples/aspire-with-node/cs/AspireWithNode.AppHost/AspireWithNode.AppHost.csproj @@ -9,7 +9,7 @@ - + diff --git a/samples/aspire-with-node/AspireWithNode.AppHost/Properties/launchSettings.json b/samples/aspire-with-node/cs/AspireWithNode.AppHost/Properties/launchSettings.json similarity index 100% rename from samples/aspire-with-node/AspireWithNode.AppHost/Properties/launchSettings.json rename to samples/aspire-with-node/cs/AspireWithNode.AppHost/Properties/launchSettings.json diff --git a/samples/aspire-with-node/AspireWithNode.AppHost/appsettings.Development.json b/samples/aspire-with-node/cs/AspireWithNode.AppHost/appsettings.Development.json similarity index 100% rename from samples/aspire-with-node/AspireWithNode.AppHost/appsettings.Development.json rename to samples/aspire-with-node/cs/AspireWithNode.AppHost/appsettings.Development.json diff --git a/samples/aspire-with-node/AspireWithNode.AppHost/appsettings.json b/samples/aspire-with-node/cs/AspireWithNode.AppHost/appsettings.json similarity index 100% rename from samples/aspire-with-node/AspireWithNode.AppHost/appsettings.json rename to samples/aspire-with-node/cs/AspireWithNode.AppHost/appsettings.json diff --git a/samples/aspire-with-node/AspireWithNode.AppHost/aspire-manifest.json b/samples/aspire-with-node/cs/AspireWithNode.AppHost/aspire-manifest.json similarity index 100% rename from samples/aspire-with-node/AspireWithNode.AppHost/aspire-manifest.json rename to samples/aspire-with-node/cs/AspireWithNode.AppHost/aspire-manifest.json diff --git a/samples/aspire-with-node/ts/.aspire/settings.json b/samples/aspire-with-node/ts/.aspire/settings.json new file mode 100644 index 00000000..a60c25b1 --- /dev/null +++ b/samples/aspire-with-node/ts/.aspire/settings.json @@ -0,0 +1,3 @@ +{ + "appHostPath": "../apphost.ts" +} \ No newline at end of file diff --git a/samples/aspire-with-node/AspireWithNode.AppHost/apphost.ts b/samples/aspire-with-node/ts/apphost.ts similarity index 100% rename from samples/aspire-with-node/AspireWithNode.AppHost/apphost.ts rename to samples/aspire-with-node/ts/apphost.ts diff --git a/samples/aspire-with-python/.aspire/settings.json b/samples/aspire-with-python/.aspire/settings.json deleted file mode 100644 index 7812a6fe..00000000 --- a/samples/aspire-with-python/.aspire/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "appHostPath": "../apphost.cs" -} \ No newline at end of file diff --git a/samples/aspire-with-python/cs/.aspire/settings.json b/samples/aspire-with-python/cs/.aspire/settings.json new file mode 100644 index 00000000..d8fee785 --- /dev/null +++ b/samples/aspire-with-python/cs/.aspire/settings.json @@ -0,0 +1 @@ +{"appHostPath":"../apphost.cs"} \ No newline at end of file diff --git a/samples/aspire-with-python/apphost.cs b/samples/aspire-with-python/cs/apphost.cs similarity index 80% rename from samples/aspire-with-python/apphost.cs rename to samples/aspire-with-python/cs/apphost.cs index f7726845..8ee1bbd9 100644 --- a/samples/aspire-with-python/apphost.cs +++ b/samples/aspire-with-python/cs/apphost.cs @@ -7,14 +7,14 @@ var cache = builder.AddRedis("cache"); -var app = builder.AddUvicornApp("app", "./app", "main:app") +var app = builder.AddUvicornApp("app", "../app", "main:app") .WithUv() .WithExternalHttpEndpoints() .WithReference(cache) .WaitFor(cache) .WithHttpHealthCheck("/health"); -var frontend = builder.AddViteApp("frontend", "./frontend") +var frontend = builder.AddViteApp("frontend", "../frontend") .WithReference(app) .WaitFor(app); diff --git a/samples/aspire-with-python/apphost.run.json b/samples/aspire-with-python/cs/apphost.run.json similarity index 100% rename from samples/aspire-with-python/apphost.run.json rename to samples/aspire-with-python/cs/apphost.run.json diff --git a/samples/aspire-with-python/ts/.aspire/settings.json b/samples/aspire-with-python/ts/.aspire/settings.json new file mode 100644 index 00000000..7d5a1905 --- /dev/null +++ b/samples/aspire-with-python/ts/.aspire/settings.json @@ -0,0 +1 @@ +{"appHostPath":"../apphost.ts"} \ No newline at end of file diff --git a/samples/aspire-with-python/apphost.ts b/samples/aspire-with-python/ts/apphost.ts similarity index 83% rename from samples/aspire-with-python/apphost.ts rename to samples/aspire-with-python/ts/apphost.ts index 039b0a5e..9b1b83d2 100644 --- a/samples/aspire-with-python/apphost.ts +++ b/samples/aspire-with-python/ts/apphost.ts @@ -9,14 +9,14 @@ const builder = await createBuilder(); const cache = builder.addRedis("cache"); -const app = builder.addUvicornApp("app", "./app", "main:app") +const app = builder.addUvicornApp("app", "../app", "main:app") .withUv() .withExternalHttpEndpoints() .withReference(cache) .waitFor(cache) .withHttpHealthCheck("/health"); -const frontend = builder.addViteApp("frontend", "./frontend") +const frontend = builder.addViteApp("frontend", "../frontend") .withReference(app) .waitFor(app); diff --git a/samples/client-apps-integration/ClientAppsIntegration.slnx b/samples/client-apps-integration/ClientAppsIntegration.slnx index 6d061585..2e8e30c6 100644 --- a/samples/client-apps-integration/ClientAppsIntegration.slnx +++ b/samples/client-apps-integration/ClientAppsIntegration.slnx @@ -4,7 +4,7 @@ - + diff --git a/samples/client-apps-integration/.aspire/settings.json b/samples/client-apps-integration/cs/.aspire/settings.json similarity index 100% rename from samples/client-apps-integration/.aspire/settings.json rename to samples/client-apps-integration/cs/.aspire/settings.json diff --git a/samples/client-apps-integration/ClientAppsIntegration.AppHost/AppHost.cs b/samples/client-apps-integration/cs/ClientAppsIntegration.AppHost/AppHost.cs similarity index 100% rename from samples/client-apps-integration/ClientAppsIntegration.AppHost/AppHost.cs rename to samples/client-apps-integration/cs/ClientAppsIntegration.AppHost/AppHost.cs diff --git a/samples/client-apps-integration/ClientAppsIntegration.AppHost/ClientAppsIntegration.AppHost.csproj b/samples/client-apps-integration/cs/ClientAppsIntegration.AppHost/ClientAppsIntegration.AppHost.csproj similarity index 51% rename from samples/client-apps-integration/ClientAppsIntegration.AppHost/ClientAppsIntegration.AppHost.csproj rename to samples/client-apps-integration/cs/ClientAppsIntegration.AppHost/ClientAppsIntegration.AppHost.csproj index 9567cc89..560a2b3a 100644 --- a/samples/client-apps-integration/ClientAppsIntegration.AppHost/ClientAppsIntegration.AppHost.csproj +++ b/samples/client-apps-integration/cs/ClientAppsIntegration.AppHost/ClientAppsIntegration.AppHost.csproj @@ -9,9 +9,9 @@ - - - + + + diff --git a/samples/client-apps-integration/ClientAppsIntegration.AppHost/Properties/launchSettings.json b/samples/client-apps-integration/cs/ClientAppsIntegration.AppHost/Properties/launchSettings.json similarity index 100% rename from samples/client-apps-integration/ClientAppsIntegration.AppHost/Properties/launchSettings.json rename to samples/client-apps-integration/cs/ClientAppsIntegration.AppHost/Properties/launchSettings.json diff --git a/samples/client-apps-integration/ClientAppsIntegration.AppHost/appsettings.Development.json b/samples/client-apps-integration/cs/ClientAppsIntegration.AppHost/appsettings.Development.json similarity index 100% rename from samples/client-apps-integration/ClientAppsIntegration.AppHost/appsettings.Development.json rename to samples/client-apps-integration/cs/ClientAppsIntegration.AppHost/appsettings.Development.json diff --git a/samples/client-apps-integration/ClientAppsIntegration.AppHost/appsettings.json b/samples/client-apps-integration/cs/ClientAppsIntegration.AppHost/appsettings.json similarity index 100% rename from samples/client-apps-integration/ClientAppsIntegration.AppHost/appsettings.json rename to samples/client-apps-integration/cs/ClientAppsIntegration.AppHost/appsettings.json diff --git a/samples/client-apps-integration/ts/.aspire/settings.json b/samples/client-apps-integration/ts/.aspire/settings.json new file mode 100644 index 00000000..a60c25b1 --- /dev/null +++ b/samples/client-apps-integration/ts/.aspire/settings.json @@ -0,0 +1,3 @@ +{ + "appHostPath": "../apphost.ts" +} \ No newline at end of file diff --git a/samples/client-apps-integration/ClientAppsIntegration.AppHost/apphost.ts b/samples/client-apps-integration/ts/apphost.ts similarity index 100% rename from samples/client-apps-integration/ClientAppsIntegration.AppHost/apphost.ts rename to samples/client-apps-integration/ts/apphost.ts diff --git a/samples/container-build/.aspire/settings.json b/samples/container-build/.aspire/settings.json deleted file mode 100644 index 7812a6fe..00000000 --- a/samples/container-build/.aspire/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "appHostPath": "../apphost.cs" -} \ No newline at end of file diff --git a/samples/container-build/cs/.aspire/settings.json b/samples/container-build/cs/.aspire/settings.json new file mode 100644 index 00000000..d8fee785 --- /dev/null +++ b/samples/container-build/cs/.aspire/settings.json @@ -0,0 +1 @@ +{"appHostPath":"../apphost.cs"} \ No newline at end of file diff --git a/samples/container-build/apphost.cs b/samples/container-build/cs/apphost.cs similarity index 86% rename from samples/container-build/apphost.cs rename to samples/container-build/cs/apphost.cs index e1fff0e8..9df0d93d 100644 --- a/samples/container-build/apphost.cs +++ b/samples/container-build/cs/apphost.cs @@ -11,15 +11,15 @@ if (builder.ExecutionContext.IsPublishMode) { // Production build: multi-stage Dockerfile for optimized image - ginapp = builder.AddDockerfile("ginapp", "./ginapp") + ginapp = builder.AddDockerfile("ginapp", "../ginapp") .WithBuildArg("GO_VERSION", goVersion); } else { // Development build: use Air for hot reload with bind mount - ginapp = builder.AddDockerfile("ginapp", "./ginapp", "Dockerfile.dev") + ginapp = builder.AddDockerfile("ginapp", "../ginapp", "Dockerfile.dev") .WithBuildArg("GO_VERSION", goVersion) - .WithBindMount("./ginapp", "/app"); + .WithBindMount("../ginapp", "/app"); } ginapp diff --git a/samples/container-build/apphost.run.json b/samples/container-build/cs/apphost.run.json similarity index 100% rename from samples/container-build/apphost.run.json rename to samples/container-build/cs/apphost.run.json diff --git a/samples/container-build/apphost.settings.Development.json b/samples/container-build/cs/apphost.settings.Development.json similarity index 100% rename from samples/container-build/apphost.settings.Development.json rename to samples/container-build/cs/apphost.settings.Development.json diff --git a/samples/container-build/apphost.settings.json b/samples/container-build/cs/apphost.settings.json similarity index 100% rename from samples/container-build/apphost.settings.json rename to samples/container-build/cs/apphost.settings.json diff --git a/samples/container-build/ts/.aspire/settings.json b/samples/container-build/ts/.aspire/settings.json new file mode 100644 index 00000000..7d5a1905 --- /dev/null +++ b/samples/container-build/ts/.aspire/settings.json @@ -0,0 +1 @@ +{"appHostPath":"../apphost.ts"} \ No newline at end of file diff --git a/samples/container-build/apphost.ts b/samples/container-build/ts/apphost.ts similarity index 84% rename from samples/container-build/apphost.ts rename to samples/container-build/ts/apphost.ts index c6a2ee1d..c7a37f14 100644 --- a/samples/container-build/apphost.ts +++ b/samples/container-build/ts/apphost.ts @@ -12,12 +12,12 @@ const isPublishMode = !isRunMode; let ginapp; if (isPublishMode) { - ginapp = builder.addDockerfile("ginapp", "./ginapp") + ginapp = builder.addDockerfile("ginapp", "../ginapp") .withBuildArg("GO_VERSION", goVersion); } else { - ginapp = builder.addDockerfile("ginapp", "./ginapp", "Dockerfile.dev") + ginapp = builder.addDockerfile("ginapp", "../ginapp", "Dockerfile.dev") .withBuildArg("GO_VERSION", goVersion) - .withBindMount("./ginapp", "/app"); + .withBindMount("../ginapp", "/app"); } ginapp diff --git a/samples/custom-resources/CustomResources.slnx b/samples/custom-resources/CustomResources.slnx index 3b4c3333..be9901bc 100644 --- a/samples/custom-resources/CustomResources.slnx +++ b/samples/custom-resources/CustomResources.slnx @@ -4,5 +4,5 @@ - + diff --git a/samples/custom-resources/.aspire/settings.json b/samples/custom-resources/cs/.aspire/settings.json similarity index 100% rename from samples/custom-resources/.aspire/settings.json rename to samples/custom-resources/cs/.aspire/settings.json diff --git a/samples/custom-resources/CustomResources.AppHost/AppHost.cs b/samples/custom-resources/cs/CustomResources.AppHost/AppHost.cs similarity index 100% rename from samples/custom-resources/CustomResources.AppHost/AppHost.cs rename to samples/custom-resources/cs/CustomResources.AppHost/AppHost.cs diff --git a/samples/custom-resources/CustomResources.AppHost/CustomResources.AppHost.csproj b/samples/custom-resources/cs/CustomResources.AppHost/CustomResources.AppHost.csproj similarity index 100% rename from samples/custom-resources/CustomResources.AppHost/CustomResources.AppHost.csproj rename to samples/custom-resources/cs/CustomResources.AppHost/CustomResources.AppHost.csproj diff --git a/samples/custom-resources/CustomResources.AppHost/Properties/launchSettings.json b/samples/custom-resources/cs/CustomResources.AppHost/Properties/launchSettings.json similarity index 100% rename from samples/custom-resources/CustomResources.AppHost/Properties/launchSettings.json rename to samples/custom-resources/cs/CustomResources.AppHost/Properties/launchSettings.json diff --git a/samples/custom-resources/CustomResources.AppHost/TalkingClockResource.cs b/samples/custom-resources/cs/CustomResources.AppHost/TalkingClockResource.cs similarity index 100% rename from samples/custom-resources/CustomResources.AppHost/TalkingClockResource.cs rename to samples/custom-resources/cs/CustomResources.AppHost/TalkingClockResource.cs diff --git a/samples/custom-resources/CustomResources.AppHost/TestResource.cs b/samples/custom-resources/cs/CustomResources.AppHost/TestResource.cs similarity index 100% rename from samples/custom-resources/CustomResources.AppHost/TestResource.cs rename to samples/custom-resources/cs/CustomResources.AppHost/TestResource.cs diff --git a/samples/custom-resources/CustomResources.AppHost/appsettings.Development.json b/samples/custom-resources/cs/CustomResources.AppHost/appsettings.Development.json similarity index 100% rename from samples/custom-resources/CustomResources.AppHost/appsettings.Development.json rename to samples/custom-resources/cs/CustomResources.AppHost/appsettings.Development.json diff --git a/samples/custom-resources/CustomResources.AppHost/appsettings.json b/samples/custom-resources/cs/CustomResources.AppHost/appsettings.json similarity index 100% rename from samples/custom-resources/CustomResources.AppHost/appsettings.json rename to samples/custom-resources/cs/CustomResources.AppHost/appsettings.json diff --git a/samples/custom-resources/ts/.aspire/settings.json b/samples/custom-resources/ts/.aspire/settings.json new file mode 100644 index 00000000..a60c25b1 --- /dev/null +++ b/samples/custom-resources/ts/.aspire/settings.json @@ -0,0 +1,3 @@ +{ + "appHostPath": "../apphost.ts" +} \ No newline at end of file diff --git a/samples/custom-resources/CustomResources.AppHost/apphost.ts b/samples/custom-resources/ts/apphost.ts similarity index 100% rename from samples/custom-resources/CustomResources.AppHost/apphost.ts rename to samples/custom-resources/ts/apphost.ts diff --git a/samples/database-containers/DatabaseContainers.slnx b/samples/database-containers/DatabaseContainers.slnx index 27f13f19..a03eb830 100644 --- a/samples/database-containers/DatabaseContainers.slnx +++ b/samples/database-containers/DatabaseContainers.slnx @@ -3,6 +3,6 @@ - + diff --git a/samples/database-containers/.aspire/settings.json b/samples/database-containers/cs/.aspire/settings.json similarity index 100% rename from samples/database-containers/.aspire/settings.json rename to samples/database-containers/cs/.aspire/settings.json diff --git a/samples/database-containers/DatabaseContainers.AppHost/AppHost.cs b/samples/database-containers/cs/DatabaseContainers.AppHost/AppHost.cs similarity index 93% rename from samples/database-containers/DatabaseContainers.AppHost/AppHost.cs rename to samples/database-containers/cs/DatabaseContainers.AppHost/AppHost.cs index f4a74310..841e02e3 100644 --- a/samples/database-containers/DatabaseContainers.AppHost/AppHost.cs +++ b/samples/database-containers/cs/DatabaseContainers.AppHost/AppHost.cs @@ -8,7 +8,7 @@ // Set the name of the default database to auto-create on container startup. .WithEnvironment("POSTGRES_DB", todosDbName) // Mount the SQL scripts directory into the container so that the init scripts run. - .WithBindMount("../DatabaseContainers.ApiService/data/postgres", "/docker-entrypoint-initdb.d") + .WithBindMount("../../DatabaseContainers.ApiService/data/postgres", "/docker-entrypoint-initdb.d") // Configure the container to store data in a volume so that it persists across instances. .WithDataVolume() .WithPgWeb() @@ -26,7 +26,7 @@ // Set the name of the database to auto-create on container startup. .WithEnvironment("MYSQL_DATABASE", catalogDbName) // Mount the SQL scripts directory into the container so that the init scripts run. - .WithBindMount("../DatabaseContainers.ApiService/data/mysql", "/docker-entrypoint-initdb.d") + .WithBindMount("../../DatabaseContainers.ApiService/data/mysql", "/docker-entrypoint-initdb.d") // Configure the container to store data in a volume so that it persists across instances. .WithDataVolume() // Keep the container running between app host sessions. diff --git a/samples/database-containers/DatabaseContainers.AppHost/DatabaseContainers.AppHost.csproj b/samples/database-containers/cs/DatabaseContainers.AppHost/DatabaseContainers.AppHost.csproj similarity index 72% rename from samples/database-containers/DatabaseContainers.AppHost/DatabaseContainers.AppHost.csproj rename to samples/database-containers/cs/DatabaseContainers.AppHost/DatabaseContainers.AppHost.csproj index 4d24c1e2..966b126c 100644 --- a/samples/database-containers/DatabaseContainers.AppHost/DatabaseContainers.AppHost.csproj +++ b/samples/database-containers/cs/DatabaseContainers.AppHost/DatabaseContainers.AppHost.csproj @@ -9,11 +9,11 @@ - + - + diff --git a/samples/database-containers/DatabaseContainers.AppHost/Properties/launchSettings.json b/samples/database-containers/cs/DatabaseContainers.AppHost/Properties/launchSettings.json similarity index 100% rename from samples/database-containers/DatabaseContainers.AppHost/Properties/launchSettings.json rename to samples/database-containers/cs/DatabaseContainers.AppHost/Properties/launchSettings.json diff --git a/samples/database-containers/DatabaseContainers.AppHost/appsettings.Development.json b/samples/database-containers/cs/DatabaseContainers.AppHost/appsettings.Development.json similarity index 100% rename from samples/database-containers/DatabaseContainers.AppHost/appsettings.Development.json rename to samples/database-containers/cs/DatabaseContainers.AppHost/appsettings.Development.json diff --git a/samples/database-containers/DatabaseContainers.AppHost/appsettings.json b/samples/database-containers/cs/DatabaseContainers.AppHost/appsettings.json similarity index 100% rename from samples/database-containers/DatabaseContainers.AppHost/appsettings.json rename to samples/database-containers/cs/DatabaseContainers.AppHost/appsettings.json diff --git a/samples/database-containers/ts/.aspire/settings.json b/samples/database-containers/ts/.aspire/settings.json new file mode 100644 index 00000000..a60c25b1 --- /dev/null +++ b/samples/database-containers/ts/.aspire/settings.json @@ -0,0 +1,3 @@ +{ + "appHostPath": "../apphost.ts" +} \ No newline at end of file diff --git a/samples/database-containers/DatabaseContainers.AppHost/apphost.ts b/samples/database-containers/ts/apphost.ts similarity index 100% rename from samples/database-containers/DatabaseContainers.AppHost/apphost.ts rename to samples/database-containers/ts/apphost.ts diff --git a/samples/database-migrations/DatabaseMigrations.slnx b/samples/database-migrations/DatabaseMigrations.slnx index 6cf0f382..4269777a 100644 --- a/samples/database-migrations/DatabaseMigrations.slnx +++ b/samples/database-migrations/DatabaseMigrations.slnx @@ -1,7 +1,7 @@ - + diff --git a/samples/database-migrations/.aspire/settings.json b/samples/database-migrations/cs/.aspire/settings.json similarity index 97% rename from samples/database-migrations/.aspire/settings.json rename to samples/database-migrations/cs/.aspire/settings.json index 0f241c2b..6846cee4 100644 --- a/samples/database-migrations/.aspire/settings.json +++ b/samples/database-migrations/cs/.aspire/settings.json @@ -1,3 +1,3 @@ { "appHostPath": "../DatabaseMigrations.AppHost/DatabaseMigrations.AppHost.csproj" -} +} \ No newline at end of file diff --git a/samples/database-migrations/DatabaseMigrations.AppHost/AppHost.cs b/samples/database-migrations/cs/DatabaseMigrations.AppHost/AppHost.cs similarity index 100% rename from samples/database-migrations/DatabaseMigrations.AppHost/AppHost.cs rename to samples/database-migrations/cs/DatabaseMigrations.AppHost/AppHost.cs diff --git a/samples/database-migrations/DatabaseMigrations.AppHost/DatabaseMigrations.AppHost.csproj b/samples/database-migrations/cs/DatabaseMigrations.AppHost/DatabaseMigrations.AppHost.csproj similarity index 66% rename from samples/database-migrations/DatabaseMigrations.AppHost/DatabaseMigrations.AppHost.csproj rename to samples/database-migrations/cs/DatabaseMigrations.AppHost/DatabaseMigrations.AppHost.csproj index 52d5b8e4..df8f9f7b 100644 --- a/samples/database-migrations/DatabaseMigrations.AppHost/DatabaseMigrations.AppHost.csproj +++ b/samples/database-migrations/cs/DatabaseMigrations.AppHost/DatabaseMigrations.AppHost.csproj @@ -13,8 +13,8 @@ - - + + diff --git a/samples/database-migrations/DatabaseMigrations.AppHost/Properties/launchSettings.json b/samples/database-migrations/cs/DatabaseMigrations.AppHost/Properties/launchSettings.json similarity index 100% rename from samples/database-migrations/DatabaseMigrations.AppHost/Properties/launchSettings.json rename to samples/database-migrations/cs/DatabaseMigrations.AppHost/Properties/launchSettings.json diff --git a/samples/database-migrations/DatabaseMigrations.AppHost/appsettings.Development.json b/samples/database-migrations/cs/DatabaseMigrations.AppHost/appsettings.Development.json similarity index 100% rename from samples/database-migrations/DatabaseMigrations.AppHost/appsettings.Development.json rename to samples/database-migrations/cs/DatabaseMigrations.AppHost/appsettings.Development.json diff --git a/samples/database-migrations/DatabaseMigrations.AppHost/appsettings.json b/samples/database-migrations/cs/DatabaseMigrations.AppHost/appsettings.json similarity index 100% rename from samples/database-migrations/DatabaseMigrations.AppHost/appsettings.json rename to samples/database-migrations/cs/DatabaseMigrations.AppHost/appsettings.json diff --git a/samples/database-migrations/ts/.aspire/settings.json b/samples/database-migrations/ts/.aspire/settings.json new file mode 100644 index 00000000..a60c25b1 --- /dev/null +++ b/samples/database-migrations/ts/.aspire/settings.json @@ -0,0 +1,3 @@ +{ + "appHostPath": "../apphost.ts" +} \ No newline at end of file diff --git a/samples/database-migrations/DatabaseMigrations.AppHost/apphost.ts b/samples/database-migrations/ts/apphost.ts similarity index 100% rename from samples/database-migrations/DatabaseMigrations.AppHost/apphost.ts rename to samples/database-migrations/ts/apphost.ts diff --git a/samples/health-checks-ui/HealthChecksUI.slnx b/samples/health-checks-ui/HealthChecksUI.slnx index ab25c014..201df7c2 100644 --- a/samples/health-checks-ui/HealthChecksUI.slnx +++ b/samples/health-checks-ui/HealthChecksUI.slnx @@ -3,7 +3,7 @@ - + diff --git a/samples/health-checks-ui/.aspire/settings.json b/samples/health-checks-ui/cs/.aspire/settings.json similarity index 100% rename from samples/health-checks-ui/.aspire/settings.json rename to samples/health-checks-ui/cs/.aspire/settings.json diff --git a/samples/health-checks-ui/HealthChecksUI.AppHost/AppHost.cs b/samples/health-checks-ui/cs/HealthChecksUI.AppHost/AppHost.cs similarity index 100% rename from samples/health-checks-ui/HealthChecksUI.AppHost/AppHost.cs rename to samples/health-checks-ui/cs/HealthChecksUI.AppHost/AppHost.cs diff --git a/samples/health-checks-ui/HealthChecksUI.AppHost/HealthChecksUI.AppHost.csproj b/samples/health-checks-ui/cs/HealthChecksUI.AppHost/HealthChecksUI.AppHost.csproj similarity index 74% rename from samples/health-checks-ui/HealthChecksUI.AppHost/HealthChecksUI.AppHost.csproj rename to samples/health-checks-ui/cs/HealthChecksUI.AppHost/HealthChecksUI.AppHost.csproj index 3a847c2e..8dc87a46 100644 --- a/samples/health-checks-ui/HealthChecksUI.AppHost/HealthChecksUI.AppHost.csproj +++ b/samples/health-checks-ui/cs/HealthChecksUI.AppHost/HealthChecksUI.AppHost.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/samples/health-checks-ui/HealthChecksUI.AppHost/HealthChecksUIExtensions.cs b/samples/health-checks-ui/cs/HealthChecksUI.AppHost/HealthChecksUIExtensions.cs similarity index 100% rename from samples/health-checks-ui/HealthChecksUI.AppHost/HealthChecksUIExtensions.cs rename to samples/health-checks-ui/cs/HealthChecksUI.AppHost/HealthChecksUIExtensions.cs diff --git a/samples/health-checks-ui/HealthChecksUI.AppHost/HealthChecksUIResource.cs b/samples/health-checks-ui/cs/HealthChecksUI.AppHost/HealthChecksUIResource.cs similarity index 100% rename from samples/health-checks-ui/HealthChecksUI.AppHost/HealthChecksUIResource.cs rename to samples/health-checks-ui/cs/HealthChecksUI.AppHost/HealthChecksUIResource.cs diff --git a/samples/health-checks-ui/HealthChecksUI.AppHost/Properties/launchSettings.json b/samples/health-checks-ui/cs/HealthChecksUI.AppHost/Properties/launchSettings.json similarity index 100% rename from samples/health-checks-ui/HealthChecksUI.AppHost/Properties/launchSettings.json rename to samples/health-checks-ui/cs/HealthChecksUI.AppHost/Properties/launchSettings.json diff --git a/samples/health-checks-ui/HealthChecksUI.AppHost/appsettings.Development.json b/samples/health-checks-ui/cs/HealthChecksUI.AppHost/appsettings.Development.json similarity index 100% rename from samples/health-checks-ui/HealthChecksUI.AppHost/appsettings.Development.json rename to samples/health-checks-ui/cs/HealthChecksUI.AppHost/appsettings.Development.json diff --git a/samples/health-checks-ui/HealthChecksUI.AppHost/appsettings.json b/samples/health-checks-ui/cs/HealthChecksUI.AppHost/appsettings.json similarity index 100% rename from samples/health-checks-ui/HealthChecksUI.AppHost/appsettings.json rename to samples/health-checks-ui/cs/HealthChecksUI.AppHost/appsettings.json diff --git a/samples/health-checks-ui/HealthChecksUI.AppHost/aspire-manifest.json b/samples/health-checks-ui/cs/HealthChecksUI.AppHost/aspire-manifest.json similarity index 100% rename from samples/health-checks-ui/HealthChecksUI.AppHost/aspire-manifest.json rename to samples/health-checks-ui/cs/HealthChecksUI.AppHost/aspire-manifest.json diff --git a/samples/health-checks-ui/ts/.aspire/settings.json b/samples/health-checks-ui/ts/.aspire/settings.json new file mode 100644 index 00000000..a60c25b1 --- /dev/null +++ b/samples/health-checks-ui/ts/.aspire/settings.json @@ -0,0 +1,3 @@ +{ + "appHostPath": "../apphost.ts" +} \ No newline at end of file diff --git a/samples/health-checks-ui/HealthChecksUI.AppHost/apphost.ts b/samples/health-checks-ui/ts/apphost.ts similarity index 100% rename from samples/health-checks-ui/HealthChecksUI.AppHost/apphost.ts rename to samples/health-checks-ui/ts/apphost.ts diff --git a/samples/orleans-voting/OrleansVoting.slnx b/samples/orleans-voting/OrleansVoting.slnx index 34723e28..db8987f7 100644 --- a/samples/orleans-voting/OrleansVoting.slnx +++ b/samples/orleans-voting/OrleansVoting.slnx @@ -2,7 +2,7 @@ - + diff --git a/samples/orleans-voting/.aspire/settings.json b/samples/orleans-voting/cs/.aspire/settings.json similarity index 100% rename from samples/orleans-voting/.aspire/settings.json rename to samples/orleans-voting/cs/.aspire/settings.json diff --git a/samples/orleans-voting/OrleansVoting.AppHost/AppHost.cs b/samples/orleans-voting/cs/OrleansVoting.AppHost/AppHost.cs similarity index 100% rename from samples/orleans-voting/OrleansVoting.AppHost/AppHost.cs rename to samples/orleans-voting/cs/OrleansVoting.AppHost/AppHost.cs diff --git a/samples/orleans-voting/OrleansVoting.AppHost/OrleansVoting.AppHost.csproj b/samples/orleans-voting/cs/OrleansVoting.AppHost/OrleansVoting.AppHost.csproj similarity index 85% rename from samples/orleans-voting/OrleansVoting.AppHost/OrleansVoting.AppHost.csproj rename to samples/orleans-voting/cs/OrleansVoting.AppHost/OrleansVoting.AppHost.csproj index 33f9c0ac..5b2dc2b9 100644 --- a/samples/orleans-voting/OrleansVoting.AppHost/OrleansVoting.AppHost.csproj +++ b/samples/orleans-voting/cs/OrleansVoting.AppHost/OrleansVoting.AppHost.csproj @@ -14,7 +14,7 @@ - + diff --git a/samples/orleans-voting/OrleansVoting.AppHost/Properties/launchSettings.json b/samples/orleans-voting/cs/OrleansVoting.AppHost/Properties/launchSettings.json similarity index 100% rename from samples/orleans-voting/OrleansVoting.AppHost/Properties/launchSettings.json rename to samples/orleans-voting/cs/OrleansVoting.AppHost/Properties/launchSettings.json diff --git a/samples/orleans-voting/OrleansVoting.AppHost/appsettings.Development.json b/samples/orleans-voting/cs/OrleansVoting.AppHost/appsettings.Development.json similarity index 100% rename from samples/orleans-voting/OrleansVoting.AppHost/appsettings.Development.json rename to samples/orleans-voting/cs/OrleansVoting.AppHost/appsettings.Development.json diff --git a/samples/orleans-voting/OrleansVoting.AppHost/appsettings.json b/samples/orleans-voting/cs/OrleansVoting.AppHost/appsettings.json similarity index 100% rename from samples/orleans-voting/OrleansVoting.AppHost/appsettings.json rename to samples/orleans-voting/cs/OrleansVoting.AppHost/appsettings.json diff --git a/samples/orleans-voting/ts/.aspire/settings.json b/samples/orleans-voting/ts/.aspire/settings.json new file mode 100644 index 00000000..a60c25b1 --- /dev/null +++ b/samples/orleans-voting/ts/.aspire/settings.json @@ -0,0 +1,3 @@ +{ + "appHostPath": "../apphost.ts" +} \ No newline at end of file diff --git a/samples/orleans-voting/OrleansVoting.AppHost/apphost.ts b/samples/orleans-voting/ts/apphost.ts similarity index 100% rename from samples/orleans-voting/OrleansVoting.AppHost/apphost.ts rename to samples/orleans-voting/ts/apphost.ts diff --git a/samples/standalone-dashboard/ConsoleApp.cs b/samples/standalone-dashboard/cs/ConsoleApp.cs similarity index 100% rename from samples/standalone-dashboard/ConsoleApp.cs rename to samples/standalone-dashboard/cs/ConsoleApp.cs diff --git a/samples/standalone-dashboard/ConsoleApp.run.json b/samples/standalone-dashboard/cs/ConsoleApp.run.json similarity index 100% rename from samples/standalone-dashboard/ConsoleApp.run.json rename to samples/standalone-dashboard/cs/ConsoleApp.run.json diff --git a/samples/standalone-dashboard/ConsoleApp.settings.Development.json b/samples/standalone-dashboard/cs/ConsoleApp.settings.Development.json similarity index 100% rename from samples/standalone-dashboard/ConsoleApp.settings.Development.json rename to samples/standalone-dashboard/cs/ConsoleApp.settings.Development.json diff --git a/samples/standalone-dashboard/ConsoleApp.settings.json b/samples/standalone-dashboard/cs/ConsoleApp.settings.json similarity index 100% rename from samples/standalone-dashboard/ConsoleApp.settings.json rename to samples/standalone-dashboard/cs/ConsoleApp.settings.json diff --git a/samples/volume-mount/VolumeMount.slnx b/samples/volume-mount/VolumeMount.slnx index 74e2be8d..164623b4 100644 --- a/samples/volume-mount/VolumeMount.slnx +++ b/samples/volume-mount/VolumeMount.slnx @@ -1,5 +1,5 @@ - + diff --git a/samples/volume-mount/.aspire/settings.json b/samples/volume-mount/cs/.aspire/settings.json similarity index 100% rename from samples/volume-mount/.aspire/settings.json rename to samples/volume-mount/cs/.aspire/settings.json diff --git a/samples/volume-mount/VolumeMount.AppHost/AppHost.cs b/samples/volume-mount/cs/VolumeMount.AppHost/AppHost.cs similarity index 100% rename from samples/volume-mount/VolumeMount.AppHost/AppHost.cs rename to samples/volume-mount/cs/VolumeMount.AppHost/AppHost.cs diff --git a/samples/volume-mount/VolumeMount.AppHost/Properties/launchSettings.json b/samples/volume-mount/cs/VolumeMount.AppHost/Properties/launchSettings.json similarity index 100% rename from samples/volume-mount/VolumeMount.AppHost/Properties/launchSettings.json rename to samples/volume-mount/cs/VolumeMount.AppHost/Properties/launchSettings.json diff --git a/samples/volume-mount/VolumeMount.AppHost/VolumeMount.AppHost.csproj b/samples/volume-mount/cs/VolumeMount.AppHost/VolumeMount.AppHost.csproj similarity index 86% rename from samples/volume-mount/VolumeMount.AppHost/VolumeMount.AppHost.csproj rename to samples/volume-mount/cs/VolumeMount.AppHost/VolumeMount.AppHost.csproj index 2a07a2c7..104d0f9e 100644 --- a/samples/volume-mount/VolumeMount.AppHost/VolumeMount.AppHost.csproj +++ b/samples/volume-mount/cs/VolumeMount.AppHost/VolumeMount.AppHost.csproj @@ -15,7 +15,7 @@ - + diff --git a/samples/volume-mount/VolumeMount.AppHost/appsettings.Development.json b/samples/volume-mount/cs/VolumeMount.AppHost/appsettings.Development.json similarity index 100% rename from samples/volume-mount/VolumeMount.AppHost/appsettings.Development.json rename to samples/volume-mount/cs/VolumeMount.AppHost/appsettings.Development.json diff --git a/samples/volume-mount/VolumeMount.AppHost/appsettings.json b/samples/volume-mount/cs/VolumeMount.AppHost/appsettings.json similarity index 100% rename from samples/volume-mount/VolumeMount.AppHost/appsettings.json rename to samples/volume-mount/cs/VolumeMount.AppHost/appsettings.json diff --git a/samples/volume-mount/ts/.aspire/settings.json b/samples/volume-mount/ts/.aspire/settings.json new file mode 100644 index 00000000..a60c25b1 --- /dev/null +++ b/samples/volume-mount/ts/.aspire/settings.json @@ -0,0 +1,3 @@ +{ + "appHostPath": "../apphost.ts" +} \ No newline at end of file diff --git a/samples/volume-mount/VolumeMount.AppHost/apphost.ts b/samples/volume-mount/ts/apphost.ts similarity index 100% rename from samples/volume-mount/VolumeMount.AppHost/apphost.ts rename to samples/volume-mount/ts/apphost.ts From a560b60417567150b8c2388d0539dab05b8c59f9 Mon Sep 17 00:00:00 2001 From: David Pine Date: Mon, 9 Mar 2026 21:17:05 -0500 Subject: [PATCH 11/25] Clean build artifacts and document cs/ts folder structure in README Remove bin/, obj/, and .binlog files left from build validation. Add 'Sample Directory Structure' section to README.md explaining the cs/ and ts/ subfolders and how to run each AppHost variant. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index ecc96962..84a9bb90 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,24 @@ Samples for [Aspire](https://aspire.dev). | [HealthChecksUI](./samples/health-checks-ui) | C# | ASP.NET Core, Containers, Docker Compose | Demonstrates resources with separate isolated endpoints for health checks. | | [Azure Functions](./samples/aspire-with-azure-functions) | C# | ASP.NET Core, Blazor, Azure Functions, Azure Blob Storage | Shows how to integrate [Azure Functions](https://learn.microsoft.com/azure/azure-functions/functions-overview) with Aspire. | +## Sample Directory Structure + +Each sample contains `cs/` and `ts/` subfolders that isolate the C# and TypeScript [polyglot AppHosts](https://learn.microsoft.com/dotnet/aspire/app-host/polyglot-apphost) respectively. Shared service projects remain at the sample root. + +To run a sample with the **C# AppHost**: + +```bash +cd samples//cs +aspire run +``` + +To run a sample with the **TypeScript AppHost** (requires the [staging Aspire CLI](./samples/POLYGLOT_NOTES.md)): + +```bash +cd samples//ts +aspire run +``` + ## eShop [eShop](https://github.com/dotnet/eshop) is a reference application implementing an eCommerce web site on a services-based architecture using Aspire. From 388d3fda019ef42932f2998c26a8fe8d7b8171af Mon Sep 17 00:00:00 2001 From: David Pine Date: Mon, 9 Mar 2026 21:23:15 -0500 Subject: [PATCH 12/25] Generate .modules/ SDK for all TypeScript AppHosts via aspire add Run 'aspire add {integration}' for each ts/ AppHost to generate the .modules/ TypeScript SDK (aspire.ts, base.ts, transport.ts) and update .aspire/settings.json with package versions. Integrations added per sample: - aspire-shop: postgres, redis - aspire-with-azure-functions: azure-appcontainers, azure-storage, azure-functions - aspire-with-javascript: javascript - aspire-with-node: javascript, redis - aspire-with-python: javascript, python, redis - database-containers: postgres, mysql, sqlserver - database-migrations: sqlserver - health-checks-ui: redis, docker - orleans-voting: redis, orleans - volume-mount: sqlserver, azure-storage Samples using core APIs only (aspire restore): - client-apps-integration, container-build, custom-resources, Metrics Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- samples/Metrics/ts/.modules/.codegen-hash | 1 + samples/Metrics/ts/.modules/aspire.ts | 13306 ++++++++++++++++ samples/Metrics/ts/.modules/base.ts | 473 + samples/Metrics/ts/.modules/transport.ts | 574 + samples/Metrics/ts/package-lock.json | 6 + samples/aspire-shop/ts/.aspire/settings.json | 7 +- samples/aspire-shop/ts/.modules/.codegen-hash | 1 + samples/aspire-shop/ts/.modules/aspire.ts | 13306 ++++++++++++++++ samples/aspire-shop/ts/.modules/base.ts | 473 + samples/aspire-shop/ts/.modules/transport.ts | 574 + samples/aspire-shop/ts/package-lock.json | 6 + .../ts/.aspire/settings.json | 8 +- .../ts/.modules/.codegen-hash | 1 + .../ts/.modules/aspire.ts | 13306 ++++++++++++++++ .../ts/.modules/base.ts | 473 + .../ts/.modules/transport.ts | 574 + .../ts/package-lock.json | 6 + .../ts/.aspire/settings.json | 6 +- .../ts/.modules/.codegen-hash | 1 + .../ts/.modules/aspire.ts | 13306 ++++++++++++++++ .../ts/.modules/base.ts | 473 + .../ts/.modules/transport.ts | 574 + .../ts/package-lock.json | 6 + .../aspire-with-node/ts/.aspire/settings.json | 7 +- .../ts/.modules/.codegen-hash | 1 + .../aspire-with-node/ts/.modules/aspire.ts | 13306 ++++++++++++++++ samples/aspire-with-node/ts/.modules/base.ts | 473 + .../aspire-with-node/ts/.modules/transport.ts | 574 + samples/aspire-with-node/ts/package-lock.json | 6 + .../ts/.aspire/settings.json | 10 +- .../ts/.modules/.codegen-hash | 1 + .../aspire-with-python/ts/.modules/aspire.ts | 13306 ++++++++++++++++ .../aspire-with-python/ts/.modules/base.ts | 473 + .../ts/.modules/transport.ts | 574 + .../aspire-with-python/ts/package-lock.json | 6 + .../ts/.modules/.codegen-hash | 1 + .../ts/.modules/aspire.ts | 13306 ++++++++++++++++ .../ts/.modules/base.ts | 473 + .../ts/.modules/transport.ts | 574 + .../ts/package-lock.json | 6 + .../container-build/ts/.modules/.codegen-hash | 1 + samples/container-build/ts/.modules/aspire.ts | 13306 ++++++++++++++++ samples/container-build/ts/.modules/base.ts | 473 + .../container-build/ts/.modules/transport.ts | 574 + samples/container-build/ts/package-lock.json | 6 + .../ts/.modules/.codegen-hash | 1 + .../custom-resources/ts/.modules/aspire.ts | 13306 ++++++++++++++++ samples/custom-resources/ts/.modules/base.ts | 473 + .../custom-resources/ts/.modules/transport.ts | 574 + samples/custom-resources/ts/package-lock.json | 6 + .../ts/.aspire/settings.json | 8 +- .../ts/.modules/.codegen-hash | 1 + .../database-containers/ts/.modules/aspire.ts | 13306 ++++++++++++++++ .../database-containers/ts/.modules/base.ts | 473 + .../ts/.modules/transport.ts | 574 + .../database-containers/ts/package-lock.json | 6 + .../ts/.aspire/settings.json | 6 +- .../ts/.modules/.codegen-hash | 1 + .../database-migrations/ts/.modules/aspire.ts | 13306 ++++++++++++++++ .../database-migrations/ts/.modules/base.ts | 473 + .../ts/.modules/transport.ts | 574 + .../database-migrations/ts/package-lock.json | 6 + .../health-checks-ui/ts/.aspire/settings.json | 7 +- .../ts/.modules/.codegen-hash | 1 + .../health-checks-ui/ts/.modules/aspire.ts | 13306 ++++++++++++++++ samples/health-checks-ui/ts/.modules/base.ts | 473 + .../health-checks-ui/ts/.modules/transport.ts | 574 + samples/health-checks-ui/ts/package-lock.json | 6 + .../orleans-voting/ts/.aspire/settings.json | 7 +- .../orleans-voting/ts/.modules/.codegen-hash | 1 + samples/orleans-voting/ts/.modules/aspire.ts | 13306 ++++++++++++++++ samples/orleans-voting/ts/.modules/base.ts | 473 + .../orleans-voting/ts/.modules/transport.ts | 574 + samples/orleans-voting/ts/package-lock.json | 6 + samples/volume-mount/ts/.aspire/settings.json | 7 +- .../volume-mount/ts/.modules/.codegen-hash | 1 + samples/volume-mount/ts/.modules/aspire.ts | 13306 ++++++++++++++++ samples/volume-mount/ts/.modules/base.ts | 473 + samples/volume-mount/ts/.modules/transport.ts | 574 + samples/volume-mount/ts/package-lock.json | 6 + 80 files changed, 201103 insertions(+), 10 deletions(-) create mode 100644 samples/Metrics/ts/.modules/.codegen-hash create mode 100644 samples/Metrics/ts/.modules/aspire.ts create mode 100644 samples/Metrics/ts/.modules/base.ts create mode 100644 samples/Metrics/ts/.modules/transport.ts create mode 100644 samples/Metrics/ts/package-lock.json create mode 100644 samples/aspire-shop/ts/.modules/.codegen-hash create mode 100644 samples/aspire-shop/ts/.modules/aspire.ts create mode 100644 samples/aspire-shop/ts/.modules/base.ts create mode 100644 samples/aspire-shop/ts/.modules/transport.ts create mode 100644 samples/aspire-shop/ts/package-lock.json create mode 100644 samples/aspire-with-azure-functions/ts/.modules/.codegen-hash create mode 100644 samples/aspire-with-azure-functions/ts/.modules/aspire.ts create mode 100644 samples/aspire-with-azure-functions/ts/.modules/base.ts create mode 100644 samples/aspire-with-azure-functions/ts/.modules/transport.ts create mode 100644 samples/aspire-with-azure-functions/ts/package-lock.json create mode 100644 samples/aspire-with-javascript/ts/.modules/.codegen-hash create mode 100644 samples/aspire-with-javascript/ts/.modules/aspire.ts create mode 100644 samples/aspire-with-javascript/ts/.modules/base.ts create mode 100644 samples/aspire-with-javascript/ts/.modules/transport.ts create mode 100644 samples/aspire-with-javascript/ts/package-lock.json create mode 100644 samples/aspire-with-node/ts/.modules/.codegen-hash create mode 100644 samples/aspire-with-node/ts/.modules/aspire.ts create mode 100644 samples/aspire-with-node/ts/.modules/base.ts create mode 100644 samples/aspire-with-node/ts/.modules/transport.ts create mode 100644 samples/aspire-with-node/ts/package-lock.json create mode 100644 samples/aspire-with-python/ts/.modules/.codegen-hash create mode 100644 samples/aspire-with-python/ts/.modules/aspire.ts create mode 100644 samples/aspire-with-python/ts/.modules/base.ts create mode 100644 samples/aspire-with-python/ts/.modules/transport.ts create mode 100644 samples/aspire-with-python/ts/package-lock.json create mode 100644 samples/client-apps-integration/ts/.modules/.codegen-hash create mode 100644 samples/client-apps-integration/ts/.modules/aspire.ts create mode 100644 samples/client-apps-integration/ts/.modules/base.ts create mode 100644 samples/client-apps-integration/ts/.modules/transport.ts create mode 100644 samples/client-apps-integration/ts/package-lock.json create mode 100644 samples/container-build/ts/.modules/.codegen-hash create mode 100644 samples/container-build/ts/.modules/aspire.ts create mode 100644 samples/container-build/ts/.modules/base.ts create mode 100644 samples/container-build/ts/.modules/transport.ts create mode 100644 samples/container-build/ts/package-lock.json create mode 100644 samples/custom-resources/ts/.modules/.codegen-hash create mode 100644 samples/custom-resources/ts/.modules/aspire.ts create mode 100644 samples/custom-resources/ts/.modules/base.ts create mode 100644 samples/custom-resources/ts/.modules/transport.ts create mode 100644 samples/custom-resources/ts/package-lock.json create mode 100644 samples/database-containers/ts/.modules/.codegen-hash create mode 100644 samples/database-containers/ts/.modules/aspire.ts create mode 100644 samples/database-containers/ts/.modules/base.ts create mode 100644 samples/database-containers/ts/.modules/transport.ts create mode 100644 samples/database-containers/ts/package-lock.json create mode 100644 samples/database-migrations/ts/.modules/.codegen-hash create mode 100644 samples/database-migrations/ts/.modules/aspire.ts create mode 100644 samples/database-migrations/ts/.modules/base.ts create mode 100644 samples/database-migrations/ts/.modules/transport.ts create mode 100644 samples/database-migrations/ts/package-lock.json create mode 100644 samples/health-checks-ui/ts/.modules/.codegen-hash create mode 100644 samples/health-checks-ui/ts/.modules/aspire.ts create mode 100644 samples/health-checks-ui/ts/.modules/base.ts create mode 100644 samples/health-checks-ui/ts/.modules/transport.ts create mode 100644 samples/health-checks-ui/ts/package-lock.json create mode 100644 samples/orleans-voting/ts/.modules/.codegen-hash create mode 100644 samples/orleans-voting/ts/.modules/aspire.ts create mode 100644 samples/orleans-voting/ts/.modules/base.ts create mode 100644 samples/orleans-voting/ts/.modules/transport.ts create mode 100644 samples/orleans-voting/ts/package-lock.json create mode 100644 samples/volume-mount/ts/.modules/.codegen-hash create mode 100644 samples/volume-mount/ts/.modules/aspire.ts create mode 100644 samples/volume-mount/ts/.modules/base.ts create mode 100644 samples/volume-mount/ts/.modules/transport.ts create mode 100644 samples/volume-mount/ts/package-lock.json diff --git a/samples/Metrics/ts/.modules/.codegen-hash b/samples/Metrics/ts/.modules/.codegen-hash new file mode 100644 index 00000000..1369f62c --- /dev/null +++ b/samples/Metrics/ts/.modules/.codegen-hash @@ -0,0 +1 @@ +385A37965F5742D9B7F75074E7065C879412F46A58CE04016D535C18DA21950E \ No newline at end of file diff --git a/samples/Metrics/ts/.modules/aspire.ts b/samples/Metrics/ts/.modules/aspire.ts new file mode 100644 index 00000000..73dc52d2 --- /dev/null +++ b/samples/Metrics/ts/.modules/aspire.ts @@ -0,0 +1,13306 @@ +// aspire.ts - Capability-based Aspire SDK +// This SDK uses the ATS (Aspire Type System) capability API. +// Capabilities are endpoints like 'Aspire.Hosting/createBuilder'. +// +// GENERATED CODE - DO NOT EDIT + +import { + AspireClient as AspireClientRpc, + Handle, + MarshalledHandle, + CapabilityError, + registerCallback, + wrapIfHandle, + registerHandleWrapper +} from './transport.js'; + +import { + ResourceBuilderBase, + ReferenceExpression, + refExpr, + AspireDict, + AspireList +} from './base.js'; + +// ============================================================================ +// Handle Type Aliases (Internal - not exported to users) +// ============================================================================ + +/** Handle to CommandLineArgsCallbackContext */ +type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; + +/** Handle to ContainerRegistryResource */ +type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; + +/** Handle to ContainerResource */ +type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource'>; + +/** Handle to CSharpAppResource */ +type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; + +/** Handle to DotnetToolResource */ +type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; + +/** Handle to EndpointReference */ +type EndpointReferenceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference'>; + +/** Handle to EndpointReferenceExpression */ +type EndpointReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression'>; + +/** Handle to EnvironmentCallbackContext */ +type EnvironmentCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext'>; + +/** Handle to ExecutableResource */ +type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource'>; + +/** Handle to ExecuteCommandContext */ +type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; + +/** Handle to IContainerFilesDestinationResource */ +type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; + +/** Handle to IResource */ +type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; + +/** Handle to IResourceWithArgs */ +type IResourceWithArgsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs'>; + +/** Handle to IResourceWithConnectionString */ +type IResourceWithConnectionStringHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString'>; + +/** Handle to IResourceWithEndpoints */ +type IResourceWithEndpointsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints'>; + +/** Handle to IResourceWithEnvironment */ +type IResourceWithEnvironmentHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment'>; + +/** Handle to IResourceWithWaitSupport */ +type IResourceWithWaitSupportHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport'>; + +/** Handle to ParameterResource */ +type ParameterResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource'>; + +/** Handle to ProjectResource */ +type ProjectResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource'>; + +/** Handle to ReferenceExpression */ +type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression'>; + +/** Handle to ReferenceExpressionBuilder */ +type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; + +/** Handle to ResourceLoggerService */ +type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; + +/** Handle to ResourceNotificationService */ +type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; + +/** Handle to ResourceUrlsCallbackContext */ +type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; + +/** Handle to ConnectionStringResource */ +type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; + +/** Handle to DistributedApplication */ +type DistributedApplicationHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplication'>; + +/** Handle to DistributedApplicationExecutionContext */ +type DistributedApplicationExecutionContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext'>; + +/** Handle to DistributedApplicationEventSubscription */ +type DistributedApplicationEventSubscriptionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.DistributedApplicationEventSubscription'>; + +/** Handle to IDistributedApplicationEventing */ +type IDistributedApplicationEventingHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing'>; + +/** Handle to ExternalServiceResource */ +type ExternalServiceResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ExternalServiceResource'>; + +/** Handle to IDistributedApplicationBuilder */ +type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder'>; + +/** Handle to IResourceWithContainerFiles */ +type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; + +/** Handle to IResourceWithServiceDiscovery */ +type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; + +/** Handle to PipelineConfigurationContext */ +type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; + +/** Handle to PipelineStep */ +type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; + +/** Handle to PipelineStepContext */ +type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; + +/** Handle to ProjectResourceOptions */ +type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; + +/** Handle to Dict */ +type DictstringanyHandle = Handle<'Aspire.Hosting/Dict'>; + +/** Handle to List */ +type ListanyHandle = Handle<'Aspire.Hosting/List'>; + +/** Handle to IConfiguration */ +type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; + +/** Handle to IHostEnvironment */ +type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; + +/** Handle to ILogger */ +type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; + +/** Handle to string[] */ +type stringArrayHandle = Handle<'string[]'>; + +/** Handle to IServiceProvider */ +type IServiceProviderHandle = Handle<'System.ComponentModel/System.IServiceProvider'>; + +// ============================================================================ +// Enum Types +// ============================================================================ + +/** Enum type for CertificateTrustScope */ +export enum CertificateTrustScope { + None = "None", + Append = "Append", + Override = "Override", + System = "System", +} + +/** Enum type for ContainerLifetime */ +export enum ContainerLifetime { + Session = "Session", + Persistent = "Persistent", +} + +/** Enum type for DistributedApplicationOperation */ +export enum DistributedApplicationOperation { + Run = "Run", + Publish = "Publish", +} + +/** Enum type for EndpointProperty */ +export enum EndpointProperty { + Url = "Url", + Host = "Host", + IPV4Host = "IPV4Host", + Port = "Port", + Scheme = "Scheme", + TargetPort = "TargetPort", + HostAndPort = "HostAndPort", +} + +/** Enum type for IconVariant */ +export enum IconVariant { + Regular = "Regular", + Filled = "Filled", +} + +/** Enum type for ImagePullPolicy */ +export enum ImagePullPolicy { + Default = "Default", + Always = "Always", + Missing = "Missing", + Never = "Never", +} + +/** Enum type for OtlpProtocol */ +export enum OtlpProtocol { + Grpc = "Grpc", + HttpProtobuf = "HttpProtobuf", + HttpJson = "HttpJson", +} + +/** Enum type for ProbeType */ +export enum ProbeType { + Startup = "Startup", + Readiness = "Readiness", + Liveness = "Liveness", +} + +/** Enum type for ProtocolType */ +export enum ProtocolType { + IP = "IP", + IPv6HopByHopOptions = "IPv6HopByHopOptions", + Unspecified = "Unspecified", + Icmp = "Icmp", + Igmp = "Igmp", + Ggp = "Ggp", + IPv4 = "IPv4", + Tcp = "Tcp", + Pup = "Pup", + Udp = "Udp", + Idp = "Idp", + IPv6 = "IPv6", + IPv6RoutingHeader = "IPv6RoutingHeader", + IPv6FragmentHeader = "IPv6FragmentHeader", + IPSecEncapsulatingSecurityPayload = "IPSecEncapsulatingSecurityPayload", + IPSecAuthenticationHeader = "IPSecAuthenticationHeader", + IcmpV6 = "IcmpV6", + IPv6NoNextHeader = "IPv6NoNextHeader", + IPv6DestinationOptions = "IPv6DestinationOptions", + ND = "ND", + Raw = "Raw", + Ipx = "Ipx", + Spx = "Spx", + SpxII = "SpxII", + Unknown = "Unknown", +} + +/** Enum type for UrlDisplayLocation */ +export enum UrlDisplayLocation { + SummaryAndDetails = "SummaryAndDetails", + DetailsOnly = "DetailsOnly", +} + +/** Enum type for WaitBehavior */ +export enum WaitBehavior { + WaitOnResourceUnavailable = "WaitOnResourceUnavailable", + StopOnResourceUnavailable = "StopOnResourceUnavailable", +} + +// ============================================================================ +// DTO Interfaces +// ============================================================================ + +/** DTO interface for CommandOptions */ +export interface CommandOptions { + description?: string; + parameter?: any; + confirmationMessage?: string; + iconName?: string; + iconVariant?: IconVariant; + isHighlighted?: boolean; + updateState?: any; +} + +/** DTO interface for CreateBuilderOptions */ +export interface CreateBuilderOptions { + args?: string[]; + projectDirectory?: string; + appHostFilePath?: string; + containerRegistryOverride?: string; + disableDashboard?: boolean; + dashboardApplicationName?: string; + allowUnsecuredTransport?: boolean; + enableResourceLogging?: boolean; +} + +/** DTO interface for ExecuteCommandResult */ +export interface ExecuteCommandResult { + success?: boolean; + canceled?: boolean; + errorMessage?: string; +} + +/** DTO interface for ResourceEventDto */ +export interface ResourceEventDto { + resourceName?: string; + resourceId?: string; + state?: string; + stateStyle?: string; + healthStatus?: string; + exitCode?: number; +} + +/** DTO interface for ResourceUrlAnnotation */ +export interface ResourceUrlAnnotation { + url?: string; + displayText?: string; + endpoint?: EndpointReferenceHandle; + displayLocation?: UrlDisplayLocation; +} + +// ============================================================================ +// Options Interfaces +// ============================================================================ + +export interface AddConnectionStringOptions { + environmentVariableName?: string; +} + +export interface AddContainerRegistryOptions { + repository?: ParameterResource; +} + +export interface AddDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface AddParameterFromConfigurationOptions { + secret?: boolean; +} + +export interface AddParameterOptions { + secret?: boolean; +} + +export interface AppendFormattedOptions { + format?: string; +} + +export interface AppendValueProviderOptions { + format?: string; +} + +export interface GetValueAsyncOptions { + cancellationToken?: AbortSignal; +} + +export interface RunOptions { + cancellationToken?: AbortSignal; +} + +export interface WaitForCompletionOptions { + exitCode?: number; +} + +export interface WithBindMountOptions { + isReadOnly?: boolean; +} + +export interface WithCommandOptions { + commandOptions?: CommandOptions; +} + +export interface WithDescriptionOptions { + enableMarkdown?: boolean; +} + +export interface WithDockerfileBaseImageOptions { + buildImage?: string; + runtimeImage?: string; +} + +export interface WithDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface WithEndpointOptions { + port?: number; + targetPort?: number; + scheme?: string; + name?: string; + env?: string; + isProxied?: boolean; + isExternal?: boolean; + protocol?: ProtocolType; +} + +export interface WithExternalServiceHttpHealthCheckOptions { + path?: string; + statusCode?: number; +} + +export interface WithHttpEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithHttpHealthCheckOptions { + path?: string; + statusCode?: number; + endpointName?: string; +} + +export interface WithHttpProbeOptions { + path?: string; + initialDelaySeconds?: number; + periodSeconds?: number; + timeoutSeconds?: number; + failureThreshold?: number; + successThreshold?: number; + endpointName?: string; +} + +export interface WithHttpsDeveloperCertificateOptions { + password?: ParameterResource; +} + +export interface WithHttpsEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithIconNameOptions { + iconVariant?: IconVariant; +} + +export interface WithImageOptions { + tag?: string; +} + +export interface WithMcpServerOptions { + path?: string; + endpointName?: string; +} + +export interface WithPipelineStepFactoryOptions { + dependsOn?: string[]; + requiredBy?: string[]; + tags?: string[]; + description?: string; +} + +export interface WithReferenceOptions { + connectionName?: string; + optional?: boolean; +} + +export interface WithRequiredCommandOptions { + helpLink?: string; +} + +export interface WithUrlExpressionOptions { + displayText?: string; +} + +export interface WithUrlOptions { + displayText?: string; +} + +export interface WithVolumeOptions { + name?: string; + isReadOnly?: boolean; +} + +// ============================================================================ +// CommandLineArgsCallbackContext +// ============================================================================ + +/** + * Type class for CommandLineArgsCallbackContext. + */ +export class CommandLineArgsCallbackContext { + constructor(private _handle: CommandLineArgsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Args property */ + private _args?: AspireList; + get args(): AspireList { + if (!this._args) { + this._args = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args', + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args' + ); + } + return this._args; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplication +// ============================================================================ + +/** + * Type class for DistributedApplication. + */ +export class DistributedApplication { + constructor(private _handle: DistributedApplicationHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Runs the distributed application */ + /** @internal */ + async _runInternal(cancellationToken?: AbortSignal): Promise { + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + await this._client.invokeCapability( + 'Aspire.Hosting/run', + rpcArgs + ); + return this; + } + + run(options?: RunOptions): DistributedApplicationPromise { + const cancellationToken = options?.cancellationToken; + return new DistributedApplicationPromise(this._runInternal(cancellationToken)); + } + +} + +/** + * Thenable wrapper for DistributedApplication that enables fluent chaining. + */ +export class DistributedApplicationPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplication) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Runs the distributed application */ + run(options?: RunOptions): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.run(options))); + } + +} + +// ============================================================================ +// DistributedApplicationExecutionContext +// ============================================================================ + +/** + * Type class for DistributedApplicationExecutionContext. + */ +export class DistributedApplicationExecutionContext { + constructor(private _handle: DistributedApplicationExecutionContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PublisherName property */ + publisherName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.publisherName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.setPublisherName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Operation property */ + operation = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.operation', + { context: this._handle } + ); + }, + }; + + /** Gets the IsPublishMode property */ + isPublishMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isPublishMode', + { context: this._handle } + ); + }, + }; + + /** Gets the IsRunMode property */ + isRunMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isRunMode', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EndpointReference +// ============================================================================ + +/** + * Type class for EndpointReference. + */ +export class EndpointReference { + constructor(private _handle: EndpointReferenceHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EndpointName property */ + endpointName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.endpointName', + { context: this._handle } + ); + }, + }; + + /** Gets the ErrorMessage property */ + errorMessage = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.errorMessage', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.setErrorMessage', + { context: this._handle, value } + ); + } + }; + + /** Gets the IsAllocated property */ + isAllocated = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isAllocated', + { context: this._handle } + ); + }, + }; + + /** Gets the Exists property */ + exists = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.exists', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttp property */ + isHttp = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttp', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttps property */ + isHttps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttps', + { context: this._handle } + ); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.port', + { context: this._handle } + ); + }, + }; + + /** Gets the TargetPort property */ + targetPort = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.targetPort', + { context: this._handle } + ); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.host', + { context: this._handle } + ); + }, + }; + + /** Gets the Scheme property */ + scheme = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.scheme', + { context: this._handle } + ); + }, + }; + + /** Gets the Url property */ + url = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.url', + { context: this._handle } + ); + }, + }; + + /** Gets the URL of the endpoint asynchronously */ + async getValueAsync(options?: GetValueAsyncOptions): Promise { + const cancellationToken = options?.cancellationToken; + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValueAsync', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for EndpointReference that enables fluent chaining. + */ +export class EndpointReferencePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: EndpointReference) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets the URL of the endpoint asynchronously */ + getValueAsync(options?: GetValueAsyncOptions): Promise { + return this._promise.then(obj => obj.getValueAsync(options)); + } + +} + +// ============================================================================ +// EndpointReferenceExpression +// ============================================================================ + +/** + * Type class for EndpointReferenceExpression. + */ +export class EndpointReferenceExpression { + constructor(private _handle: EndpointReferenceExpressionHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Endpoint property */ + endpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.endpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Property property */ + property = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.property', + { context: this._handle } + ); + }, + }; + + /** Gets the ValueExpression property */ + valueExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.valueExpression', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EnvironmentCallbackContext +// ============================================================================ + +/** + * Type class for EnvironmentCallbackContext. + */ +export class EnvironmentCallbackContext { + constructor(private _handle: EnvironmentCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EnvironmentVariables property */ + private _environmentVariables?: AspireDict; + get environmentVariables(): AspireDict { + if (!this._environmentVariables) { + this._environmentVariables = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables', + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables' + ); + } + return this._environmentVariables; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ExecuteCommandContext +// ============================================================================ + +/** + * Type class for ExecuteCommandContext. + */ +export class ExecuteCommandContext { + constructor(private _handle: ExecuteCommandContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ResourceName property */ + resourceName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.resourceName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setResourceName', + { context: this._handle, value } + ); + } + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', + { context: this._handle } + ); + }, + set: async (value: AbortSignal): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + { context: this._handle } + ); + }, + set: async (value: PipelineStep[]): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', + { context: this._handle, value } + ); + } + }; + + /** Gets pipeline steps with the specified tag */ + async getStepsByTag(tag: string): Promise { + const rpcArgs: Record = { context: this._handle, tag }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/getStepsByTag', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for PipelineConfigurationContext that enables fluent chaining. + */ +export class PipelineConfigurationContextPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineConfigurationContext) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets pipeline steps with the specified tag */ + getStepsByTag(tag: string): Promise { + return this._promise.then(obj => obj.getStepsByTag(tag)); + } + +} + +// ============================================================================ +// PipelineStep +// ============================================================================ + +/** + * Type class for PipelineStep. + */ +export class PipelineStep { + constructor(private _handle: PipelineStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.name', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Description property */ + description = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.description', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setDescription', + { context: this._handle, value } + ); + } + }; + + /** Gets the DependsOnSteps property */ + private _dependsOnSteps?: AspireList; + get dependsOnSteps(): AspireList { + if (!this._dependsOnSteps) { + this._dependsOnSteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps', + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps' + ); + } + return this._dependsOnSteps; + } + + /** Gets the RequiredBySteps property */ + private _requiredBySteps?: AspireList; + get requiredBySteps(): AspireList { + if (!this._requiredBySteps) { + this._requiredBySteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps', + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps' + ); + } + return this._requiredBySteps; + } + + /** Gets the Tags property */ + private _tags?: AspireList; + get tags(): AspireList { + if (!this._tags) { + this._tags = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.tags', + 'Aspire.Hosting.Pipelines/PipelineStep.tags' + ); + } + return this._tags; + } + + /** Adds a dependency on another step by name */ + /** @internal */ + async _dependsOnInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/dependsOn', + rpcArgs + ); + return this; + } + + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._dependsOnInternal(stepName)); + } + + /** Specifies that another step requires this step by name */ + /** @internal */ + async _requiredByInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/requiredBy', + rpcArgs + ); + return this; + } + + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._requiredByInternal(stepName)); + } + +} + +/** + * Thenable wrapper for PipelineStep that enables fluent chaining. + */ +export class PipelineStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineStep) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a dependency on another step by name */ + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.dependsOn(stepName))); + } + + /** Specifies that another step requires this step by name */ + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.requiredBy(stepName))); + } + +} + +// ============================================================================ +// PipelineStepContext +// ============================================================================ + +/** + * Type class for PipelineStepContext. + */ +export class PipelineStepContext { + constructor(private _handle: PipelineStepContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// ProjectResourceOptions +// ============================================================================ + +/** + * Type class for ProjectResourceOptions. + */ +export class ProjectResourceOptions { + constructor(private _handle: ProjectResourceOptionsHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the LaunchProfileName property */ + launchProfileName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.launchProfileName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setLaunchProfileName', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeLaunchProfile property */ + excludeLaunchProfile = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeLaunchProfile', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeLaunchProfile', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeKestrelEndpoints property */ + excludeKestrelEndpoints = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeKestrelEndpoints', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeKestrelEndpoints', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// ReferenceExpressionBuilder +// ============================================================================ + +/** + * Type class for ReferenceExpressionBuilder. + */ +export class ReferenceExpressionBuilder { + constructor(private _handle: ReferenceExpressionBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the IsEmpty property */ + isEmpty = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ReferenceExpressionBuilder.isEmpty', + { context: this._handle } + ); + }, + }; + + /** Appends a literal string to the reference expression */ + /** @internal */ + async _appendLiteralInternal(value: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendLiteral', + rpcArgs + ); + return this; + } + + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._appendLiteralInternal(value)); + } + + /** Appends a formatted string value to the reference expression */ + /** @internal */ + async _appendFormattedInternal(value: string, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendFormatted', + rpcArgs + ); + return this; + } + + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendFormattedInternal(value, format)); + } + + /** Appends a value provider to the reference expression */ + /** @internal */ + async _appendValueProviderInternal(valueProvider: any, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, valueProvider }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendValueProvider', + rpcArgs + ); + return this; + } + + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendValueProviderInternal(valueProvider, format)); + } + + /** Builds the reference expression */ + async build(): Promise { + const rpcArgs: Record = { context: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/build', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ReferenceExpressionBuilder that enables fluent chaining. + */ +export class ReferenceExpressionBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReferenceExpressionBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Appends a literal string to the reference expression */ + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendLiteral(value))); + } + + /** Appends a formatted string value to the reference expression */ + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendFormatted(value, options))); + } + + /** Appends a value provider to the reference expression */ + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendValueProvider(valueProvider, options))); + } + + /** Builds the reference expression */ + build(): Promise { + return this._promise.then(obj => obj.build()); + } + +} + +// ============================================================================ +// ResourceUrlsCallbackContext +// ============================================================================ + +/** + * Type class for ResourceUrlsCallbackContext. + */ +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Builds the distributed application */ + /** @internal */ + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', + rpcArgs + ); + return new DistributedApplication(result, this._client); + } + + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); + } + + /** Adds a connection string with a builder callback */ + /** @internal */ + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionStringBuilder', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + } + + /** Adds a container registry resource */ + /** @internal */ + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + } + + /** Adds a container resource */ + /** @internal */ + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); + } + + /** Adds a container resource built from a Dockerfile */ + /** @internal */ + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); + } + + /** Adds a .NET tool resource */ + /** @internal */ + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + } + + /** Adds an executable resource */ + /** @internal */ + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + } + + /** Adds an external service resource */ + /** @internal */ + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); + } + + /** Adds a parameter resource */ + /** @internal */ + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); + } + + /** Adds a parameter sourced from configuration */ + /** @internal */ + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + } + + /** Adds a connection string resource */ + /** @internal */ + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + } + + /** Adds a .NET project resource */ + /** @internal */ + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + } + + /** Adds a project resource with configuration options */ + /** @internal */ + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + } + + /** Adds a C# application resource */ + /** @internal */ + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + } + + /** Adds a C# application resource with configuration options */ + /** @internal */ + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + */ +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); + } + + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + } + + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + } + + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + } + + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + } + + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + } + + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); + } + + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + } + + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); + } + + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + } + + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); + } + + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); + } + + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); + } + + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); + } + + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); + } + +} + +// ============================================================================ +// DistributedApplicationEventing +// ============================================================================ + +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Unsubscribe method */ + /** @internal */ + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + rpcArgs + ); + return this; + } + + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ + +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerResource +// ============================================================================ + +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + const exitCode = options?.exitCode; + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + const password = options?.password; + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// CSharpAppResource +// ============================================================================ + +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + const exitCode = options?.exitCode; + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + const commandOptions = options?.commandOptions; + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + const password = options?.password; + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + const iconVariant = options?.iconVariant; + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// DotnetToolResource +// ============================================================================ + +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + } + + /** @internal */ + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + } + + /** @internal */ + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + } + + /** @internal */ + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + } + + /** @internal */ + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + } + + /** @internal */ + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + const exitCode = options?.exitCode; + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + const commandOptions = options?.commandOptions; + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + const password = options?.password; + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + const iconVariant = options?.iconVariant; + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for DotnetToolResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExecutableResource +// ============================================================================ + +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerFilesDestinationResource +// ============================================================================ + +export class ContainerFilesDestinationResource extends ResourceBuilderBase { + constructor(handle: IContainerFilesDestinationResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ContainerFilesDestinationResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + +} + +/** + * Thenable wrapper for ContainerFilesDestinationResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerFilesDestinationResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerFilesDestinationResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + +} + +// ============================================================================ +// Resource +// ============================================================================ + +export class Resource extends ResourceBuilderBase { + constructor(handle: IResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + const helpLink = options?.helpLink; + return new ResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + const commandOptions = options?.commandOptions; + return new ResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + const iconVariant = options?.iconVariant; + return new ResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for Resource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Resource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ResourceWithArgs +// ============================================================================ + +export class ResourceWithArgs extends ResourceBuilderBase { + constructor(handle: IResourceWithArgsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackAsyncInternal(callback)); + } + +} + +/** + * Thenable wrapper for ResourceWithArgs that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithArgsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithArgs) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + +} + +// ============================================================================ +// ResourceWithConnectionString +// ============================================================================ + +export class ResourceWithConnectionString extends ResourceBuilderBase { + constructor(handle: IResourceWithConnectionStringHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyValueInternal(name, value)); + } + +} + +/** + * Thenable wrapper for ResourceWithConnectionString that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithConnectionStringPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithConnectionString) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + +} + +// ============================================================================ +// ResourceWithContainerFiles +// ============================================================================ + +export class ResourceWithContainerFiles extends ResourceBuilderBase { + constructor(handle: IResourceWithContainerFilesHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._clearContainerFilesSourcesInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithContainerFiles that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithContainerFilesPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithContainerFiles) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + +} + +// ============================================================================ +// ResourceWithEndpoints +// ============================================================================ + +export class ResourceWithEndpoints extends ResourceBuilderBase { + constructor(handle: IResourceWithEndpointsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ResourceWithEndpointsPromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + +} + +/** + * Thenable wrapper for ResourceWithEndpoints that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEndpointsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEndpoints) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + +} + +// ============================================================================ +// ResourceWithEnvironment +// ============================================================================ + +export class ResourceWithEnvironment extends ResourceBuilderBase { + constructor(handle: IResourceWithEnvironmentHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + const password = options?.password; + return new ResourceWithEnvironmentPromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withoutHttpsCertificateInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithEnvironment that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + +} + +// ============================================================================ +// ResourceWithServiceDiscovery +// ============================================================================ + +export class ResourceWithServiceDiscovery extends ResourceBuilderBase { + constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { + super(handle, client); + } + +} + +/** + * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithServiceDiscoveryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + +} + +// ============================================================================ +// ResourceWithWaitSupport +// ============================================================================ + +export class ResourceWithWaitSupport extends ResourceBuilderBase { + constructor(handle: IResourceWithWaitSupportHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + const exitCode = options?.exitCode; + return new ResourceWithWaitSupportPromise(this._waitForCompletionInternal(dependency, exitCode)); + } + +} + +/** + * Thenable wrapper for ResourceWithWaitSupport that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithWaitSupportPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithWaitSupport) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + +} + +// ============================================================================ +// Connection Helper +// ============================================================================ + +/** + * Creates and connects to the Aspire AppHost. + * Reads connection info from environment variables set by `aspire run`. + */ +export async function connect(): Promise { + const socketPath = process.env.REMOTE_APP_HOST_SOCKET_PATH; + if (!socketPath) { + throw new Error( + 'REMOTE_APP_HOST_SOCKET_PATH environment variable not set. ' + + 'Run this application using `aspire run`.' + ); + } + + const client = new AspireClientRpc(socketPath); + await client.connect(); + + // Exit the process if the server connection is lost + client.onDisconnect(() => { + console.error('Connection to AppHost lost. Exiting...'); + process.exit(1); + }); + + return client; +} + +/** + * Creates a new distributed application builder. + * This is the entry point for building Aspire applications. + * + * @param options - Optional configuration options for the builder + * @returns A DistributedApplicationBuilder instance + * + * @example + * const builder = await createBuilder(); + * builder.addRedis("cache"); + * builder.addContainer("api", "mcr.microsoft.com/dotnet/samples:aspnetapp"); + * const app = await builder.build(); + * await app.run(); + */ +export async function createBuilder(options?: CreateBuilderOptions): Promise { + const client = await connect(); + + // Default args, projectDirectory, and appHostFilePath if not provided + // ASPIRE_APPHOST_FILEPATH is set by the CLI for consistent socket hash computation + const effectiveOptions: CreateBuilderOptions = { + ...options, + args: options?.args ?? process.argv.slice(2), + projectDirectory: options?.projectDirectory ?? process.env.ASPIRE_PROJECT_DIRECTORY ?? process.cwd(), + appHostFilePath: options?.appHostFilePath ?? process.env.ASPIRE_APPHOST_FILEPATH + }; + + const handle = await client.invokeCapability( + 'Aspire.Hosting/createBuilderWithOptions', + { options: effectiveOptions } + ); + return new DistributedApplicationBuilder(handle, client); +} + +// Re-export commonly used types +export { Handle, CapabilityError, registerCallback } from './transport.js'; +export { refExpr, ReferenceExpression } from './base.js'; + +// ============================================================================ +// Global Error Handling +// ============================================================================ + +/** + * Set up global error handlers to ensure the process exits properly on errors. + * Node.js doesn't exit on unhandled rejections by default, so we need to handle them. + */ +process.on('unhandledRejection', (reason: unknown) => { + const error = reason instanceof Error ? reason : new Error(String(reason)); + + if (reason instanceof CapabilityError) { + console.error(`\n❌ Capability Error: ${error.message}`); + console.error(` Code: ${(reason as CapabilityError).code}`); + if ((reason as CapabilityError).capability) { + console.error(` Capability: ${(reason as CapabilityError).capability}`); + } + } else { + console.error(`\n❌ Unhandled Error: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + } + + process.exit(1); +}); + +process.on('uncaughtException', (error: Error) => { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + process.exit(1); +}); + +// ============================================================================ +// Handle Wrapper Registrations +// ============================================================================ + +// Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource', (handle, client) => new CSharpAppResource(handle as CSharpAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString', (handle, client) => new ResourceWithConnectionString(handle as IResourceWithConnectionStringHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); + diff --git a/samples/Metrics/ts/.modules/base.ts b/samples/Metrics/ts/.modules/base.ts new file mode 100644 index 00000000..7778b0f1 --- /dev/null +++ b/samples/Metrics/ts/.modules/base.ts @@ -0,0 +1,473 @@ +// aspire.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle } from './transport.js'; + +// Re-export transport types for convenience +export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; +export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; + +// ============================================================================ +// Reference Expression +// ============================================================================ + +/** + * Represents a reference expression that can be passed to capabilities. + * + * Reference expressions are serialized in the protocol as: + * ```json + * { + * "$expr": { + * "format": "redis://{0}:{1}", + * "valueProviders": [ + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:1" }, + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:2" } + * ] + * } + * } + * ``` + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export class ReferenceExpression { + // Expression mode fields + private readonly _format?: string; + private readonly _valueProviders?: unknown[]; + + // Handle mode fields (when wrapping a server-returned handle) + private readonly _handle?: Handle; + private readonly _client?: AspireClient; + + constructor(format: string, valueProviders: unknown[]); + constructor(handle: Handle, client: AspireClient); + constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { + if (typeof handleOrFormat === 'string') { + this._format = handleOrFormat; + this._valueProviders = clientOrValueProviders as unknown[]; + } else { + this._handle = handleOrFormat; + this._client = clientOrValueProviders as AspireClient; + } + } + + /** + * Creates a reference expression from a tagged template literal. + * + * @param strings - The template literal string parts + * @param values - The interpolated values (handles to value providers) + * @returns A ReferenceExpression instance + */ + static create(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + // Build the format string with {0}, {1}, etc. placeholders + let format = ''; + for (let i = 0; i < strings.length; i++) { + format += strings[i]; + if (i < values.length) { + format += `{${i}}`; + } + } + + // Extract handles from values + const valueProviders = values.map(extractHandleForExpr); + + return new ReferenceExpression(format, valueProviders); + } + + /** + * Serializes the reference expression for JSON-RPC transport. + * In template-literal mode, uses the $expr format. + * In handle mode, delegates to the handle's serialization. + */ + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + if (this._handle) { + return this._handle.toJSON(); + } + + return { + $expr: { + format: this._format!, + valueProviders: this._valueProviders && this._valueProviders.length > 0 ? this._valueProviders : undefined + } + }; + } + + /** + * String representation for debugging. + */ + toString(): string { + if (this._handle) { + return `ReferenceExpression(handle)`; + } + return `ReferenceExpression(${this._format})`; + } +} + +/** + * Extracts a value for use in reference expressions. + * Supports handles (objects) and string literals. + * @internal + */ +function extractHandleForExpr(value: unknown): unknown { + if (value === null || value === undefined) { + throw new Error('Cannot use null or undefined in reference expression'); + } + + // String literals - include directly in the expression + if (typeof value === 'string') { + return value; + } + + // Number literals - convert to string + if (typeof value === 'number') { + return String(value); + } + + // Handle objects - get their JSON representation + if (value instanceof Handle) { + return value.toJSON(); + } + + // Objects with $handle property (already in handle format) + if (typeof value === 'object' && value !== null && '$handle' in value) { + return value; + } + + // Objects with toJSON that returns a handle + if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { + const json = value.toJSON(); + if (json && typeof json === 'object' && '$handle' in json) { + return json; + } + } + + throw new Error( + `Cannot use value of type ${typeof value} in reference expression. ` + + `Expected a Handle, string, or number.` + ); +} + +/** + * Tagged template function for creating reference expressions. + * + * Use this to create dynamic expressions that reference endpoints, parameters, and other + * value providers. The expression is evaluated at runtime by Aspire. + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression using the tagged template + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export function refExpr(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + return ReferenceExpression.create(strings, ...values); +} + +// ============================================================================ +// ResourceBuilderBase +// ============================================================================ + +/** + * Base class for resource builders (e.g., RedisBuilder, ContainerBuilder). + * Provides handle management and JSON serialization. + */ +export class ResourceBuilderBase { + constructor(protected _handle: THandle, protected _client: AspireClient) {} + + toJSON(): MarshalledHandle { return this._handle.toJSON(); } +} + +// ============================================================================ +// AspireList - Mutable List Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET List. + * Provides array-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const items = await resource.getItems(); // Returns AspireList + * const count = await items.count(); + * const first = await items.get(0); + * await items.add(newItem); + * ``` + */ +export class AspireList { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the list handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual list handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual list handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of elements in the list. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.length', { + list: handle + }) as number; + } + + /** + * Gets the element at the specified index. + */ + async get(index: number): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.get', { + list: handle, + index + }) as T; + } + + /** + * Adds an element to the end of the list. + */ + async add(item: T): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.add', { + list: handle, + item + }); + } + + /** + * Removes the element at the specified index. + */ + async removeAt(index: number): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.removeAt', { + list: handle, + index + }); + } + + /** + * Clears all elements from the list. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.clear', { + list: handle + }); + } + + /** + * Converts the list to an array (creates a copy). + */ + async toArray(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.toArray', { + list: handle + }) as T[]; + } + + toJSON(): MarshalledHandle { + if (this._resolvedHandle) { + return this._resolvedHandle.toJSON(); + } + return this._handleOrContext.toJSON(); + } +} + +// ============================================================================ +// AspireDict - Mutable Dictionary Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET Dictionary. + * Provides object-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const config = await resource.getConfig(); // Returns AspireDict + * const value = await config.get("key"); + * await config.set("key", "value"); + * const hasKey = await config.containsKey("key"); + * ``` + */ +export class AspireDict { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the dictionary handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual dictionary handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual dictionary handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of key-value pairs in the dictionary. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.count', { + dict: handle + }) as number; + } + + /** + * Gets the value associated with the specified key. + * @throws If the key is not found. + */ + async get(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.get', { + dict: handle, + key + }) as V; + } + + /** + * Sets the value for the specified key. + */ + async set(key: K, value: V): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.set', { + dict: handle, + key, + value + }); + } + + /** + * Determines whether the dictionary contains the specified key. + */ + async containsKey(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.has', { + dict: handle, + key + }) as boolean; + } + + /** + * Removes the value with the specified key. + * @returns True if the element was removed; false if the key was not found. + */ + async remove(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.remove', { + dict: handle, + key + }) as boolean; + } + + /** + * Clears all key-value pairs from the dictionary. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.clear', { + dict: handle + }); + } + + /** + * Gets all keys in the dictionary. + */ + async keys(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.keys', { + dict: handle + }) as K[]; + } + + /** + * Gets all values in the dictionary. + */ + async values(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.values', { + dict: handle + }) as V[]; + } + + /** + * Converts the dictionary to a plain object (creates a copy). + * Only works when K is string. + */ + async toObject(): Promise> { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.toObject', { + dict: handle + }) as Record; + } + + async toJSON(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } +} diff --git a/samples/Metrics/ts/.modules/transport.ts b/samples/Metrics/ts/.modules/transport.ts new file mode 100644 index 00000000..7bddd74b --- /dev/null +++ b/samples/Metrics/ts/.modules/transport.ts @@ -0,0 +1,574 @@ +// transport.ts - ATS transport layer: RPC, Handle, errors, callbacks +import * as net from 'net'; +import * as rpc from 'vscode-jsonrpc/node.js'; + +// ============================================================================ +// Base Types +// ============================================================================ + +/** + * Type for callback functions that can be registered and invoked from .NET. + * Internal: receives args and client for handle wrapping. + */ +export type CallbackFunction = (args: unknown, client: AspireClient) => unknown | Promise; + +/** + * Represents a handle to a .NET object in the ATS system. + * Handles are typed references that can be passed between capabilities. + */ +export interface MarshalledHandle { + /** The handle ID (instance number) */ + $handle: string; + /** The ATS type ID */ + $type: string; +} + +/** + * Error details for ATS errors. + */ +export interface AtsErrorDetails { + /** The parameter that caused the error */ + parameter?: string; + /** The expected type or value */ + expected?: string; + /** The actual type or value */ + actual?: string; +} + +/** + * Structured error from ATS capability invocation. + */ +export interface AtsError { + /** Machine-readable error code */ + code: string; + /** Human-readable error message */ + message: string; + /** The capability that failed (if applicable) */ + capability?: string; + /** Additional error details */ + details?: AtsErrorDetails; +} + +/** + * ATS error codes returned by the server. + */ +export const AtsErrorCodes = { + /** Unknown capability ID */ + CapabilityNotFound: 'CAPABILITY_NOT_FOUND', + /** Handle ID doesn't exist or was disposed */ + HandleNotFound: 'HANDLE_NOT_FOUND', + /** Handle type doesn't satisfy capability's type constraint */ + TypeMismatch: 'TYPE_MISMATCH', + /** Missing required argument or wrong type */ + InvalidArgument: 'INVALID_ARGUMENT', + /** Argument value outside valid range */ + ArgumentOutOfRange: 'ARGUMENT_OUT_OF_RANGE', + /** Error occurred during callback invocation */ + CallbackError: 'CALLBACK_ERROR', + /** Unexpected error in capability execution */ + InternalError: 'INTERNAL_ERROR', +} as const; + +/** + * Type guard to check if a value is an ATS error response. + */ +export function isAtsError(value: unknown): value is { $error: AtsError } { + return ( + value !== null && + typeof value === 'object' && + '$error' in value && + typeof (value as { $error: unknown }).$error === 'object' + ); +} + +/** + * Type guard to check if a value is a marshalled handle. + */ +export function isMarshalledHandle(value: unknown): value is MarshalledHandle { + return ( + value !== null && + typeof value === 'object' && + '$handle' in value && + '$type' in value + ); +} + +// ============================================================================ +// Handle +// ============================================================================ + +/** + * A typed handle to a .NET object in the ATS system. + * Handles are opaque references that can be passed to capabilities. + * + * @typeParam T - The ATS type ID (e.g., "Aspire.Hosting/IDistributedApplicationBuilder") + */ +export class Handle { + private readonly _handleId: string; + private readonly _typeId: T; + + constructor(marshalled: MarshalledHandle) { + this._handleId = marshalled.$handle; + this._typeId = marshalled.$type as T; + } + + /** The handle ID (instance number) */ + get $handle(): string { + return this._handleId; + } + + /** The ATS type ID */ + get $type(): T { + return this._typeId; + } + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { + return { + $handle: this._handleId, + $type: this._typeId + }; + } + + /** String representation for debugging */ + toString(): string { + return `Handle<${this._typeId}>(${this._handleId})`; + } +} + +// ============================================================================ +// Handle Wrapper Registry +// ============================================================================ + +/** + * Factory function for creating typed wrapper instances from handles. + */ +export type HandleWrapperFactory = (handle: Handle, client: AspireClient) => unknown; + +/** + * Registry of handle wrapper factories by type ID. + * Generated code registers wrapper classes here so callback handles can be properly typed. + */ +const handleWrapperRegistry = new Map(); + +/** + * Register a wrapper factory for a type ID. + * Called by generated code to register wrapper classes. + */ +export function registerHandleWrapper(typeId: string, factory: HandleWrapperFactory): void { + handleWrapperRegistry.set(typeId, factory); +} + +/** + * Checks if a value is a marshalled handle and wraps it appropriately. + * Uses the wrapper registry to create typed wrapper instances when available. + * + * @param value - The value to potentially wrap + * @param client - Optional client for creating typed wrapper instances + */ +export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { + if (value && typeof value === 'object') { + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); + } + } + + return handle; + } + } + return value; +} + +// ============================================================================ +// Capability Error +// ============================================================================ + +/** + * Error thrown when an ATS capability invocation fails. + */ +export class CapabilityError extends Error { + constructor( + /** The structured error from the server */ + public readonly error: AtsError + ) { + super(error.message); + this.name = 'CapabilityError'; + } + + /** Machine-readable error code */ + get code(): string { + return this.error.code; + } + + /** The capability that failed (if applicable) */ + get capability(): string | undefined { + return this.error.capability; + } +} + +// ============================================================================ +// Callback Registry +// ============================================================================ + +const callbackRegistry = new Map(); +let callbackIdCounter = 0; + +/** + * Register a callback function that can be invoked from the .NET side. + * Returns a callback ID that should be passed to methods accepting callbacks. + * + * .NET passes arguments as an object with positional keys: `{ p0: value0, p1: value1, ... }` + * This function automatically extracts positional parameters and wraps handles. + * + * @example + * // Single parameter callback + * const id = registerCallback((ctx) => console.log(ctx)); + * // .NET sends: { p0: { $handle: "...", $type: "..." } } + * // Callback receives: Handle instance + * + * @example + * // Multi-parameter callback + * const id = registerCallback((a, b) => console.log(a, b)); + * // .NET sends: { p0: "hello", p1: 42 } + * // Callback receives: "hello", 42 + */ +export function registerCallback( + callback: (...args: any[]) => TResult | Promise +): string { + const callbackId = `callback_${++callbackIdCounter}_${Date.now()}`; + + // Wrap the callback to handle .NET's positional argument format + const wrapper: CallbackFunction = async (args: unknown, client: AspireClient) => { + // .NET sends args as object { p0: value0, p1: value1, ... } + if (args && typeof args === 'object' && !Array.isArray(args)) { + const argObj = args as Record; + const argArray: unknown[] = []; + + // Extract positional parameters (p0, p1, p2, ...) + for (let i = 0; ; i++) { + const key = `p${i}`; + if (key in argObj) { + argArray.push(wrapIfHandle(argObj[key], client)); + } else { + break; + } + } + + if (argArray.length > 0) { + // Spread positional arguments to callback + const result = await callback(...argArray); + // DTO writeback protocol: when a void callback returns undefined, we + // return the original args object so the .NET host can detect property + // mutations made by the callback and apply them back to the original + // C# DTO objects. DTO args are plain JS objects (not Handle wrappers), + // so any property changes the callback made are reflected in args. + // + // Non-void callbacks (result !== undefined) return their actual result. + // The .NET side only activates writeback for void delegates whose + // parameters include [AspireDto] types — all other cases discard the + // returned args object, so the extra wire payload is harmless. + // + // IMPORTANT: callbacks that intentionally return undefined will also + // trigger this path. For non-void delegate types, the C# proxy uses + // a result-unmarshalling path (not writeback), so returning args will + // cause an unmarshal error. Void callbacks should never return a + // meaningful value; non-void callbacks should always return one. + return result !== undefined ? result : args; + } + + // No positional params found — nothing to write back + return await callback(); + } + + // Null/undefined - call with no args + if (args === null || args === undefined) { + return await callback(); + } + + // Primitive value - pass as single arg (shouldn't happen with current protocol) + return await callback(wrapIfHandle(args, client)); + }; + + callbackRegistry.set(callbackId, wrapper); + return callbackId; +} + +/** + * Unregister a callback by its ID. + */ +export function unregisterCallback(callbackId: string): boolean { + return callbackRegistry.delete(callbackId); +} + +/** + * Get the number of registered callbacks. + */ +export function getCallbackCount(): number { + return callbackRegistry.size; +} + +// ============================================================================ +// Cancellation Token Registry +// ============================================================================ + +/** + * Registry for cancellation tokens. + * Maps cancellation IDs to cleanup functions. + */ +const cancellationRegistry = new Map void>(); +let cancellationIdCounter = 0; + +/** + * A reference to the current AspireClient for sending cancel requests. + * Set by AspireClient.connect(). + */ +let currentClient: AspireClient | null = null; + +/** + * Register an AbortSignal for cancellation support. + * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * + * When the AbortSignal is aborted, sends a cancelToken request to the host. + * + * @param signal - The AbortSignal to register (optional) + * @returns The cancellation ID, or undefined if no signal provided + * + * @example + * const controller = new AbortController(); + * const id = registerCancellation(controller.signal); + * // Pass id to capability invocation + * // Later: controller.abort() will cancel the operation + */ +export function registerCancellation(signal?: AbortSignal): string | undefined { + if (!signal) { + return undefined; + } + + // Already aborted? Don't register + if (signal.aborted) { + return undefined; + } + + const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; + + // Set up the abort listener + const onAbort = () => { + // Send cancel request to host + if (currentClient?.connected) { + currentClient.cancelToken(cancellationId).catch(() => { + // Ignore errors - the operation may have already completed + }); + } + // Clean up the listener + cancellationRegistry.delete(cancellationId); + }; + + // Listen for abort + signal.addEventListener('abort', onAbort, { once: true }); + + // Store cleanup function + cancellationRegistry.set(cancellationId, () => { + signal.removeEventListener('abort', onAbort); + }); + + return cancellationId; +} + +/** + * Unregister a cancellation token by its ID. + * Call this when the operation completes to clean up resources. + * + * @param cancellationId - The cancellation ID to unregister + */ +export function unregisterCancellation(cancellationId: string | undefined): void { + if (!cancellationId) { + return; + } + + const cleanup = cancellationRegistry.get(cancellationId); + if (cleanup) { + cleanup(); + cancellationRegistry.delete(cancellationId); + } +} + +// ============================================================================ +// AspireClient (JSON-RPC Connection) +// ============================================================================ + +/** + * Client for connecting to the Aspire AppHost via socket/named pipe. + */ +export class AspireClient { + private connection: rpc.MessageConnection | null = null; + private socket: net.Socket | null = null; + private disconnectCallbacks: (() => void)[] = []; + private _pendingCalls = 0; + + constructor(private socketPath: string) { } + + /** + * Register a callback to be called when the connection is lost + */ + onDisconnect(callback: () => void): void { + this.disconnectCallbacks.push(callback); + } + + private notifyDisconnect(): void { + for (const callback of this.disconnectCallbacks) { + try { + callback(); + } catch { + // Ignore callback errors + } + } + } + + connect(timeoutMs: number = 5000): Promise { + return new Promise((resolve, reject) => { + const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this.socket = net.createConnection(pipePath); + + this.socket.once('error', (error: Error) => { + clearTimeout(timeout); + reject(error); + }); + + this.socket.once('connect', () => { + clearTimeout(timeout); + try { + const reader = new rpc.SocketMessageReader(this.socket!); + const writer = new rpc.SocketMessageWriter(this.socket!); + this.connection = rpc.createMessageConnection(reader, writer); + + this.connection.onClose(() => { + this.connection = null; + this.notifyDisconnect(); + }); + this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); + + // Handle callback invocations from the .NET side + this.connection.onRequest('invokeCallback', async (callbackId: string, args: unknown) => { + const callback = callbackRegistry.get(callbackId); + if (!callback) { + throw new Error(`Callback not found: ${callbackId}`); + } + try { + // The registered wrapper handles arg unpacking and handle wrapping + // Pass this client so handles can be wrapped with typed wrapper classes + return await Promise.resolve(callback(args, this)); + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + throw new Error(`Callback execution failed: ${message}`); + } + }); + + this.connection.listen(); + + // Set the current client for cancellation registry + currentClient = this; + + resolve(); + } catch (e) { + reject(e); + } + }); + + this.socket.on('close', () => { + this.connection?.dispose(); + this.connection = null; + if (currentClient === this) { + currentClient = null; + } + this.notifyDisconnect(); + }); + }); + } + + ping(): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('ping'); + } + + /** + * Cancel a CancellationToken by its ID. + * Called when an AbortSignal is aborted. + * + * @param tokenId - The token ID to cancel + * @returns True if the token was found and cancelled, false otherwise + */ + cancelToken(tokenId: string): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('cancelToken', tokenId); + } + + /** + * Invoke an ATS capability by ID. + * + * Capabilities are operations exposed by [AspireExport] attributes. + * Results are automatically wrapped in Handle objects when applicable. + * + * @param capabilityId - The capability ID (e.g., "Aspire.Hosting/createBuilder") + * @param args - Arguments to pass to the capability + * @returns The capability result, wrapped as Handle if it's a handle type + * @throws CapabilityError if the capability fails + */ + async invokeCapability( + capabilityId: string, + args?: Record + ): Promise { + if (!this.connection) { + throw new Error('Not connected to AppHost'); + } + + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); + } + this._pendingCalls++; + + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + args ?? null + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } + } + + disconnect(): void { + try { this.connection?.dispose(); } finally { this.connection = null; } + try { this.socket?.end(); } finally { this.socket = null; } + } + + get connected(): boolean { + return this.connection !== null && this.socket !== null; + } +} diff --git a/samples/Metrics/ts/package-lock.json b/samples/Metrics/ts/package-lock.json new file mode 100644 index 00000000..c4d3800c --- /dev/null +++ b/samples/Metrics/ts/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "ts", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/samples/aspire-shop/ts/.aspire/settings.json b/samples/aspire-shop/ts/.aspire/settings.json index a60c25b1..1c4d3f71 100644 --- a/samples/aspire-shop/ts/.aspire/settings.json +++ b/samples/aspire-shop/ts/.aspire/settings.json @@ -1,3 +1,8 @@ { - "appHostPath": "../apphost.ts" + "appHostPath": "../apphost.ts", + "sdkVersion": "13.2.0-preview.1.26159.1", + "packages": { + "Aspire.Hosting.Redis": "13.1.2", + "Aspire.Hosting.PostgreSQL": "13.1.2" + } } \ No newline at end of file diff --git a/samples/aspire-shop/ts/.modules/.codegen-hash b/samples/aspire-shop/ts/.modules/.codegen-hash new file mode 100644 index 00000000..f80172fe --- /dev/null +++ b/samples/aspire-shop/ts/.modules/.codegen-hash @@ -0,0 +1 @@ +A3D717B4303871C79C85DCB46CECA2EF50362BF3EB47F81CC6B7DCDFAB93E0DA \ No newline at end of file diff --git a/samples/aspire-shop/ts/.modules/aspire.ts b/samples/aspire-shop/ts/.modules/aspire.ts new file mode 100644 index 00000000..73dc52d2 --- /dev/null +++ b/samples/aspire-shop/ts/.modules/aspire.ts @@ -0,0 +1,13306 @@ +// aspire.ts - Capability-based Aspire SDK +// This SDK uses the ATS (Aspire Type System) capability API. +// Capabilities are endpoints like 'Aspire.Hosting/createBuilder'. +// +// GENERATED CODE - DO NOT EDIT + +import { + AspireClient as AspireClientRpc, + Handle, + MarshalledHandle, + CapabilityError, + registerCallback, + wrapIfHandle, + registerHandleWrapper +} from './transport.js'; + +import { + ResourceBuilderBase, + ReferenceExpression, + refExpr, + AspireDict, + AspireList +} from './base.js'; + +// ============================================================================ +// Handle Type Aliases (Internal - not exported to users) +// ============================================================================ + +/** Handle to CommandLineArgsCallbackContext */ +type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; + +/** Handle to ContainerRegistryResource */ +type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; + +/** Handle to ContainerResource */ +type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource'>; + +/** Handle to CSharpAppResource */ +type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; + +/** Handle to DotnetToolResource */ +type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; + +/** Handle to EndpointReference */ +type EndpointReferenceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference'>; + +/** Handle to EndpointReferenceExpression */ +type EndpointReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression'>; + +/** Handle to EnvironmentCallbackContext */ +type EnvironmentCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext'>; + +/** Handle to ExecutableResource */ +type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource'>; + +/** Handle to ExecuteCommandContext */ +type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; + +/** Handle to IContainerFilesDestinationResource */ +type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; + +/** Handle to IResource */ +type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; + +/** Handle to IResourceWithArgs */ +type IResourceWithArgsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs'>; + +/** Handle to IResourceWithConnectionString */ +type IResourceWithConnectionStringHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString'>; + +/** Handle to IResourceWithEndpoints */ +type IResourceWithEndpointsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints'>; + +/** Handle to IResourceWithEnvironment */ +type IResourceWithEnvironmentHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment'>; + +/** Handle to IResourceWithWaitSupport */ +type IResourceWithWaitSupportHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport'>; + +/** Handle to ParameterResource */ +type ParameterResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource'>; + +/** Handle to ProjectResource */ +type ProjectResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource'>; + +/** Handle to ReferenceExpression */ +type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression'>; + +/** Handle to ReferenceExpressionBuilder */ +type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; + +/** Handle to ResourceLoggerService */ +type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; + +/** Handle to ResourceNotificationService */ +type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; + +/** Handle to ResourceUrlsCallbackContext */ +type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; + +/** Handle to ConnectionStringResource */ +type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; + +/** Handle to DistributedApplication */ +type DistributedApplicationHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplication'>; + +/** Handle to DistributedApplicationExecutionContext */ +type DistributedApplicationExecutionContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext'>; + +/** Handle to DistributedApplicationEventSubscription */ +type DistributedApplicationEventSubscriptionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.DistributedApplicationEventSubscription'>; + +/** Handle to IDistributedApplicationEventing */ +type IDistributedApplicationEventingHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing'>; + +/** Handle to ExternalServiceResource */ +type ExternalServiceResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ExternalServiceResource'>; + +/** Handle to IDistributedApplicationBuilder */ +type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder'>; + +/** Handle to IResourceWithContainerFiles */ +type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; + +/** Handle to IResourceWithServiceDiscovery */ +type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; + +/** Handle to PipelineConfigurationContext */ +type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; + +/** Handle to PipelineStep */ +type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; + +/** Handle to PipelineStepContext */ +type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; + +/** Handle to ProjectResourceOptions */ +type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; + +/** Handle to Dict */ +type DictstringanyHandle = Handle<'Aspire.Hosting/Dict'>; + +/** Handle to List */ +type ListanyHandle = Handle<'Aspire.Hosting/List'>; + +/** Handle to IConfiguration */ +type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; + +/** Handle to IHostEnvironment */ +type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; + +/** Handle to ILogger */ +type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; + +/** Handle to string[] */ +type stringArrayHandle = Handle<'string[]'>; + +/** Handle to IServiceProvider */ +type IServiceProviderHandle = Handle<'System.ComponentModel/System.IServiceProvider'>; + +// ============================================================================ +// Enum Types +// ============================================================================ + +/** Enum type for CertificateTrustScope */ +export enum CertificateTrustScope { + None = "None", + Append = "Append", + Override = "Override", + System = "System", +} + +/** Enum type for ContainerLifetime */ +export enum ContainerLifetime { + Session = "Session", + Persistent = "Persistent", +} + +/** Enum type for DistributedApplicationOperation */ +export enum DistributedApplicationOperation { + Run = "Run", + Publish = "Publish", +} + +/** Enum type for EndpointProperty */ +export enum EndpointProperty { + Url = "Url", + Host = "Host", + IPV4Host = "IPV4Host", + Port = "Port", + Scheme = "Scheme", + TargetPort = "TargetPort", + HostAndPort = "HostAndPort", +} + +/** Enum type for IconVariant */ +export enum IconVariant { + Regular = "Regular", + Filled = "Filled", +} + +/** Enum type for ImagePullPolicy */ +export enum ImagePullPolicy { + Default = "Default", + Always = "Always", + Missing = "Missing", + Never = "Never", +} + +/** Enum type for OtlpProtocol */ +export enum OtlpProtocol { + Grpc = "Grpc", + HttpProtobuf = "HttpProtobuf", + HttpJson = "HttpJson", +} + +/** Enum type for ProbeType */ +export enum ProbeType { + Startup = "Startup", + Readiness = "Readiness", + Liveness = "Liveness", +} + +/** Enum type for ProtocolType */ +export enum ProtocolType { + IP = "IP", + IPv6HopByHopOptions = "IPv6HopByHopOptions", + Unspecified = "Unspecified", + Icmp = "Icmp", + Igmp = "Igmp", + Ggp = "Ggp", + IPv4 = "IPv4", + Tcp = "Tcp", + Pup = "Pup", + Udp = "Udp", + Idp = "Idp", + IPv6 = "IPv6", + IPv6RoutingHeader = "IPv6RoutingHeader", + IPv6FragmentHeader = "IPv6FragmentHeader", + IPSecEncapsulatingSecurityPayload = "IPSecEncapsulatingSecurityPayload", + IPSecAuthenticationHeader = "IPSecAuthenticationHeader", + IcmpV6 = "IcmpV6", + IPv6NoNextHeader = "IPv6NoNextHeader", + IPv6DestinationOptions = "IPv6DestinationOptions", + ND = "ND", + Raw = "Raw", + Ipx = "Ipx", + Spx = "Spx", + SpxII = "SpxII", + Unknown = "Unknown", +} + +/** Enum type for UrlDisplayLocation */ +export enum UrlDisplayLocation { + SummaryAndDetails = "SummaryAndDetails", + DetailsOnly = "DetailsOnly", +} + +/** Enum type for WaitBehavior */ +export enum WaitBehavior { + WaitOnResourceUnavailable = "WaitOnResourceUnavailable", + StopOnResourceUnavailable = "StopOnResourceUnavailable", +} + +// ============================================================================ +// DTO Interfaces +// ============================================================================ + +/** DTO interface for CommandOptions */ +export interface CommandOptions { + description?: string; + parameter?: any; + confirmationMessage?: string; + iconName?: string; + iconVariant?: IconVariant; + isHighlighted?: boolean; + updateState?: any; +} + +/** DTO interface for CreateBuilderOptions */ +export interface CreateBuilderOptions { + args?: string[]; + projectDirectory?: string; + appHostFilePath?: string; + containerRegistryOverride?: string; + disableDashboard?: boolean; + dashboardApplicationName?: string; + allowUnsecuredTransport?: boolean; + enableResourceLogging?: boolean; +} + +/** DTO interface for ExecuteCommandResult */ +export interface ExecuteCommandResult { + success?: boolean; + canceled?: boolean; + errorMessage?: string; +} + +/** DTO interface for ResourceEventDto */ +export interface ResourceEventDto { + resourceName?: string; + resourceId?: string; + state?: string; + stateStyle?: string; + healthStatus?: string; + exitCode?: number; +} + +/** DTO interface for ResourceUrlAnnotation */ +export interface ResourceUrlAnnotation { + url?: string; + displayText?: string; + endpoint?: EndpointReferenceHandle; + displayLocation?: UrlDisplayLocation; +} + +// ============================================================================ +// Options Interfaces +// ============================================================================ + +export interface AddConnectionStringOptions { + environmentVariableName?: string; +} + +export interface AddContainerRegistryOptions { + repository?: ParameterResource; +} + +export interface AddDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface AddParameterFromConfigurationOptions { + secret?: boolean; +} + +export interface AddParameterOptions { + secret?: boolean; +} + +export interface AppendFormattedOptions { + format?: string; +} + +export interface AppendValueProviderOptions { + format?: string; +} + +export interface GetValueAsyncOptions { + cancellationToken?: AbortSignal; +} + +export interface RunOptions { + cancellationToken?: AbortSignal; +} + +export interface WaitForCompletionOptions { + exitCode?: number; +} + +export interface WithBindMountOptions { + isReadOnly?: boolean; +} + +export interface WithCommandOptions { + commandOptions?: CommandOptions; +} + +export interface WithDescriptionOptions { + enableMarkdown?: boolean; +} + +export interface WithDockerfileBaseImageOptions { + buildImage?: string; + runtimeImage?: string; +} + +export interface WithDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface WithEndpointOptions { + port?: number; + targetPort?: number; + scheme?: string; + name?: string; + env?: string; + isProxied?: boolean; + isExternal?: boolean; + protocol?: ProtocolType; +} + +export interface WithExternalServiceHttpHealthCheckOptions { + path?: string; + statusCode?: number; +} + +export interface WithHttpEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithHttpHealthCheckOptions { + path?: string; + statusCode?: number; + endpointName?: string; +} + +export interface WithHttpProbeOptions { + path?: string; + initialDelaySeconds?: number; + periodSeconds?: number; + timeoutSeconds?: number; + failureThreshold?: number; + successThreshold?: number; + endpointName?: string; +} + +export interface WithHttpsDeveloperCertificateOptions { + password?: ParameterResource; +} + +export interface WithHttpsEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithIconNameOptions { + iconVariant?: IconVariant; +} + +export interface WithImageOptions { + tag?: string; +} + +export interface WithMcpServerOptions { + path?: string; + endpointName?: string; +} + +export interface WithPipelineStepFactoryOptions { + dependsOn?: string[]; + requiredBy?: string[]; + tags?: string[]; + description?: string; +} + +export interface WithReferenceOptions { + connectionName?: string; + optional?: boolean; +} + +export interface WithRequiredCommandOptions { + helpLink?: string; +} + +export interface WithUrlExpressionOptions { + displayText?: string; +} + +export interface WithUrlOptions { + displayText?: string; +} + +export interface WithVolumeOptions { + name?: string; + isReadOnly?: boolean; +} + +// ============================================================================ +// CommandLineArgsCallbackContext +// ============================================================================ + +/** + * Type class for CommandLineArgsCallbackContext. + */ +export class CommandLineArgsCallbackContext { + constructor(private _handle: CommandLineArgsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Args property */ + private _args?: AspireList; + get args(): AspireList { + if (!this._args) { + this._args = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args', + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args' + ); + } + return this._args; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplication +// ============================================================================ + +/** + * Type class for DistributedApplication. + */ +export class DistributedApplication { + constructor(private _handle: DistributedApplicationHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Runs the distributed application */ + /** @internal */ + async _runInternal(cancellationToken?: AbortSignal): Promise { + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + await this._client.invokeCapability( + 'Aspire.Hosting/run', + rpcArgs + ); + return this; + } + + run(options?: RunOptions): DistributedApplicationPromise { + const cancellationToken = options?.cancellationToken; + return new DistributedApplicationPromise(this._runInternal(cancellationToken)); + } + +} + +/** + * Thenable wrapper for DistributedApplication that enables fluent chaining. + */ +export class DistributedApplicationPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplication) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Runs the distributed application */ + run(options?: RunOptions): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.run(options))); + } + +} + +// ============================================================================ +// DistributedApplicationExecutionContext +// ============================================================================ + +/** + * Type class for DistributedApplicationExecutionContext. + */ +export class DistributedApplicationExecutionContext { + constructor(private _handle: DistributedApplicationExecutionContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PublisherName property */ + publisherName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.publisherName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.setPublisherName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Operation property */ + operation = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.operation', + { context: this._handle } + ); + }, + }; + + /** Gets the IsPublishMode property */ + isPublishMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isPublishMode', + { context: this._handle } + ); + }, + }; + + /** Gets the IsRunMode property */ + isRunMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isRunMode', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EndpointReference +// ============================================================================ + +/** + * Type class for EndpointReference. + */ +export class EndpointReference { + constructor(private _handle: EndpointReferenceHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EndpointName property */ + endpointName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.endpointName', + { context: this._handle } + ); + }, + }; + + /** Gets the ErrorMessage property */ + errorMessage = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.errorMessage', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.setErrorMessage', + { context: this._handle, value } + ); + } + }; + + /** Gets the IsAllocated property */ + isAllocated = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isAllocated', + { context: this._handle } + ); + }, + }; + + /** Gets the Exists property */ + exists = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.exists', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttp property */ + isHttp = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttp', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttps property */ + isHttps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttps', + { context: this._handle } + ); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.port', + { context: this._handle } + ); + }, + }; + + /** Gets the TargetPort property */ + targetPort = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.targetPort', + { context: this._handle } + ); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.host', + { context: this._handle } + ); + }, + }; + + /** Gets the Scheme property */ + scheme = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.scheme', + { context: this._handle } + ); + }, + }; + + /** Gets the Url property */ + url = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.url', + { context: this._handle } + ); + }, + }; + + /** Gets the URL of the endpoint asynchronously */ + async getValueAsync(options?: GetValueAsyncOptions): Promise { + const cancellationToken = options?.cancellationToken; + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValueAsync', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for EndpointReference that enables fluent chaining. + */ +export class EndpointReferencePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: EndpointReference) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets the URL of the endpoint asynchronously */ + getValueAsync(options?: GetValueAsyncOptions): Promise { + return this._promise.then(obj => obj.getValueAsync(options)); + } + +} + +// ============================================================================ +// EndpointReferenceExpression +// ============================================================================ + +/** + * Type class for EndpointReferenceExpression. + */ +export class EndpointReferenceExpression { + constructor(private _handle: EndpointReferenceExpressionHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Endpoint property */ + endpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.endpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Property property */ + property = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.property', + { context: this._handle } + ); + }, + }; + + /** Gets the ValueExpression property */ + valueExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.valueExpression', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EnvironmentCallbackContext +// ============================================================================ + +/** + * Type class for EnvironmentCallbackContext. + */ +export class EnvironmentCallbackContext { + constructor(private _handle: EnvironmentCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EnvironmentVariables property */ + private _environmentVariables?: AspireDict; + get environmentVariables(): AspireDict { + if (!this._environmentVariables) { + this._environmentVariables = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables', + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables' + ); + } + return this._environmentVariables; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ExecuteCommandContext +// ============================================================================ + +/** + * Type class for ExecuteCommandContext. + */ +export class ExecuteCommandContext { + constructor(private _handle: ExecuteCommandContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ResourceName property */ + resourceName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.resourceName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setResourceName', + { context: this._handle, value } + ); + } + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', + { context: this._handle } + ); + }, + set: async (value: AbortSignal): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + { context: this._handle } + ); + }, + set: async (value: PipelineStep[]): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', + { context: this._handle, value } + ); + } + }; + + /** Gets pipeline steps with the specified tag */ + async getStepsByTag(tag: string): Promise { + const rpcArgs: Record = { context: this._handle, tag }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/getStepsByTag', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for PipelineConfigurationContext that enables fluent chaining. + */ +export class PipelineConfigurationContextPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineConfigurationContext) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets pipeline steps with the specified tag */ + getStepsByTag(tag: string): Promise { + return this._promise.then(obj => obj.getStepsByTag(tag)); + } + +} + +// ============================================================================ +// PipelineStep +// ============================================================================ + +/** + * Type class for PipelineStep. + */ +export class PipelineStep { + constructor(private _handle: PipelineStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.name', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Description property */ + description = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.description', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setDescription', + { context: this._handle, value } + ); + } + }; + + /** Gets the DependsOnSteps property */ + private _dependsOnSteps?: AspireList; + get dependsOnSteps(): AspireList { + if (!this._dependsOnSteps) { + this._dependsOnSteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps', + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps' + ); + } + return this._dependsOnSteps; + } + + /** Gets the RequiredBySteps property */ + private _requiredBySteps?: AspireList; + get requiredBySteps(): AspireList { + if (!this._requiredBySteps) { + this._requiredBySteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps', + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps' + ); + } + return this._requiredBySteps; + } + + /** Gets the Tags property */ + private _tags?: AspireList; + get tags(): AspireList { + if (!this._tags) { + this._tags = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.tags', + 'Aspire.Hosting.Pipelines/PipelineStep.tags' + ); + } + return this._tags; + } + + /** Adds a dependency on another step by name */ + /** @internal */ + async _dependsOnInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/dependsOn', + rpcArgs + ); + return this; + } + + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._dependsOnInternal(stepName)); + } + + /** Specifies that another step requires this step by name */ + /** @internal */ + async _requiredByInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/requiredBy', + rpcArgs + ); + return this; + } + + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._requiredByInternal(stepName)); + } + +} + +/** + * Thenable wrapper for PipelineStep that enables fluent chaining. + */ +export class PipelineStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineStep) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a dependency on another step by name */ + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.dependsOn(stepName))); + } + + /** Specifies that another step requires this step by name */ + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.requiredBy(stepName))); + } + +} + +// ============================================================================ +// PipelineStepContext +// ============================================================================ + +/** + * Type class for PipelineStepContext. + */ +export class PipelineStepContext { + constructor(private _handle: PipelineStepContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// ProjectResourceOptions +// ============================================================================ + +/** + * Type class for ProjectResourceOptions. + */ +export class ProjectResourceOptions { + constructor(private _handle: ProjectResourceOptionsHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the LaunchProfileName property */ + launchProfileName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.launchProfileName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setLaunchProfileName', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeLaunchProfile property */ + excludeLaunchProfile = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeLaunchProfile', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeLaunchProfile', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeKestrelEndpoints property */ + excludeKestrelEndpoints = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeKestrelEndpoints', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeKestrelEndpoints', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// ReferenceExpressionBuilder +// ============================================================================ + +/** + * Type class for ReferenceExpressionBuilder. + */ +export class ReferenceExpressionBuilder { + constructor(private _handle: ReferenceExpressionBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the IsEmpty property */ + isEmpty = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ReferenceExpressionBuilder.isEmpty', + { context: this._handle } + ); + }, + }; + + /** Appends a literal string to the reference expression */ + /** @internal */ + async _appendLiteralInternal(value: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendLiteral', + rpcArgs + ); + return this; + } + + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._appendLiteralInternal(value)); + } + + /** Appends a formatted string value to the reference expression */ + /** @internal */ + async _appendFormattedInternal(value: string, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendFormatted', + rpcArgs + ); + return this; + } + + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendFormattedInternal(value, format)); + } + + /** Appends a value provider to the reference expression */ + /** @internal */ + async _appendValueProviderInternal(valueProvider: any, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, valueProvider }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendValueProvider', + rpcArgs + ); + return this; + } + + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendValueProviderInternal(valueProvider, format)); + } + + /** Builds the reference expression */ + async build(): Promise { + const rpcArgs: Record = { context: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/build', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ReferenceExpressionBuilder that enables fluent chaining. + */ +export class ReferenceExpressionBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReferenceExpressionBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Appends a literal string to the reference expression */ + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendLiteral(value))); + } + + /** Appends a formatted string value to the reference expression */ + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendFormatted(value, options))); + } + + /** Appends a value provider to the reference expression */ + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendValueProvider(valueProvider, options))); + } + + /** Builds the reference expression */ + build(): Promise { + return this._promise.then(obj => obj.build()); + } + +} + +// ============================================================================ +// ResourceUrlsCallbackContext +// ============================================================================ + +/** + * Type class for ResourceUrlsCallbackContext. + */ +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Builds the distributed application */ + /** @internal */ + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', + rpcArgs + ); + return new DistributedApplication(result, this._client); + } + + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); + } + + /** Adds a connection string with a builder callback */ + /** @internal */ + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionStringBuilder', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + } + + /** Adds a container registry resource */ + /** @internal */ + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + } + + /** Adds a container resource */ + /** @internal */ + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); + } + + /** Adds a container resource built from a Dockerfile */ + /** @internal */ + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); + } + + /** Adds a .NET tool resource */ + /** @internal */ + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + } + + /** Adds an executable resource */ + /** @internal */ + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + } + + /** Adds an external service resource */ + /** @internal */ + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); + } + + /** Adds a parameter resource */ + /** @internal */ + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); + } + + /** Adds a parameter sourced from configuration */ + /** @internal */ + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + } + + /** Adds a connection string resource */ + /** @internal */ + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + } + + /** Adds a .NET project resource */ + /** @internal */ + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + } + + /** Adds a project resource with configuration options */ + /** @internal */ + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + } + + /** Adds a C# application resource */ + /** @internal */ + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + } + + /** Adds a C# application resource with configuration options */ + /** @internal */ + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + */ +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); + } + + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + } + + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + } + + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + } + + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + } + + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + } + + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); + } + + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + } + + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); + } + + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + } + + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); + } + + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); + } + + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); + } + + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); + } + + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); + } + +} + +// ============================================================================ +// DistributedApplicationEventing +// ============================================================================ + +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Unsubscribe method */ + /** @internal */ + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + rpcArgs + ); + return this; + } + + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ + +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerResource +// ============================================================================ + +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + const exitCode = options?.exitCode; + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + const password = options?.password; + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// CSharpAppResource +// ============================================================================ + +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + const exitCode = options?.exitCode; + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + const commandOptions = options?.commandOptions; + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + const password = options?.password; + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + const iconVariant = options?.iconVariant; + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// DotnetToolResource +// ============================================================================ + +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + } + + /** @internal */ + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + } + + /** @internal */ + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + } + + /** @internal */ + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + } + + /** @internal */ + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + } + + /** @internal */ + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + const exitCode = options?.exitCode; + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + const commandOptions = options?.commandOptions; + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + const password = options?.password; + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + const iconVariant = options?.iconVariant; + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for DotnetToolResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExecutableResource +// ============================================================================ + +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerFilesDestinationResource +// ============================================================================ + +export class ContainerFilesDestinationResource extends ResourceBuilderBase { + constructor(handle: IContainerFilesDestinationResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ContainerFilesDestinationResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + +} + +/** + * Thenable wrapper for ContainerFilesDestinationResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerFilesDestinationResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerFilesDestinationResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + +} + +// ============================================================================ +// Resource +// ============================================================================ + +export class Resource extends ResourceBuilderBase { + constructor(handle: IResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + const helpLink = options?.helpLink; + return new ResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + const commandOptions = options?.commandOptions; + return new ResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + const iconVariant = options?.iconVariant; + return new ResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for Resource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Resource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ResourceWithArgs +// ============================================================================ + +export class ResourceWithArgs extends ResourceBuilderBase { + constructor(handle: IResourceWithArgsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackAsyncInternal(callback)); + } + +} + +/** + * Thenable wrapper for ResourceWithArgs that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithArgsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithArgs) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + +} + +// ============================================================================ +// ResourceWithConnectionString +// ============================================================================ + +export class ResourceWithConnectionString extends ResourceBuilderBase { + constructor(handle: IResourceWithConnectionStringHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyValueInternal(name, value)); + } + +} + +/** + * Thenable wrapper for ResourceWithConnectionString that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithConnectionStringPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithConnectionString) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + +} + +// ============================================================================ +// ResourceWithContainerFiles +// ============================================================================ + +export class ResourceWithContainerFiles extends ResourceBuilderBase { + constructor(handle: IResourceWithContainerFilesHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._clearContainerFilesSourcesInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithContainerFiles that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithContainerFilesPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithContainerFiles) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + +} + +// ============================================================================ +// ResourceWithEndpoints +// ============================================================================ + +export class ResourceWithEndpoints extends ResourceBuilderBase { + constructor(handle: IResourceWithEndpointsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ResourceWithEndpointsPromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + +} + +/** + * Thenable wrapper for ResourceWithEndpoints that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEndpointsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEndpoints) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + +} + +// ============================================================================ +// ResourceWithEnvironment +// ============================================================================ + +export class ResourceWithEnvironment extends ResourceBuilderBase { + constructor(handle: IResourceWithEnvironmentHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + const password = options?.password; + return new ResourceWithEnvironmentPromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withoutHttpsCertificateInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithEnvironment that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + +} + +// ============================================================================ +// ResourceWithServiceDiscovery +// ============================================================================ + +export class ResourceWithServiceDiscovery extends ResourceBuilderBase { + constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { + super(handle, client); + } + +} + +/** + * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithServiceDiscoveryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + +} + +// ============================================================================ +// ResourceWithWaitSupport +// ============================================================================ + +export class ResourceWithWaitSupport extends ResourceBuilderBase { + constructor(handle: IResourceWithWaitSupportHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + const exitCode = options?.exitCode; + return new ResourceWithWaitSupportPromise(this._waitForCompletionInternal(dependency, exitCode)); + } + +} + +/** + * Thenable wrapper for ResourceWithWaitSupport that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithWaitSupportPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithWaitSupport) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + +} + +// ============================================================================ +// Connection Helper +// ============================================================================ + +/** + * Creates and connects to the Aspire AppHost. + * Reads connection info from environment variables set by `aspire run`. + */ +export async function connect(): Promise { + const socketPath = process.env.REMOTE_APP_HOST_SOCKET_PATH; + if (!socketPath) { + throw new Error( + 'REMOTE_APP_HOST_SOCKET_PATH environment variable not set. ' + + 'Run this application using `aspire run`.' + ); + } + + const client = new AspireClientRpc(socketPath); + await client.connect(); + + // Exit the process if the server connection is lost + client.onDisconnect(() => { + console.error('Connection to AppHost lost. Exiting...'); + process.exit(1); + }); + + return client; +} + +/** + * Creates a new distributed application builder. + * This is the entry point for building Aspire applications. + * + * @param options - Optional configuration options for the builder + * @returns A DistributedApplicationBuilder instance + * + * @example + * const builder = await createBuilder(); + * builder.addRedis("cache"); + * builder.addContainer("api", "mcr.microsoft.com/dotnet/samples:aspnetapp"); + * const app = await builder.build(); + * await app.run(); + */ +export async function createBuilder(options?: CreateBuilderOptions): Promise { + const client = await connect(); + + // Default args, projectDirectory, and appHostFilePath if not provided + // ASPIRE_APPHOST_FILEPATH is set by the CLI for consistent socket hash computation + const effectiveOptions: CreateBuilderOptions = { + ...options, + args: options?.args ?? process.argv.slice(2), + projectDirectory: options?.projectDirectory ?? process.env.ASPIRE_PROJECT_DIRECTORY ?? process.cwd(), + appHostFilePath: options?.appHostFilePath ?? process.env.ASPIRE_APPHOST_FILEPATH + }; + + const handle = await client.invokeCapability( + 'Aspire.Hosting/createBuilderWithOptions', + { options: effectiveOptions } + ); + return new DistributedApplicationBuilder(handle, client); +} + +// Re-export commonly used types +export { Handle, CapabilityError, registerCallback } from './transport.js'; +export { refExpr, ReferenceExpression } from './base.js'; + +// ============================================================================ +// Global Error Handling +// ============================================================================ + +/** + * Set up global error handlers to ensure the process exits properly on errors. + * Node.js doesn't exit on unhandled rejections by default, so we need to handle them. + */ +process.on('unhandledRejection', (reason: unknown) => { + const error = reason instanceof Error ? reason : new Error(String(reason)); + + if (reason instanceof CapabilityError) { + console.error(`\n❌ Capability Error: ${error.message}`); + console.error(` Code: ${(reason as CapabilityError).code}`); + if ((reason as CapabilityError).capability) { + console.error(` Capability: ${(reason as CapabilityError).capability}`); + } + } else { + console.error(`\n❌ Unhandled Error: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + } + + process.exit(1); +}); + +process.on('uncaughtException', (error: Error) => { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + process.exit(1); +}); + +// ============================================================================ +// Handle Wrapper Registrations +// ============================================================================ + +// Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource', (handle, client) => new CSharpAppResource(handle as CSharpAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString', (handle, client) => new ResourceWithConnectionString(handle as IResourceWithConnectionStringHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); + diff --git a/samples/aspire-shop/ts/.modules/base.ts b/samples/aspire-shop/ts/.modules/base.ts new file mode 100644 index 00000000..7778b0f1 --- /dev/null +++ b/samples/aspire-shop/ts/.modules/base.ts @@ -0,0 +1,473 @@ +// aspire.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle } from './transport.js'; + +// Re-export transport types for convenience +export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; +export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; + +// ============================================================================ +// Reference Expression +// ============================================================================ + +/** + * Represents a reference expression that can be passed to capabilities. + * + * Reference expressions are serialized in the protocol as: + * ```json + * { + * "$expr": { + * "format": "redis://{0}:{1}", + * "valueProviders": [ + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:1" }, + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:2" } + * ] + * } + * } + * ``` + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export class ReferenceExpression { + // Expression mode fields + private readonly _format?: string; + private readonly _valueProviders?: unknown[]; + + // Handle mode fields (when wrapping a server-returned handle) + private readonly _handle?: Handle; + private readonly _client?: AspireClient; + + constructor(format: string, valueProviders: unknown[]); + constructor(handle: Handle, client: AspireClient); + constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { + if (typeof handleOrFormat === 'string') { + this._format = handleOrFormat; + this._valueProviders = clientOrValueProviders as unknown[]; + } else { + this._handle = handleOrFormat; + this._client = clientOrValueProviders as AspireClient; + } + } + + /** + * Creates a reference expression from a tagged template literal. + * + * @param strings - The template literal string parts + * @param values - The interpolated values (handles to value providers) + * @returns A ReferenceExpression instance + */ + static create(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + // Build the format string with {0}, {1}, etc. placeholders + let format = ''; + for (let i = 0; i < strings.length; i++) { + format += strings[i]; + if (i < values.length) { + format += `{${i}}`; + } + } + + // Extract handles from values + const valueProviders = values.map(extractHandleForExpr); + + return new ReferenceExpression(format, valueProviders); + } + + /** + * Serializes the reference expression for JSON-RPC transport. + * In template-literal mode, uses the $expr format. + * In handle mode, delegates to the handle's serialization. + */ + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + if (this._handle) { + return this._handle.toJSON(); + } + + return { + $expr: { + format: this._format!, + valueProviders: this._valueProviders && this._valueProviders.length > 0 ? this._valueProviders : undefined + } + }; + } + + /** + * String representation for debugging. + */ + toString(): string { + if (this._handle) { + return `ReferenceExpression(handle)`; + } + return `ReferenceExpression(${this._format})`; + } +} + +/** + * Extracts a value for use in reference expressions. + * Supports handles (objects) and string literals. + * @internal + */ +function extractHandleForExpr(value: unknown): unknown { + if (value === null || value === undefined) { + throw new Error('Cannot use null or undefined in reference expression'); + } + + // String literals - include directly in the expression + if (typeof value === 'string') { + return value; + } + + // Number literals - convert to string + if (typeof value === 'number') { + return String(value); + } + + // Handle objects - get their JSON representation + if (value instanceof Handle) { + return value.toJSON(); + } + + // Objects with $handle property (already in handle format) + if (typeof value === 'object' && value !== null && '$handle' in value) { + return value; + } + + // Objects with toJSON that returns a handle + if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { + const json = value.toJSON(); + if (json && typeof json === 'object' && '$handle' in json) { + return json; + } + } + + throw new Error( + `Cannot use value of type ${typeof value} in reference expression. ` + + `Expected a Handle, string, or number.` + ); +} + +/** + * Tagged template function for creating reference expressions. + * + * Use this to create dynamic expressions that reference endpoints, parameters, and other + * value providers. The expression is evaluated at runtime by Aspire. + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression using the tagged template + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export function refExpr(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + return ReferenceExpression.create(strings, ...values); +} + +// ============================================================================ +// ResourceBuilderBase +// ============================================================================ + +/** + * Base class for resource builders (e.g., RedisBuilder, ContainerBuilder). + * Provides handle management and JSON serialization. + */ +export class ResourceBuilderBase { + constructor(protected _handle: THandle, protected _client: AspireClient) {} + + toJSON(): MarshalledHandle { return this._handle.toJSON(); } +} + +// ============================================================================ +// AspireList - Mutable List Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET List. + * Provides array-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const items = await resource.getItems(); // Returns AspireList + * const count = await items.count(); + * const first = await items.get(0); + * await items.add(newItem); + * ``` + */ +export class AspireList { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the list handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual list handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual list handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of elements in the list. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.length', { + list: handle + }) as number; + } + + /** + * Gets the element at the specified index. + */ + async get(index: number): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.get', { + list: handle, + index + }) as T; + } + + /** + * Adds an element to the end of the list. + */ + async add(item: T): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.add', { + list: handle, + item + }); + } + + /** + * Removes the element at the specified index. + */ + async removeAt(index: number): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.removeAt', { + list: handle, + index + }); + } + + /** + * Clears all elements from the list. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.clear', { + list: handle + }); + } + + /** + * Converts the list to an array (creates a copy). + */ + async toArray(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.toArray', { + list: handle + }) as T[]; + } + + toJSON(): MarshalledHandle { + if (this._resolvedHandle) { + return this._resolvedHandle.toJSON(); + } + return this._handleOrContext.toJSON(); + } +} + +// ============================================================================ +// AspireDict - Mutable Dictionary Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET Dictionary. + * Provides object-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const config = await resource.getConfig(); // Returns AspireDict + * const value = await config.get("key"); + * await config.set("key", "value"); + * const hasKey = await config.containsKey("key"); + * ``` + */ +export class AspireDict { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the dictionary handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual dictionary handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual dictionary handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of key-value pairs in the dictionary. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.count', { + dict: handle + }) as number; + } + + /** + * Gets the value associated with the specified key. + * @throws If the key is not found. + */ + async get(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.get', { + dict: handle, + key + }) as V; + } + + /** + * Sets the value for the specified key. + */ + async set(key: K, value: V): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.set', { + dict: handle, + key, + value + }); + } + + /** + * Determines whether the dictionary contains the specified key. + */ + async containsKey(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.has', { + dict: handle, + key + }) as boolean; + } + + /** + * Removes the value with the specified key. + * @returns True if the element was removed; false if the key was not found. + */ + async remove(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.remove', { + dict: handle, + key + }) as boolean; + } + + /** + * Clears all key-value pairs from the dictionary. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.clear', { + dict: handle + }); + } + + /** + * Gets all keys in the dictionary. + */ + async keys(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.keys', { + dict: handle + }) as K[]; + } + + /** + * Gets all values in the dictionary. + */ + async values(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.values', { + dict: handle + }) as V[]; + } + + /** + * Converts the dictionary to a plain object (creates a copy). + * Only works when K is string. + */ + async toObject(): Promise> { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.toObject', { + dict: handle + }) as Record; + } + + async toJSON(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } +} diff --git a/samples/aspire-shop/ts/.modules/transport.ts b/samples/aspire-shop/ts/.modules/transport.ts new file mode 100644 index 00000000..7bddd74b --- /dev/null +++ b/samples/aspire-shop/ts/.modules/transport.ts @@ -0,0 +1,574 @@ +// transport.ts - ATS transport layer: RPC, Handle, errors, callbacks +import * as net from 'net'; +import * as rpc from 'vscode-jsonrpc/node.js'; + +// ============================================================================ +// Base Types +// ============================================================================ + +/** + * Type for callback functions that can be registered and invoked from .NET. + * Internal: receives args and client for handle wrapping. + */ +export type CallbackFunction = (args: unknown, client: AspireClient) => unknown | Promise; + +/** + * Represents a handle to a .NET object in the ATS system. + * Handles are typed references that can be passed between capabilities. + */ +export interface MarshalledHandle { + /** The handle ID (instance number) */ + $handle: string; + /** The ATS type ID */ + $type: string; +} + +/** + * Error details for ATS errors. + */ +export interface AtsErrorDetails { + /** The parameter that caused the error */ + parameter?: string; + /** The expected type or value */ + expected?: string; + /** The actual type or value */ + actual?: string; +} + +/** + * Structured error from ATS capability invocation. + */ +export interface AtsError { + /** Machine-readable error code */ + code: string; + /** Human-readable error message */ + message: string; + /** The capability that failed (if applicable) */ + capability?: string; + /** Additional error details */ + details?: AtsErrorDetails; +} + +/** + * ATS error codes returned by the server. + */ +export const AtsErrorCodes = { + /** Unknown capability ID */ + CapabilityNotFound: 'CAPABILITY_NOT_FOUND', + /** Handle ID doesn't exist or was disposed */ + HandleNotFound: 'HANDLE_NOT_FOUND', + /** Handle type doesn't satisfy capability's type constraint */ + TypeMismatch: 'TYPE_MISMATCH', + /** Missing required argument or wrong type */ + InvalidArgument: 'INVALID_ARGUMENT', + /** Argument value outside valid range */ + ArgumentOutOfRange: 'ARGUMENT_OUT_OF_RANGE', + /** Error occurred during callback invocation */ + CallbackError: 'CALLBACK_ERROR', + /** Unexpected error in capability execution */ + InternalError: 'INTERNAL_ERROR', +} as const; + +/** + * Type guard to check if a value is an ATS error response. + */ +export function isAtsError(value: unknown): value is { $error: AtsError } { + return ( + value !== null && + typeof value === 'object' && + '$error' in value && + typeof (value as { $error: unknown }).$error === 'object' + ); +} + +/** + * Type guard to check if a value is a marshalled handle. + */ +export function isMarshalledHandle(value: unknown): value is MarshalledHandle { + return ( + value !== null && + typeof value === 'object' && + '$handle' in value && + '$type' in value + ); +} + +// ============================================================================ +// Handle +// ============================================================================ + +/** + * A typed handle to a .NET object in the ATS system. + * Handles are opaque references that can be passed to capabilities. + * + * @typeParam T - The ATS type ID (e.g., "Aspire.Hosting/IDistributedApplicationBuilder") + */ +export class Handle { + private readonly _handleId: string; + private readonly _typeId: T; + + constructor(marshalled: MarshalledHandle) { + this._handleId = marshalled.$handle; + this._typeId = marshalled.$type as T; + } + + /** The handle ID (instance number) */ + get $handle(): string { + return this._handleId; + } + + /** The ATS type ID */ + get $type(): T { + return this._typeId; + } + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { + return { + $handle: this._handleId, + $type: this._typeId + }; + } + + /** String representation for debugging */ + toString(): string { + return `Handle<${this._typeId}>(${this._handleId})`; + } +} + +// ============================================================================ +// Handle Wrapper Registry +// ============================================================================ + +/** + * Factory function for creating typed wrapper instances from handles. + */ +export type HandleWrapperFactory = (handle: Handle, client: AspireClient) => unknown; + +/** + * Registry of handle wrapper factories by type ID. + * Generated code registers wrapper classes here so callback handles can be properly typed. + */ +const handleWrapperRegistry = new Map(); + +/** + * Register a wrapper factory for a type ID. + * Called by generated code to register wrapper classes. + */ +export function registerHandleWrapper(typeId: string, factory: HandleWrapperFactory): void { + handleWrapperRegistry.set(typeId, factory); +} + +/** + * Checks if a value is a marshalled handle and wraps it appropriately. + * Uses the wrapper registry to create typed wrapper instances when available. + * + * @param value - The value to potentially wrap + * @param client - Optional client for creating typed wrapper instances + */ +export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { + if (value && typeof value === 'object') { + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); + } + } + + return handle; + } + } + return value; +} + +// ============================================================================ +// Capability Error +// ============================================================================ + +/** + * Error thrown when an ATS capability invocation fails. + */ +export class CapabilityError extends Error { + constructor( + /** The structured error from the server */ + public readonly error: AtsError + ) { + super(error.message); + this.name = 'CapabilityError'; + } + + /** Machine-readable error code */ + get code(): string { + return this.error.code; + } + + /** The capability that failed (if applicable) */ + get capability(): string | undefined { + return this.error.capability; + } +} + +// ============================================================================ +// Callback Registry +// ============================================================================ + +const callbackRegistry = new Map(); +let callbackIdCounter = 0; + +/** + * Register a callback function that can be invoked from the .NET side. + * Returns a callback ID that should be passed to methods accepting callbacks. + * + * .NET passes arguments as an object with positional keys: `{ p0: value0, p1: value1, ... }` + * This function automatically extracts positional parameters and wraps handles. + * + * @example + * // Single parameter callback + * const id = registerCallback((ctx) => console.log(ctx)); + * // .NET sends: { p0: { $handle: "...", $type: "..." } } + * // Callback receives: Handle instance + * + * @example + * // Multi-parameter callback + * const id = registerCallback((a, b) => console.log(a, b)); + * // .NET sends: { p0: "hello", p1: 42 } + * // Callback receives: "hello", 42 + */ +export function registerCallback( + callback: (...args: any[]) => TResult | Promise +): string { + const callbackId = `callback_${++callbackIdCounter}_${Date.now()}`; + + // Wrap the callback to handle .NET's positional argument format + const wrapper: CallbackFunction = async (args: unknown, client: AspireClient) => { + // .NET sends args as object { p0: value0, p1: value1, ... } + if (args && typeof args === 'object' && !Array.isArray(args)) { + const argObj = args as Record; + const argArray: unknown[] = []; + + // Extract positional parameters (p0, p1, p2, ...) + for (let i = 0; ; i++) { + const key = `p${i}`; + if (key in argObj) { + argArray.push(wrapIfHandle(argObj[key], client)); + } else { + break; + } + } + + if (argArray.length > 0) { + // Spread positional arguments to callback + const result = await callback(...argArray); + // DTO writeback protocol: when a void callback returns undefined, we + // return the original args object so the .NET host can detect property + // mutations made by the callback and apply them back to the original + // C# DTO objects. DTO args are plain JS objects (not Handle wrappers), + // so any property changes the callback made are reflected in args. + // + // Non-void callbacks (result !== undefined) return their actual result. + // The .NET side only activates writeback for void delegates whose + // parameters include [AspireDto] types — all other cases discard the + // returned args object, so the extra wire payload is harmless. + // + // IMPORTANT: callbacks that intentionally return undefined will also + // trigger this path. For non-void delegate types, the C# proxy uses + // a result-unmarshalling path (not writeback), so returning args will + // cause an unmarshal error. Void callbacks should never return a + // meaningful value; non-void callbacks should always return one. + return result !== undefined ? result : args; + } + + // No positional params found — nothing to write back + return await callback(); + } + + // Null/undefined - call with no args + if (args === null || args === undefined) { + return await callback(); + } + + // Primitive value - pass as single arg (shouldn't happen with current protocol) + return await callback(wrapIfHandle(args, client)); + }; + + callbackRegistry.set(callbackId, wrapper); + return callbackId; +} + +/** + * Unregister a callback by its ID. + */ +export function unregisterCallback(callbackId: string): boolean { + return callbackRegistry.delete(callbackId); +} + +/** + * Get the number of registered callbacks. + */ +export function getCallbackCount(): number { + return callbackRegistry.size; +} + +// ============================================================================ +// Cancellation Token Registry +// ============================================================================ + +/** + * Registry for cancellation tokens. + * Maps cancellation IDs to cleanup functions. + */ +const cancellationRegistry = new Map void>(); +let cancellationIdCounter = 0; + +/** + * A reference to the current AspireClient for sending cancel requests. + * Set by AspireClient.connect(). + */ +let currentClient: AspireClient | null = null; + +/** + * Register an AbortSignal for cancellation support. + * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * + * When the AbortSignal is aborted, sends a cancelToken request to the host. + * + * @param signal - The AbortSignal to register (optional) + * @returns The cancellation ID, or undefined if no signal provided + * + * @example + * const controller = new AbortController(); + * const id = registerCancellation(controller.signal); + * // Pass id to capability invocation + * // Later: controller.abort() will cancel the operation + */ +export function registerCancellation(signal?: AbortSignal): string | undefined { + if (!signal) { + return undefined; + } + + // Already aborted? Don't register + if (signal.aborted) { + return undefined; + } + + const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; + + // Set up the abort listener + const onAbort = () => { + // Send cancel request to host + if (currentClient?.connected) { + currentClient.cancelToken(cancellationId).catch(() => { + // Ignore errors - the operation may have already completed + }); + } + // Clean up the listener + cancellationRegistry.delete(cancellationId); + }; + + // Listen for abort + signal.addEventListener('abort', onAbort, { once: true }); + + // Store cleanup function + cancellationRegistry.set(cancellationId, () => { + signal.removeEventListener('abort', onAbort); + }); + + return cancellationId; +} + +/** + * Unregister a cancellation token by its ID. + * Call this when the operation completes to clean up resources. + * + * @param cancellationId - The cancellation ID to unregister + */ +export function unregisterCancellation(cancellationId: string | undefined): void { + if (!cancellationId) { + return; + } + + const cleanup = cancellationRegistry.get(cancellationId); + if (cleanup) { + cleanup(); + cancellationRegistry.delete(cancellationId); + } +} + +// ============================================================================ +// AspireClient (JSON-RPC Connection) +// ============================================================================ + +/** + * Client for connecting to the Aspire AppHost via socket/named pipe. + */ +export class AspireClient { + private connection: rpc.MessageConnection | null = null; + private socket: net.Socket | null = null; + private disconnectCallbacks: (() => void)[] = []; + private _pendingCalls = 0; + + constructor(private socketPath: string) { } + + /** + * Register a callback to be called when the connection is lost + */ + onDisconnect(callback: () => void): void { + this.disconnectCallbacks.push(callback); + } + + private notifyDisconnect(): void { + for (const callback of this.disconnectCallbacks) { + try { + callback(); + } catch { + // Ignore callback errors + } + } + } + + connect(timeoutMs: number = 5000): Promise { + return new Promise((resolve, reject) => { + const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this.socket = net.createConnection(pipePath); + + this.socket.once('error', (error: Error) => { + clearTimeout(timeout); + reject(error); + }); + + this.socket.once('connect', () => { + clearTimeout(timeout); + try { + const reader = new rpc.SocketMessageReader(this.socket!); + const writer = new rpc.SocketMessageWriter(this.socket!); + this.connection = rpc.createMessageConnection(reader, writer); + + this.connection.onClose(() => { + this.connection = null; + this.notifyDisconnect(); + }); + this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); + + // Handle callback invocations from the .NET side + this.connection.onRequest('invokeCallback', async (callbackId: string, args: unknown) => { + const callback = callbackRegistry.get(callbackId); + if (!callback) { + throw new Error(`Callback not found: ${callbackId}`); + } + try { + // The registered wrapper handles arg unpacking and handle wrapping + // Pass this client so handles can be wrapped with typed wrapper classes + return await Promise.resolve(callback(args, this)); + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + throw new Error(`Callback execution failed: ${message}`); + } + }); + + this.connection.listen(); + + // Set the current client for cancellation registry + currentClient = this; + + resolve(); + } catch (e) { + reject(e); + } + }); + + this.socket.on('close', () => { + this.connection?.dispose(); + this.connection = null; + if (currentClient === this) { + currentClient = null; + } + this.notifyDisconnect(); + }); + }); + } + + ping(): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('ping'); + } + + /** + * Cancel a CancellationToken by its ID. + * Called when an AbortSignal is aborted. + * + * @param tokenId - The token ID to cancel + * @returns True if the token was found and cancelled, false otherwise + */ + cancelToken(tokenId: string): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('cancelToken', tokenId); + } + + /** + * Invoke an ATS capability by ID. + * + * Capabilities are operations exposed by [AspireExport] attributes. + * Results are automatically wrapped in Handle objects when applicable. + * + * @param capabilityId - The capability ID (e.g., "Aspire.Hosting/createBuilder") + * @param args - Arguments to pass to the capability + * @returns The capability result, wrapped as Handle if it's a handle type + * @throws CapabilityError if the capability fails + */ + async invokeCapability( + capabilityId: string, + args?: Record + ): Promise { + if (!this.connection) { + throw new Error('Not connected to AppHost'); + } + + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); + } + this._pendingCalls++; + + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + args ?? null + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } + } + + disconnect(): void { + try { this.connection?.dispose(); } finally { this.connection = null; } + try { this.socket?.end(); } finally { this.socket = null; } + } + + get connected(): boolean { + return this.connection !== null && this.socket !== null; + } +} diff --git a/samples/aspire-shop/ts/package-lock.json b/samples/aspire-shop/ts/package-lock.json new file mode 100644 index 00000000..c4d3800c --- /dev/null +++ b/samples/aspire-shop/ts/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "ts", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/samples/aspire-with-azure-functions/ts/.aspire/settings.json b/samples/aspire-with-azure-functions/ts/.aspire/settings.json index a60c25b1..cbded5d2 100644 --- a/samples/aspire-with-azure-functions/ts/.aspire/settings.json +++ b/samples/aspire-with-azure-functions/ts/.aspire/settings.json @@ -1,3 +1,9 @@ { - "appHostPath": "../apphost.ts" + "appHostPath": "../apphost.ts", + "sdkVersion": "13.2.0-preview.1.26159.1", + "packages": { + "Aspire.Hosting.Azure.AppContainers": "13.1.2", + "Aspire.Hosting.Azure.Storage": "13.1.2", + "Aspire.Hosting.Azure.Functions": "13.1.2" + } } \ No newline at end of file diff --git a/samples/aspire-with-azure-functions/ts/.modules/.codegen-hash b/samples/aspire-with-azure-functions/ts/.modules/.codegen-hash new file mode 100644 index 00000000..614e1876 --- /dev/null +++ b/samples/aspire-with-azure-functions/ts/.modules/.codegen-hash @@ -0,0 +1 @@ +EC1A60F277849F10E3FAA5D7EFE05EE83509414FA0AE9B5B529866A62EB7D48E \ No newline at end of file diff --git a/samples/aspire-with-azure-functions/ts/.modules/aspire.ts b/samples/aspire-with-azure-functions/ts/.modules/aspire.ts new file mode 100644 index 00000000..73dc52d2 --- /dev/null +++ b/samples/aspire-with-azure-functions/ts/.modules/aspire.ts @@ -0,0 +1,13306 @@ +// aspire.ts - Capability-based Aspire SDK +// This SDK uses the ATS (Aspire Type System) capability API. +// Capabilities are endpoints like 'Aspire.Hosting/createBuilder'. +// +// GENERATED CODE - DO NOT EDIT + +import { + AspireClient as AspireClientRpc, + Handle, + MarshalledHandle, + CapabilityError, + registerCallback, + wrapIfHandle, + registerHandleWrapper +} from './transport.js'; + +import { + ResourceBuilderBase, + ReferenceExpression, + refExpr, + AspireDict, + AspireList +} from './base.js'; + +// ============================================================================ +// Handle Type Aliases (Internal - not exported to users) +// ============================================================================ + +/** Handle to CommandLineArgsCallbackContext */ +type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; + +/** Handle to ContainerRegistryResource */ +type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; + +/** Handle to ContainerResource */ +type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource'>; + +/** Handle to CSharpAppResource */ +type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; + +/** Handle to DotnetToolResource */ +type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; + +/** Handle to EndpointReference */ +type EndpointReferenceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference'>; + +/** Handle to EndpointReferenceExpression */ +type EndpointReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression'>; + +/** Handle to EnvironmentCallbackContext */ +type EnvironmentCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext'>; + +/** Handle to ExecutableResource */ +type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource'>; + +/** Handle to ExecuteCommandContext */ +type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; + +/** Handle to IContainerFilesDestinationResource */ +type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; + +/** Handle to IResource */ +type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; + +/** Handle to IResourceWithArgs */ +type IResourceWithArgsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs'>; + +/** Handle to IResourceWithConnectionString */ +type IResourceWithConnectionStringHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString'>; + +/** Handle to IResourceWithEndpoints */ +type IResourceWithEndpointsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints'>; + +/** Handle to IResourceWithEnvironment */ +type IResourceWithEnvironmentHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment'>; + +/** Handle to IResourceWithWaitSupport */ +type IResourceWithWaitSupportHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport'>; + +/** Handle to ParameterResource */ +type ParameterResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource'>; + +/** Handle to ProjectResource */ +type ProjectResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource'>; + +/** Handle to ReferenceExpression */ +type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression'>; + +/** Handle to ReferenceExpressionBuilder */ +type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; + +/** Handle to ResourceLoggerService */ +type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; + +/** Handle to ResourceNotificationService */ +type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; + +/** Handle to ResourceUrlsCallbackContext */ +type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; + +/** Handle to ConnectionStringResource */ +type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; + +/** Handle to DistributedApplication */ +type DistributedApplicationHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplication'>; + +/** Handle to DistributedApplicationExecutionContext */ +type DistributedApplicationExecutionContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext'>; + +/** Handle to DistributedApplicationEventSubscription */ +type DistributedApplicationEventSubscriptionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.DistributedApplicationEventSubscription'>; + +/** Handle to IDistributedApplicationEventing */ +type IDistributedApplicationEventingHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing'>; + +/** Handle to ExternalServiceResource */ +type ExternalServiceResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ExternalServiceResource'>; + +/** Handle to IDistributedApplicationBuilder */ +type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder'>; + +/** Handle to IResourceWithContainerFiles */ +type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; + +/** Handle to IResourceWithServiceDiscovery */ +type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; + +/** Handle to PipelineConfigurationContext */ +type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; + +/** Handle to PipelineStep */ +type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; + +/** Handle to PipelineStepContext */ +type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; + +/** Handle to ProjectResourceOptions */ +type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; + +/** Handle to Dict */ +type DictstringanyHandle = Handle<'Aspire.Hosting/Dict'>; + +/** Handle to List */ +type ListanyHandle = Handle<'Aspire.Hosting/List'>; + +/** Handle to IConfiguration */ +type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; + +/** Handle to IHostEnvironment */ +type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; + +/** Handle to ILogger */ +type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; + +/** Handle to string[] */ +type stringArrayHandle = Handle<'string[]'>; + +/** Handle to IServiceProvider */ +type IServiceProviderHandle = Handle<'System.ComponentModel/System.IServiceProvider'>; + +// ============================================================================ +// Enum Types +// ============================================================================ + +/** Enum type for CertificateTrustScope */ +export enum CertificateTrustScope { + None = "None", + Append = "Append", + Override = "Override", + System = "System", +} + +/** Enum type for ContainerLifetime */ +export enum ContainerLifetime { + Session = "Session", + Persistent = "Persistent", +} + +/** Enum type for DistributedApplicationOperation */ +export enum DistributedApplicationOperation { + Run = "Run", + Publish = "Publish", +} + +/** Enum type for EndpointProperty */ +export enum EndpointProperty { + Url = "Url", + Host = "Host", + IPV4Host = "IPV4Host", + Port = "Port", + Scheme = "Scheme", + TargetPort = "TargetPort", + HostAndPort = "HostAndPort", +} + +/** Enum type for IconVariant */ +export enum IconVariant { + Regular = "Regular", + Filled = "Filled", +} + +/** Enum type for ImagePullPolicy */ +export enum ImagePullPolicy { + Default = "Default", + Always = "Always", + Missing = "Missing", + Never = "Never", +} + +/** Enum type for OtlpProtocol */ +export enum OtlpProtocol { + Grpc = "Grpc", + HttpProtobuf = "HttpProtobuf", + HttpJson = "HttpJson", +} + +/** Enum type for ProbeType */ +export enum ProbeType { + Startup = "Startup", + Readiness = "Readiness", + Liveness = "Liveness", +} + +/** Enum type for ProtocolType */ +export enum ProtocolType { + IP = "IP", + IPv6HopByHopOptions = "IPv6HopByHopOptions", + Unspecified = "Unspecified", + Icmp = "Icmp", + Igmp = "Igmp", + Ggp = "Ggp", + IPv4 = "IPv4", + Tcp = "Tcp", + Pup = "Pup", + Udp = "Udp", + Idp = "Idp", + IPv6 = "IPv6", + IPv6RoutingHeader = "IPv6RoutingHeader", + IPv6FragmentHeader = "IPv6FragmentHeader", + IPSecEncapsulatingSecurityPayload = "IPSecEncapsulatingSecurityPayload", + IPSecAuthenticationHeader = "IPSecAuthenticationHeader", + IcmpV6 = "IcmpV6", + IPv6NoNextHeader = "IPv6NoNextHeader", + IPv6DestinationOptions = "IPv6DestinationOptions", + ND = "ND", + Raw = "Raw", + Ipx = "Ipx", + Spx = "Spx", + SpxII = "SpxII", + Unknown = "Unknown", +} + +/** Enum type for UrlDisplayLocation */ +export enum UrlDisplayLocation { + SummaryAndDetails = "SummaryAndDetails", + DetailsOnly = "DetailsOnly", +} + +/** Enum type for WaitBehavior */ +export enum WaitBehavior { + WaitOnResourceUnavailable = "WaitOnResourceUnavailable", + StopOnResourceUnavailable = "StopOnResourceUnavailable", +} + +// ============================================================================ +// DTO Interfaces +// ============================================================================ + +/** DTO interface for CommandOptions */ +export interface CommandOptions { + description?: string; + parameter?: any; + confirmationMessage?: string; + iconName?: string; + iconVariant?: IconVariant; + isHighlighted?: boolean; + updateState?: any; +} + +/** DTO interface for CreateBuilderOptions */ +export interface CreateBuilderOptions { + args?: string[]; + projectDirectory?: string; + appHostFilePath?: string; + containerRegistryOverride?: string; + disableDashboard?: boolean; + dashboardApplicationName?: string; + allowUnsecuredTransport?: boolean; + enableResourceLogging?: boolean; +} + +/** DTO interface for ExecuteCommandResult */ +export interface ExecuteCommandResult { + success?: boolean; + canceled?: boolean; + errorMessage?: string; +} + +/** DTO interface for ResourceEventDto */ +export interface ResourceEventDto { + resourceName?: string; + resourceId?: string; + state?: string; + stateStyle?: string; + healthStatus?: string; + exitCode?: number; +} + +/** DTO interface for ResourceUrlAnnotation */ +export interface ResourceUrlAnnotation { + url?: string; + displayText?: string; + endpoint?: EndpointReferenceHandle; + displayLocation?: UrlDisplayLocation; +} + +// ============================================================================ +// Options Interfaces +// ============================================================================ + +export interface AddConnectionStringOptions { + environmentVariableName?: string; +} + +export interface AddContainerRegistryOptions { + repository?: ParameterResource; +} + +export interface AddDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface AddParameterFromConfigurationOptions { + secret?: boolean; +} + +export interface AddParameterOptions { + secret?: boolean; +} + +export interface AppendFormattedOptions { + format?: string; +} + +export interface AppendValueProviderOptions { + format?: string; +} + +export interface GetValueAsyncOptions { + cancellationToken?: AbortSignal; +} + +export interface RunOptions { + cancellationToken?: AbortSignal; +} + +export interface WaitForCompletionOptions { + exitCode?: number; +} + +export interface WithBindMountOptions { + isReadOnly?: boolean; +} + +export interface WithCommandOptions { + commandOptions?: CommandOptions; +} + +export interface WithDescriptionOptions { + enableMarkdown?: boolean; +} + +export interface WithDockerfileBaseImageOptions { + buildImage?: string; + runtimeImage?: string; +} + +export interface WithDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface WithEndpointOptions { + port?: number; + targetPort?: number; + scheme?: string; + name?: string; + env?: string; + isProxied?: boolean; + isExternal?: boolean; + protocol?: ProtocolType; +} + +export interface WithExternalServiceHttpHealthCheckOptions { + path?: string; + statusCode?: number; +} + +export interface WithHttpEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithHttpHealthCheckOptions { + path?: string; + statusCode?: number; + endpointName?: string; +} + +export interface WithHttpProbeOptions { + path?: string; + initialDelaySeconds?: number; + periodSeconds?: number; + timeoutSeconds?: number; + failureThreshold?: number; + successThreshold?: number; + endpointName?: string; +} + +export interface WithHttpsDeveloperCertificateOptions { + password?: ParameterResource; +} + +export interface WithHttpsEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithIconNameOptions { + iconVariant?: IconVariant; +} + +export interface WithImageOptions { + tag?: string; +} + +export interface WithMcpServerOptions { + path?: string; + endpointName?: string; +} + +export interface WithPipelineStepFactoryOptions { + dependsOn?: string[]; + requiredBy?: string[]; + tags?: string[]; + description?: string; +} + +export interface WithReferenceOptions { + connectionName?: string; + optional?: boolean; +} + +export interface WithRequiredCommandOptions { + helpLink?: string; +} + +export interface WithUrlExpressionOptions { + displayText?: string; +} + +export interface WithUrlOptions { + displayText?: string; +} + +export interface WithVolumeOptions { + name?: string; + isReadOnly?: boolean; +} + +// ============================================================================ +// CommandLineArgsCallbackContext +// ============================================================================ + +/** + * Type class for CommandLineArgsCallbackContext. + */ +export class CommandLineArgsCallbackContext { + constructor(private _handle: CommandLineArgsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Args property */ + private _args?: AspireList; + get args(): AspireList { + if (!this._args) { + this._args = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args', + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args' + ); + } + return this._args; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplication +// ============================================================================ + +/** + * Type class for DistributedApplication. + */ +export class DistributedApplication { + constructor(private _handle: DistributedApplicationHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Runs the distributed application */ + /** @internal */ + async _runInternal(cancellationToken?: AbortSignal): Promise { + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + await this._client.invokeCapability( + 'Aspire.Hosting/run', + rpcArgs + ); + return this; + } + + run(options?: RunOptions): DistributedApplicationPromise { + const cancellationToken = options?.cancellationToken; + return new DistributedApplicationPromise(this._runInternal(cancellationToken)); + } + +} + +/** + * Thenable wrapper for DistributedApplication that enables fluent chaining. + */ +export class DistributedApplicationPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplication) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Runs the distributed application */ + run(options?: RunOptions): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.run(options))); + } + +} + +// ============================================================================ +// DistributedApplicationExecutionContext +// ============================================================================ + +/** + * Type class for DistributedApplicationExecutionContext. + */ +export class DistributedApplicationExecutionContext { + constructor(private _handle: DistributedApplicationExecutionContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PublisherName property */ + publisherName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.publisherName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.setPublisherName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Operation property */ + operation = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.operation', + { context: this._handle } + ); + }, + }; + + /** Gets the IsPublishMode property */ + isPublishMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isPublishMode', + { context: this._handle } + ); + }, + }; + + /** Gets the IsRunMode property */ + isRunMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isRunMode', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EndpointReference +// ============================================================================ + +/** + * Type class for EndpointReference. + */ +export class EndpointReference { + constructor(private _handle: EndpointReferenceHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EndpointName property */ + endpointName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.endpointName', + { context: this._handle } + ); + }, + }; + + /** Gets the ErrorMessage property */ + errorMessage = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.errorMessage', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.setErrorMessage', + { context: this._handle, value } + ); + } + }; + + /** Gets the IsAllocated property */ + isAllocated = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isAllocated', + { context: this._handle } + ); + }, + }; + + /** Gets the Exists property */ + exists = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.exists', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttp property */ + isHttp = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttp', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttps property */ + isHttps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttps', + { context: this._handle } + ); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.port', + { context: this._handle } + ); + }, + }; + + /** Gets the TargetPort property */ + targetPort = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.targetPort', + { context: this._handle } + ); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.host', + { context: this._handle } + ); + }, + }; + + /** Gets the Scheme property */ + scheme = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.scheme', + { context: this._handle } + ); + }, + }; + + /** Gets the Url property */ + url = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.url', + { context: this._handle } + ); + }, + }; + + /** Gets the URL of the endpoint asynchronously */ + async getValueAsync(options?: GetValueAsyncOptions): Promise { + const cancellationToken = options?.cancellationToken; + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValueAsync', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for EndpointReference that enables fluent chaining. + */ +export class EndpointReferencePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: EndpointReference) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets the URL of the endpoint asynchronously */ + getValueAsync(options?: GetValueAsyncOptions): Promise { + return this._promise.then(obj => obj.getValueAsync(options)); + } + +} + +// ============================================================================ +// EndpointReferenceExpression +// ============================================================================ + +/** + * Type class for EndpointReferenceExpression. + */ +export class EndpointReferenceExpression { + constructor(private _handle: EndpointReferenceExpressionHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Endpoint property */ + endpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.endpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Property property */ + property = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.property', + { context: this._handle } + ); + }, + }; + + /** Gets the ValueExpression property */ + valueExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.valueExpression', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EnvironmentCallbackContext +// ============================================================================ + +/** + * Type class for EnvironmentCallbackContext. + */ +export class EnvironmentCallbackContext { + constructor(private _handle: EnvironmentCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EnvironmentVariables property */ + private _environmentVariables?: AspireDict; + get environmentVariables(): AspireDict { + if (!this._environmentVariables) { + this._environmentVariables = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables', + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables' + ); + } + return this._environmentVariables; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ExecuteCommandContext +// ============================================================================ + +/** + * Type class for ExecuteCommandContext. + */ +export class ExecuteCommandContext { + constructor(private _handle: ExecuteCommandContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ResourceName property */ + resourceName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.resourceName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setResourceName', + { context: this._handle, value } + ); + } + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', + { context: this._handle } + ); + }, + set: async (value: AbortSignal): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + { context: this._handle } + ); + }, + set: async (value: PipelineStep[]): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', + { context: this._handle, value } + ); + } + }; + + /** Gets pipeline steps with the specified tag */ + async getStepsByTag(tag: string): Promise { + const rpcArgs: Record = { context: this._handle, tag }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/getStepsByTag', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for PipelineConfigurationContext that enables fluent chaining. + */ +export class PipelineConfigurationContextPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineConfigurationContext) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets pipeline steps with the specified tag */ + getStepsByTag(tag: string): Promise { + return this._promise.then(obj => obj.getStepsByTag(tag)); + } + +} + +// ============================================================================ +// PipelineStep +// ============================================================================ + +/** + * Type class for PipelineStep. + */ +export class PipelineStep { + constructor(private _handle: PipelineStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.name', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Description property */ + description = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.description', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setDescription', + { context: this._handle, value } + ); + } + }; + + /** Gets the DependsOnSteps property */ + private _dependsOnSteps?: AspireList; + get dependsOnSteps(): AspireList { + if (!this._dependsOnSteps) { + this._dependsOnSteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps', + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps' + ); + } + return this._dependsOnSteps; + } + + /** Gets the RequiredBySteps property */ + private _requiredBySteps?: AspireList; + get requiredBySteps(): AspireList { + if (!this._requiredBySteps) { + this._requiredBySteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps', + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps' + ); + } + return this._requiredBySteps; + } + + /** Gets the Tags property */ + private _tags?: AspireList; + get tags(): AspireList { + if (!this._tags) { + this._tags = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.tags', + 'Aspire.Hosting.Pipelines/PipelineStep.tags' + ); + } + return this._tags; + } + + /** Adds a dependency on another step by name */ + /** @internal */ + async _dependsOnInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/dependsOn', + rpcArgs + ); + return this; + } + + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._dependsOnInternal(stepName)); + } + + /** Specifies that another step requires this step by name */ + /** @internal */ + async _requiredByInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/requiredBy', + rpcArgs + ); + return this; + } + + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._requiredByInternal(stepName)); + } + +} + +/** + * Thenable wrapper for PipelineStep that enables fluent chaining. + */ +export class PipelineStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineStep) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a dependency on another step by name */ + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.dependsOn(stepName))); + } + + /** Specifies that another step requires this step by name */ + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.requiredBy(stepName))); + } + +} + +// ============================================================================ +// PipelineStepContext +// ============================================================================ + +/** + * Type class for PipelineStepContext. + */ +export class PipelineStepContext { + constructor(private _handle: PipelineStepContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// ProjectResourceOptions +// ============================================================================ + +/** + * Type class for ProjectResourceOptions. + */ +export class ProjectResourceOptions { + constructor(private _handle: ProjectResourceOptionsHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the LaunchProfileName property */ + launchProfileName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.launchProfileName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setLaunchProfileName', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeLaunchProfile property */ + excludeLaunchProfile = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeLaunchProfile', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeLaunchProfile', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeKestrelEndpoints property */ + excludeKestrelEndpoints = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeKestrelEndpoints', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeKestrelEndpoints', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// ReferenceExpressionBuilder +// ============================================================================ + +/** + * Type class for ReferenceExpressionBuilder. + */ +export class ReferenceExpressionBuilder { + constructor(private _handle: ReferenceExpressionBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the IsEmpty property */ + isEmpty = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ReferenceExpressionBuilder.isEmpty', + { context: this._handle } + ); + }, + }; + + /** Appends a literal string to the reference expression */ + /** @internal */ + async _appendLiteralInternal(value: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendLiteral', + rpcArgs + ); + return this; + } + + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._appendLiteralInternal(value)); + } + + /** Appends a formatted string value to the reference expression */ + /** @internal */ + async _appendFormattedInternal(value: string, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendFormatted', + rpcArgs + ); + return this; + } + + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendFormattedInternal(value, format)); + } + + /** Appends a value provider to the reference expression */ + /** @internal */ + async _appendValueProviderInternal(valueProvider: any, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, valueProvider }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendValueProvider', + rpcArgs + ); + return this; + } + + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendValueProviderInternal(valueProvider, format)); + } + + /** Builds the reference expression */ + async build(): Promise { + const rpcArgs: Record = { context: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/build', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ReferenceExpressionBuilder that enables fluent chaining. + */ +export class ReferenceExpressionBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReferenceExpressionBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Appends a literal string to the reference expression */ + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendLiteral(value))); + } + + /** Appends a formatted string value to the reference expression */ + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendFormatted(value, options))); + } + + /** Appends a value provider to the reference expression */ + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendValueProvider(valueProvider, options))); + } + + /** Builds the reference expression */ + build(): Promise { + return this._promise.then(obj => obj.build()); + } + +} + +// ============================================================================ +// ResourceUrlsCallbackContext +// ============================================================================ + +/** + * Type class for ResourceUrlsCallbackContext. + */ +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Builds the distributed application */ + /** @internal */ + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', + rpcArgs + ); + return new DistributedApplication(result, this._client); + } + + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); + } + + /** Adds a connection string with a builder callback */ + /** @internal */ + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionStringBuilder', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + } + + /** Adds a container registry resource */ + /** @internal */ + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + } + + /** Adds a container resource */ + /** @internal */ + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); + } + + /** Adds a container resource built from a Dockerfile */ + /** @internal */ + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); + } + + /** Adds a .NET tool resource */ + /** @internal */ + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + } + + /** Adds an executable resource */ + /** @internal */ + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + } + + /** Adds an external service resource */ + /** @internal */ + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); + } + + /** Adds a parameter resource */ + /** @internal */ + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); + } + + /** Adds a parameter sourced from configuration */ + /** @internal */ + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + } + + /** Adds a connection string resource */ + /** @internal */ + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + } + + /** Adds a .NET project resource */ + /** @internal */ + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + } + + /** Adds a project resource with configuration options */ + /** @internal */ + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + } + + /** Adds a C# application resource */ + /** @internal */ + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + } + + /** Adds a C# application resource with configuration options */ + /** @internal */ + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + */ +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); + } + + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + } + + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + } + + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + } + + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + } + + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + } + + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); + } + + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + } + + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); + } + + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + } + + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); + } + + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); + } + + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); + } + + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); + } + + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); + } + +} + +// ============================================================================ +// DistributedApplicationEventing +// ============================================================================ + +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Unsubscribe method */ + /** @internal */ + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + rpcArgs + ); + return this; + } + + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ + +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerResource +// ============================================================================ + +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + const exitCode = options?.exitCode; + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + const password = options?.password; + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// CSharpAppResource +// ============================================================================ + +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + const exitCode = options?.exitCode; + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + const commandOptions = options?.commandOptions; + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + const password = options?.password; + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + const iconVariant = options?.iconVariant; + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// DotnetToolResource +// ============================================================================ + +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + } + + /** @internal */ + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + } + + /** @internal */ + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + } + + /** @internal */ + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + } + + /** @internal */ + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + } + + /** @internal */ + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + const exitCode = options?.exitCode; + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + const commandOptions = options?.commandOptions; + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + const password = options?.password; + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + const iconVariant = options?.iconVariant; + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for DotnetToolResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExecutableResource +// ============================================================================ + +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerFilesDestinationResource +// ============================================================================ + +export class ContainerFilesDestinationResource extends ResourceBuilderBase { + constructor(handle: IContainerFilesDestinationResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ContainerFilesDestinationResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + +} + +/** + * Thenable wrapper for ContainerFilesDestinationResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerFilesDestinationResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerFilesDestinationResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + +} + +// ============================================================================ +// Resource +// ============================================================================ + +export class Resource extends ResourceBuilderBase { + constructor(handle: IResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + const helpLink = options?.helpLink; + return new ResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + const commandOptions = options?.commandOptions; + return new ResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + const iconVariant = options?.iconVariant; + return new ResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for Resource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Resource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ResourceWithArgs +// ============================================================================ + +export class ResourceWithArgs extends ResourceBuilderBase { + constructor(handle: IResourceWithArgsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackAsyncInternal(callback)); + } + +} + +/** + * Thenable wrapper for ResourceWithArgs that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithArgsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithArgs) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + +} + +// ============================================================================ +// ResourceWithConnectionString +// ============================================================================ + +export class ResourceWithConnectionString extends ResourceBuilderBase { + constructor(handle: IResourceWithConnectionStringHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyValueInternal(name, value)); + } + +} + +/** + * Thenable wrapper for ResourceWithConnectionString that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithConnectionStringPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithConnectionString) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + +} + +// ============================================================================ +// ResourceWithContainerFiles +// ============================================================================ + +export class ResourceWithContainerFiles extends ResourceBuilderBase { + constructor(handle: IResourceWithContainerFilesHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._clearContainerFilesSourcesInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithContainerFiles that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithContainerFilesPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithContainerFiles) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + +} + +// ============================================================================ +// ResourceWithEndpoints +// ============================================================================ + +export class ResourceWithEndpoints extends ResourceBuilderBase { + constructor(handle: IResourceWithEndpointsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ResourceWithEndpointsPromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + +} + +/** + * Thenable wrapper for ResourceWithEndpoints that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEndpointsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEndpoints) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + +} + +// ============================================================================ +// ResourceWithEnvironment +// ============================================================================ + +export class ResourceWithEnvironment extends ResourceBuilderBase { + constructor(handle: IResourceWithEnvironmentHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + const password = options?.password; + return new ResourceWithEnvironmentPromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withoutHttpsCertificateInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithEnvironment that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + +} + +// ============================================================================ +// ResourceWithServiceDiscovery +// ============================================================================ + +export class ResourceWithServiceDiscovery extends ResourceBuilderBase { + constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { + super(handle, client); + } + +} + +/** + * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithServiceDiscoveryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + +} + +// ============================================================================ +// ResourceWithWaitSupport +// ============================================================================ + +export class ResourceWithWaitSupport extends ResourceBuilderBase { + constructor(handle: IResourceWithWaitSupportHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + const exitCode = options?.exitCode; + return new ResourceWithWaitSupportPromise(this._waitForCompletionInternal(dependency, exitCode)); + } + +} + +/** + * Thenable wrapper for ResourceWithWaitSupport that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithWaitSupportPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithWaitSupport) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + +} + +// ============================================================================ +// Connection Helper +// ============================================================================ + +/** + * Creates and connects to the Aspire AppHost. + * Reads connection info from environment variables set by `aspire run`. + */ +export async function connect(): Promise { + const socketPath = process.env.REMOTE_APP_HOST_SOCKET_PATH; + if (!socketPath) { + throw new Error( + 'REMOTE_APP_HOST_SOCKET_PATH environment variable not set. ' + + 'Run this application using `aspire run`.' + ); + } + + const client = new AspireClientRpc(socketPath); + await client.connect(); + + // Exit the process if the server connection is lost + client.onDisconnect(() => { + console.error('Connection to AppHost lost. Exiting...'); + process.exit(1); + }); + + return client; +} + +/** + * Creates a new distributed application builder. + * This is the entry point for building Aspire applications. + * + * @param options - Optional configuration options for the builder + * @returns A DistributedApplicationBuilder instance + * + * @example + * const builder = await createBuilder(); + * builder.addRedis("cache"); + * builder.addContainer("api", "mcr.microsoft.com/dotnet/samples:aspnetapp"); + * const app = await builder.build(); + * await app.run(); + */ +export async function createBuilder(options?: CreateBuilderOptions): Promise { + const client = await connect(); + + // Default args, projectDirectory, and appHostFilePath if not provided + // ASPIRE_APPHOST_FILEPATH is set by the CLI for consistent socket hash computation + const effectiveOptions: CreateBuilderOptions = { + ...options, + args: options?.args ?? process.argv.slice(2), + projectDirectory: options?.projectDirectory ?? process.env.ASPIRE_PROJECT_DIRECTORY ?? process.cwd(), + appHostFilePath: options?.appHostFilePath ?? process.env.ASPIRE_APPHOST_FILEPATH + }; + + const handle = await client.invokeCapability( + 'Aspire.Hosting/createBuilderWithOptions', + { options: effectiveOptions } + ); + return new DistributedApplicationBuilder(handle, client); +} + +// Re-export commonly used types +export { Handle, CapabilityError, registerCallback } from './transport.js'; +export { refExpr, ReferenceExpression } from './base.js'; + +// ============================================================================ +// Global Error Handling +// ============================================================================ + +/** + * Set up global error handlers to ensure the process exits properly on errors. + * Node.js doesn't exit on unhandled rejections by default, so we need to handle them. + */ +process.on('unhandledRejection', (reason: unknown) => { + const error = reason instanceof Error ? reason : new Error(String(reason)); + + if (reason instanceof CapabilityError) { + console.error(`\n❌ Capability Error: ${error.message}`); + console.error(` Code: ${(reason as CapabilityError).code}`); + if ((reason as CapabilityError).capability) { + console.error(` Capability: ${(reason as CapabilityError).capability}`); + } + } else { + console.error(`\n❌ Unhandled Error: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + } + + process.exit(1); +}); + +process.on('uncaughtException', (error: Error) => { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + process.exit(1); +}); + +// ============================================================================ +// Handle Wrapper Registrations +// ============================================================================ + +// Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource', (handle, client) => new CSharpAppResource(handle as CSharpAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString', (handle, client) => new ResourceWithConnectionString(handle as IResourceWithConnectionStringHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); + diff --git a/samples/aspire-with-azure-functions/ts/.modules/base.ts b/samples/aspire-with-azure-functions/ts/.modules/base.ts new file mode 100644 index 00000000..7778b0f1 --- /dev/null +++ b/samples/aspire-with-azure-functions/ts/.modules/base.ts @@ -0,0 +1,473 @@ +// aspire.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle } from './transport.js'; + +// Re-export transport types for convenience +export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; +export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; + +// ============================================================================ +// Reference Expression +// ============================================================================ + +/** + * Represents a reference expression that can be passed to capabilities. + * + * Reference expressions are serialized in the protocol as: + * ```json + * { + * "$expr": { + * "format": "redis://{0}:{1}", + * "valueProviders": [ + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:1" }, + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:2" } + * ] + * } + * } + * ``` + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export class ReferenceExpression { + // Expression mode fields + private readonly _format?: string; + private readonly _valueProviders?: unknown[]; + + // Handle mode fields (when wrapping a server-returned handle) + private readonly _handle?: Handle; + private readonly _client?: AspireClient; + + constructor(format: string, valueProviders: unknown[]); + constructor(handle: Handle, client: AspireClient); + constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { + if (typeof handleOrFormat === 'string') { + this._format = handleOrFormat; + this._valueProviders = clientOrValueProviders as unknown[]; + } else { + this._handle = handleOrFormat; + this._client = clientOrValueProviders as AspireClient; + } + } + + /** + * Creates a reference expression from a tagged template literal. + * + * @param strings - The template literal string parts + * @param values - The interpolated values (handles to value providers) + * @returns A ReferenceExpression instance + */ + static create(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + // Build the format string with {0}, {1}, etc. placeholders + let format = ''; + for (let i = 0; i < strings.length; i++) { + format += strings[i]; + if (i < values.length) { + format += `{${i}}`; + } + } + + // Extract handles from values + const valueProviders = values.map(extractHandleForExpr); + + return new ReferenceExpression(format, valueProviders); + } + + /** + * Serializes the reference expression for JSON-RPC transport. + * In template-literal mode, uses the $expr format. + * In handle mode, delegates to the handle's serialization. + */ + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + if (this._handle) { + return this._handle.toJSON(); + } + + return { + $expr: { + format: this._format!, + valueProviders: this._valueProviders && this._valueProviders.length > 0 ? this._valueProviders : undefined + } + }; + } + + /** + * String representation for debugging. + */ + toString(): string { + if (this._handle) { + return `ReferenceExpression(handle)`; + } + return `ReferenceExpression(${this._format})`; + } +} + +/** + * Extracts a value for use in reference expressions. + * Supports handles (objects) and string literals. + * @internal + */ +function extractHandleForExpr(value: unknown): unknown { + if (value === null || value === undefined) { + throw new Error('Cannot use null or undefined in reference expression'); + } + + // String literals - include directly in the expression + if (typeof value === 'string') { + return value; + } + + // Number literals - convert to string + if (typeof value === 'number') { + return String(value); + } + + // Handle objects - get their JSON representation + if (value instanceof Handle) { + return value.toJSON(); + } + + // Objects with $handle property (already in handle format) + if (typeof value === 'object' && value !== null && '$handle' in value) { + return value; + } + + // Objects with toJSON that returns a handle + if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { + const json = value.toJSON(); + if (json && typeof json === 'object' && '$handle' in json) { + return json; + } + } + + throw new Error( + `Cannot use value of type ${typeof value} in reference expression. ` + + `Expected a Handle, string, or number.` + ); +} + +/** + * Tagged template function for creating reference expressions. + * + * Use this to create dynamic expressions that reference endpoints, parameters, and other + * value providers. The expression is evaluated at runtime by Aspire. + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression using the tagged template + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export function refExpr(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + return ReferenceExpression.create(strings, ...values); +} + +// ============================================================================ +// ResourceBuilderBase +// ============================================================================ + +/** + * Base class for resource builders (e.g., RedisBuilder, ContainerBuilder). + * Provides handle management and JSON serialization. + */ +export class ResourceBuilderBase { + constructor(protected _handle: THandle, protected _client: AspireClient) {} + + toJSON(): MarshalledHandle { return this._handle.toJSON(); } +} + +// ============================================================================ +// AspireList - Mutable List Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET List. + * Provides array-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const items = await resource.getItems(); // Returns AspireList + * const count = await items.count(); + * const first = await items.get(0); + * await items.add(newItem); + * ``` + */ +export class AspireList { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the list handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual list handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual list handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of elements in the list. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.length', { + list: handle + }) as number; + } + + /** + * Gets the element at the specified index. + */ + async get(index: number): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.get', { + list: handle, + index + }) as T; + } + + /** + * Adds an element to the end of the list. + */ + async add(item: T): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.add', { + list: handle, + item + }); + } + + /** + * Removes the element at the specified index. + */ + async removeAt(index: number): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.removeAt', { + list: handle, + index + }); + } + + /** + * Clears all elements from the list. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.clear', { + list: handle + }); + } + + /** + * Converts the list to an array (creates a copy). + */ + async toArray(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.toArray', { + list: handle + }) as T[]; + } + + toJSON(): MarshalledHandle { + if (this._resolvedHandle) { + return this._resolvedHandle.toJSON(); + } + return this._handleOrContext.toJSON(); + } +} + +// ============================================================================ +// AspireDict - Mutable Dictionary Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET Dictionary. + * Provides object-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const config = await resource.getConfig(); // Returns AspireDict + * const value = await config.get("key"); + * await config.set("key", "value"); + * const hasKey = await config.containsKey("key"); + * ``` + */ +export class AspireDict { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the dictionary handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual dictionary handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual dictionary handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of key-value pairs in the dictionary. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.count', { + dict: handle + }) as number; + } + + /** + * Gets the value associated with the specified key. + * @throws If the key is not found. + */ + async get(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.get', { + dict: handle, + key + }) as V; + } + + /** + * Sets the value for the specified key. + */ + async set(key: K, value: V): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.set', { + dict: handle, + key, + value + }); + } + + /** + * Determines whether the dictionary contains the specified key. + */ + async containsKey(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.has', { + dict: handle, + key + }) as boolean; + } + + /** + * Removes the value with the specified key. + * @returns True if the element was removed; false if the key was not found. + */ + async remove(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.remove', { + dict: handle, + key + }) as boolean; + } + + /** + * Clears all key-value pairs from the dictionary. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.clear', { + dict: handle + }); + } + + /** + * Gets all keys in the dictionary. + */ + async keys(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.keys', { + dict: handle + }) as K[]; + } + + /** + * Gets all values in the dictionary. + */ + async values(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.values', { + dict: handle + }) as V[]; + } + + /** + * Converts the dictionary to a plain object (creates a copy). + * Only works when K is string. + */ + async toObject(): Promise> { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.toObject', { + dict: handle + }) as Record; + } + + async toJSON(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } +} diff --git a/samples/aspire-with-azure-functions/ts/.modules/transport.ts b/samples/aspire-with-azure-functions/ts/.modules/transport.ts new file mode 100644 index 00000000..7bddd74b --- /dev/null +++ b/samples/aspire-with-azure-functions/ts/.modules/transport.ts @@ -0,0 +1,574 @@ +// transport.ts - ATS transport layer: RPC, Handle, errors, callbacks +import * as net from 'net'; +import * as rpc from 'vscode-jsonrpc/node.js'; + +// ============================================================================ +// Base Types +// ============================================================================ + +/** + * Type for callback functions that can be registered and invoked from .NET. + * Internal: receives args and client for handle wrapping. + */ +export type CallbackFunction = (args: unknown, client: AspireClient) => unknown | Promise; + +/** + * Represents a handle to a .NET object in the ATS system. + * Handles are typed references that can be passed between capabilities. + */ +export interface MarshalledHandle { + /** The handle ID (instance number) */ + $handle: string; + /** The ATS type ID */ + $type: string; +} + +/** + * Error details for ATS errors. + */ +export interface AtsErrorDetails { + /** The parameter that caused the error */ + parameter?: string; + /** The expected type or value */ + expected?: string; + /** The actual type or value */ + actual?: string; +} + +/** + * Structured error from ATS capability invocation. + */ +export interface AtsError { + /** Machine-readable error code */ + code: string; + /** Human-readable error message */ + message: string; + /** The capability that failed (if applicable) */ + capability?: string; + /** Additional error details */ + details?: AtsErrorDetails; +} + +/** + * ATS error codes returned by the server. + */ +export const AtsErrorCodes = { + /** Unknown capability ID */ + CapabilityNotFound: 'CAPABILITY_NOT_FOUND', + /** Handle ID doesn't exist or was disposed */ + HandleNotFound: 'HANDLE_NOT_FOUND', + /** Handle type doesn't satisfy capability's type constraint */ + TypeMismatch: 'TYPE_MISMATCH', + /** Missing required argument or wrong type */ + InvalidArgument: 'INVALID_ARGUMENT', + /** Argument value outside valid range */ + ArgumentOutOfRange: 'ARGUMENT_OUT_OF_RANGE', + /** Error occurred during callback invocation */ + CallbackError: 'CALLBACK_ERROR', + /** Unexpected error in capability execution */ + InternalError: 'INTERNAL_ERROR', +} as const; + +/** + * Type guard to check if a value is an ATS error response. + */ +export function isAtsError(value: unknown): value is { $error: AtsError } { + return ( + value !== null && + typeof value === 'object' && + '$error' in value && + typeof (value as { $error: unknown }).$error === 'object' + ); +} + +/** + * Type guard to check if a value is a marshalled handle. + */ +export function isMarshalledHandle(value: unknown): value is MarshalledHandle { + return ( + value !== null && + typeof value === 'object' && + '$handle' in value && + '$type' in value + ); +} + +// ============================================================================ +// Handle +// ============================================================================ + +/** + * A typed handle to a .NET object in the ATS system. + * Handles are opaque references that can be passed to capabilities. + * + * @typeParam T - The ATS type ID (e.g., "Aspire.Hosting/IDistributedApplicationBuilder") + */ +export class Handle { + private readonly _handleId: string; + private readonly _typeId: T; + + constructor(marshalled: MarshalledHandle) { + this._handleId = marshalled.$handle; + this._typeId = marshalled.$type as T; + } + + /** The handle ID (instance number) */ + get $handle(): string { + return this._handleId; + } + + /** The ATS type ID */ + get $type(): T { + return this._typeId; + } + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { + return { + $handle: this._handleId, + $type: this._typeId + }; + } + + /** String representation for debugging */ + toString(): string { + return `Handle<${this._typeId}>(${this._handleId})`; + } +} + +// ============================================================================ +// Handle Wrapper Registry +// ============================================================================ + +/** + * Factory function for creating typed wrapper instances from handles. + */ +export type HandleWrapperFactory = (handle: Handle, client: AspireClient) => unknown; + +/** + * Registry of handle wrapper factories by type ID. + * Generated code registers wrapper classes here so callback handles can be properly typed. + */ +const handleWrapperRegistry = new Map(); + +/** + * Register a wrapper factory for a type ID. + * Called by generated code to register wrapper classes. + */ +export function registerHandleWrapper(typeId: string, factory: HandleWrapperFactory): void { + handleWrapperRegistry.set(typeId, factory); +} + +/** + * Checks if a value is a marshalled handle and wraps it appropriately. + * Uses the wrapper registry to create typed wrapper instances when available. + * + * @param value - The value to potentially wrap + * @param client - Optional client for creating typed wrapper instances + */ +export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { + if (value && typeof value === 'object') { + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); + } + } + + return handle; + } + } + return value; +} + +// ============================================================================ +// Capability Error +// ============================================================================ + +/** + * Error thrown when an ATS capability invocation fails. + */ +export class CapabilityError extends Error { + constructor( + /** The structured error from the server */ + public readonly error: AtsError + ) { + super(error.message); + this.name = 'CapabilityError'; + } + + /** Machine-readable error code */ + get code(): string { + return this.error.code; + } + + /** The capability that failed (if applicable) */ + get capability(): string | undefined { + return this.error.capability; + } +} + +// ============================================================================ +// Callback Registry +// ============================================================================ + +const callbackRegistry = new Map(); +let callbackIdCounter = 0; + +/** + * Register a callback function that can be invoked from the .NET side. + * Returns a callback ID that should be passed to methods accepting callbacks. + * + * .NET passes arguments as an object with positional keys: `{ p0: value0, p1: value1, ... }` + * This function automatically extracts positional parameters and wraps handles. + * + * @example + * // Single parameter callback + * const id = registerCallback((ctx) => console.log(ctx)); + * // .NET sends: { p0: { $handle: "...", $type: "..." } } + * // Callback receives: Handle instance + * + * @example + * // Multi-parameter callback + * const id = registerCallback((a, b) => console.log(a, b)); + * // .NET sends: { p0: "hello", p1: 42 } + * // Callback receives: "hello", 42 + */ +export function registerCallback( + callback: (...args: any[]) => TResult | Promise +): string { + const callbackId = `callback_${++callbackIdCounter}_${Date.now()}`; + + // Wrap the callback to handle .NET's positional argument format + const wrapper: CallbackFunction = async (args: unknown, client: AspireClient) => { + // .NET sends args as object { p0: value0, p1: value1, ... } + if (args && typeof args === 'object' && !Array.isArray(args)) { + const argObj = args as Record; + const argArray: unknown[] = []; + + // Extract positional parameters (p0, p1, p2, ...) + for (let i = 0; ; i++) { + const key = `p${i}`; + if (key in argObj) { + argArray.push(wrapIfHandle(argObj[key], client)); + } else { + break; + } + } + + if (argArray.length > 0) { + // Spread positional arguments to callback + const result = await callback(...argArray); + // DTO writeback protocol: when a void callback returns undefined, we + // return the original args object so the .NET host can detect property + // mutations made by the callback and apply them back to the original + // C# DTO objects. DTO args are plain JS objects (not Handle wrappers), + // so any property changes the callback made are reflected in args. + // + // Non-void callbacks (result !== undefined) return their actual result. + // The .NET side only activates writeback for void delegates whose + // parameters include [AspireDto] types — all other cases discard the + // returned args object, so the extra wire payload is harmless. + // + // IMPORTANT: callbacks that intentionally return undefined will also + // trigger this path. For non-void delegate types, the C# proxy uses + // a result-unmarshalling path (not writeback), so returning args will + // cause an unmarshal error. Void callbacks should never return a + // meaningful value; non-void callbacks should always return one. + return result !== undefined ? result : args; + } + + // No positional params found — nothing to write back + return await callback(); + } + + // Null/undefined - call with no args + if (args === null || args === undefined) { + return await callback(); + } + + // Primitive value - pass as single arg (shouldn't happen with current protocol) + return await callback(wrapIfHandle(args, client)); + }; + + callbackRegistry.set(callbackId, wrapper); + return callbackId; +} + +/** + * Unregister a callback by its ID. + */ +export function unregisterCallback(callbackId: string): boolean { + return callbackRegistry.delete(callbackId); +} + +/** + * Get the number of registered callbacks. + */ +export function getCallbackCount(): number { + return callbackRegistry.size; +} + +// ============================================================================ +// Cancellation Token Registry +// ============================================================================ + +/** + * Registry for cancellation tokens. + * Maps cancellation IDs to cleanup functions. + */ +const cancellationRegistry = new Map void>(); +let cancellationIdCounter = 0; + +/** + * A reference to the current AspireClient for sending cancel requests. + * Set by AspireClient.connect(). + */ +let currentClient: AspireClient | null = null; + +/** + * Register an AbortSignal for cancellation support. + * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * + * When the AbortSignal is aborted, sends a cancelToken request to the host. + * + * @param signal - The AbortSignal to register (optional) + * @returns The cancellation ID, or undefined if no signal provided + * + * @example + * const controller = new AbortController(); + * const id = registerCancellation(controller.signal); + * // Pass id to capability invocation + * // Later: controller.abort() will cancel the operation + */ +export function registerCancellation(signal?: AbortSignal): string | undefined { + if (!signal) { + return undefined; + } + + // Already aborted? Don't register + if (signal.aborted) { + return undefined; + } + + const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; + + // Set up the abort listener + const onAbort = () => { + // Send cancel request to host + if (currentClient?.connected) { + currentClient.cancelToken(cancellationId).catch(() => { + // Ignore errors - the operation may have already completed + }); + } + // Clean up the listener + cancellationRegistry.delete(cancellationId); + }; + + // Listen for abort + signal.addEventListener('abort', onAbort, { once: true }); + + // Store cleanup function + cancellationRegistry.set(cancellationId, () => { + signal.removeEventListener('abort', onAbort); + }); + + return cancellationId; +} + +/** + * Unregister a cancellation token by its ID. + * Call this when the operation completes to clean up resources. + * + * @param cancellationId - The cancellation ID to unregister + */ +export function unregisterCancellation(cancellationId: string | undefined): void { + if (!cancellationId) { + return; + } + + const cleanup = cancellationRegistry.get(cancellationId); + if (cleanup) { + cleanup(); + cancellationRegistry.delete(cancellationId); + } +} + +// ============================================================================ +// AspireClient (JSON-RPC Connection) +// ============================================================================ + +/** + * Client for connecting to the Aspire AppHost via socket/named pipe. + */ +export class AspireClient { + private connection: rpc.MessageConnection | null = null; + private socket: net.Socket | null = null; + private disconnectCallbacks: (() => void)[] = []; + private _pendingCalls = 0; + + constructor(private socketPath: string) { } + + /** + * Register a callback to be called when the connection is lost + */ + onDisconnect(callback: () => void): void { + this.disconnectCallbacks.push(callback); + } + + private notifyDisconnect(): void { + for (const callback of this.disconnectCallbacks) { + try { + callback(); + } catch { + // Ignore callback errors + } + } + } + + connect(timeoutMs: number = 5000): Promise { + return new Promise((resolve, reject) => { + const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this.socket = net.createConnection(pipePath); + + this.socket.once('error', (error: Error) => { + clearTimeout(timeout); + reject(error); + }); + + this.socket.once('connect', () => { + clearTimeout(timeout); + try { + const reader = new rpc.SocketMessageReader(this.socket!); + const writer = new rpc.SocketMessageWriter(this.socket!); + this.connection = rpc.createMessageConnection(reader, writer); + + this.connection.onClose(() => { + this.connection = null; + this.notifyDisconnect(); + }); + this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); + + // Handle callback invocations from the .NET side + this.connection.onRequest('invokeCallback', async (callbackId: string, args: unknown) => { + const callback = callbackRegistry.get(callbackId); + if (!callback) { + throw new Error(`Callback not found: ${callbackId}`); + } + try { + // The registered wrapper handles arg unpacking and handle wrapping + // Pass this client so handles can be wrapped with typed wrapper classes + return await Promise.resolve(callback(args, this)); + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + throw new Error(`Callback execution failed: ${message}`); + } + }); + + this.connection.listen(); + + // Set the current client for cancellation registry + currentClient = this; + + resolve(); + } catch (e) { + reject(e); + } + }); + + this.socket.on('close', () => { + this.connection?.dispose(); + this.connection = null; + if (currentClient === this) { + currentClient = null; + } + this.notifyDisconnect(); + }); + }); + } + + ping(): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('ping'); + } + + /** + * Cancel a CancellationToken by its ID. + * Called when an AbortSignal is aborted. + * + * @param tokenId - The token ID to cancel + * @returns True if the token was found and cancelled, false otherwise + */ + cancelToken(tokenId: string): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('cancelToken', tokenId); + } + + /** + * Invoke an ATS capability by ID. + * + * Capabilities are operations exposed by [AspireExport] attributes. + * Results are automatically wrapped in Handle objects when applicable. + * + * @param capabilityId - The capability ID (e.g., "Aspire.Hosting/createBuilder") + * @param args - Arguments to pass to the capability + * @returns The capability result, wrapped as Handle if it's a handle type + * @throws CapabilityError if the capability fails + */ + async invokeCapability( + capabilityId: string, + args?: Record + ): Promise { + if (!this.connection) { + throw new Error('Not connected to AppHost'); + } + + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); + } + this._pendingCalls++; + + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + args ?? null + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } + } + + disconnect(): void { + try { this.connection?.dispose(); } finally { this.connection = null; } + try { this.socket?.end(); } finally { this.socket = null; } + } + + get connected(): boolean { + return this.connection !== null && this.socket !== null; + } +} diff --git a/samples/aspire-with-azure-functions/ts/package-lock.json b/samples/aspire-with-azure-functions/ts/package-lock.json new file mode 100644 index 00000000..c4d3800c --- /dev/null +++ b/samples/aspire-with-azure-functions/ts/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "ts", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/samples/aspire-with-javascript/ts/.aspire/settings.json b/samples/aspire-with-javascript/ts/.aspire/settings.json index a60c25b1..14ce40b7 100644 --- a/samples/aspire-with-javascript/ts/.aspire/settings.json +++ b/samples/aspire-with-javascript/ts/.aspire/settings.json @@ -1,3 +1,7 @@ { - "appHostPath": "../apphost.ts" + "appHostPath": "../apphost.ts", + "sdkVersion": "13.2.0-preview.1.26159.1", + "packages": { + "Aspire.Hosting.JavaScript": "13.1.2" + } } \ No newline at end of file diff --git a/samples/aspire-with-javascript/ts/.modules/.codegen-hash b/samples/aspire-with-javascript/ts/.modules/.codegen-hash new file mode 100644 index 00000000..3be8a4c4 --- /dev/null +++ b/samples/aspire-with-javascript/ts/.modules/.codegen-hash @@ -0,0 +1 @@ +C83A16C77B47A5C68F56361378E1F2F14BC156C402FB624987486277E4429782 \ No newline at end of file diff --git a/samples/aspire-with-javascript/ts/.modules/aspire.ts b/samples/aspire-with-javascript/ts/.modules/aspire.ts new file mode 100644 index 00000000..73dc52d2 --- /dev/null +++ b/samples/aspire-with-javascript/ts/.modules/aspire.ts @@ -0,0 +1,13306 @@ +// aspire.ts - Capability-based Aspire SDK +// This SDK uses the ATS (Aspire Type System) capability API. +// Capabilities are endpoints like 'Aspire.Hosting/createBuilder'. +// +// GENERATED CODE - DO NOT EDIT + +import { + AspireClient as AspireClientRpc, + Handle, + MarshalledHandle, + CapabilityError, + registerCallback, + wrapIfHandle, + registerHandleWrapper +} from './transport.js'; + +import { + ResourceBuilderBase, + ReferenceExpression, + refExpr, + AspireDict, + AspireList +} from './base.js'; + +// ============================================================================ +// Handle Type Aliases (Internal - not exported to users) +// ============================================================================ + +/** Handle to CommandLineArgsCallbackContext */ +type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; + +/** Handle to ContainerRegistryResource */ +type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; + +/** Handle to ContainerResource */ +type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource'>; + +/** Handle to CSharpAppResource */ +type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; + +/** Handle to DotnetToolResource */ +type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; + +/** Handle to EndpointReference */ +type EndpointReferenceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference'>; + +/** Handle to EndpointReferenceExpression */ +type EndpointReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression'>; + +/** Handle to EnvironmentCallbackContext */ +type EnvironmentCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext'>; + +/** Handle to ExecutableResource */ +type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource'>; + +/** Handle to ExecuteCommandContext */ +type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; + +/** Handle to IContainerFilesDestinationResource */ +type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; + +/** Handle to IResource */ +type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; + +/** Handle to IResourceWithArgs */ +type IResourceWithArgsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs'>; + +/** Handle to IResourceWithConnectionString */ +type IResourceWithConnectionStringHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString'>; + +/** Handle to IResourceWithEndpoints */ +type IResourceWithEndpointsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints'>; + +/** Handle to IResourceWithEnvironment */ +type IResourceWithEnvironmentHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment'>; + +/** Handle to IResourceWithWaitSupport */ +type IResourceWithWaitSupportHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport'>; + +/** Handle to ParameterResource */ +type ParameterResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource'>; + +/** Handle to ProjectResource */ +type ProjectResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource'>; + +/** Handle to ReferenceExpression */ +type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression'>; + +/** Handle to ReferenceExpressionBuilder */ +type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; + +/** Handle to ResourceLoggerService */ +type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; + +/** Handle to ResourceNotificationService */ +type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; + +/** Handle to ResourceUrlsCallbackContext */ +type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; + +/** Handle to ConnectionStringResource */ +type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; + +/** Handle to DistributedApplication */ +type DistributedApplicationHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplication'>; + +/** Handle to DistributedApplicationExecutionContext */ +type DistributedApplicationExecutionContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext'>; + +/** Handle to DistributedApplicationEventSubscription */ +type DistributedApplicationEventSubscriptionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.DistributedApplicationEventSubscription'>; + +/** Handle to IDistributedApplicationEventing */ +type IDistributedApplicationEventingHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing'>; + +/** Handle to ExternalServiceResource */ +type ExternalServiceResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ExternalServiceResource'>; + +/** Handle to IDistributedApplicationBuilder */ +type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder'>; + +/** Handle to IResourceWithContainerFiles */ +type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; + +/** Handle to IResourceWithServiceDiscovery */ +type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; + +/** Handle to PipelineConfigurationContext */ +type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; + +/** Handle to PipelineStep */ +type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; + +/** Handle to PipelineStepContext */ +type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; + +/** Handle to ProjectResourceOptions */ +type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; + +/** Handle to Dict */ +type DictstringanyHandle = Handle<'Aspire.Hosting/Dict'>; + +/** Handle to List */ +type ListanyHandle = Handle<'Aspire.Hosting/List'>; + +/** Handle to IConfiguration */ +type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; + +/** Handle to IHostEnvironment */ +type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; + +/** Handle to ILogger */ +type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; + +/** Handle to string[] */ +type stringArrayHandle = Handle<'string[]'>; + +/** Handle to IServiceProvider */ +type IServiceProviderHandle = Handle<'System.ComponentModel/System.IServiceProvider'>; + +// ============================================================================ +// Enum Types +// ============================================================================ + +/** Enum type for CertificateTrustScope */ +export enum CertificateTrustScope { + None = "None", + Append = "Append", + Override = "Override", + System = "System", +} + +/** Enum type for ContainerLifetime */ +export enum ContainerLifetime { + Session = "Session", + Persistent = "Persistent", +} + +/** Enum type for DistributedApplicationOperation */ +export enum DistributedApplicationOperation { + Run = "Run", + Publish = "Publish", +} + +/** Enum type for EndpointProperty */ +export enum EndpointProperty { + Url = "Url", + Host = "Host", + IPV4Host = "IPV4Host", + Port = "Port", + Scheme = "Scheme", + TargetPort = "TargetPort", + HostAndPort = "HostAndPort", +} + +/** Enum type for IconVariant */ +export enum IconVariant { + Regular = "Regular", + Filled = "Filled", +} + +/** Enum type for ImagePullPolicy */ +export enum ImagePullPolicy { + Default = "Default", + Always = "Always", + Missing = "Missing", + Never = "Never", +} + +/** Enum type for OtlpProtocol */ +export enum OtlpProtocol { + Grpc = "Grpc", + HttpProtobuf = "HttpProtobuf", + HttpJson = "HttpJson", +} + +/** Enum type for ProbeType */ +export enum ProbeType { + Startup = "Startup", + Readiness = "Readiness", + Liveness = "Liveness", +} + +/** Enum type for ProtocolType */ +export enum ProtocolType { + IP = "IP", + IPv6HopByHopOptions = "IPv6HopByHopOptions", + Unspecified = "Unspecified", + Icmp = "Icmp", + Igmp = "Igmp", + Ggp = "Ggp", + IPv4 = "IPv4", + Tcp = "Tcp", + Pup = "Pup", + Udp = "Udp", + Idp = "Idp", + IPv6 = "IPv6", + IPv6RoutingHeader = "IPv6RoutingHeader", + IPv6FragmentHeader = "IPv6FragmentHeader", + IPSecEncapsulatingSecurityPayload = "IPSecEncapsulatingSecurityPayload", + IPSecAuthenticationHeader = "IPSecAuthenticationHeader", + IcmpV6 = "IcmpV6", + IPv6NoNextHeader = "IPv6NoNextHeader", + IPv6DestinationOptions = "IPv6DestinationOptions", + ND = "ND", + Raw = "Raw", + Ipx = "Ipx", + Spx = "Spx", + SpxII = "SpxII", + Unknown = "Unknown", +} + +/** Enum type for UrlDisplayLocation */ +export enum UrlDisplayLocation { + SummaryAndDetails = "SummaryAndDetails", + DetailsOnly = "DetailsOnly", +} + +/** Enum type for WaitBehavior */ +export enum WaitBehavior { + WaitOnResourceUnavailable = "WaitOnResourceUnavailable", + StopOnResourceUnavailable = "StopOnResourceUnavailable", +} + +// ============================================================================ +// DTO Interfaces +// ============================================================================ + +/** DTO interface for CommandOptions */ +export interface CommandOptions { + description?: string; + parameter?: any; + confirmationMessage?: string; + iconName?: string; + iconVariant?: IconVariant; + isHighlighted?: boolean; + updateState?: any; +} + +/** DTO interface for CreateBuilderOptions */ +export interface CreateBuilderOptions { + args?: string[]; + projectDirectory?: string; + appHostFilePath?: string; + containerRegistryOverride?: string; + disableDashboard?: boolean; + dashboardApplicationName?: string; + allowUnsecuredTransport?: boolean; + enableResourceLogging?: boolean; +} + +/** DTO interface for ExecuteCommandResult */ +export interface ExecuteCommandResult { + success?: boolean; + canceled?: boolean; + errorMessage?: string; +} + +/** DTO interface for ResourceEventDto */ +export interface ResourceEventDto { + resourceName?: string; + resourceId?: string; + state?: string; + stateStyle?: string; + healthStatus?: string; + exitCode?: number; +} + +/** DTO interface for ResourceUrlAnnotation */ +export interface ResourceUrlAnnotation { + url?: string; + displayText?: string; + endpoint?: EndpointReferenceHandle; + displayLocation?: UrlDisplayLocation; +} + +// ============================================================================ +// Options Interfaces +// ============================================================================ + +export interface AddConnectionStringOptions { + environmentVariableName?: string; +} + +export interface AddContainerRegistryOptions { + repository?: ParameterResource; +} + +export interface AddDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface AddParameterFromConfigurationOptions { + secret?: boolean; +} + +export interface AddParameterOptions { + secret?: boolean; +} + +export interface AppendFormattedOptions { + format?: string; +} + +export interface AppendValueProviderOptions { + format?: string; +} + +export interface GetValueAsyncOptions { + cancellationToken?: AbortSignal; +} + +export interface RunOptions { + cancellationToken?: AbortSignal; +} + +export interface WaitForCompletionOptions { + exitCode?: number; +} + +export interface WithBindMountOptions { + isReadOnly?: boolean; +} + +export interface WithCommandOptions { + commandOptions?: CommandOptions; +} + +export interface WithDescriptionOptions { + enableMarkdown?: boolean; +} + +export interface WithDockerfileBaseImageOptions { + buildImage?: string; + runtimeImage?: string; +} + +export interface WithDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface WithEndpointOptions { + port?: number; + targetPort?: number; + scheme?: string; + name?: string; + env?: string; + isProxied?: boolean; + isExternal?: boolean; + protocol?: ProtocolType; +} + +export interface WithExternalServiceHttpHealthCheckOptions { + path?: string; + statusCode?: number; +} + +export interface WithHttpEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithHttpHealthCheckOptions { + path?: string; + statusCode?: number; + endpointName?: string; +} + +export interface WithHttpProbeOptions { + path?: string; + initialDelaySeconds?: number; + periodSeconds?: number; + timeoutSeconds?: number; + failureThreshold?: number; + successThreshold?: number; + endpointName?: string; +} + +export interface WithHttpsDeveloperCertificateOptions { + password?: ParameterResource; +} + +export interface WithHttpsEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithIconNameOptions { + iconVariant?: IconVariant; +} + +export interface WithImageOptions { + tag?: string; +} + +export interface WithMcpServerOptions { + path?: string; + endpointName?: string; +} + +export interface WithPipelineStepFactoryOptions { + dependsOn?: string[]; + requiredBy?: string[]; + tags?: string[]; + description?: string; +} + +export interface WithReferenceOptions { + connectionName?: string; + optional?: boolean; +} + +export interface WithRequiredCommandOptions { + helpLink?: string; +} + +export interface WithUrlExpressionOptions { + displayText?: string; +} + +export interface WithUrlOptions { + displayText?: string; +} + +export interface WithVolumeOptions { + name?: string; + isReadOnly?: boolean; +} + +// ============================================================================ +// CommandLineArgsCallbackContext +// ============================================================================ + +/** + * Type class for CommandLineArgsCallbackContext. + */ +export class CommandLineArgsCallbackContext { + constructor(private _handle: CommandLineArgsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Args property */ + private _args?: AspireList; + get args(): AspireList { + if (!this._args) { + this._args = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args', + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args' + ); + } + return this._args; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplication +// ============================================================================ + +/** + * Type class for DistributedApplication. + */ +export class DistributedApplication { + constructor(private _handle: DistributedApplicationHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Runs the distributed application */ + /** @internal */ + async _runInternal(cancellationToken?: AbortSignal): Promise { + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + await this._client.invokeCapability( + 'Aspire.Hosting/run', + rpcArgs + ); + return this; + } + + run(options?: RunOptions): DistributedApplicationPromise { + const cancellationToken = options?.cancellationToken; + return new DistributedApplicationPromise(this._runInternal(cancellationToken)); + } + +} + +/** + * Thenable wrapper for DistributedApplication that enables fluent chaining. + */ +export class DistributedApplicationPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplication) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Runs the distributed application */ + run(options?: RunOptions): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.run(options))); + } + +} + +// ============================================================================ +// DistributedApplicationExecutionContext +// ============================================================================ + +/** + * Type class for DistributedApplicationExecutionContext. + */ +export class DistributedApplicationExecutionContext { + constructor(private _handle: DistributedApplicationExecutionContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PublisherName property */ + publisherName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.publisherName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.setPublisherName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Operation property */ + operation = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.operation', + { context: this._handle } + ); + }, + }; + + /** Gets the IsPublishMode property */ + isPublishMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isPublishMode', + { context: this._handle } + ); + }, + }; + + /** Gets the IsRunMode property */ + isRunMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isRunMode', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EndpointReference +// ============================================================================ + +/** + * Type class for EndpointReference. + */ +export class EndpointReference { + constructor(private _handle: EndpointReferenceHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EndpointName property */ + endpointName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.endpointName', + { context: this._handle } + ); + }, + }; + + /** Gets the ErrorMessage property */ + errorMessage = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.errorMessage', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.setErrorMessage', + { context: this._handle, value } + ); + } + }; + + /** Gets the IsAllocated property */ + isAllocated = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isAllocated', + { context: this._handle } + ); + }, + }; + + /** Gets the Exists property */ + exists = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.exists', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttp property */ + isHttp = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttp', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttps property */ + isHttps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttps', + { context: this._handle } + ); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.port', + { context: this._handle } + ); + }, + }; + + /** Gets the TargetPort property */ + targetPort = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.targetPort', + { context: this._handle } + ); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.host', + { context: this._handle } + ); + }, + }; + + /** Gets the Scheme property */ + scheme = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.scheme', + { context: this._handle } + ); + }, + }; + + /** Gets the Url property */ + url = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.url', + { context: this._handle } + ); + }, + }; + + /** Gets the URL of the endpoint asynchronously */ + async getValueAsync(options?: GetValueAsyncOptions): Promise { + const cancellationToken = options?.cancellationToken; + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValueAsync', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for EndpointReference that enables fluent chaining. + */ +export class EndpointReferencePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: EndpointReference) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets the URL of the endpoint asynchronously */ + getValueAsync(options?: GetValueAsyncOptions): Promise { + return this._promise.then(obj => obj.getValueAsync(options)); + } + +} + +// ============================================================================ +// EndpointReferenceExpression +// ============================================================================ + +/** + * Type class for EndpointReferenceExpression. + */ +export class EndpointReferenceExpression { + constructor(private _handle: EndpointReferenceExpressionHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Endpoint property */ + endpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.endpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Property property */ + property = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.property', + { context: this._handle } + ); + }, + }; + + /** Gets the ValueExpression property */ + valueExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.valueExpression', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EnvironmentCallbackContext +// ============================================================================ + +/** + * Type class for EnvironmentCallbackContext. + */ +export class EnvironmentCallbackContext { + constructor(private _handle: EnvironmentCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EnvironmentVariables property */ + private _environmentVariables?: AspireDict; + get environmentVariables(): AspireDict { + if (!this._environmentVariables) { + this._environmentVariables = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables', + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables' + ); + } + return this._environmentVariables; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ExecuteCommandContext +// ============================================================================ + +/** + * Type class for ExecuteCommandContext. + */ +export class ExecuteCommandContext { + constructor(private _handle: ExecuteCommandContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ResourceName property */ + resourceName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.resourceName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setResourceName', + { context: this._handle, value } + ); + } + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', + { context: this._handle } + ); + }, + set: async (value: AbortSignal): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + { context: this._handle } + ); + }, + set: async (value: PipelineStep[]): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', + { context: this._handle, value } + ); + } + }; + + /** Gets pipeline steps with the specified tag */ + async getStepsByTag(tag: string): Promise { + const rpcArgs: Record = { context: this._handle, tag }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/getStepsByTag', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for PipelineConfigurationContext that enables fluent chaining. + */ +export class PipelineConfigurationContextPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineConfigurationContext) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets pipeline steps with the specified tag */ + getStepsByTag(tag: string): Promise { + return this._promise.then(obj => obj.getStepsByTag(tag)); + } + +} + +// ============================================================================ +// PipelineStep +// ============================================================================ + +/** + * Type class for PipelineStep. + */ +export class PipelineStep { + constructor(private _handle: PipelineStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.name', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Description property */ + description = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.description', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setDescription', + { context: this._handle, value } + ); + } + }; + + /** Gets the DependsOnSteps property */ + private _dependsOnSteps?: AspireList; + get dependsOnSteps(): AspireList { + if (!this._dependsOnSteps) { + this._dependsOnSteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps', + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps' + ); + } + return this._dependsOnSteps; + } + + /** Gets the RequiredBySteps property */ + private _requiredBySteps?: AspireList; + get requiredBySteps(): AspireList { + if (!this._requiredBySteps) { + this._requiredBySteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps', + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps' + ); + } + return this._requiredBySteps; + } + + /** Gets the Tags property */ + private _tags?: AspireList; + get tags(): AspireList { + if (!this._tags) { + this._tags = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.tags', + 'Aspire.Hosting.Pipelines/PipelineStep.tags' + ); + } + return this._tags; + } + + /** Adds a dependency on another step by name */ + /** @internal */ + async _dependsOnInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/dependsOn', + rpcArgs + ); + return this; + } + + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._dependsOnInternal(stepName)); + } + + /** Specifies that another step requires this step by name */ + /** @internal */ + async _requiredByInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/requiredBy', + rpcArgs + ); + return this; + } + + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._requiredByInternal(stepName)); + } + +} + +/** + * Thenable wrapper for PipelineStep that enables fluent chaining. + */ +export class PipelineStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineStep) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a dependency on another step by name */ + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.dependsOn(stepName))); + } + + /** Specifies that another step requires this step by name */ + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.requiredBy(stepName))); + } + +} + +// ============================================================================ +// PipelineStepContext +// ============================================================================ + +/** + * Type class for PipelineStepContext. + */ +export class PipelineStepContext { + constructor(private _handle: PipelineStepContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// ProjectResourceOptions +// ============================================================================ + +/** + * Type class for ProjectResourceOptions. + */ +export class ProjectResourceOptions { + constructor(private _handle: ProjectResourceOptionsHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the LaunchProfileName property */ + launchProfileName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.launchProfileName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setLaunchProfileName', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeLaunchProfile property */ + excludeLaunchProfile = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeLaunchProfile', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeLaunchProfile', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeKestrelEndpoints property */ + excludeKestrelEndpoints = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeKestrelEndpoints', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeKestrelEndpoints', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// ReferenceExpressionBuilder +// ============================================================================ + +/** + * Type class for ReferenceExpressionBuilder. + */ +export class ReferenceExpressionBuilder { + constructor(private _handle: ReferenceExpressionBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the IsEmpty property */ + isEmpty = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ReferenceExpressionBuilder.isEmpty', + { context: this._handle } + ); + }, + }; + + /** Appends a literal string to the reference expression */ + /** @internal */ + async _appendLiteralInternal(value: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendLiteral', + rpcArgs + ); + return this; + } + + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._appendLiteralInternal(value)); + } + + /** Appends a formatted string value to the reference expression */ + /** @internal */ + async _appendFormattedInternal(value: string, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendFormatted', + rpcArgs + ); + return this; + } + + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendFormattedInternal(value, format)); + } + + /** Appends a value provider to the reference expression */ + /** @internal */ + async _appendValueProviderInternal(valueProvider: any, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, valueProvider }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendValueProvider', + rpcArgs + ); + return this; + } + + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendValueProviderInternal(valueProvider, format)); + } + + /** Builds the reference expression */ + async build(): Promise { + const rpcArgs: Record = { context: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/build', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ReferenceExpressionBuilder that enables fluent chaining. + */ +export class ReferenceExpressionBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReferenceExpressionBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Appends a literal string to the reference expression */ + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendLiteral(value))); + } + + /** Appends a formatted string value to the reference expression */ + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendFormatted(value, options))); + } + + /** Appends a value provider to the reference expression */ + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendValueProvider(valueProvider, options))); + } + + /** Builds the reference expression */ + build(): Promise { + return this._promise.then(obj => obj.build()); + } + +} + +// ============================================================================ +// ResourceUrlsCallbackContext +// ============================================================================ + +/** + * Type class for ResourceUrlsCallbackContext. + */ +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Builds the distributed application */ + /** @internal */ + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', + rpcArgs + ); + return new DistributedApplication(result, this._client); + } + + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); + } + + /** Adds a connection string with a builder callback */ + /** @internal */ + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionStringBuilder', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + } + + /** Adds a container registry resource */ + /** @internal */ + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + } + + /** Adds a container resource */ + /** @internal */ + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); + } + + /** Adds a container resource built from a Dockerfile */ + /** @internal */ + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); + } + + /** Adds a .NET tool resource */ + /** @internal */ + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + } + + /** Adds an executable resource */ + /** @internal */ + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + } + + /** Adds an external service resource */ + /** @internal */ + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); + } + + /** Adds a parameter resource */ + /** @internal */ + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); + } + + /** Adds a parameter sourced from configuration */ + /** @internal */ + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + } + + /** Adds a connection string resource */ + /** @internal */ + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + } + + /** Adds a .NET project resource */ + /** @internal */ + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + } + + /** Adds a project resource with configuration options */ + /** @internal */ + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + } + + /** Adds a C# application resource */ + /** @internal */ + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + } + + /** Adds a C# application resource with configuration options */ + /** @internal */ + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + */ +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); + } + + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + } + + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + } + + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + } + + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + } + + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + } + + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); + } + + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + } + + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); + } + + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + } + + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); + } + + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); + } + + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); + } + + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); + } + + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); + } + +} + +// ============================================================================ +// DistributedApplicationEventing +// ============================================================================ + +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Unsubscribe method */ + /** @internal */ + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + rpcArgs + ); + return this; + } + + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ + +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerResource +// ============================================================================ + +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + const exitCode = options?.exitCode; + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + const password = options?.password; + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// CSharpAppResource +// ============================================================================ + +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + const exitCode = options?.exitCode; + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + const commandOptions = options?.commandOptions; + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + const password = options?.password; + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + const iconVariant = options?.iconVariant; + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// DotnetToolResource +// ============================================================================ + +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + } + + /** @internal */ + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + } + + /** @internal */ + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + } + + /** @internal */ + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + } + + /** @internal */ + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + } + + /** @internal */ + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + const exitCode = options?.exitCode; + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + const commandOptions = options?.commandOptions; + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + const password = options?.password; + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + const iconVariant = options?.iconVariant; + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for DotnetToolResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExecutableResource +// ============================================================================ + +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerFilesDestinationResource +// ============================================================================ + +export class ContainerFilesDestinationResource extends ResourceBuilderBase { + constructor(handle: IContainerFilesDestinationResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ContainerFilesDestinationResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + +} + +/** + * Thenable wrapper for ContainerFilesDestinationResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerFilesDestinationResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerFilesDestinationResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + +} + +// ============================================================================ +// Resource +// ============================================================================ + +export class Resource extends ResourceBuilderBase { + constructor(handle: IResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + const helpLink = options?.helpLink; + return new ResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + const commandOptions = options?.commandOptions; + return new ResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + const iconVariant = options?.iconVariant; + return new ResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for Resource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Resource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ResourceWithArgs +// ============================================================================ + +export class ResourceWithArgs extends ResourceBuilderBase { + constructor(handle: IResourceWithArgsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackAsyncInternal(callback)); + } + +} + +/** + * Thenable wrapper for ResourceWithArgs that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithArgsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithArgs) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + +} + +// ============================================================================ +// ResourceWithConnectionString +// ============================================================================ + +export class ResourceWithConnectionString extends ResourceBuilderBase { + constructor(handle: IResourceWithConnectionStringHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyValueInternal(name, value)); + } + +} + +/** + * Thenable wrapper for ResourceWithConnectionString that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithConnectionStringPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithConnectionString) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + +} + +// ============================================================================ +// ResourceWithContainerFiles +// ============================================================================ + +export class ResourceWithContainerFiles extends ResourceBuilderBase { + constructor(handle: IResourceWithContainerFilesHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._clearContainerFilesSourcesInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithContainerFiles that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithContainerFilesPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithContainerFiles) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + +} + +// ============================================================================ +// ResourceWithEndpoints +// ============================================================================ + +export class ResourceWithEndpoints extends ResourceBuilderBase { + constructor(handle: IResourceWithEndpointsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ResourceWithEndpointsPromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + +} + +/** + * Thenable wrapper for ResourceWithEndpoints that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEndpointsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEndpoints) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + +} + +// ============================================================================ +// ResourceWithEnvironment +// ============================================================================ + +export class ResourceWithEnvironment extends ResourceBuilderBase { + constructor(handle: IResourceWithEnvironmentHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + const password = options?.password; + return new ResourceWithEnvironmentPromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withoutHttpsCertificateInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithEnvironment that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + +} + +// ============================================================================ +// ResourceWithServiceDiscovery +// ============================================================================ + +export class ResourceWithServiceDiscovery extends ResourceBuilderBase { + constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { + super(handle, client); + } + +} + +/** + * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithServiceDiscoveryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + +} + +// ============================================================================ +// ResourceWithWaitSupport +// ============================================================================ + +export class ResourceWithWaitSupport extends ResourceBuilderBase { + constructor(handle: IResourceWithWaitSupportHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + const exitCode = options?.exitCode; + return new ResourceWithWaitSupportPromise(this._waitForCompletionInternal(dependency, exitCode)); + } + +} + +/** + * Thenable wrapper for ResourceWithWaitSupport that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithWaitSupportPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithWaitSupport) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + +} + +// ============================================================================ +// Connection Helper +// ============================================================================ + +/** + * Creates and connects to the Aspire AppHost. + * Reads connection info from environment variables set by `aspire run`. + */ +export async function connect(): Promise { + const socketPath = process.env.REMOTE_APP_HOST_SOCKET_PATH; + if (!socketPath) { + throw new Error( + 'REMOTE_APP_HOST_SOCKET_PATH environment variable not set. ' + + 'Run this application using `aspire run`.' + ); + } + + const client = new AspireClientRpc(socketPath); + await client.connect(); + + // Exit the process if the server connection is lost + client.onDisconnect(() => { + console.error('Connection to AppHost lost. Exiting...'); + process.exit(1); + }); + + return client; +} + +/** + * Creates a new distributed application builder. + * This is the entry point for building Aspire applications. + * + * @param options - Optional configuration options for the builder + * @returns A DistributedApplicationBuilder instance + * + * @example + * const builder = await createBuilder(); + * builder.addRedis("cache"); + * builder.addContainer("api", "mcr.microsoft.com/dotnet/samples:aspnetapp"); + * const app = await builder.build(); + * await app.run(); + */ +export async function createBuilder(options?: CreateBuilderOptions): Promise { + const client = await connect(); + + // Default args, projectDirectory, and appHostFilePath if not provided + // ASPIRE_APPHOST_FILEPATH is set by the CLI for consistent socket hash computation + const effectiveOptions: CreateBuilderOptions = { + ...options, + args: options?.args ?? process.argv.slice(2), + projectDirectory: options?.projectDirectory ?? process.env.ASPIRE_PROJECT_DIRECTORY ?? process.cwd(), + appHostFilePath: options?.appHostFilePath ?? process.env.ASPIRE_APPHOST_FILEPATH + }; + + const handle = await client.invokeCapability( + 'Aspire.Hosting/createBuilderWithOptions', + { options: effectiveOptions } + ); + return new DistributedApplicationBuilder(handle, client); +} + +// Re-export commonly used types +export { Handle, CapabilityError, registerCallback } from './transport.js'; +export { refExpr, ReferenceExpression } from './base.js'; + +// ============================================================================ +// Global Error Handling +// ============================================================================ + +/** + * Set up global error handlers to ensure the process exits properly on errors. + * Node.js doesn't exit on unhandled rejections by default, so we need to handle them. + */ +process.on('unhandledRejection', (reason: unknown) => { + const error = reason instanceof Error ? reason : new Error(String(reason)); + + if (reason instanceof CapabilityError) { + console.error(`\n❌ Capability Error: ${error.message}`); + console.error(` Code: ${(reason as CapabilityError).code}`); + if ((reason as CapabilityError).capability) { + console.error(` Capability: ${(reason as CapabilityError).capability}`); + } + } else { + console.error(`\n❌ Unhandled Error: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + } + + process.exit(1); +}); + +process.on('uncaughtException', (error: Error) => { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + process.exit(1); +}); + +// ============================================================================ +// Handle Wrapper Registrations +// ============================================================================ + +// Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource', (handle, client) => new CSharpAppResource(handle as CSharpAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString', (handle, client) => new ResourceWithConnectionString(handle as IResourceWithConnectionStringHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); + diff --git a/samples/aspire-with-javascript/ts/.modules/base.ts b/samples/aspire-with-javascript/ts/.modules/base.ts new file mode 100644 index 00000000..7778b0f1 --- /dev/null +++ b/samples/aspire-with-javascript/ts/.modules/base.ts @@ -0,0 +1,473 @@ +// aspire.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle } from './transport.js'; + +// Re-export transport types for convenience +export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; +export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; + +// ============================================================================ +// Reference Expression +// ============================================================================ + +/** + * Represents a reference expression that can be passed to capabilities. + * + * Reference expressions are serialized in the protocol as: + * ```json + * { + * "$expr": { + * "format": "redis://{0}:{1}", + * "valueProviders": [ + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:1" }, + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:2" } + * ] + * } + * } + * ``` + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export class ReferenceExpression { + // Expression mode fields + private readonly _format?: string; + private readonly _valueProviders?: unknown[]; + + // Handle mode fields (when wrapping a server-returned handle) + private readonly _handle?: Handle; + private readonly _client?: AspireClient; + + constructor(format: string, valueProviders: unknown[]); + constructor(handle: Handle, client: AspireClient); + constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { + if (typeof handleOrFormat === 'string') { + this._format = handleOrFormat; + this._valueProviders = clientOrValueProviders as unknown[]; + } else { + this._handle = handleOrFormat; + this._client = clientOrValueProviders as AspireClient; + } + } + + /** + * Creates a reference expression from a tagged template literal. + * + * @param strings - The template literal string parts + * @param values - The interpolated values (handles to value providers) + * @returns A ReferenceExpression instance + */ + static create(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + // Build the format string with {0}, {1}, etc. placeholders + let format = ''; + for (let i = 0; i < strings.length; i++) { + format += strings[i]; + if (i < values.length) { + format += `{${i}}`; + } + } + + // Extract handles from values + const valueProviders = values.map(extractHandleForExpr); + + return new ReferenceExpression(format, valueProviders); + } + + /** + * Serializes the reference expression for JSON-RPC transport. + * In template-literal mode, uses the $expr format. + * In handle mode, delegates to the handle's serialization. + */ + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + if (this._handle) { + return this._handle.toJSON(); + } + + return { + $expr: { + format: this._format!, + valueProviders: this._valueProviders && this._valueProviders.length > 0 ? this._valueProviders : undefined + } + }; + } + + /** + * String representation for debugging. + */ + toString(): string { + if (this._handle) { + return `ReferenceExpression(handle)`; + } + return `ReferenceExpression(${this._format})`; + } +} + +/** + * Extracts a value for use in reference expressions. + * Supports handles (objects) and string literals. + * @internal + */ +function extractHandleForExpr(value: unknown): unknown { + if (value === null || value === undefined) { + throw new Error('Cannot use null or undefined in reference expression'); + } + + // String literals - include directly in the expression + if (typeof value === 'string') { + return value; + } + + // Number literals - convert to string + if (typeof value === 'number') { + return String(value); + } + + // Handle objects - get their JSON representation + if (value instanceof Handle) { + return value.toJSON(); + } + + // Objects with $handle property (already in handle format) + if (typeof value === 'object' && value !== null && '$handle' in value) { + return value; + } + + // Objects with toJSON that returns a handle + if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { + const json = value.toJSON(); + if (json && typeof json === 'object' && '$handle' in json) { + return json; + } + } + + throw new Error( + `Cannot use value of type ${typeof value} in reference expression. ` + + `Expected a Handle, string, or number.` + ); +} + +/** + * Tagged template function for creating reference expressions. + * + * Use this to create dynamic expressions that reference endpoints, parameters, and other + * value providers. The expression is evaluated at runtime by Aspire. + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression using the tagged template + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export function refExpr(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + return ReferenceExpression.create(strings, ...values); +} + +// ============================================================================ +// ResourceBuilderBase +// ============================================================================ + +/** + * Base class for resource builders (e.g., RedisBuilder, ContainerBuilder). + * Provides handle management and JSON serialization. + */ +export class ResourceBuilderBase { + constructor(protected _handle: THandle, protected _client: AspireClient) {} + + toJSON(): MarshalledHandle { return this._handle.toJSON(); } +} + +// ============================================================================ +// AspireList - Mutable List Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET List. + * Provides array-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const items = await resource.getItems(); // Returns AspireList + * const count = await items.count(); + * const first = await items.get(0); + * await items.add(newItem); + * ``` + */ +export class AspireList { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the list handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual list handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual list handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of elements in the list. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.length', { + list: handle + }) as number; + } + + /** + * Gets the element at the specified index. + */ + async get(index: number): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.get', { + list: handle, + index + }) as T; + } + + /** + * Adds an element to the end of the list. + */ + async add(item: T): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.add', { + list: handle, + item + }); + } + + /** + * Removes the element at the specified index. + */ + async removeAt(index: number): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.removeAt', { + list: handle, + index + }); + } + + /** + * Clears all elements from the list. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.clear', { + list: handle + }); + } + + /** + * Converts the list to an array (creates a copy). + */ + async toArray(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.toArray', { + list: handle + }) as T[]; + } + + toJSON(): MarshalledHandle { + if (this._resolvedHandle) { + return this._resolvedHandle.toJSON(); + } + return this._handleOrContext.toJSON(); + } +} + +// ============================================================================ +// AspireDict - Mutable Dictionary Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET Dictionary. + * Provides object-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const config = await resource.getConfig(); // Returns AspireDict + * const value = await config.get("key"); + * await config.set("key", "value"); + * const hasKey = await config.containsKey("key"); + * ``` + */ +export class AspireDict { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the dictionary handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual dictionary handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual dictionary handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of key-value pairs in the dictionary. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.count', { + dict: handle + }) as number; + } + + /** + * Gets the value associated with the specified key. + * @throws If the key is not found. + */ + async get(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.get', { + dict: handle, + key + }) as V; + } + + /** + * Sets the value for the specified key. + */ + async set(key: K, value: V): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.set', { + dict: handle, + key, + value + }); + } + + /** + * Determines whether the dictionary contains the specified key. + */ + async containsKey(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.has', { + dict: handle, + key + }) as boolean; + } + + /** + * Removes the value with the specified key. + * @returns True if the element was removed; false if the key was not found. + */ + async remove(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.remove', { + dict: handle, + key + }) as boolean; + } + + /** + * Clears all key-value pairs from the dictionary. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.clear', { + dict: handle + }); + } + + /** + * Gets all keys in the dictionary. + */ + async keys(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.keys', { + dict: handle + }) as K[]; + } + + /** + * Gets all values in the dictionary. + */ + async values(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.values', { + dict: handle + }) as V[]; + } + + /** + * Converts the dictionary to a plain object (creates a copy). + * Only works when K is string. + */ + async toObject(): Promise> { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.toObject', { + dict: handle + }) as Record; + } + + async toJSON(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } +} diff --git a/samples/aspire-with-javascript/ts/.modules/transport.ts b/samples/aspire-with-javascript/ts/.modules/transport.ts new file mode 100644 index 00000000..7bddd74b --- /dev/null +++ b/samples/aspire-with-javascript/ts/.modules/transport.ts @@ -0,0 +1,574 @@ +// transport.ts - ATS transport layer: RPC, Handle, errors, callbacks +import * as net from 'net'; +import * as rpc from 'vscode-jsonrpc/node.js'; + +// ============================================================================ +// Base Types +// ============================================================================ + +/** + * Type for callback functions that can be registered and invoked from .NET. + * Internal: receives args and client for handle wrapping. + */ +export type CallbackFunction = (args: unknown, client: AspireClient) => unknown | Promise; + +/** + * Represents a handle to a .NET object in the ATS system. + * Handles are typed references that can be passed between capabilities. + */ +export interface MarshalledHandle { + /** The handle ID (instance number) */ + $handle: string; + /** The ATS type ID */ + $type: string; +} + +/** + * Error details for ATS errors. + */ +export interface AtsErrorDetails { + /** The parameter that caused the error */ + parameter?: string; + /** The expected type or value */ + expected?: string; + /** The actual type or value */ + actual?: string; +} + +/** + * Structured error from ATS capability invocation. + */ +export interface AtsError { + /** Machine-readable error code */ + code: string; + /** Human-readable error message */ + message: string; + /** The capability that failed (if applicable) */ + capability?: string; + /** Additional error details */ + details?: AtsErrorDetails; +} + +/** + * ATS error codes returned by the server. + */ +export const AtsErrorCodes = { + /** Unknown capability ID */ + CapabilityNotFound: 'CAPABILITY_NOT_FOUND', + /** Handle ID doesn't exist or was disposed */ + HandleNotFound: 'HANDLE_NOT_FOUND', + /** Handle type doesn't satisfy capability's type constraint */ + TypeMismatch: 'TYPE_MISMATCH', + /** Missing required argument or wrong type */ + InvalidArgument: 'INVALID_ARGUMENT', + /** Argument value outside valid range */ + ArgumentOutOfRange: 'ARGUMENT_OUT_OF_RANGE', + /** Error occurred during callback invocation */ + CallbackError: 'CALLBACK_ERROR', + /** Unexpected error in capability execution */ + InternalError: 'INTERNAL_ERROR', +} as const; + +/** + * Type guard to check if a value is an ATS error response. + */ +export function isAtsError(value: unknown): value is { $error: AtsError } { + return ( + value !== null && + typeof value === 'object' && + '$error' in value && + typeof (value as { $error: unknown }).$error === 'object' + ); +} + +/** + * Type guard to check if a value is a marshalled handle. + */ +export function isMarshalledHandle(value: unknown): value is MarshalledHandle { + return ( + value !== null && + typeof value === 'object' && + '$handle' in value && + '$type' in value + ); +} + +// ============================================================================ +// Handle +// ============================================================================ + +/** + * A typed handle to a .NET object in the ATS system. + * Handles are opaque references that can be passed to capabilities. + * + * @typeParam T - The ATS type ID (e.g., "Aspire.Hosting/IDistributedApplicationBuilder") + */ +export class Handle { + private readonly _handleId: string; + private readonly _typeId: T; + + constructor(marshalled: MarshalledHandle) { + this._handleId = marshalled.$handle; + this._typeId = marshalled.$type as T; + } + + /** The handle ID (instance number) */ + get $handle(): string { + return this._handleId; + } + + /** The ATS type ID */ + get $type(): T { + return this._typeId; + } + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { + return { + $handle: this._handleId, + $type: this._typeId + }; + } + + /** String representation for debugging */ + toString(): string { + return `Handle<${this._typeId}>(${this._handleId})`; + } +} + +// ============================================================================ +// Handle Wrapper Registry +// ============================================================================ + +/** + * Factory function for creating typed wrapper instances from handles. + */ +export type HandleWrapperFactory = (handle: Handle, client: AspireClient) => unknown; + +/** + * Registry of handle wrapper factories by type ID. + * Generated code registers wrapper classes here so callback handles can be properly typed. + */ +const handleWrapperRegistry = new Map(); + +/** + * Register a wrapper factory for a type ID. + * Called by generated code to register wrapper classes. + */ +export function registerHandleWrapper(typeId: string, factory: HandleWrapperFactory): void { + handleWrapperRegistry.set(typeId, factory); +} + +/** + * Checks if a value is a marshalled handle and wraps it appropriately. + * Uses the wrapper registry to create typed wrapper instances when available. + * + * @param value - The value to potentially wrap + * @param client - Optional client for creating typed wrapper instances + */ +export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { + if (value && typeof value === 'object') { + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); + } + } + + return handle; + } + } + return value; +} + +// ============================================================================ +// Capability Error +// ============================================================================ + +/** + * Error thrown when an ATS capability invocation fails. + */ +export class CapabilityError extends Error { + constructor( + /** The structured error from the server */ + public readonly error: AtsError + ) { + super(error.message); + this.name = 'CapabilityError'; + } + + /** Machine-readable error code */ + get code(): string { + return this.error.code; + } + + /** The capability that failed (if applicable) */ + get capability(): string | undefined { + return this.error.capability; + } +} + +// ============================================================================ +// Callback Registry +// ============================================================================ + +const callbackRegistry = new Map(); +let callbackIdCounter = 0; + +/** + * Register a callback function that can be invoked from the .NET side. + * Returns a callback ID that should be passed to methods accepting callbacks. + * + * .NET passes arguments as an object with positional keys: `{ p0: value0, p1: value1, ... }` + * This function automatically extracts positional parameters and wraps handles. + * + * @example + * // Single parameter callback + * const id = registerCallback((ctx) => console.log(ctx)); + * // .NET sends: { p0: { $handle: "...", $type: "..." } } + * // Callback receives: Handle instance + * + * @example + * // Multi-parameter callback + * const id = registerCallback((a, b) => console.log(a, b)); + * // .NET sends: { p0: "hello", p1: 42 } + * // Callback receives: "hello", 42 + */ +export function registerCallback( + callback: (...args: any[]) => TResult | Promise +): string { + const callbackId = `callback_${++callbackIdCounter}_${Date.now()}`; + + // Wrap the callback to handle .NET's positional argument format + const wrapper: CallbackFunction = async (args: unknown, client: AspireClient) => { + // .NET sends args as object { p0: value0, p1: value1, ... } + if (args && typeof args === 'object' && !Array.isArray(args)) { + const argObj = args as Record; + const argArray: unknown[] = []; + + // Extract positional parameters (p0, p1, p2, ...) + for (let i = 0; ; i++) { + const key = `p${i}`; + if (key in argObj) { + argArray.push(wrapIfHandle(argObj[key], client)); + } else { + break; + } + } + + if (argArray.length > 0) { + // Spread positional arguments to callback + const result = await callback(...argArray); + // DTO writeback protocol: when a void callback returns undefined, we + // return the original args object so the .NET host can detect property + // mutations made by the callback and apply them back to the original + // C# DTO objects. DTO args are plain JS objects (not Handle wrappers), + // so any property changes the callback made are reflected in args. + // + // Non-void callbacks (result !== undefined) return their actual result. + // The .NET side only activates writeback for void delegates whose + // parameters include [AspireDto] types — all other cases discard the + // returned args object, so the extra wire payload is harmless. + // + // IMPORTANT: callbacks that intentionally return undefined will also + // trigger this path. For non-void delegate types, the C# proxy uses + // a result-unmarshalling path (not writeback), so returning args will + // cause an unmarshal error. Void callbacks should never return a + // meaningful value; non-void callbacks should always return one. + return result !== undefined ? result : args; + } + + // No positional params found — nothing to write back + return await callback(); + } + + // Null/undefined - call with no args + if (args === null || args === undefined) { + return await callback(); + } + + // Primitive value - pass as single arg (shouldn't happen with current protocol) + return await callback(wrapIfHandle(args, client)); + }; + + callbackRegistry.set(callbackId, wrapper); + return callbackId; +} + +/** + * Unregister a callback by its ID. + */ +export function unregisterCallback(callbackId: string): boolean { + return callbackRegistry.delete(callbackId); +} + +/** + * Get the number of registered callbacks. + */ +export function getCallbackCount(): number { + return callbackRegistry.size; +} + +// ============================================================================ +// Cancellation Token Registry +// ============================================================================ + +/** + * Registry for cancellation tokens. + * Maps cancellation IDs to cleanup functions. + */ +const cancellationRegistry = new Map void>(); +let cancellationIdCounter = 0; + +/** + * A reference to the current AspireClient for sending cancel requests. + * Set by AspireClient.connect(). + */ +let currentClient: AspireClient | null = null; + +/** + * Register an AbortSignal for cancellation support. + * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * + * When the AbortSignal is aborted, sends a cancelToken request to the host. + * + * @param signal - The AbortSignal to register (optional) + * @returns The cancellation ID, or undefined if no signal provided + * + * @example + * const controller = new AbortController(); + * const id = registerCancellation(controller.signal); + * // Pass id to capability invocation + * // Later: controller.abort() will cancel the operation + */ +export function registerCancellation(signal?: AbortSignal): string | undefined { + if (!signal) { + return undefined; + } + + // Already aborted? Don't register + if (signal.aborted) { + return undefined; + } + + const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; + + // Set up the abort listener + const onAbort = () => { + // Send cancel request to host + if (currentClient?.connected) { + currentClient.cancelToken(cancellationId).catch(() => { + // Ignore errors - the operation may have already completed + }); + } + // Clean up the listener + cancellationRegistry.delete(cancellationId); + }; + + // Listen for abort + signal.addEventListener('abort', onAbort, { once: true }); + + // Store cleanup function + cancellationRegistry.set(cancellationId, () => { + signal.removeEventListener('abort', onAbort); + }); + + return cancellationId; +} + +/** + * Unregister a cancellation token by its ID. + * Call this when the operation completes to clean up resources. + * + * @param cancellationId - The cancellation ID to unregister + */ +export function unregisterCancellation(cancellationId: string | undefined): void { + if (!cancellationId) { + return; + } + + const cleanup = cancellationRegistry.get(cancellationId); + if (cleanup) { + cleanup(); + cancellationRegistry.delete(cancellationId); + } +} + +// ============================================================================ +// AspireClient (JSON-RPC Connection) +// ============================================================================ + +/** + * Client for connecting to the Aspire AppHost via socket/named pipe. + */ +export class AspireClient { + private connection: rpc.MessageConnection | null = null; + private socket: net.Socket | null = null; + private disconnectCallbacks: (() => void)[] = []; + private _pendingCalls = 0; + + constructor(private socketPath: string) { } + + /** + * Register a callback to be called when the connection is lost + */ + onDisconnect(callback: () => void): void { + this.disconnectCallbacks.push(callback); + } + + private notifyDisconnect(): void { + for (const callback of this.disconnectCallbacks) { + try { + callback(); + } catch { + // Ignore callback errors + } + } + } + + connect(timeoutMs: number = 5000): Promise { + return new Promise((resolve, reject) => { + const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this.socket = net.createConnection(pipePath); + + this.socket.once('error', (error: Error) => { + clearTimeout(timeout); + reject(error); + }); + + this.socket.once('connect', () => { + clearTimeout(timeout); + try { + const reader = new rpc.SocketMessageReader(this.socket!); + const writer = new rpc.SocketMessageWriter(this.socket!); + this.connection = rpc.createMessageConnection(reader, writer); + + this.connection.onClose(() => { + this.connection = null; + this.notifyDisconnect(); + }); + this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); + + // Handle callback invocations from the .NET side + this.connection.onRequest('invokeCallback', async (callbackId: string, args: unknown) => { + const callback = callbackRegistry.get(callbackId); + if (!callback) { + throw new Error(`Callback not found: ${callbackId}`); + } + try { + // The registered wrapper handles arg unpacking and handle wrapping + // Pass this client so handles can be wrapped with typed wrapper classes + return await Promise.resolve(callback(args, this)); + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + throw new Error(`Callback execution failed: ${message}`); + } + }); + + this.connection.listen(); + + // Set the current client for cancellation registry + currentClient = this; + + resolve(); + } catch (e) { + reject(e); + } + }); + + this.socket.on('close', () => { + this.connection?.dispose(); + this.connection = null; + if (currentClient === this) { + currentClient = null; + } + this.notifyDisconnect(); + }); + }); + } + + ping(): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('ping'); + } + + /** + * Cancel a CancellationToken by its ID. + * Called when an AbortSignal is aborted. + * + * @param tokenId - The token ID to cancel + * @returns True if the token was found and cancelled, false otherwise + */ + cancelToken(tokenId: string): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('cancelToken', tokenId); + } + + /** + * Invoke an ATS capability by ID. + * + * Capabilities are operations exposed by [AspireExport] attributes. + * Results are automatically wrapped in Handle objects when applicable. + * + * @param capabilityId - The capability ID (e.g., "Aspire.Hosting/createBuilder") + * @param args - Arguments to pass to the capability + * @returns The capability result, wrapped as Handle if it's a handle type + * @throws CapabilityError if the capability fails + */ + async invokeCapability( + capabilityId: string, + args?: Record + ): Promise { + if (!this.connection) { + throw new Error('Not connected to AppHost'); + } + + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); + } + this._pendingCalls++; + + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + args ?? null + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } + } + + disconnect(): void { + try { this.connection?.dispose(); } finally { this.connection = null; } + try { this.socket?.end(); } finally { this.socket = null; } + } + + get connected(): boolean { + return this.connection !== null && this.socket !== null; + } +} diff --git a/samples/aspire-with-javascript/ts/package-lock.json b/samples/aspire-with-javascript/ts/package-lock.json new file mode 100644 index 00000000..c4d3800c --- /dev/null +++ b/samples/aspire-with-javascript/ts/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "ts", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/samples/aspire-with-node/ts/.aspire/settings.json b/samples/aspire-with-node/ts/.aspire/settings.json index a60c25b1..37e15bd6 100644 --- a/samples/aspire-with-node/ts/.aspire/settings.json +++ b/samples/aspire-with-node/ts/.aspire/settings.json @@ -1,3 +1,8 @@ { - "appHostPath": "../apphost.ts" + "appHostPath": "../apphost.ts", + "sdkVersion": "13.2.0-preview.1.26159.1", + "packages": { + "Aspire.Hosting.JavaScript": "13.1.2", + "Aspire.Hosting.Redis": "13.1.2" + } } \ No newline at end of file diff --git a/samples/aspire-with-node/ts/.modules/.codegen-hash b/samples/aspire-with-node/ts/.modules/.codegen-hash new file mode 100644 index 00000000..55ba0bec --- /dev/null +++ b/samples/aspire-with-node/ts/.modules/.codegen-hash @@ -0,0 +1 @@ +27FE203695BE4332BD6FD0DE4CA5270B104D44B178E85007FC229E720FBFC238 \ No newline at end of file diff --git a/samples/aspire-with-node/ts/.modules/aspire.ts b/samples/aspire-with-node/ts/.modules/aspire.ts new file mode 100644 index 00000000..73dc52d2 --- /dev/null +++ b/samples/aspire-with-node/ts/.modules/aspire.ts @@ -0,0 +1,13306 @@ +// aspire.ts - Capability-based Aspire SDK +// This SDK uses the ATS (Aspire Type System) capability API. +// Capabilities are endpoints like 'Aspire.Hosting/createBuilder'. +// +// GENERATED CODE - DO NOT EDIT + +import { + AspireClient as AspireClientRpc, + Handle, + MarshalledHandle, + CapabilityError, + registerCallback, + wrapIfHandle, + registerHandleWrapper +} from './transport.js'; + +import { + ResourceBuilderBase, + ReferenceExpression, + refExpr, + AspireDict, + AspireList +} from './base.js'; + +// ============================================================================ +// Handle Type Aliases (Internal - not exported to users) +// ============================================================================ + +/** Handle to CommandLineArgsCallbackContext */ +type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; + +/** Handle to ContainerRegistryResource */ +type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; + +/** Handle to ContainerResource */ +type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource'>; + +/** Handle to CSharpAppResource */ +type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; + +/** Handle to DotnetToolResource */ +type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; + +/** Handle to EndpointReference */ +type EndpointReferenceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference'>; + +/** Handle to EndpointReferenceExpression */ +type EndpointReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression'>; + +/** Handle to EnvironmentCallbackContext */ +type EnvironmentCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext'>; + +/** Handle to ExecutableResource */ +type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource'>; + +/** Handle to ExecuteCommandContext */ +type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; + +/** Handle to IContainerFilesDestinationResource */ +type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; + +/** Handle to IResource */ +type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; + +/** Handle to IResourceWithArgs */ +type IResourceWithArgsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs'>; + +/** Handle to IResourceWithConnectionString */ +type IResourceWithConnectionStringHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString'>; + +/** Handle to IResourceWithEndpoints */ +type IResourceWithEndpointsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints'>; + +/** Handle to IResourceWithEnvironment */ +type IResourceWithEnvironmentHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment'>; + +/** Handle to IResourceWithWaitSupport */ +type IResourceWithWaitSupportHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport'>; + +/** Handle to ParameterResource */ +type ParameterResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource'>; + +/** Handle to ProjectResource */ +type ProjectResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource'>; + +/** Handle to ReferenceExpression */ +type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression'>; + +/** Handle to ReferenceExpressionBuilder */ +type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; + +/** Handle to ResourceLoggerService */ +type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; + +/** Handle to ResourceNotificationService */ +type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; + +/** Handle to ResourceUrlsCallbackContext */ +type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; + +/** Handle to ConnectionStringResource */ +type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; + +/** Handle to DistributedApplication */ +type DistributedApplicationHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplication'>; + +/** Handle to DistributedApplicationExecutionContext */ +type DistributedApplicationExecutionContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext'>; + +/** Handle to DistributedApplicationEventSubscription */ +type DistributedApplicationEventSubscriptionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.DistributedApplicationEventSubscription'>; + +/** Handle to IDistributedApplicationEventing */ +type IDistributedApplicationEventingHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing'>; + +/** Handle to ExternalServiceResource */ +type ExternalServiceResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ExternalServiceResource'>; + +/** Handle to IDistributedApplicationBuilder */ +type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder'>; + +/** Handle to IResourceWithContainerFiles */ +type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; + +/** Handle to IResourceWithServiceDiscovery */ +type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; + +/** Handle to PipelineConfigurationContext */ +type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; + +/** Handle to PipelineStep */ +type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; + +/** Handle to PipelineStepContext */ +type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; + +/** Handle to ProjectResourceOptions */ +type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; + +/** Handle to Dict */ +type DictstringanyHandle = Handle<'Aspire.Hosting/Dict'>; + +/** Handle to List */ +type ListanyHandle = Handle<'Aspire.Hosting/List'>; + +/** Handle to IConfiguration */ +type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; + +/** Handle to IHostEnvironment */ +type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; + +/** Handle to ILogger */ +type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; + +/** Handle to string[] */ +type stringArrayHandle = Handle<'string[]'>; + +/** Handle to IServiceProvider */ +type IServiceProviderHandle = Handle<'System.ComponentModel/System.IServiceProvider'>; + +// ============================================================================ +// Enum Types +// ============================================================================ + +/** Enum type for CertificateTrustScope */ +export enum CertificateTrustScope { + None = "None", + Append = "Append", + Override = "Override", + System = "System", +} + +/** Enum type for ContainerLifetime */ +export enum ContainerLifetime { + Session = "Session", + Persistent = "Persistent", +} + +/** Enum type for DistributedApplicationOperation */ +export enum DistributedApplicationOperation { + Run = "Run", + Publish = "Publish", +} + +/** Enum type for EndpointProperty */ +export enum EndpointProperty { + Url = "Url", + Host = "Host", + IPV4Host = "IPV4Host", + Port = "Port", + Scheme = "Scheme", + TargetPort = "TargetPort", + HostAndPort = "HostAndPort", +} + +/** Enum type for IconVariant */ +export enum IconVariant { + Regular = "Regular", + Filled = "Filled", +} + +/** Enum type for ImagePullPolicy */ +export enum ImagePullPolicy { + Default = "Default", + Always = "Always", + Missing = "Missing", + Never = "Never", +} + +/** Enum type for OtlpProtocol */ +export enum OtlpProtocol { + Grpc = "Grpc", + HttpProtobuf = "HttpProtobuf", + HttpJson = "HttpJson", +} + +/** Enum type for ProbeType */ +export enum ProbeType { + Startup = "Startup", + Readiness = "Readiness", + Liveness = "Liveness", +} + +/** Enum type for ProtocolType */ +export enum ProtocolType { + IP = "IP", + IPv6HopByHopOptions = "IPv6HopByHopOptions", + Unspecified = "Unspecified", + Icmp = "Icmp", + Igmp = "Igmp", + Ggp = "Ggp", + IPv4 = "IPv4", + Tcp = "Tcp", + Pup = "Pup", + Udp = "Udp", + Idp = "Idp", + IPv6 = "IPv6", + IPv6RoutingHeader = "IPv6RoutingHeader", + IPv6FragmentHeader = "IPv6FragmentHeader", + IPSecEncapsulatingSecurityPayload = "IPSecEncapsulatingSecurityPayload", + IPSecAuthenticationHeader = "IPSecAuthenticationHeader", + IcmpV6 = "IcmpV6", + IPv6NoNextHeader = "IPv6NoNextHeader", + IPv6DestinationOptions = "IPv6DestinationOptions", + ND = "ND", + Raw = "Raw", + Ipx = "Ipx", + Spx = "Spx", + SpxII = "SpxII", + Unknown = "Unknown", +} + +/** Enum type for UrlDisplayLocation */ +export enum UrlDisplayLocation { + SummaryAndDetails = "SummaryAndDetails", + DetailsOnly = "DetailsOnly", +} + +/** Enum type for WaitBehavior */ +export enum WaitBehavior { + WaitOnResourceUnavailable = "WaitOnResourceUnavailable", + StopOnResourceUnavailable = "StopOnResourceUnavailable", +} + +// ============================================================================ +// DTO Interfaces +// ============================================================================ + +/** DTO interface for CommandOptions */ +export interface CommandOptions { + description?: string; + parameter?: any; + confirmationMessage?: string; + iconName?: string; + iconVariant?: IconVariant; + isHighlighted?: boolean; + updateState?: any; +} + +/** DTO interface for CreateBuilderOptions */ +export interface CreateBuilderOptions { + args?: string[]; + projectDirectory?: string; + appHostFilePath?: string; + containerRegistryOverride?: string; + disableDashboard?: boolean; + dashboardApplicationName?: string; + allowUnsecuredTransport?: boolean; + enableResourceLogging?: boolean; +} + +/** DTO interface for ExecuteCommandResult */ +export interface ExecuteCommandResult { + success?: boolean; + canceled?: boolean; + errorMessage?: string; +} + +/** DTO interface for ResourceEventDto */ +export interface ResourceEventDto { + resourceName?: string; + resourceId?: string; + state?: string; + stateStyle?: string; + healthStatus?: string; + exitCode?: number; +} + +/** DTO interface for ResourceUrlAnnotation */ +export interface ResourceUrlAnnotation { + url?: string; + displayText?: string; + endpoint?: EndpointReferenceHandle; + displayLocation?: UrlDisplayLocation; +} + +// ============================================================================ +// Options Interfaces +// ============================================================================ + +export interface AddConnectionStringOptions { + environmentVariableName?: string; +} + +export interface AddContainerRegistryOptions { + repository?: ParameterResource; +} + +export interface AddDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface AddParameterFromConfigurationOptions { + secret?: boolean; +} + +export interface AddParameterOptions { + secret?: boolean; +} + +export interface AppendFormattedOptions { + format?: string; +} + +export interface AppendValueProviderOptions { + format?: string; +} + +export interface GetValueAsyncOptions { + cancellationToken?: AbortSignal; +} + +export interface RunOptions { + cancellationToken?: AbortSignal; +} + +export interface WaitForCompletionOptions { + exitCode?: number; +} + +export interface WithBindMountOptions { + isReadOnly?: boolean; +} + +export interface WithCommandOptions { + commandOptions?: CommandOptions; +} + +export interface WithDescriptionOptions { + enableMarkdown?: boolean; +} + +export interface WithDockerfileBaseImageOptions { + buildImage?: string; + runtimeImage?: string; +} + +export interface WithDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface WithEndpointOptions { + port?: number; + targetPort?: number; + scheme?: string; + name?: string; + env?: string; + isProxied?: boolean; + isExternal?: boolean; + protocol?: ProtocolType; +} + +export interface WithExternalServiceHttpHealthCheckOptions { + path?: string; + statusCode?: number; +} + +export interface WithHttpEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithHttpHealthCheckOptions { + path?: string; + statusCode?: number; + endpointName?: string; +} + +export interface WithHttpProbeOptions { + path?: string; + initialDelaySeconds?: number; + periodSeconds?: number; + timeoutSeconds?: number; + failureThreshold?: number; + successThreshold?: number; + endpointName?: string; +} + +export interface WithHttpsDeveloperCertificateOptions { + password?: ParameterResource; +} + +export interface WithHttpsEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithIconNameOptions { + iconVariant?: IconVariant; +} + +export interface WithImageOptions { + tag?: string; +} + +export interface WithMcpServerOptions { + path?: string; + endpointName?: string; +} + +export interface WithPipelineStepFactoryOptions { + dependsOn?: string[]; + requiredBy?: string[]; + tags?: string[]; + description?: string; +} + +export interface WithReferenceOptions { + connectionName?: string; + optional?: boolean; +} + +export interface WithRequiredCommandOptions { + helpLink?: string; +} + +export interface WithUrlExpressionOptions { + displayText?: string; +} + +export interface WithUrlOptions { + displayText?: string; +} + +export interface WithVolumeOptions { + name?: string; + isReadOnly?: boolean; +} + +// ============================================================================ +// CommandLineArgsCallbackContext +// ============================================================================ + +/** + * Type class for CommandLineArgsCallbackContext. + */ +export class CommandLineArgsCallbackContext { + constructor(private _handle: CommandLineArgsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Args property */ + private _args?: AspireList; + get args(): AspireList { + if (!this._args) { + this._args = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args', + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args' + ); + } + return this._args; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplication +// ============================================================================ + +/** + * Type class for DistributedApplication. + */ +export class DistributedApplication { + constructor(private _handle: DistributedApplicationHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Runs the distributed application */ + /** @internal */ + async _runInternal(cancellationToken?: AbortSignal): Promise { + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + await this._client.invokeCapability( + 'Aspire.Hosting/run', + rpcArgs + ); + return this; + } + + run(options?: RunOptions): DistributedApplicationPromise { + const cancellationToken = options?.cancellationToken; + return new DistributedApplicationPromise(this._runInternal(cancellationToken)); + } + +} + +/** + * Thenable wrapper for DistributedApplication that enables fluent chaining. + */ +export class DistributedApplicationPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplication) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Runs the distributed application */ + run(options?: RunOptions): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.run(options))); + } + +} + +// ============================================================================ +// DistributedApplicationExecutionContext +// ============================================================================ + +/** + * Type class for DistributedApplicationExecutionContext. + */ +export class DistributedApplicationExecutionContext { + constructor(private _handle: DistributedApplicationExecutionContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PublisherName property */ + publisherName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.publisherName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.setPublisherName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Operation property */ + operation = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.operation', + { context: this._handle } + ); + }, + }; + + /** Gets the IsPublishMode property */ + isPublishMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isPublishMode', + { context: this._handle } + ); + }, + }; + + /** Gets the IsRunMode property */ + isRunMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isRunMode', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EndpointReference +// ============================================================================ + +/** + * Type class for EndpointReference. + */ +export class EndpointReference { + constructor(private _handle: EndpointReferenceHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EndpointName property */ + endpointName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.endpointName', + { context: this._handle } + ); + }, + }; + + /** Gets the ErrorMessage property */ + errorMessage = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.errorMessage', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.setErrorMessage', + { context: this._handle, value } + ); + } + }; + + /** Gets the IsAllocated property */ + isAllocated = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isAllocated', + { context: this._handle } + ); + }, + }; + + /** Gets the Exists property */ + exists = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.exists', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttp property */ + isHttp = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttp', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttps property */ + isHttps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttps', + { context: this._handle } + ); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.port', + { context: this._handle } + ); + }, + }; + + /** Gets the TargetPort property */ + targetPort = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.targetPort', + { context: this._handle } + ); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.host', + { context: this._handle } + ); + }, + }; + + /** Gets the Scheme property */ + scheme = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.scheme', + { context: this._handle } + ); + }, + }; + + /** Gets the Url property */ + url = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.url', + { context: this._handle } + ); + }, + }; + + /** Gets the URL of the endpoint asynchronously */ + async getValueAsync(options?: GetValueAsyncOptions): Promise { + const cancellationToken = options?.cancellationToken; + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValueAsync', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for EndpointReference that enables fluent chaining. + */ +export class EndpointReferencePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: EndpointReference) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets the URL of the endpoint asynchronously */ + getValueAsync(options?: GetValueAsyncOptions): Promise { + return this._promise.then(obj => obj.getValueAsync(options)); + } + +} + +// ============================================================================ +// EndpointReferenceExpression +// ============================================================================ + +/** + * Type class for EndpointReferenceExpression. + */ +export class EndpointReferenceExpression { + constructor(private _handle: EndpointReferenceExpressionHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Endpoint property */ + endpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.endpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Property property */ + property = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.property', + { context: this._handle } + ); + }, + }; + + /** Gets the ValueExpression property */ + valueExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.valueExpression', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EnvironmentCallbackContext +// ============================================================================ + +/** + * Type class for EnvironmentCallbackContext. + */ +export class EnvironmentCallbackContext { + constructor(private _handle: EnvironmentCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EnvironmentVariables property */ + private _environmentVariables?: AspireDict; + get environmentVariables(): AspireDict { + if (!this._environmentVariables) { + this._environmentVariables = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables', + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables' + ); + } + return this._environmentVariables; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ExecuteCommandContext +// ============================================================================ + +/** + * Type class for ExecuteCommandContext. + */ +export class ExecuteCommandContext { + constructor(private _handle: ExecuteCommandContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ResourceName property */ + resourceName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.resourceName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setResourceName', + { context: this._handle, value } + ); + } + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', + { context: this._handle } + ); + }, + set: async (value: AbortSignal): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + { context: this._handle } + ); + }, + set: async (value: PipelineStep[]): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', + { context: this._handle, value } + ); + } + }; + + /** Gets pipeline steps with the specified tag */ + async getStepsByTag(tag: string): Promise { + const rpcArgs: Record = { context: this._handle, tag }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/getStepsByTag', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for PipelineConfigurationContext that enables fluent chaining. + */ +export class PipelineConfigurationContextPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineConfigurationContext) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets pipeline steps with the specified tag */ + getStepsByTag(tag: string): Promise { + return this._promise.then(obj => obj.getStepsByTag(tag)); + } + +} + +// ============================================================================ +// PipelineStep +// ============================================================================ + +/** + * Type class for PipelineStep. + */ +export class PipelineStep { + constructor(private _handle: PipelineStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.name', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Description property */ + description = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.description', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setDescription', + { context: this._handle, value } + ); + } + }; + + /** Gets the DependsOnSteps property */ + private _dependsOnSteps?: AspireList; + get dependsOnSteps(): AspireList { + if (!this._dependsOnSteps) { + this._dependsOnSteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps', + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps' + ); + } + return this._dependsOnSteps; + } + + /** Gets the RequiredBySteps property */ + private _requiredBySteps?: AspireList; + get requiredBySteps(): AspireList { + if (!this._requiredBySteps) { + this._requiredBySteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps', + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps' + ); + } + return this._requiredBySteps; + } + + /** Gets the Tags property */ + private _tags?: AspireList; + get tags(): AspireList { + if (!this._tags) { + this._tags = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.tags', + 'Aspire.Hosting.Pipelines/PipelineStep.tags' + ); + } + return this._tags; + } + + /** Adds a dependency on another step by name */ + /** @internal */ + async _dependsOnInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/dependsOn', + rpcArgs + ); + return this; + } + + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._dependsOnInternal(stepName)); + } + + /** Specifies that another step requires this step by name */ + /** @internal */ + async _requiredByInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/requiredBy', + rpcArgs + ); + return this; + } + + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._requiredByInternal(stepName)); + } + +} + +/** + * Thenable wrapper for PipelineStep that enables fluent chaining. + */ +export class PipelineStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineStep) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a dependency on another step by name */ + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.dependsOn(stepName))); + } + + /** Specifies that another step requires this step by name */ + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.requiredBy(stepName))); + } + +} + +// ============================================================================ +// PipelineStepContext +// ============================================================================ + +/** + * Type class for PipelineStepContext. + */ +export class PipelineStepContext { + constructor(private _handle: PipelineStepContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// ProjectResourceOptions +// ============================================================================ + +/** + * Type class for ProjectResourceOptions. + */ +export class ProjectResourceOptions { + constructor(private _handle: ProjectResourceOptionsHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the LaunchProfileName property */ + launchProfileName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.launchProfileName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setLaunchProfileName', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeLaunchProfile property */ + excludeLaunchProfile = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeLaunchProfile', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeLaunchProfile', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeKestrelEndpoints property */ + excludeKestrelEndpoints = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeKestrelEndpoints', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeKestrelEndpoints', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// ReferenceExpressionBuilder +// ============================================================================ + +/** + * Type class for ReferenceExpressionBuilder. + */ +export class ReferenceExpressionBuilder { + constructor(private _handle: ReferenceExpressionBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the IsEmpty property */ + isEmpty = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ReferenceExpressionBuilder.isEmpty', + { context: this._handle } + ); + }, + }; + + /** Appends a literal string to the reference expression */ + /** @internal */ + async _appendLiteralInternal(value: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendLiteral', + rpcArgs + ); + return this; + } + + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._appendLiteralInternal(value)); + } + + /** Appends a formatted string value to the reference expression */ + /** @internal */ + async _appendFormattedInternal(value: string, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendFormatted', + rpcArgs + ); + return this; + } + + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendFormattedInternal(value, format)); + } + + /** Appends a value provider to the reference expression */ + /** @internal */ + async _appendValueProviderInternal(valueProvider: any, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, valueProvider }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendValueProvider', + rpcArgs + ); + return this; + } + + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendValueProviderInternal(valueProvider, format)); + } + + /** Builds the reference expression */ + async build(): Promise { + const rpcArgs: Record = { context: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/build', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ReferenceExpressionBuilder that enables fluent chaining. + */ +export class ReferenceExpressionBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReferenceExpressionBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Appends a literal string to the reference expression */ + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendLiteral(value))); + } + + /** Appends a formatted string value to the reference expression */ + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendFormatted(value, options))); + } + + /** Appends a value provider to the reference expression */ + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendValueProvider(valueProvider, options))); + } + + /** Builds the reference expression */ + build(): Promise { + return this._promise.then(obj => obj.build()); + } + +} + +// ============================================================================ +// ResourceUrlsCallbackContext +// ============================================================================ + +/** + * Type class for ResourceUrlsCallbackContext. + */ +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Builds the distributed application */ + /** @internal */ + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', + rpcArgs + ); + return new DistributedApplication(result, this._client); + } + + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); + } + + /** Adds a connection string with a builder callback */ + /** @internal */ + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionStringBuilder', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + } + + /** Adds a container registry resource */ + /** @internal */ + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + } + + /** Adds a container resource */ + /** @internal */ + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); + } + + /** Adds a container resource built from a Dockerfile */ + /** @internal */ + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); + } + + /** Adds a .NET tool resource */ + /** @internal */ + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + } + + /** Adds an executable resource */ + /** @internal */ + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + } + + /** Adds an external service resource */ + /** @internal */ + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); + } + + /** Adds a parameter resource */ + /** @internal */ + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); + } + + /** Adds a parameter sourced from configuration */ + /** @internal */ + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + } + + /** Adds a connection string resource */ + /** @internal */ + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + } + + /** Adds a .NET project resource */ + /** @internal */ + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + } + + /** Adds a project resource with configuration options */ + /** @internal */ + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + } + + /** Adds a C# application resource */ + /** @internal */ + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + } + + /** Adds a C# application resource with configuration options */ + /** @internal */ + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + */ +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); + } + + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + } + + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + } + + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + } + + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + } + + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + } + + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); + } + + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + } + + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); + } + + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + } + + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); + } + + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); + } + + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); + } + + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); + } + + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); + } + +} + +// ============================================================================ +// DistributedApplicationEventing +// ============================================================================ + +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Unsubscribe method */ + /** @internal */ + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + rpcArgs + ); + return this; + } + + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ + +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerResource +// ============================================================================ + +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + const exitCode = options?.exitCode; + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + const password = options?.password; + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// CSharpAppResource +// ============================================================================ + +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + const exitCode = options?.exitCode; + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + const commandOptions = options?.commandOptions; + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + const password = options?.password; + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + const iconVariant = options?.iconVariant; + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// DotnetToolResource +// ============================================================================ + +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + } + + /** @internal */ + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + } + + /** @internal */ + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + } + + /** @internal */ + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + } + + /** @internal */ + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + } + + /** @internal */ + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + const exitCode = options?.exitCode; + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + const commandOptions = options?.commandOptions; + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + const password = options?.password; + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + const iconVariant = options?.iconVariant; + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for DotnetToolResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExecutableResource +// ============================================================================ + +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerFilesDestinationResource +// ============================================================================ + +export class ContainerFilesDestinationResource extends ResourceBuilderBase { + constructor(handle: IContainerFilesDestinationResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ContainerFilesDestinationResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + +} + +/** + * Thenable wrapper for ContainerFilesDestinationResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerFilesDestinationResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerFilesDestinationResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + +} + +// ============================================================================ +// Resource +// ============================================================================ + +export class Resource extends ResourceBuilderBase { + constructor(handle: IResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + const helpLink = options?.helpLink; + return new ResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + const commandOptions = options?.commandOptions; + return new ResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + const iconVariant = options?.iconVariant; + return new ResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for Resource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Resource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ResourceWithArgs +// ============================================================================ + +export class ResourceWithArgs extends ResourceBuilderBase { + constructor(handle: IResourceWithArgsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackAsyncInternal(callback)); + } + +} + +/** + * Thenable wrapper for ResourceWithArgs that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithArgsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithArgs) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + +} + +// ============================================================================ +// ResourceWithConnectionString +// ============================================================================ + +export class ResourceWithConnectionString extends ResourceBuilderBase { + constructor(handle: IResourceWithConnectionStringHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyValueInternal(name, value)); + } + +} + +/** + * Thenable wrapper for ResourceWithConnectionString that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithConnectionStringPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithConnectionString) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + +} + +// ============================================================================ +// ResourceWithContainerFiles +// ============================================================================ + +export class ResourceWithContainerFiles extends ResourceBuilderBase { + constructor(handle: IResourceWithContainerFilesHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._clearContainerFilesSourcesInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithContainerFiles that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithContainerFilesPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithContainerFiles) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + +} + +// ============================================================================ +// ResourceWithEndpoints +// ============================================================================ + +export class ResourceWithEndpoints extends ResourceBuilderBase { + constructor(handle: IResourceWithEndpointsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ResourceWithEndpointsPromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + +} + +/** + * Thenable wrapper for ResourceWithEndpoints that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEndpointsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEndpoints) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + +} + +// ============================================================================ +// ResourceWithEnvironment +// ============================================================================ + +export class ResourceWithEnvironment extends ResourceBuilderBase { + constructor(handle: IResourceWithEnvironmentHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + const password = options?.password; + return new ResourceWithEnvironmentPromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withoutHttpsCertificateInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithEnvironment that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + +} + +// ============================================================================ +// ResourceWithServiceDiscovery +// ============================================================================ + +export class ResourceWithServiceDiscovery extends ResourceBuilderBase { + constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { + super(handle, client); + } + +} + +/** + * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithServiceDiscoveryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + +} + +// ============================================================================ +// ResourceWithWaitSupport +// ============================================================================ + +export class ResourceWithWaitSupport extends ResourceBuilderBase { + constructor(handle: IResourceWithWaitSupportHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + const exitCode = options?.exitCode; + return new ResourceWithWaitSupportPromise(this._waitForCompletionInternal(dependency, exitCode)); + } + +} + +/** + * Thenable wrapper for ResourceWithWaitSupport that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithWaitSupportPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithWaitSupport) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + +} + +// ============================================================================ +// Connection Helper +// ============================================================================ + +/** + * Creates and connects to the Aspire AppHost. + * Reads connection info from environment variables set by `aspire run`. + */ +export async function connect(): Promise { + const socketPath = process.env.REMOTE_APP_HOST_SOCKET_PATH; + if (!socketPath) { + throw new Error( + 'REMOTE_APP_HOST_SOCKET_PATH environment variable not set. ' + + 'Run this application using `aspire run`.' + ); + } + + const client = new AspireClientRpc(socketPath); + await client.connect(); + + // Exit the process if the server connection is lost + client.onDisconnect(() => { + console.error('Connection to AppHost lost. Exiting...'); + process.exit(1); + }); + + return client; +} + +/** + * Creates a new distributed application builder. + * This is the entry point for building Aspire applications. + * + * @param options - Optional configuration options for the builder + * @returns A DistributedApplicationBuilder instance + * + * @example + * const builder = await createBuilder(); + * builder.addRedis("cache"); + * builder.addContainer("api", "mcr.microsoft.com/dotnet/samples:aspnetapp"); + * const app = await builder.build(); + * await app.run(); + */ +export async function createBuilder(options?: CreateBuilderOptions): Promise { + const client = await connect(); + + // Default args, projectDirectory, and appHostFilePath if not provided + // ASPIRE_APPHOST_FILEPATH is set by the CLI for consistent socket hash computation + const effectiveOptions: CreateBuilderOptions = { + ...options, + args: options?.args ?? process.argv.slice(2), + projectDirectory: options?.projectDirectory ?? process.env.ASPIRE_PROJECT_DIRECTORY ?? process.cwd(), + appHostFilePath: options?.appHostFilePath ?? process.env.ASPIRE_APPHOST_FILEPATH + }; + + const handle = await client.invokeCapability( + 'Aspire.Hosting/createBuilderWithOptions', + { options: effectiveOptions } + ); + return new DistributedApplicationBuilder(handle, client); +} + +// Re-export commonly used types +export { Handle, CapabilityError, registerCallback } from './transport.js'; +export { refExpr, ReferenceExpression } from './base.js'; + +// ============================================================================ +// Global Error Handling +// ============================================================================ + +/** + * Set up global error handlers to ensure the process exits properly on errors. + * Node.js doesn't exit on unhandled rejections by default, so we need to handle them. + */ +process.on('unhandledRejection', (reason: unknown) => { + const error = reason instanceof Error ? reason : new Error(String(reason)); + + if (reason instanceof CapabilityError) { + console.error(`\n❌ Capability Error: ${error.message}`); + console.error(` Code: ${(reason as CapabilityError).code}`); + if ((reason as CapabilityError).capability) { + console.error(` Capability: ${(reason as CapabilityError).capability}`); + } + } else { + console.error(`\n❌ Unhandled Error: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + } + + process.exit(1); +}); + +process.on('uncaughtException', (error: Error) => { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + process.exit(1); +}); + +// ============================================================================ +// Handle Wrapper Registrations +// ============================================================================ + +// Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource', (handle, client) => new CSharpAppResource(handle as CSharpAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString', (handle, client) => new ResourceWithConnectionString(handle as IResourceWithConnectionStringHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); + diff --git a/samples/aspire-with-node/ts/.modules/base.ts b/samples/aspire-with-node/ts/.modules/base.ts new file mode 100644 index 00000000..7778b0f1 --- /dev/null +++ b/samples/aspire-with-node/ts/.modules/base.ts @@ -0,0 +1,473 @@ +// aspire.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle } from './transport.js'; + +// Re-export transport types for convenience +export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; +export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; + +// ============================================================================ +// Reference Expression +// ============================================================================ + +/** + * Represents a reference expression that can be passed to capabilities. + * + * Reference expressions are serialized in the protocol as: + * ```json + * { + * "$expr": { + * "format": "redis://{0}:{1}", + * "valueProviders": [ + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:1" }, + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:2" } + * ] + * } + * } + * ``` + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export class ReferenceExpression { + // Expression mode fields + private readonly _format?: string; + private readonly _valueProviders?: unknown[]; + + // Handle mode fields (when wrapping a server-returned handle) + private readonly _handle?: Handle; + private readonly _client?: AspireClient; + + constructor(format: string, valueProviders: unknown[]); + constructor(handle: Handle, client: AspireClient); + constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { + if (typeof handleOrFormat === 'string') { + this._format = handleOrFormat; + this._valueProviders = clientOrValueProviders as unknown[]; + } else { + this._handle = handleOrFormat; + this._client = clientOrValueProviders as AspireClient; + } + } + + /** + * Creates a reference expression from a tagged template literal. + * + * @param strings - The template literal string parts + * @param values - The interpolated values (handles to value providers) + * @returns A ReferenceExpression instance + */ + static create(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + // Build the format string with {0}, {1}, etc. placeholders + let format = ''; + for (let i = 0; i < strings.length; i++) { + format += strings[i]; + if (i < values.length) { + format += `{${i}}`; + } + } + + // Extract handles from values + const valueProviders = values.map(extractHandleForExpr); + + return new ReferenceExpression(format, valueProviders); + } + + /** + * Serializes the reference expression for JSON-RPC transport. + * In template-literal mode, uses the $expr format. + * In handle mode, delegates to the handle's serialization. + */ + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + if (this._handle) { + return this._handle.toJSON(); + } + + return { + $expr: { + format: this._format!, + valueProviders: this._valueProviders && this._valueProviders.length > 0 ? this._valueProviders : undefined + } + }; + } + + /** + * String representation for debugging. + */ + toString(): string { + if (this._handle) { + return `ReferenceExpression(handle)`; + } + return `ReferenceExpression(${this._format})`; + } +} + +/** + * Extracts a value for use in reference expressions. + * Supports handles (objects) and string literals. + * @internal + */ +function extractHandleForExpr(value: unknown): unknown { + if (value === null || value === undefined) { + throw new Error('Cannot use null or undefined in reference expression'); + } + + // String literals - include directly in the expression + if (typeof value === 'string') { + return value; + } + + // Number literals - convert to string + if (typeof value === 'number') { + return String(value); + } + + // Handle objects - get their JSON representation + if (value instanceof Handle) { + return value.toJSON(); + } + + // Objects with $handle property (already in handle format) + if (typeof value === 'object' && value !== null && '$handle' in value) { + return value; + } + + // Objects with toJSON that returns a handle + if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { + const json = value.toJSON(); + if (json && typeof json === 'object' && '$handle' in json) { + return json; + } + } + + throw new Error( + `Cannot use value of type ${typeof value} in reference expression. ` + + `Expected a Handle, string, or number.` + ); +} + +/** + * Tagged template function for creating reference expressions. + * + * Use this to create dynamic expressions that reference endpoints, parameters, and other + * value providers. The expression is evaluated at runtime by Aspire. + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression using the tagged template + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export function refExpr(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + return ReferenceExpression.create(strings, ...values); +} + +// ============================================================================ +// ResourceBuilderBase +// ============================================================================ + +/** + * Base class for resource builders (e.g., RedisBuilder, ContainerBuilder). + * Provides handle management and JSON serialization. + */ +export class ResourceBuilderBase { + constructor(protected _handle: THandle, protected _client: AspireClient) {} + + toJSON(): MarshalledHandle { return this._handle.toJSON(); } +} + +// ============================================================================ +// AspireList - Mutable List Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET List. + * Provides array-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const items = await resource.getItems(); // Returns AspireList + * const count = await items.count(); + * const first = await items.get(0); + * await items.add(newItem); + * ``` + */ +export class AspireList { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the list handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual list handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual list handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of elements in the list. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.length', { + list: handle + }) as number; + } + + /** + * Gets the element at the specified index. + */ + async get(index: number): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.get', { + list: handle, + index + }) as T; + } + + /** + * Adds an element to the end of the list. + */ + async add(item: T): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.add', { + list: handle, + item + }); + } + + /** + * Removes the element at the specified index. + */ + async removeAt(index: number): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.removeAt', { + list: handle, + index + }); + } + + /** + * Clears all elements from the list. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.clear', { + list: handle + }); + } + + /** + * Converts the list to an array (creates a copy). + */ + async toArray(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.toArray', { + list: handle + }) as T[]; + } + + toJSON(): MarshalledHandle { + if (this._resolvedHandle) { + return this._resolvedHandle.toJSON(); + } + return this._handleOrContext.toJSON(); + } +} + +// ============================================================================ +// AspireDict - Mutable Dictionary Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET Dictionary. + * Provides object-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const config = await resource.getConfig(); // Returns AspireDict + * const value = await config.get("key"); + * await config.set("key", "value"); + * const hasKey = await config.containsKey("key"); + * ``` + */ +export class AspireDict { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the dictionary handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual dictionary handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual dictionary handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of key-value pairs in the dictionary. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.count', { + dict: handle + }) as number; + } + + /** + * Gets the value associated with the specified key. + * @throws If the key is not found. + */ + async get(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.get', { + dict: handle, + key + }) as V; + } + + /** + * Sets the value for the specified key. + */ + async set(key: K, value: V): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.set', { + dict: handle, + key, + value + }); + } + + /** + * Determines whether the dictionary contains the specified key. + */ + async containsKey(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.has', { + dict: handle, + key + }) as boolean; + } + + /** + * Removes the value with the specified key. + * @returns True if the element was removed; false if the key was not found. + */ + async remove(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.remove', { + dict: handle, + key + }) as boolean; + } + + /** + * Clears all key-value pairs from the dictionary. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.clear', { + dict: handle + }); + } + + /** + * Gets all keys in the dictionary. + */ + async keys(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.keys', { + dict: handle + }) as K[]; + } + + /** + * Gets all values in the dictionary. + */ + async values(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.values', { + dict: handle + }) as V[]; + } + + /** + * Converts the dictionary to a plain object (creates a copy). + * Only works when K is string. + */ + async toObject(): Promise> { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.toObject', { + dict: handle + }) as Record; + } + + async toJSON(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } +} diff --git a/samples/aspire-with-node/ts/.modules/transport.ts b/samples/aspire-with-node/ts/.modules/transport.ts new file mode 100644 index 00000000..7bddd74b --- /dev/null +++ b/samples/aspire-with-node/ts/.modules/transport.ts @@ -0,0 +1,574 @@ +// transport.ts - ATS transport layer: RPC, Handle, errors, callbacks +import * as net from 'net'; +import * as rpc from 'vscode-jsonrpc/node.js'; + +// ============================================================================ +// Base Types +// ============================================================================ + +/** + * Type for callback functions that can be registered and invoked from .NET. + * Internal: receives args and client for handle wrapping. + */ +export type CallbackFunction = (args: unknown, client: AspireClient) => unknown | Promise; + +/** + * Represents a handle to a .NET object in the ATS system. + * Handles are typed references that can be passed between capabilities. + */ +export interface MarshalledHandle { + /** The handle ID (instance number) */ + $handle: string; + /** The ATS type ID */ + $type: string; +} + +/** + * Error details for ATS errors. + */ +export interface AtsErrorDetails { + /** The parameter that caused the error */ + parameter?: string; + /** The expected type or value */ + expected?: string; + /** The actual type or value */ + actual?: string; +} + +/** + * Structured error from ATS capability invocation. + */ +export interface AtsError { + /** Machine-readable error code */ + code: string; + /** Human-readable error message */ + message: string; + /** The capability that failed (if applicable) */ + capability?: string; + /** Additional error details */ + details?: AtsErrorDetails; +} + +/** + * ATS error codes returned by the server. + */ +export const AtsErrorCodes = { + /** Unknown capability ID */ + CapabilityNotFound: 'CAPABILITY_NOT_FOUND', + /** Handle ID doesn't exist or was disposed */ + HandleNotFound: 'HANDLE_NOT_FOUND', + /** Handle type doesn't satisfy capability's type constraint */ + TypeMismatch: 'TYPE_MISMATCH', + /** Missing required argument or wrong type */ + InvalidArgument: 'INVALID_ARGUMENT', + /** Argument value outside valid range */ + ArgumentOutOfRange: 'ARGUMENT_OUT_OF_RANGE', + /** Error occurred during callback invocation */ + CallbackError: 'CALLBACK_ERROR', + /** Unexpected error in capability execution */ + InternalError: 'INTERNAL_ERROR', +} as const; + +/** + * Type guard to check if a value is an ATS error response. + */ +export function isAtsError(value: unknown): value is { $error: AtsError } { + return ( + value !== null && + typeof value === 'object' && + '$error' in value && + typeof (value as { $error: unknown }).$error === 'object' + ); +} + +/** + * Type guard to check if a value is a marshalled handle. + */ +export function isMarshalledHandle(value: unknown): value is MarshalledHandle { + return ( + value !== null && + typeof value === 'object' && + '$handle' in value && + '$type' in value + ); +} + +// ============================================================================ +// Handle +// ============================================================================ + +/** + * A typed handle to a .NET object in the ATS system. + * Handles are opaque references that can be passed to capabilities. + * + * @typeParam T - The ATS type ID (e.g., "Aspire.Hosting/IDistributedApplicationBuilder") + */ +export class Handle { + private readonly _handleId: string; + private readonly _typeId: T; + + constructor(marshalled: MarshalledHandle) { + this._handleId = marshalled.$handle; + this._typeId = marshalled.$type as T; + } + + /** The handle ID (instance number) */ + get $handle(): string { + return this._handleId; + } + + /** The ATS type ID */ + get $type(): T { + return this._typeId; + } + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { + return { + $handle: this._handleId, + $type: this._typeId + }; + } + + /** String representation for debugging */ + toString(): string { + return `Handle<${this._typeId}>(${this._handleId})`; + } +} + +// ============================================================================ +// Handle Wrapper Registry +// ============================================================================ + +/** + * Factory function for creating typed wrapper instances from handles. + */ +export type HandleWrapperFactory = (handle: Handle, client: AspireClient) => unknown; + +/** + * Registry of handle wrapper factories by type ID. + * Generated code registers wrapper classes here so callback handles can be properly typed. + */ +const handleWrapperRegistry = new Map(); + +/** + * Register a wrapper factory for a type ID. + * Called by generated code to register wrapper classes. + */ +export function registerHandleWrapper(typeId: string, factory: HandleWrapperFactory): void { + handleWrapperRegistry.set(typeId, factory); +} + +/** + * Checks if a value is a marshalled handle and wraps it appropriately. + * Uses the wrapper registry to create typed wrapper instances when available. + * + * @param value - The value to potentially wrap + * @param client - Optional client for creating typed wrapper instances + */ +export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { + if (value && typeof value === 'object') { + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); + } + } + + return handle; + } + } + return value; +} + +// ============================================================================ +// Capability Error +// ============================================================================ + +/** + * Error thrown when an ATS capability invocation fails. + */ +export class CapabilityError extends Error { + constructor( + /** The structured error from the server */ + public readonly error: AtsError + ) { + super(error.message); + this.name = 'CapabilityError'; + } + + /** Machine-readable error code */ + get code(): string { + return this.error.code; + } + + /** The capability that failed (if applicable) */ + get capability(): string | undefined { + return this.error.capability; + } +} + +// ============================================================================ +// Callback Registry +// ============================================================================ + +const callbackRegistry = new Map(); +let callbackIdCounter = 0; + +/** + * Register a callback function that can be invoked from the .NET side. + * Returns a callback ID that should be passed to methods accepting callbacks. + * + * .NET passes arguments as an object with positional keys: `{ p0: value0, p1: value1, ... }` + * This function automatically extracts positional parameters and wraps handles. + * + * @example + * // Single parameter callback + * const id = registerCallback((ctx) => console.log(ctx)); + * // .NET sends: { p0: { $handle: "...", $type: "..." } } + * // Callback receives: Handle instance + * + * @example + * // Multi-parameter callback + * const id = registerCallback((a, b) => console.log(a, b)); + * // .NET sends: { p0: "hello", p1: 42 } + * // Callback receives: "hello", 42 + */ +export function registerCallback( + callback: (...args: any[]) => TResult | Promise +): string { + const callbackId = `callback_${++callbackIdCounter}_${Date.now()}`; + + // Wrap the callback to handle .NET's positional argument format + const wrapper: CallbackFunction = async (args: unknown, client: AspireClient) => { + // .NET sends args as object { p0: value0, p1: value1, ... } + if (args && typeof args === 'object' && !Array.isArray(args)) { + const argObj = args as Record; + const argArray: unknown[] = []; + + // Extract positional parameters (p0, p1, p2, ...) + for (let i = 0; ; i++) { + const key = `p${i}`; + if (key in argObj) { + argArray.push(wrapIfHandle(argObj[key], client)); + } else { + break; + } + } + + if (argArray.length > 0) { + // Spread positional arguments to callback + const result = await callback(...argArray); + // DTO writeback protocol: when a void callback returns undefined, we + // return the original args object so the .NET host can detect property + // mutations made by the callback and apply them back to the original + // C# DTO objects. DTO args are plain JS objects (not Handle wrappers), + // so any property changes the callback made are reflected in args. + // + // Non-void callbacks (result !== undefined) return their actual result. + // The .NET side only activates writeback for void delegates whose + // parameters include [AspireDto] types — all other cases discard the + // returned args object, so the extra wire payload is harmless. + // + // IMPORTANT: callbacks that intentionally return undefined will also + // trigger this path. For non-void delegate types, the C# proxy uses + // a result-unmarshalling path (not writeback), so returning args will + // cause an unmarshal error. Void callbacks should never return a + // meaningful value; non-void callbacks should always return one. + return result !== undefined ? result : args; + } + + // No positional params found — nothing to write back + return await callback(); + } + + // Null/undefined - call with no args + if (args === null || args === undefined) { + return await callback(); + } + + // Primitive value - pass as single arg (shouldn't happen with current protocol) + return await callback(wrapIfHandle(args, client)); + }; + + callbackRegistry.set(callbackId, wrapper); + return callbackId; +} + +/** + * Unregister a callback by its ID. + */ +export function unregisterCallback(callbackId: string): boolean { + return callbackRegistry.delete(callbackId); +} + +/** + * Get the number of registered callbacks. + */ +export function getCallbackCount(): number { + return callbackRegistry.size; +} + +// ============================================================================ +// Cancellation Token Registry +// ============================================================================ + +/** + * Registry for cancellation tokens. + * Maps cancellation IDs to cleanup functions. + */ +const cancellationRegistry = new Map void>(); +let cancellationIdCounter = 0; + +/** + * A reference to the current AspireClient for sending cancel requests. + * Set by AspireClient.connect(). + */ +let currentClient: AspireClient | null = null; + +/** + * Register an AbortSignal for cancellation support. + * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * + * When the AbortSignal is aborted, sends a cancelToken request to the host. + * + * @param signal - The AbortSignal to register (optional) + * @returns The cancellation ID, or undefined if no signal provided + * + * @example + * const controller = new AbortController(); + * const id = registerCancellation(controller.signal); + * // Pass id to capability invocation + * // Later: controller.abort() will cancel the operation + */ +export function registerCancellation(signal?: AbortSignal): string | undefined { + if (!signal) { + return undefined; + } + + // Already aborted? Don't register + if (signal.aborted) { + return undefined; + } + + const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; + + // Set up the abort listener + const onAbort = () => { + // Send cancel request to host + if (currentClient?.connected) { + currentClient.cancelToken(cancellationId).catch(() => { + // Ignore errors - the operation may have already completed + }); + } + // Clean up the listener + cancellationRegistry.delete(cancellationId); + }; + + // Listen for abort + signal.addEventListener('abort', onAbort, { once: true }); + + // Store cleanup function + cancellationRegistry.set(cancellationId, () => { + signal.removeEventListener('abort', onAbort); + }); + + return cancellationId; +} + +/** + * Unregister a cancellation token by its ID. + * Call this when the operation completes to clean up resources. + * + * @param cancellationId - The cancellation ID to unregister + */ +export function unregisterCancellation(cancellationId: string | undefined): void { + if (!cancellationId) { + return; + } + + const cleanup = cancellationRegistry.get(cancellationId); + if (cleanup) { + cleanup(); + cancellationRegistry.delete(cancellationId); + } +} + +// ============================================================================ +// AspireClient (JSON-RPC Connection) +// ============================================================================ + +/** + * Client for connecting to the Aspire AppHost via socket/named pipe. + */ +export class AspireClient { + private connection: rpc.MessageConnection | null = null; + private socket: net.Socket | null = null; + private disconnectCallbacks: (() => void)[] = []; + private _pendingCalls = 0; + + constructor(private socketPath: string) { } + + /** + * Register a callback to be called when the connection is lost + */ + onDisconnect(callback: () => void): void { + this.disconnectCallbacks.push(callback); + } + + private notifyDisconnect(): void { + for (const callback of this.disconnectCallbacks) { + try { + callback(); + } catch { + // Ignore callback errors + } + } + } + + connect(timeoutMs: number = 5000): Promise { + return new Promise((resolve, reject) => { + const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this.socket = net.createConnection(pipePath); + + this.socket.once('error', (error: Error) => { + clearTimeout(timeout); + reject(error); + }); + + this.socket.once('connect', () => { + clearTimeout(timeout); + try { + const reader = new rpc.SocketMessageReader(this.socket!); + const writer = new rpc.SocketMessageWriter(this.socket!); + this.connection = rpc.createMessageConnection(reader, writer); + + this.connection.onClose(() => { + this.connection = null; + this.notifyDisconnect(); + }); + this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); + + // Handle callback invocations from the .NET side + this.connection.onRequest('invokeCallback', async (callbackId: string, args: unknown) => { + const callback = callbackRegistry.get(callbackId); + if (!callback) { + throw new Error(`Callback not found: ${callbackId}`); + } + try { + // The registered wrapper handles arg unpacking and handle wrapping + // Pass this client so handles can be wrapped with typed wrapper classes + return await Promise.resolve(callback(args, this)); + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + throw new Error(`Callback execution failed: ${message}`); + } + }); + + this.connection.listen(); + + // Set the current client for cancellation registry + currentClient = this; + + resolve(); + } catch (e) { + reject(e); + } + }); + + this.socket.on('close', () => { + this.connection?.dispose(); + this.connection = null; + if (currentClient === this) { + currentClient = null; + } + this.notifyDisconnect(); + }); + }); + } + + ping(): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('ping'); + } + + /** + * Cancel a CancellationToken by its ID. + * Called when an AbortSignal is aborted. + * + * @param tokenId - The token ID to cancel + * @returns True if the token was found and cancelled, false otherwise + */ + cancelToken(tokenId: string): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('cancelToken', tokenId); + } + + /** + * Invoke an ATS capability by ID. + * + * Capabilities are operations exposed by [AspireExport] attributes. + * Results are automatically wrapped in Handle objects when applicable. + * + * @param capabilityId - The capability ID (e.g., "Aspire.Hosting/createBuilder") + * @param args - Arguments to pass to the capability + * @returns The capability result, wrapped as Handle if it's a handle type + * @throws CapabilityError if the capability fails + */ + async invokeCapability( + capabilityId: string, + args?: Record + ): Promise { + if (!this.connection) { + throw new Error('Not connected to AppHost'); + } + + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); + } + this._pendingCalls++; + + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + args ?? null + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } + } + + disconnect(): void { + try { this.connection?.dispose(); } finally { this.connection = null; } + try { this.socket?.end(); } finally { this.socket = null; } + } + + get connected(): boolean { + return this.connection !== null && this.socket !== null; + } +} diff --git a/samples/aspire-with-node/ts/package-lock.json b/samples/aspire-with-node/ts/package-lock.json new file mode 100644 index 00000000..c4d3800c --- /dev/null +++ b/samples/aspire-with-node/ts/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "ts", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/samples/aspire-with-python/ts/.aspire/settings.json b/samples/aspire-with-python/ts/.aspire/settings.json index 7d5a1905..d1f66f1c 100644 --- a/samples/aspire-with-python/ts/.aspire/settings.json +++ b/samples/aspire-with-python/ts/.aspire/settings.json @@ -1 +1,9 @@ -{"appHostPath":"../apphost.ts"} \ No newline at end of file +{ + "appHostPath": "../apphost.ts", + "sdkVersion": "13.2.0-preview.1.26159.1", + "packages": { + "Aspire.Hosting.JavaScript": "13.1.2", + "Aspire.Hosting.Python": "13.1.2", + "Aspire.Hosting.Redis": "13.1.2" + } +} \ No newline at end of file diff --git a/samples/aspire-with-python/ts/.modules/.codegen-hash b/samples/aspire-with-python/ts/.modules/.codegen-hash new file mode 100644 index 00000000..9096ba67 --- /dev/null +++ b/samples/aspire-with-python/ts/.modules/.codegen-hash @@ -0,0 +1 @@ +D66AA668A0AD635945E71F6603AA313690E7E1F03850A50E65F7552A3CCC96A8 \ No newline at end of file diff --git a/samples/aspire-with-python/ts/.modules/aspire.ts b/samples/aspire-with-python/ts/.modules/aspire.ts new file mode 100644 index 00000000..73dc52d2 --- /dev/null +++ b/samples/aspire-with-python/ts/.modules/aspire.ts @@ -0,0 +1,13306 @@ +// aspire.ts - Capability-based Aspire SDK +// This SDK uses the ATS (Aspire Type System) capability API. +// Capabilities are endpoints like 'Aspire.Hosting/createBuilder'. +// +// GENERATED CODE - DO NOT EDIT + +import { + AspireClient as AspireClientRpc, + Handle, + MarshalledHandle, + CapabilityError, + registerCallback, + wrapIfHandle, + registerHandleWrapper +} from './transport.js'; + +import { + ResourceBuilderBase, + ReferenceExpression, + refExpr, + AspireDict, + AspireList +} from './base.js'; + +// ============================================================================ +// Handle Type Aliases (Internal - not exported to users) +// ============================================================================ + +/** Handle to CommandLineArgsCallbackContext */ +type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; + +/** Handle to ContainerRegistryResource */ +type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; + +/** Handle to ContainerResource */ +type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource'>; + +/** Handle to CSharpAppResource */ +type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; + +/** Handle to DotnetToolResource */ +type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; + +/** Handle to EndpointReference */ +type EndpointReferenceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference'>; + +/** Handle to EndpointReferenceExpression */ +type EndpointReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression'>; + +/** Handle to EnvironmentCallbackContext */ +type EnvironmentCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext'>; + +/** Handle to ExecutableResource */ +type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource'>; + +/** Handle to ExecuteCommandContext */ +type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; + +/** Handle to IContainerFilesDestinationResource */ +type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; + +/** Handle to IResource */ +type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; + +/** Handle to IResourceWithArgs */ +type IResourceWithArgsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs'>; + +/** Handle to IResourceWithConnectionString */ +type IResourceWithConnectionStringHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString'>; + +/** Handle to IResourceWithEndpoints */ +type IResourceWithEndpointsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints'>; + +/** Handle to IResourceWithEnvironment */ +type IResourceWithEnvironmentHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment'>; + +/** Handle to IResourceWithWaitSupport */ +type IResourceWithWaitSupportHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport'>; + +/** Handle to ParameterResource */ +type ParameterResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource'>; + +/** Handle to ProjectResource */ +type ProjectResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource'>; + +/** Handle to ReferenceExpression */ +type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression'>; + +/** Handle to ReferenceExpressionBuilder */ +type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; + +/** Handle to ResourceLoggerService */ +type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; + +/** Handle to ResourceNotificationService */ +type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; + +/** Handle to ResourceUrlsCallbackContext */ +type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; + +/** Handle to ConnectionStringResource */ +type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; + +/** Handle to DistributedApplication */ +type DistributedApplicationHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplication'>; + +/** Handle to DistributedApplicationExecutionContext */ +type DistributedApplicationExecutionContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext'>; + +/** Handle to DistributedApplicationEventSubscription */ +type DistributedApplicationEventSubscriptionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.DistributedApplicationEventSubscription'>; + +/** Handle to IDistributedApplicationEventing */ +type IDistributedApplicationEventingHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing'>; + +/** Handle to ExternalServiceResource */ +type ExternalServiceResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ExternalServiceResource'>; + +/** Handle to IDistributedApplicationBuilder */ +type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder'>; + +/** Handle to IResourceWithContainerFiles */ +type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; + +/** Handle to IResourceWithServiceDiscovery */ +type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; + +/** Handle to PipelineConfigurationContext */ +type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; + +/** Handle to PipelineStep */ +type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; + +/** Handle to PipelineStepContext */ +type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; + +/** Handle to ProjectResourceOptions */ +type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; + +/** Handle to Dict */ +type DictstringanyHandle = Handle<'Aspire.Hosting/Dict'>; + +/** Handle to List */ +type ListanyHandle = Handle<'Aspire.Hosting/List'>; + +/** Handle to IConfiguration */ +type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; + +/** Handle to IHostEnvironment */ +type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; + +/** Handle to ILogger */ +type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; + +/** Handle to string[] */ +type stringArrayHandle = Handle<'string[]'>; + +/** Handle to IServiceProvider */ +type IServiceProviderHandle = Handle<'System.ComponentModel/System.IServiceProvider'>; + +// ============================================================================ +// Enum Types +// ============================================================================ + +/** Enum type for CertificateTrustScope */ +export enum CertificateTrustScope { + None = "None", + Append = "Append", + Override = "Override", + System = "System", +} + +/** Enum type for ContainerLifetime */ +export enum ContainerLifetime { + Session = "Session", + Persistent = "Persistent", +} + +/** Enum type for DistributedApplicationOperation */ +export enum DistributedApplicationOperation { + Run = "Run", + Publish = "Publish", +} + +/** Enum type for EndpointProperty */ +export enum EndpointProperty { + Url = "Url", + Host = "Host", + IPV4Host = "IPV4Host", + Port = "Port", + Scheme = "Scheme", + TargetPort = "TargetPort", + HostAndPort = "HostAndPort", +} + +/** Enum type for IconVariant */ +export enum IconVariant { + Regular = "Regular", + Filled = "Filled", +} + +/** Enum type for ImagePullPolicy */ +export enum ImagePullPolicy { + Default = "Default", + Always = "Always", + Missing = "Missing", + Never = "Never", +} + +/** Enum type for OtlpProtocol */ +export enum OtlpProtocol { + Grpc = "Grpc", + HttpProtobuf = "HttpProtobuf", + HttpJson = "HttpJson", +} + +/** Enum type for ProbeType */ +export enum ProbeType { + Startup = "Startup", + Readiness = "Readiness", + Liveness = "Liveness", +} + +/** Enum type for ProtocolType */ +export enum ProtocolType { + IP = "IP", + IPv6HopByHopOptions = "IPv6HopByHopOptions", + Unspecified = "Unspecified", + Icmp = "Icmp", + Igmp = "Igmp", + Ggp = "Ggp", + IPv4 = "IPv4", + Tcp = "Tcp", + Pup = "Pup", + Udp = "Udp", + Idp = "Idp", + IPv6 = "IPv6", + IPv6RoutingHeader = "IPv6RoutingHeader", + IPv6FragmentHeader = "IPv6FragmentHeader", + IPSecEncapsulatingSecurityPayload = "IPSecEncapsulatingSecurityPayload", + IPSecAuthenticationHeader = "IPSecAuthenticationHeader", + IcmpV6 = "IcmpV6", + IPv6NoNextHeader = "IPv6NoNextHeader", + IPv6DestinationOptions = "IPv6DestinationOptions", + ND = "ND", + Raw = "Raw", + Ipx = "Ipx", + Spx = "Spx", + SpxII = "SpxII", + Unknown = "Unknown", +} + +/** Enum type for UrlDisplayLocation */ +export enum UrlDisplayLocation { + SummaryAndDetails = "SummaryAndDetails", + DetailsOnly = "DetailsOnly", +} + +/** Enum type for WaitBehavior */ +export enum WaitBehavior { + WaitOnResourceUnavailable = "WaitOnResourceUnavailable", + StopOnResourceUnavailable = "StopOnResourceUnavailable", +} + +// ============================================================================ +// DTO Interfaces +// ============================================================================ + +/** DTO interface for CommandOptions */ +export interface CommandOptions { + description?: string; + parameter?: any; + confirmationMessage?: string; + iconName?: string; + iconVariant?: IconVariant; + isHighlighted?: boolean; + updateState?: any; +} + +/** DTO interface for CreateBuilderOptions */ +export interface CreateBuilderOptions { + args?: string[]; + projectDirectory?: string; + appHostFilePath?: string; + containerRegistryOverride?: string; + disableDashboard?: boolean; + dashboardApplicationName?: string; + allowUnsecuredTransport?: boolean; + enableResourceLogging?: boolean; +} + +/** DTO interface for ExecuteCommandResult */ +export interface ExecuteCommandResult { + success?: boolean; + canceled?: boolean; + errorMessage?: string; +} + +/** DTO interface for ResourceEventDto */ +export interface ResourceEventDto { + resourceName?: string; + resourceId?: string; + state?: string; + stateStyle?: string; + healthStatus?: string; + exitCode?: number; +} + +/** DTO interface for ResourceUrlAnnotation */ +export interface ResourceUrlAnnotation { + url?: string; + displayText?: string; + endpoint?: EndpointReferenceHandle; + displayLocation?: UrlDisplayLocation; +} + +// ============================================================================ +// Options Interfaces +// ============================================================================ + +export interface AddConnectionStringOptions { + environmentVariableName?: string; +} + +export interface AddContainerRegistryOptions { + repository?: ParameterResource; +} + +export interface AddDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface AddParameterFromConfigurationOptions { + secret?: boolean; +} + +export interface AddParameterOptions { + secret?: boolean; +} + +export interface AppendFormattedOptions { + format?: string; +} + +export interface AppendValueProviderOptions { + format?: string; +} + +export interface GetValueAsyncOptions { + cancellationToken?: AbortSignal; +} + +export interface RunOptions { + cancellationToken?: AbortSignal; +} + +export interface WaitForCompletionOptions { + exitCode?: number; +} + +export interface WithBindMountOptions { + isReadOnly?: boolean; +} + +export interface WithCommandOptions { + commandOptions?: CommandOptions; +} + +export interface WithDescriptionOptions { + enableMarkdown?: boolean; +} + +export interface WithDockerfileBaseImageOptions { + buildImage?: string; + runtimeImage?: string; +} + +export interface WithDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface WithEndpointOptions { + port?: number; + targetPort?: number; + scheme?: string; + name?: string; + env?: string; + isProxied?: boolean; + isExternal?: boolean; + protocol?: ProtocolType; +} + +export interface WithExternalServiceHttpHealthCheckOptions { + path?: string; + statusCode?: number; +} + +export interface WithHttpEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithHttpHealthCheckOptions { + path?: string; + statusCode?: number; + endpointName?: string; +} + +export interface WithHttpProbeOptions { + path?: string; + initialDelaySeconds?: number; + periodSeconds?: number; + timeoutSeconds?: number; + failureThreshold?: number; + successThreshold?: number; + endpointName?: string; +} + +export interface WithHttpsDeveloperCertificateOptions { + password?: ParameterResource; +} + +export interface WithHttpsEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithIconNameOptions { + iconVariant?: IconVariant; +} + +export interface WithImageOptions { + tag?: string; +} + +export interface WithMcpServerOptions { + path?: string; + endpointName?: string; +} + +export interface WithPipelineStepFactoryOptions { + dependsOn?: string[]; + requiredBy?: string[]; + tags?: string[]; + description?: string; +} + +export interface WithReferenceOptions { + connectionName?: string; + optional?: boolean; +} + +export interface WithRequiredCommandOptions { + helpLink?: string; +} + +export interface WithUrlExpressionOptions { + displayText?: string; +} + +export interface WithUrlOptions { + displayText?: string; +} + +export interface WithVolumeOptions { + name?: string; + isReadOnly?: boolean; +} + +// ============================================================================ +// CommandLineArgsCallbackContext +// ============================================================================ + +/** + * Type class for CommandLineArgsCallbackContext. + */ +export class CommandLineArgsCallbackContext { + constructor(private _handle: CommandLineArgsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Args property */ + private _args?: AspireList; + get args(): AspireList { + if (!this._args) { + this._args = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args', + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args' + ); + } + return this._args; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplication +// ============================================================================ + +/** + * Type class for DistributedApplication. + */ +export class DistributedApplication { + constructor(private _handle: DistributedApplicationHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Runs the distributed application */ + /** @internal */ + async _runInternal(cancellationToken?: AbortSignal): Promise { + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + await this._client.invokeCapability( + 'Aspire.Hosting/run', + rpcArgs + ); + return this; + } + + run(options?: RunOptions): DistributedApplicationPromise { + const cancellationToken = options?.cancellationToken; + return new DistributedApplicationPromise(this._runInternal(cancellationToken)); + } + +} + +/** + * Thenable wrapper for DistributedApplication that enables fluent chaining. + */ +export class DistributedApplicationPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplication) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Runs the distributed application */ + run(options?: RunOptions): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.run(options))); + } + +} + +// ============================================================================ +// DistributedApplicationExecutionContext +// ============================================================================ + +/** + * Type class for DistributedApplicationExecutionContext. + */ +export class DistributedApplicationExecutionContext { + constructor(private _handle: DistributedApplicationExecutionContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PublisherName property */ + publisherName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.publisherName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.setPublisherName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Operation property */ + operation = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.operation', + { context: this._handle } + ); + }, + }; + + /** Gets the IsPublishMode property */ + isPublishMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isPublishMode', + { context: this._handle } + ); + }, + }; + + /** Gets the IsRunMode property */ + isRunMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isRunMode', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EndpointReference +// ============================================================================ + +/** + * Type class for EndpointReference. + */ +export class EndpointReference { + constructor(private _handle: EndpointReferenceHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EndpointName property */ + endpointName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.endpointName', + { context: this._handle } + ); + }, + }; + + /** Gets the ErrorMessage property */ + errorMessage = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.errorMessage', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.setErrorMessage', + { context: this._handle, value } + ); + } + }; + + /** Gets the IsAllocated property */ + isAllocated = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isAllocated', + { context: this._handle } + ); + }, + }; + + /** Gets the Exists property */ + exists = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.exists', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttp property */ + isHttp = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttp', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttps property */ + isHttps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttps', + { context: this._handle } + ); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.port', + { context: this._handle } + ); + }, + }; + + /** Gets the TargetPort property */ + targetPort = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.targetPort', + { context: this._handle } + ); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.host', + { context: this._handle } + ); + }, + }; + + /** Gets the Scheme property */ + scheme = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.scheme', + { context: this._handle } + ); + }, + }; + + /** Gets the Url property */ + url = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.url', + { context: this._handle } + ); + }, + }; + + /** Gets the URL of the endpoint asynchronously */ + async getValueAsync(options?: GetValueAsyncOptions): Promise { + const cancellationToken = options?.cancellationToken; + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValueAsync', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for EndpointReference that enables fluent chaining. + */ +export class EndpointReferencePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: EndpointReference) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets the URL of the endpoint asynchronously */ + getValueAsync(options?: GetValueAsyncOptions): Promise { + return this._promise.then(obj => obj.getValueAsync(options)); + } + +} + +// ============================================================================ +// EndpointReferenceExpression +// ============================================================================ + +/** + * Type class for EndpointReferenceExpression. + */ +export class EndpointReferenceExpression { + constructor(private _handle: EndpointReferenceExpressionHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Endpoint property */ + endpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.endpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Property property */ + property = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.property', + { context: this._handle } + ); + }, + }; + + /** Gets the ValueExpression property */ + valueExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.valueExpression', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EnvironmentCallbackContext +// ============================================================================ + +/** + * Type class for EnvironmentCallbackContext. + */ +export class EnvironmentCallbackContext { + constructor(private _handle: EnvironmentCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EnvironmentVariables property */ + private _environmentVariables?: AspireDict; + get environmentVariables(): AspireDict { + if (!this._environmentVariables) { + this._environmentVariables = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables', + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables' + ); + } + return this._environmentVariables; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ExecuteCommandContext +// ============================================================================ + +/** + * Type class for ExecuteCommandContext. + */ +export class ExecuteCommandContext { + constructor(private _handle: ExecuteCommandContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ResourceName property */ + resourceName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.resourceName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setResourceName', + { context: this._handle, value } + ); + } + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', + { context: this._handle } + ); + }, + set: async (value: AbortSignal): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + { context: this._handle } + ); + }, + set: async (value: PipelineStep[]): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', + { context: this._handle, value } + ); + } + }; + + /** Gets pipeline steps with the specified tag */ + async getStepsByTag(tag: string): Promise { + const rpcArgs: Record = { context: this._handle, tag }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/getStepsByTag', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for PipelineConfigurationContext that enables fluent chaining. + */ +export class PipelineConfigurationContextPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineConfigurationContext) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets pipeline steps with the specified tag */ + getStepsByTag(tag: string): Promise { + return this._promise.then(obj => obj.getStepsByTag(tag)); + } + +} + +// ============================================================================ +// PipelineStep +// ============================================================================ + +/** + * Type class for PipelineStep. + */ +export class PipelineStep { + constructor(private _handle: PipelineStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.name', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Description property */ + description = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.description', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setDescription', + { context: this._handle, value } + ); + } + }; + + /** Gets the DependsOnSteps property */ + private _dependsOnSteps?: AspireList; + get dependsOnSteps(): AspireList { + if (!this._dependsOnSteps) { + this._dependsOnSteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps', + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps' + ); + } + return this._dependsOnSteps; + } + + /** Gets the RequiredBySteps property */ + private _requiredBySteps?: AspireList; + get requiredBySteps(): AspireList { + if (!this._requiredBySteps) { + this._requiredBySteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps', + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps' + ); + } + return this._requiredBySteps; + } + + /** Gets the Tags property */ + private _tags?: AspireList; + get tags(): AspireList { + if (!this._tags) { + this._tags = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.tags', + 'Aspire.Hosting.Pipelines/PipelineStep.tags' + ); + } + return this._tags; + } + + /** Adds a dependency on another step by name */ + /** @internal */ + async _dependsOnInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/dependsOn', + rpcArgs + ); + return this; + } + + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._dependsOnInternal(stepName)); + } + + /** Specifies that another step requires this step by name */ + /** @internal */ + async _requiredByInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/requiredBy', + rpcArgs + ); + return this; + } + + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._requiredByInternal(stepName)); + } + +} + +/** + * Thenable wrapper for PipelineStep that enables fluent chaining. + */ +export class PipelineStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineStep) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a dependency on another step by name */ + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.dependsOn(stepName))); + } + + /** Specifies that another step requires this step by name */ + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.requiredBy(stepName))); + } + +} + +// ============================================================================ +// PipelineStepContext +// ============================================================================ + +/** + * Type class for PipelineStepContext. + */ +export class PipelineStepContext { + constructor(private _handle: PipelineStepContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// ProjectResourceOptions +// ============================================================================ + +/** + * Type class for ProjectResourceOptions. + */ +export class ProjectResourceOptions { + constructor(private _handle: ProjectResourceOptionsHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the LaunchProfileName property */ + launchProfileName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.launchProfileName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setLaunchProfileName', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeLaunchProfile property */ + excludeLaunchProfile = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeLaunchProfile', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeLaunchProfile', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeKestrelEndpoints property */ + excludeKestrelEndpoints = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeKestrelEndpoints', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeKestrelEndpoints', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// ReferenceExpressionBuilder +// ============================================================================ + +/** + * Type class for ReferenceExpressionBuilder. + */ +export class ReferenceExpressionBuilder { + constructor(private _handle: ReferenceExpressionBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the IsEmpty property */ + isEmpty = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ReferenceExpressionBuilder.isEmpty', + { context: this._handle } + ); + }, + }; + + /** Appends a literal string to the reference expression */ + /** @internal */ + async _appendLiteralInternal(value: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendLiteral', + rpcArgs + ); + return this; + } + + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._appendLiteralInternal(value)); + } + + /** Appends a formatted string value to the reference expression */ + /** @internal */ + async _appendFormattedInternal(value: string, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendFormatted', + rpcArgs + ); + return this; + } + + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendFormattedInternal(value, format)); + } + + /** Appends a value provider to the reference expression */ + /** @internal */ + async _appendValueProviderInternal(valueProvider: any, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, valueProvider }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendValueProvider', + rpcArgs + ); + return this; + } + + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendValueProviderInternal(valueProvider, format)); + } + + /** Builds the reference expression */ + async build(): Promise { + const rpcArgs: Record = { context: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/build', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ReferenceExpressionBuilder that enables fluent chaining. + */ +export class ReferenceExpressionBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReferenceExpressionBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Appends a literal string to the reference expression */ + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendLiteral(value))); + } + + /** Appends a formatted string value to the reference expression */ + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendFormatted(value, options))); + } + + /** Appends a value provider to the reference expression */ + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendValueProvider(valueProvider, options))); + } + + /** Builds the reference expression */ + build(): Promise { + return this._promise.then(obj => obj.build()); + } + +} + +// ============================================================================ +// ResourceUrlsCallbackContext +// ============================================================================ + +/** + * Type class for ResourceUrlsCallbackContext. + */ +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Builds the distributed application */ + /** @internal */ + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', + rpcArgs + ); + return new DistributedApplication(result, this._client); + } + + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); + } + + /** Adds a connection string with a builder callback */ + /** @internal */ + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionStringBuilder', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + } + + /** Adds a container registry resource */ + /** @internal */ + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + } + + /** Adds a container resource */ + /** @internal */ + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); + } + + /** Adds a container resource built from a Dockerfile */ + /** @internal */ + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); + } + + /** Adds a .NET tool resource */ + /** @internal */ + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + } + + /** Adds an executable resource */ + /** @internal */ + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + } + + /** Adds an external service resource */ + /** @internal */ + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); + } + + /** Adds a parameter resource */ + /** @internal */ + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); + } + + /** Adds a parameter sourced from configuration */ + /** @internal */ + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + } + + /** Adds a connection string resource */ + /** @internal */ + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + } + + /** Adds a .NET project resource */ + /** @internal */ + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + } + + /** Adds a project resource with configuration options */ + /** @internal */ + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + } + + /** Adds a C# application resource */ + /** @internal */ + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + } + + /** Adds a C# application resource with configuration options */ + /** @internal */ + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + */ +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); + } + + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + } + + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + } + + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + } + + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + } + + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + } + + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); + } + + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + } + + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); + } + + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + } + + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); + } + + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); + } + + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); + } + + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); + } + + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); + } + +} + +// ============================================================================ +// DistributedApplicationEventing +// ============================================================================ + +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Unsubscribe method */ + /** @internal */ + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + rpcArgs + ); + return this; + } + + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ + +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerResource +// ============================================================================ + +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + const exitCode = options?.exitCode; + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + const password = options?.password; + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// CSharpAppResource +// ============================================================================ + +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + const exitCode = options?.exitCode; + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + const commandOptions = options?.commandOptions; + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + const password = options?.password; + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + const iconVariant = options?.iconVariant; + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// DotnetToolResource +// ============================================================================ + +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + } + + /** @internal */ + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + } + + /** @internal */ + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + } + + /** @internal */ + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + } + + /** @internal */ + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + } + + /** @internal */ + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + const exitCode = options?.exitCode; + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + const commandOptions = options?.commandOptions; + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + const password = options?.password; + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + const iconVariant = options?.iconVariant; + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for DotnetToolResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExecutableResource +// ============================================================================ + +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerFilesDestinationResource +// ============================================================================ + +export class ContainerFilesDestinationResource extends ResourceBuilderBase { + constructor(handle: IContainerFilesDestinationResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ContainerFilesDestinationResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + +} + +/** + * Thenable wrapper for ContainerFilesDestinationResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerFilesDestinationResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerFilesDestinationResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + +} + +// ============================================================================ +// Resource +// ============================================================================ + +export class Resource extends ResourceBuilderBase { + constructor(handle: IResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + const helpLink = options?.helpLink; + return new ResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + const commandOptions = options?.commandOptions; + return new ResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + const iconVariant = options?.iconVariant; + return new ResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for Resource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Resource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ResourceWithArgs +// ============================================================================ + +export class ResourceWithArgs extends ResourceBuilderBase { + constructor(handle: IResourceWithArgsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackAsyncInternal(callback)); + } + +} + +/** + * Thenable wrapper for ResourceWithArgs that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithArgsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithArgs) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + +} + +// ============================================================================ +// ResourceWithConnectionString +// ============================================================================ + +export class ResourceWithConnectionString extends ResourceBuilderBase { + constructor(handle: IResourceWithConnectionStringHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyValueInternal(name, value)); + } + +} + +/** + * Thenable wrapper for ResourceWithConnectionString that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithConnectionStringPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithConnectionString) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + +} + +// ============================================================================ +// ResourceWithContainerFiles +// ============================================================================ + +export class ResourceWithContainerFiles extends ResourceBuilderBase { + constructor(handle: IResourceWithContainerFilesHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._clearContainerFilesSourcesInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithContainerFiles that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithContainerFilesPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithContainerFiles) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + +} + +// ============================================================================ +// ResourceWithEndpoints +// ============================================================================ + +export class ResourceWithEndpoints extends ResourceBuilderBase { + constructor(handle: IResourceWithEndpointsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ResourceWithEndpointsPromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + +} + +/** + * Thenable wrapper for ResourceWithEndpoints that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEndpointsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEndpoints) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + +} + +// ============================================================================ +// ResourceWithEnvironment +// ============================================================================ + +export class ResourceWithEnvironment extends ResourceBuilderBase { + constructor(handle: IResourceWithEnvironmentHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + const password = options?.password; + return new ResourceWithEnvironmentPromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withoutHttpsCertificateInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithEnvironment that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + +} + +// ============================================================================ +// ResourceWithServiceDiscovery +// ============================================================================ + +export class ResourceWithServiceDiscovery extends ResourceBuilderBase { + constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { + super(handle, client); + } + +} + +/** + * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithServiceDiscoveryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + +} + +// ============================================================================ +// ResourceWithWaitSupport +// ============================================================================ + +export class ResourceWithWaitSupport extends ResourceBuilderBase { + constructor(handle: IResourceWithWaitSupportHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + const exitCode = options?.exitCode; + return new ResourceWithWaitSupportPromise(this._waitForCompletionInternal(dependency, exitCode)); + } + +} + +/** + * Thenable wrapper for ResourceWithWaitSupport that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithWaitSupportPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithWaitSupport) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + +} + +// ============================================================================ +// Connection Helper +// ============================================================================ + +/** + * Creates and connects to the Aspire AppHost. + * Reads connection info from environment variables set by `aspire run`. + */ +export async function connect(): Promise { + const socketPath = process.env.REMOTE_APP_HOST_SOCKET_PATH; + if (!socketPath) { + throw new Error( + 'REMOTE_APP_HOST_SOCKET_PATH environment variable not set. ' + + 'Run this application using `aspire run`.' + ); + } + + const client = new AspireClientRpc(socketPath); + await client.connect(); + + // Exit the process if the server connection is lost + client.onDisconnect(() => { + console.error('Connection to AppHost lost. Exiting...'); + process.exit(1); + }); + + return client; +} + +/** + * Creates a new distributed application builder. + * This is the entry point for building Aspire applications. + * + * @param options - Optional configuration options for the builder + * @returns A DistributedApplicationBuilder instance + * + * @example + * const builder = await createBuilder(); + * builder.addRedis("cache"); + * builder.addContainer("api", "mcr.microsoft.com/dotnet/samples:aspnetapp"); + * const app = await builder.build(); + * await app.run(); + */ +export async function createBuilder(options?: CreateBuilderOptions): Promise { + const client = await connect(); + + // Default args, projectDirectory, and appHostFilePath if not provided + // ASPIRE_APPHOST_FILEPATH is set by the CLI for consistent socket hash computation + const effectiveOptions: CreateBuilderOptions = { + ...options, + args: options?.args ?? process.argv.slice(2), + projectDirectory: options?.projectDirectory ?? process.env.ASPIRE_PROJECT_DIRECTORY ?? process.cwd(), + appHostFilePath: options?.appHostFilePath ?? process.env.ASPIRE_APPHOST_FILEPATH + }; + + const handle = await client.invokeCapability( + 'Aspire.Hosting/createBuilderWithOptions', + { options: effectiveOptions } + ); + return new DistributedApplicationBuilder(handle, client); +} + +// Re-export commonly used types +export { Handle, CapabilityError, registerCallback } from './transport.js'; +export { refExpr, ReferenceExpression } from './base.js'; + +// ============================================================================ +// Global Error Handling +// ============================================================================ + +/** + * Set up global error handlers to ensure the process exits properly on errors. + * Node.js doesn't exit on unhandled rejections by default, so we need to handle them. + */ +process.on('unhandledRejection', (reason: unknown) => { + const error = reason instanceof Error ? reason : new Error(String(reason)); + + if (reason instanceof CapabilityError) { + console.error(`\n❌ Capability Error: ${error.message}`); + console.error(` Code: ${(reason as CapabilityError).code}`); + if ((reason as CapabilityError).capability) { + console.error(` Capability: ${(reason as CapabilityError).capability}`); + } + } else { + console.error(`\n❌ Unhandled Error: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + } + + process.exit(1); +}); + +process.on('uncaughtException', (error: Error) => { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + process.exit(1); +}); + +// ============================================================================ +// Handle Wrapper Registrations +// ============================================================================ + +// Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource', (handle, client) => new CSharpAppResource(handle as CSharpAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString', (handle, client) => new ResourceWithConnectionString(handle as IResourceWithConnectionStringHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); + diff --git a/samples/aspire-with-python/ts/.modules/base.ts b/samples/aspire-with-python/ts/.modules/base.ts new file mode 100644 index 00000000..7778b0f1 --- /dev/null +++ b/samples/aspire-with-python/ts/.modules/base.ts @@ -0,0 +1,473 @@ +// aspire.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle } from './transport.js'; + +// Re-export transport types for convenience +export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; +export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; + +// ============================================================================ +// Reference Expression +// ============================================================================ + +/** + * Represents a reference expression that can be passed to capabilities. + * + * Reference expressions are serialized in the protocol as: + * ```json + * { + * "$expr": { + * "format": "redis://{0}:{1}", + * "valueProviders": [ + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:1" }, + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:2" } + * ] + * } + * } + * ``` + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export class ReferenceExpression { + // Expression mode fields + private readonly _format?: string; + private readonly _valueProviders?: unknown[]; + + // Handle mode fields (when wrapping a server-returned handle) + private readonly _handle?: Handle; + private readonly _client?: AspireClient; + + constructor(format: string, valueProviders: unknown[]); + constructor(handle: Handle, client: AspireClient); + constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { + if (typeof handleOrFormat === 'string') { + this._format = handleOrFormat; + this._valueProviders = clientOrValueProviders as unknown[]; + } else { + this._handle = handleOrFormat; + this._client = clientOrValueProviders as AspireClient; + } + } + + /** + * Creates a reference expression from a tagged template literal. + * + * @param strings - The template literal string parts + * @param values - The interpolated values (handles to value providers) + * @returns A ReferenceExpression instance + */ + static create(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + // Build the format string with {0}, {1}, etc. placeholders + let format = ''; + for (let i = 0; i < strings.length; i++) { + format += strings[i]; + if (i < values.length) { + format += `{${i}}`; + } + } + + // Extract handles from values + const valueProviders = values.map(extractHandleForExpr); + + return new ReferenceExpression(format, valueProviders); + } + + /** + * Serializes the reference expression for JSON-RPC transport. + * In template-literal mode, uses the $expr format. + * In handle mode, delegates to the handle's serialization. + */ + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + if (this._handle) { + return this._handle.toJSON(); + } + + return { + $expr: { + format: this._format!, + valueProviders: this._valueProviders && this._valueProviders.length > 0 ? this._valueProviders : undefined + } + }; + } + + /** + * String representation for debugging. + */ + toString(): string { + if (this._handle) { + return `ReferenceExpression(handle)`; + } + return `ReferenceExpression(${this._format})`; + } +} + +/** + * Extracts a value for use in reference expressions. + * Supports handles (objects) and string literals. + * @internal + */ +function extractHandleForExpr(value: unknown): unknown { + if (value === null || value === undefined) { + throw new Error('Cannot use null or undefined in reference expression'); + } + + // String literals - include directly in the expression + if (typeof value === 'string') { + return value; + } + + // Number literals - convert to string + if (typeof value === 'number') { + return String(value); + } + + // Handle objects - get their JSON representation + if (value instanceof Handle) { + return value.toJSON(); + } + + // Objects with $handle property (already in handle format) + if (typeof value === 'object' && value !== null && '$handle' in value) { + return value; + } + + // Objects with toJSON that returns a handle + if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { + const json = value.toJSON(); + if (json && typeof json === 'object' && '$handle' in json) { + return json; + } + } + + throw new Error( + `Cannot use value of type ${typeof value} in reference expression. ` + + `Expected a Handle, string, or number.` + ); +} + +/** + * Tagged template function for creating reference expressions. + * + * Use this to create dynamic expressions that reference endpoints, parameters, and other + * value providers. The expression is evaluated at runtime by Aspire. + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression using the tagged template + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export function refExpr(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + return ReferenceExpression.create(strings, ...values); +} + +// ============================================================================ +// ResourceBuilderBase +// ============================================================================ + +/** + * Base class for resource builders (e.g., RedisBuilder, ContainerBuilder). + * Provides handle management and JSON serialization. + */ +export class ResourceBuilderBase { + constructor(protected _handle: THandle, protected _client: AspireClient) {} + + toJSON(): MarshalledHandle { return this._handle.toJSON(); } +} + +// ============================================================================ +// AspireList - Mutable List Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET List. + * Provides array-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const items = await resource.getItems(); // Returns AspireList + * const count = await items.count(); + * const first = await items.get(0); + * await items.add(newItem); + * ``` + */ +export class AspireList { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the list handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual list handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual list handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of elements in the list. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.length', { + list: handle + }) as number; + } + + /** + * Gets the element at the specified index. + */ + async get(index: number): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.get', { + list: handle, + index + }) as T; + } + + /** + * Adds an element to the end of the list. + */ + async add(item: T): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.add', { + list: handle, + item + }); + } + + /** + * Removes the element at the specified index. + */ + async removeAt(index: number): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.removeAt', { + list: handle, + index + }); + } + + /** + * Clears all elements from the list. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.clear', { + list: handle + }); + } + + /** + * Converts the list to an array (creates a copy). + */ + async toArray(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.toArray', { + list: handle + }) as T[]; + } + + toJSON(): MarshalledHandle { + if (this._resolvedHandle) { + return this._resolvedHandle.toJSON(); + } + return this._handleOrContext.toJSON(); + } +} + +// ============================================================================ +// AspireDict - Mutable Dictionary Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET Dictionary. + * Provides object-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const config = await resource.getConfig(); // Returns AspireDict + * const value = await config.get("key"); + * await config.set("key", "value"); + * const hasKey = await config.containsKey("key"); + * ``` + */ +export class AspireDict { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the dictionary handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual dictionary handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual dictionary handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of key-value pairs in the dictionary. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.count', { + dict: handle + }) as number; + } + + /** + * Gets the value associated with the specified key. + * @throws If the key is not found. + */ + async get(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.get', { + dict: handle, + key + }) as V; + } + + /** + * Sets the value for the specified key. + */ + async set(key: K, value: V): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.set', { + dict: handle, + key, + value + }); + } + + /** + * Determines whether the dictionary contains the specified key. + */ + async containsKey(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.has', { + dict: handle, + key + }) as boolean; + } + + /** + * Removes the value with the specified key. + * @returns True if the element was removed; false if the key was not found. + */ + async remove(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.remove', { + dict: handle, + key + }) as boolean; + } + + /** + * Clears all key-value pairs from the dictionary. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.clear', { + dict: handle + }); + } + + /** + * Gets all keys in the dictionary. + */ + async keys(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.keys', { + dict: handle + }) as K[]; + } + + /** + * Gets all values in the dictionary. + */ + async values(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.values', { + dict: handle + }) as V[]; + } + + /** + * Converts the dictionary to a plain object (creates a copy). + * Only works when K is string. + */ + async toObject(): Promise> { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.toObject', { + dict: handle + }) as Record; + } + + async toJSON(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } +} diff --git a/samples/aspire-with-python/ts/.modules/transport.ts b/samples/aspire-with-python/ts/.modules/transport.ts new file mode 100644 index 00000000..7bddd74b --- /dev/null +++ b/samples/aspire-with-python/ts/.modules/transport.ts @@ -0,0 +1,574 @@ +// transport.ts - ATS transport layer: RPC, Handle, errors, callbacks +import * as net from 'net'; +import * as rpc from 'vscode-jsonrpc/node.js'; + +// ============================================================================ +// Base Types +// ============================================================================ + +/** + * Type for callback functions that can be registered and invoked from .NET. + * Internal: receives args and client for handle wrapping. + */ +export type CallbackFunction = (args: unknown, client: AspireClient) => unknown | Promise; + +/** + * Represents a handle to a .NET object in the ATS system. + * Handles are typed references that can be passed between capabilities. + */ +export interface MarshalledHandle { + /** The handle ID (instance number) */ + $handle: string; + /** The ATS type ID */ + $type: string; +} + +/** + * Error details for ATS errors. + */ +export interface AtsErrorDetails { + /** The parameter that caused the error */ + parameter?: string; + /** The expected type or value */ + expected?: string; + /** The actual type or value */ + actual?: string; +} + +/** + * Structured error from ATS capability invocation. + */ +export interface AtsError { + /** Machine-readable error code */ + code: string; + /** Human-readable error message */ + message: string; + /** The capability that failed (if applicable) */ + capability?: string; + /** Additional error details */ + details?: AtsErrorDetails; +} + +/** + * ATS error codes returned by the server. + */ +export const AtsErrorCodes = { + /** Unknown capability ID */ + CapabilityNotFound: 'CAPABILITY_NOT_FOUND', + /** Handle ID doesn't exist or was disposed */ + HandleNotFound: 'HANDLE_NOT_FOUND', + /** Handle type doesn't satisfy capability's type constraint */ + TypeMismatch: 'TYPE_MISMATCH', + /** Missing required argument or wrong type */ + InvalidArgument: 'INVALID_ARGUMENT', + /** Argument value outside valid range */ + ArgumentOutOfRange: 'ARGUMENT_OUT_OF_RANGE', + /** Error occurred during callback invocation */ + CallbackError: 'CALLBACK_ERROR', + /** Unexpected error in capability execution */ + InternalError: 'INTERNAL_ERROR', +} as const; + +/** + * Type guard to check if a value is an ATS error response. + */ +export function isAtsError(value: unknown): value is { $error: AtsError } { + return ( + value !== null && + typeof value === 'object' && + '$error' in value && + typeof (value as { $error: unknown }).$error === 'object' + ); +} + +/** + * Type guard to check if a value is a marshalled handle. + */ +export function isMarshalledHandle(value: unknown): value is MarshalledHandle { + return ( + value !== null && + typeof value === 'object' && + '$handle' in value && + '$type' in value + ); +} + +// ============================================================================ +// Handle +// ============================================================================ + +/** + * A typed handle to a .NET object in the ATS system. + * Handles are opaque references that can be passed to capabilities. + * + * @typeParam T - The ATS type ID (e.g., "Aspire.Hosting/IDistributedApplicationBuilder") + */ +export class Handle { + private readonly _handleId: string; + private readonly _typeId: T; + + constructor(marshalled: MarshalledHandle) { + this._handleId = marshalled.$handle; + this._typeId = marshalled.$type as T; + } + + /** The handle ID (instance number) */ + get $handle(): string { + return this._handleId; + } + + /** The ATS type ID */ + get $type(): T { + return this._typeId; + } + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { + return { + $handle: this._handleId, + $type: this._typeId + }; + } + + /** String representation for debugging */ + toString(): string { + return `Handle<${this._typeId}>(${this._handleId})`; + } +} + +// ============================================================================ +// Handle Wrapper Registry +// ============================================================================ + +/** + * Factory function for creating typed wrapper instances from handles. + */ +export type HandleWrapperFactory = (handle: Handle, client: AspireClient) => unknown; + +/** + * Registry of handle wrapper factories by type ID. + * Generated code registers wrapper classes here so callback handles can be properly typed. + */ +const handleWrapperRegistry = new Map(); + +/** + * Register a wrapper factory for a type ID. + * Called by generated code to register wrapper classes. + */ +export function registerHandleWrapper(typeId: string, factory: HandleWrapperFactory): void { + handleWrapperRegistry.set(typeId, factory); +} + +/** + * Checks if a value is a marshalled handle and wraps it appropriately. + * Uses the wrapper registry to create typed wrapper instances when available. + * + * @param value - The value to potentially wrap + * @param client - Optional client for creating typed wrapper instances + */ +export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { + if (value && typeof value === 'object') { + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); + } + } + + return handle; + } + } + return value; +} + +// ============================================================================ +// Capability Error +// ============================================================================ + +/** + * Error thrown when an ATS capability invocation fails. + */ +export class CapabilityError extends Error { + constructor( + /** The structured error from the server */ + public readonly error: AtsError + ) { + super(error.message); + this.name = 'CapabilityError'; + } + + /** Machine-readable error code */ + get code(): string { + return this.error.code; + } + + /** The capability that failed (if applicable) */ + get capability(): string | undefined { + return this.error.capability; + } +} + +// ============================================================================ +// Callback Registry +// ============================================================================ + +const callbackRegistry = new Map(); +let callbackIdCounter = 0; + +/** + * Register a callback function that can be invoked from the .NET side. + * Returns a callback ID that should be passed to methods accepting callbacks. + * + * .NET passes arguments as an object with positional keys: `{ p0: value0, p1: value1, ... }` + * This function automatically extracts positional parameters and wraps handles. + * + * @example + * // Single parameter callback + * const id = registerCallback((ctx) => console.log(ctx)); + * // .NET sends: { p0: { $handle: "...", $type: "..." } } + * // Callback receives: Handle instance + * + * @example + * // Multi-parameter callback + * const id = registerCallback((a, b) => console.log(a, b)); + * // .NET sends: { p0: "hello", p1: 42 } + * // Callback receives: "hello", 42 + */ +export function registerCallback( + callback: (...args: any[]) => TResult | Promise +): string { + const callbackId = `callback_${++callbackIdCounter}_${Date.now()}`; + + // Wrap the callback to handle .NET's positional argument format + const wrapper: CallbackFunction = async (args: unknown, client: AspireClient) => { + // .NET sends args as object { p0: value0, p1: value1, ... } + if (args && typeof args === 'object' && !Array.isArray(args)) { + const argObj = args as Record; + const argArray: unknown[] = []; + + // Extract positional parameters (p0, p1, p2, ...) + for (let i = 0; ; i++) { + const key = `p${i}`; + if (key in argObj) { + argArray.push(wrapIfHandle(argObj[key], client)); + } else { + break; + } + } + + if (argArray.length > 0) { + // Spread positional arguments to callback + const result = await callback(...argArray); + // DTO writeback protocol: when a void callback returns undefined, we + // return the original args object so the .NET host can detect property + // mutations made by the callback and apply them back to the original + // C# DTO objects. DTO args are plain JS objects (not Handle wrappers), + // so any property changes the callback made are reflected in args. + // + // Non-void callbacks (result !== undefined) return their actual result. + // The .NET side only activates writeback for void delegates whose + // parameters include [AspireDto] types — all other cases discard the + // returned args object, so the extra wire payload is harmless. + // + // IMPORTANT: callbacks that intentionally return undefined will also + // trigger this path. For non-void delegate types, the C# proxy uses + // a result-unmarshalling path (not writeback), so returning args will + // cause an unmarshal error. Void callbacks should never return a + // meaningful value; non-void callbacks should always return one. + return result !== undefined ? result : args; + } + + // No positional params found — nothing to write back + return await callback(); + } + + // Null/undefined - call with no args + if (args === null || args === undefined) { + return await callback(); + } + + // Primitive value - pass as single arg (shouldn't happen with current protocol) + return await callback(wrapIfHandle(args, client)); + }; + + callbackRegistry.set(callbackId, wrapper); + return callbackId; +} + +/** + * Unregister a callback by its ID. + */ +export function unregisterCallback(callbackId: string): boolean { + return callbackRegistry.delete(callbackId); +} + +/** + * Get the number of registered callbacks. + */ +export function getCallbackCount(): number { + return callbackRegistry.size; +} + +// ============================================================================ +// Cancellation Token Registry +// ============================================================================ + +/** + * Registry for cancellation tokens. + * Maps cancellation IDs to cleanup functions. + */ +const cancellationRegistry = new Map void>(); +let cancellationIdCounter = 0; + +/** + * A reference to the current AspireClient for sending cancel requests. + * Set by AspireClient.connect(). + */ +let currentClient: AspireClient | null = null; + +/** + * Register an AbortSignal for cancellation support. + * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * + * When the AbortSignal is aborted, sends a cancelToken request to the host. + * + * @param signal - The AbortSignal to register (optional) + * @returns The cancellation ID, or undefined if no signal provided + * + * @example + * const controller = new AbortController(); + * const id = registerCancellation(controller.signal); + * // Pass id to capability invocation + * // Later: controller.abort() will cancel the operation + */ +export function registerCancellation(signal?: AbortSignal): string | undefined { + if (!signal) { + return undefined; + } + + // Already aborted? Don't register + if (signal.aborted) { + return undefined; + } + + const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; + + // Set up the abort listener + const onAbort = () => { + // Send cancel request to host + if (currentClient?.connected) { + currentClient.cancelToken(cancellationId).catch(() => { + // Ignore errors - the operation may have already completed + }); + } + // Clean up the listener + cancellationRegistry.delete(cancellationId); + }; + + // Listen for abort + signal.addEventListener('abort', onAbort, { once: true }); + + // Store cleanup function + cancellationRegistry.set(cancellationId, () => { + signal.removeEventListener('abort', onAbort); + }); + + return cancellationId; +} + +/** + * Unregister a cancellation token by its ID. + * Call this when the operation completes to clean up resources. + * + * @param cancellationId - The cancellation ID to unregister + */ +export function unregisterCancellation(cancellationId: string | undefined): void { + if (!cancellationId) { + return; + } + + const cleanup = cancellationRegistry.get(cancellationId); + if (cleanup) { + cleanup(); + cancellationRegistry.delete(cancellationId); + } +} + +// ============================================================================ +// AspireClient (JSON-RPC Connection) +// ============================================================================ + +/** + * Client for connecting to the Aspire AppHost via socket/named pipe. + */ +export class AspireClient { + private connection: rpc.MessageConnection | null = null; + private socket: net.Socket | null = null; + private disconnectCallbacks: (() => void)[] = []; + private _pendingCalls = 0; + + constructor(private socketPath: string) { } + + /** + * Register a callback to be called when the connection is lost + */ + onDisconnect(callback: () => void): void { + this.disconnectCallbacks.push(callback); + } + + private notifyDisconnect(): void { + for (const callback of this.disconnectCallbacks) { + try { + callback(); + } catch { + // Ignore callback errors + } + } + } + + connect(timeoutMs: number = 5000): Promise { + return new Promise((resolve, reject) => { + const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this.socket = net.createConnection(pipePath); + + this.socket.once('error', (error: Error) => { + clearTimeout(timeout); + reject(error); + }); + + this.socket.once('connect', () => { + clearTimeout(timeout); + try { + const reader = new rpc.SocketMessageReader(this.socket!); + const writer = new rpc.SocketMessageWriter(this.socket!); + this.connection = rpc.createMessageConnection(reader, writer); + + this.connection.onClose(() => { + this.connection = null; + this.notifyDisconnect(); + }); + this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); + + // Handle callback invocations from the .NET side + this.connection.onRequest('invokeCallback', async (callbackId: string, args: unknown) => { + const callback = callbackRegistry.get(callbackId); + if (!callback) { + throw new Error(`Callback not found: ${callbackId}`); + } + try { + // The registered wrapper handles arg unpacking and handle wrapping + // Pass this client so handles can be wrapped with typed wrapper classes + return await Promise.resolve(callback(args, this)); + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + throw new Error(`Callback execution failed: ${message}`); + } + }); + + this.connection.listen(); + + // Set the current client for cancellation registry + currentClient = this; + + resolve(); + } catch (e) { + reject(e); + } + }); + + this.socket.on('close', () => { + this.connection?.dispose(); + this.connection = null; + if (currentClient === this) { + currentClient = null; + } + this.notifyDisconnect(); + }); + }); + } + + ping(): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('ping'); + } + + /** + * Cancel a CancellationToken by its ID. + * Called when an AbortSignal is aborted. + * + * @param tokenId - The token ID to cancel + * @returns True if the token was found and cancelled, false otherwise + */ + cancelToken(tokenId: string): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('cancelToken', tokenId); + } + + /** + * Invoke an ATS capability by ID. + * + * Capabilities are operations exposed by [AspireExport] attributes. + * Results are automatically wrapped in Handle objects when applicable. + * + * @param capabilityId - The capability ID (e.g., "Aspire.Hosting/createBuilder") + * @param args - Arguments to pass to the capability + * @returns The capability result, wrapped as Handle if it's a handle type + * @throws CapabilityError if the capability fails + */ + async invokeCapability( + capabilityId: string, + args?: Record + ): Promise { + if (!this.connection) { + throw new Error('Not connected to AppHost'); + } + + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); + } + this._pendingCalls++; + + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + args ?? null + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } + } + + disconnect(): void { + try { this.connection?.dispose(); } finally { this.connection = null; } + try { this.socket?.end(); } finally { this.socket = null; } + } + + get connected(): boolean { + return this.connection !== null && this.socket !== null; + } +} diff --git a/samples/aspire-with-python/ts/package-lock.json b/samples/aspire-with-python/ts/package-lock.json new file mode 100644 index 00000000..c4d3800c --- /dev/null +++ b/samples/aspire-with-python/ts/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "ts", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/samples/client-apps-integration/ts/.modules/.codegen-hash b/samples/client-apps-integration/ts/.modules/.codegen-hash new file mode 100644 index 00000000..1369f62c --- /dev/null +++ b/samples/client-apps-integration/ts/.modules/.codegen-hash @@ -0,0 +1 @@ +385A37965F5742D9B7F75074E7065C879412F46A58CE04016D535C18DA21950E \ No newline at end of file diff --git a/samples/client-apps-integration/ts/.modules/aspire.ts b/samples/client-apps-integration/ts/.modules/aspire.ts new file mode 100644 index 00000000..73dc52d2 --- /dev/null +++ b/samples/client-apps-integration/ts/.modules/aspire.ts @@ -0,0 +1,13306 @@ +// aspire.ts - Capability-based Aspire SDK +// This SDK uses the ATS (Aspire Type System) capability API. +// Capabilities are endpoints like 'Aspire.Hosting/createBuilder'. +// +// GENERATED CODE - DO NOT EDIT + +import { + AspireClient as AspireClientRpc, + Handle, + MarshalledHandle, + CapabilityError, + registerCallback, + wrapIfHandle, + registerHandleWrapper +} from './transport.js'; + +import { + ResourceBuilderBase, + ReferenceExpression, + refExpr, + AspireDict, + AspireList +} from './base.js'; + +// ============================================================================ +// Handle Type Aliases (Internal - not exported to users) +// ============================================================================ + +/** Handle to CommandLineArgsCallbackContext */ +type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; + +/** Handle to ContainerRegistryResource */ +type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; + +/** Handle to ContainerResource */ +type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource'>; + +/** Handle to CSharpAppResource */ +type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; + +/** Handle to DotnetToolResource */ +type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; + +/** Handle to EndpointReference */ +type EndpointReferenceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference'>; + +/** Handle to EndpointReferenceExpression */ +type EndpointReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression'>; + +/** Handle to EnvironmentCallbackContext */ +type EnvironmentCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext'>; + +/** Handle to ExecutableResource */ +type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource'>; + +/** Handle to ExecuteCommandContext */ +type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; + +/** Handle to IContainerFilesDestinationResource */ +type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; + +/** Handle to IResource */ +type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; + +/** Handle to IResourceWithArgs */ +type IResourceWithArgsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs'>; + +/** Handle to IResourceWithConnectionString */ +type IResourceWithConnectionStringHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString'>; + +/** Handle to IResourceWithEndpoints */ +type IResourceWithEndpointsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints'>; + +/** Handle to IResourceWithEnvironment */ +type IResourceWithEnvironmentHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment'>; + +/** Handle to IResourceWithWaitSupport */ +type IResourceWithWaitSupportHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport'>; + +/** Handle to ParameterResource */ +type ParameterResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource'>; + +/** Handle to ProjectResource */ +type ProjectResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource'>; + +/** Handle to ReferenceExpression */ +type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression'>; + +/** Handle to ReferenceExpressionBuilder */ +type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; + +/** Handle to ResourceLoggerService */ +type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; + +/** Handle to ResourceNotificationService */ +type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; + +/** Handle to ResourceUrlsCallbackContext */ +type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; + +/** Handle to ConnectionStringResource */ +type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; + +/** Handle to DistributedApplication */ +type DistributedApplicationHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplication'>; + +/** Handle to DistributedApplicationExecutionContext */ +type DistributedApplicationExecutionContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext'>; + +/** Handle to DistributedApplicationEventSubscription */ +type DistributedApplicationEventSubscriptionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.DistributedApplicationEventSubscription'>; + +/** Handle to IDistributedApplicationEventing */ +type IDistributedApplicationEventingHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing'>; + +/** Handle to ExternalServiceResource */ +type ExternalServiceResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ExternalServiceResource'>; + +/** Handle to IDistributedApplicationBuilder */ +type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder'>; + +/** Handle to IResourceWithContainerFiles */ +type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; + +/** Handle to IResourceWithServiceDiscovery */ +type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; + +/** Handle to PipelineConfigurationContext */ +type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; + +/** Handle to PipelineStep */ +type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; + +/** Handle to PipelineStepContext */ +type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; + +/** Handle to ProjectResourceOptions */ +type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; + +/** Handle to Dict */ +type DictstringanyHandle = Handle<'Aspire.Hosting/Dict'>; + +/** Handle to List */ +type ListanyHandle = Handle<'Aspire.Hosting/List'>; + +/** Handle to IConfiguration */ +type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; + +/** Handle to IHostEnvironment */ +type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; + +/** Handle to ILogger */ +type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; + +/** Handle to string[] */ +type stringArrayHandle = Handle<'string[]'>; + +/** Handle to IServiceProvider */ +type IServiceProviderHandle = Handle<'System.ComponentModel/System.IServiceProvider'>; + +// ============================================================================ +// Enum Types +// ============================================================================ + +/** Enum type for CertificateTrustScope */ +export enum CertificateTrustScope { + None = "None", + Append = "Append", + Override = "Override", + System = "System", +} + +/** Enum type for ContainerLifetime */ +export enum ContainerLifetime { + Session = "Session", + Persistent = "Persistent", +} + +/** Enum type for DistributedApplicationOperation */ +export enum DistributedApplicationOperation { + Run = "Run", + Publish = "Publish", +} + +/** Enum type for EndpointProperty */ +export enum EndpointProperty { + Url = "Url", + Host = "Host", + IPV4Host = "IPV4Host", + Port = "Port", + Scheme = "Scheme", + TargetPort = "TargetPort", + HostAndPort = "HostAndPort", +} + +/** Enum type for IconVariant */ +export enum IconVariant { + Regular = "Regular", + Filled = "Filled", +} + +/** Enum type for ImagePullPolicy */ +export enum ImagePullPolicy { + Default = "Default", + Always = "Always", + Missing = "Missing", + Never = "Never", +} + +/** Enum type for OtlpProtocol */ +export enum OtlpProtocol { + Grpc = "Grpc", + HttpProtobuf = "HttpProtobuf", + HttpJson = "HttpJson", +} + +/** Enum type for ProbeType */ +export enum ProbeType { + Startup = "Startup", + Readiness = "Readiness", + Liveness = "Liveness", +} + +/** Enum type for ProtocolType */ +export enum ProtocolType { + IP = "IP", + IPv6HopByHopOptions = "IPv6HopByHopOptions", + Unspecified = "Unspecified", + Icmp = "Icmp", + Igmp = "Igmp", + Ggp = "Ggp", + IPv4 = "IPv4", + Tcp = "Tcp", + Pup = "Pup", + Udp = "Udp", + Idp = "Idp", + IPv6 = "IPv6", + IPv6RoutingHeader = "IPv6RoutingHeader", + IPv6FragmentHeader = "IPv6FragmentHeader", + IPSecEncapsulatingSecurityPayload = "IPSecEncapsulatingSecurityPayload", + IPSecAuthenticationHeader = "IPSecAuthenticationHeader", + IcmpV6 = "IcmpV6", + IPv6NoNextHeader = "IPv6NoNextHeader", + IPv6DestinationOptions = "IPv6DestinationOptions", + ND = "ND", + Raw = "Raw", + Ipx = "Ipx", + Spx = "Spx", + SpxII = "SpxII", + Unknown = "Unknown", +} + +/** Enum type for UrlDisplayLocation */ +export enum UrlDisplayLocation { + SummaryAndDetails = "SummaryAndDetails", + DetailsOnly = "DetailsOnly", +} + +/** Enum type for WaitBehavior */ +export enum WaitBehavior { + WaitOnResourceUnavailable = "WaitOnResourceUnavailable", + StopOnResourceUnavailable = "StopOnResourceUnavailable", +} + +// ============================================================================ +// DTO Interfaces +// ============================================================================ + +/** DTO interface for CommandOptions */ +export interface CommandOptions { + description?: string; + parameter?: any; + confirmationMessage?: string; + iconName?: string; + iconVariant?: IconVariant; + isHighlighted?: boolean; + updateState?: any; +} + +/** DTO interface for CreateBuilderOptions */ +export interface CreateBuilderOptions { + args?: string[]; + projectDirectory?: string; + appHostFilePath?: string; + containerRegistryOverride?: string; + disableDashboard?: boolean; + dashboardApplicationName?: string; + allowUnsecuredTransport?: boolean; + enableResourceLogging?: boolean; +} + +/** DTO interface for ExecuteCommandResult */ +export interface ExecuteCommandResult { + success?: boolean; + canceled?: boolean; + errorMessage?: string; +} + +/** DTO interface for ResourceEventDto */ +export interface ResourceEventDto { + resourceName?: string; + resourceId?: string; + state?: string; + stateStyle?: string; + healthStatus?: string; + exitCode?: number; +} + +/** DTO interface for ResourceUrlAnnotation */ +export interface ResourceUrlAnnotation { + url?: string; + displayText?: string; + endpoint?: EndpointReferenceHandle; + displayLocation?: UrlDisplayLocation; +} + +// ============================================================================ +// Options Interfaces +// ============================================================================ + +export interface AddConnectionStringOptions { + environmentVariableName?: string; +} + +export interface AddContainerRegistryOptions { + repository?: ParameterResource; +} + +export interface AddDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface AddParameterFromConfigurationOptions { + secret?: boolean; +} + +export interface AddParameterOptions { + secret?: boolean; +} + +export interface AppendFormattedOptions { + format?: string; +} + +export interface AppendValueProviderOptions { + format?: string; +} + +export interface GetValueAsyncOptions { + cancellationToken?: AbortSignal; +} + +export interface RunOptions { + cancellationToken?: AbortSignal; +} + +export interface WaitForCompletionOptions { + exitCode?: number; +} + +export interface WithBindMountOptions { + isReadOnly?: boolean; +} + +export interface WithCommandOptions { + commandOptions?: CommandOptions; +} + +export interface WithDescriptionOptions { + enableMarkdown?: boolean; +} + +export interface WithDockerfileBaseImageOptions { + buildImage?: string; + runtimeImage?: string; +} + +export interface WithDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface WithEndpointOptions { + port?: number; + targetPort?: number; + scheme?: string; + name?: string; + env?: string; + isProxied?: boolean; + isExternal?: boolean; + protocol?: ProtocolType; +} + +export interface WithExternalServiceHttpHealthCheckOptions { + path?: string; + statusCode?: number; +} + +export interface WithHttpEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithHttpHealthCheckOptions { + path?: string; + statusCode?: number; + endpointName?: string; +} + +export interface WithHttpProbeOptions { + path?: string; + initialDelaySeconds?: number; + periodSeconds?: number; + timeoutSeconds?: number; + failureThreshold?: number; + successThreshold?: number; + endpointName?: string; +} + +export interface WithHttpsDeveloperCertificateOptions { + password?: ParameterResource; +} + +export interface WithHttpsEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithIconNameOptions { + iconVariant?: IconVariant; +} + +export interface WithImageOptions { + tag?: string; +} + +export interface WithMcpServerOptions { + path?: string; + endpointName?: string; +} + +export interface WithPipelineStepFactoryOptions { + dependsOn?: string[]; + requiredBy?: string[]; + tags?: string[]; + description?: string; +} + +export interface WithReferenceOptions { + connectionName?: string; + optional?: boolean; +} + +export interface WithRequiredCommandOptions { + helpLink?: string; +} + +export interface WithUrlExpressionOptions { + displayText?: string; +} + +export interface WithUrlOptions { + displayText?: string; +} + +export interface WithVolumeOptions { + name?: string; + isReadOnly?: boolean; +} + +// ============================================================================ +// CommandLineArgsCallbackContext +// ============================================================================ + +/** + * Type class for CommandLineArgsCallbackContext. + */ +export class CommandLineArgsCallbackContext { + constructor(private _handle: CommandLineArgsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Args property */ + private _args?: AspireList; + get args(): AspireList { + if (!this._args) { + this._args = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args', + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args' + ); + } + return this._args; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplication +// ============================================================================ + +/** + * Type class for DistributedApplication. + */ +export class DistributedApplication { + constructor(private _handle: DistributedApplicationHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Runs the distributed application */ + /** @internal */ + async _runInternal(cancellationToken?: AbortSignal): Promise { + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + await this._client.invokeCapability( + 'Aspire.Hosting/run', + rpcArgs + ); + return this; + } + + run(options?: RunOptions): DistributedApplicationPromise { + const cancellationToken = options?.cancellationToken; + return new DistributedApplicationPromise(this._runInternal(cancellationToken)); + } + +} + +/** + * Thenable wrapper for DistributedApplication that enables fluent chaining. + */ +export class DistributedApplicationPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplication) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Runs the distributed application */ + run(options?: RunOptions): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.run(options))); + } + +} + +// ============================================================================ +// DistributedApplicationExecutionContext +// ============================================================================ + +/** + * Type class for DistributedApplicationExecutionContext. + */ +export class DistributedApplicationExecutionContext { + constructor(private _handle: DistributedApplicationExecutionContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PublisherName property */ + publisherName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.publisherName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.setPublisherName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Operation property */ + operation = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.operation', + { context: this._handle } + ); + }, + }; + + /** Gets the IsPublishMode property */ + isPublishMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isPublishMode', + { context: this._handle } + ); + }, + }; + + /** Gets the IsRunMode property */ + isRunMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isRunMode', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EndpointReference +// ============================================================================ + +/** + * Type class for EndpointReference. + */ +export class EndpointReference { + constructor(private _handle: EndpointReferenceHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EndpointName property */ + endpointName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.endpointName', + { context: this._handle } + ); + }, + }; + + /** Gets the ErrorMessage property */ + errorMessage = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.errorMessage', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.setErrorMessage', + { context: this._handle, value } + ); + } + }; + + /** Gets the IsAllocated property */ + isAllocated = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isAllocated', + { context: this._handle } + ); + }, + }; + + /** Gets the Exists property */ + exists = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.exists', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttp property */ + isHttp = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttp', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttps property */ + isHttps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttps', + { context: this._handle } + ); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.port', + { context: this._handle } + ); + }, + }; + + /** Gets the TargetPort property */ + targetPort = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.targetPort', + { context: this._handle } + ); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.host', + { context: this._handle } + ); + }, + }; + + /** Gets the Scheme property */ + scheme = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.scheme', + { context: this._handle } + ); + }, + }; + + /** Gets the Url property */ + url = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.url', + { context: this._handle } + ); + }, + }; + + /** Gets the URL of the endpoint asynchronously */ + async getValueAsync(options?: GetValueAsyncOptions): Promise { + const cancellationToken = options?.cancellationToken; + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValueAsync', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for EndpointReference that enables fluent chaining. + */ +export class EndpointReferencePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: EndpointReference) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets the URL of the endpoint asynchronously */ + getValueAsync(options?: GetValueAsyncOptions): Promise { + return this._promise.then(obj => obj.getValueAsync(options)); + } + +} + +// ============================================================================ +// EndpointReferenceExpression +// ============================================================================ + +/** + * Type class for EndpointReferenceExpression. + */ +export class EndpointReferenceExpression { + constructor(private _handle: EndpointReferenceExpressionHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Endpoint property */ + endpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.endpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Property property */ + property = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.property', + { context: this._handle } + ); + }, + }; + + /** Gets the ValueExpression property */ + valueExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.valueExpression', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EnvironmentCallbackContext +// ============================================================================ + +/** + * Type class for EnvironmentCallbackContext. + */ +export class EnvironmentCallbackContext { + constructor(private _handle: EnvironmentCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EnvironmentVariables property */ + private _environmentVariables?: AspireDict; + get environmentVariables(): AspireDict { + if (!this._environmentVariables) { + this._environmentVariables = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables', + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables' + ); + } + return this._environmentVariables; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ExecuteCommandContext +// ============================================================================ + +/** + * Type class for ExecuteCommandContext. + */ +export class ExecuteCommandContext { + constructor(private _handle: ExecuteCommandContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ResourceName property */ + resourceName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.resourceName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setResourceName', + { context: this._handle, value } + ); + } + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', + { context: this._handle } + ); + }, + set: async (value: AbortSignal): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + { context: this._handle } + ); + }, + set: async (value: PipelineStep[]): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', + { context: this._handle, value } + ); + } + }; + + /** Gets pipeline steps with the specified tag */ + async getStepsByTag(tag: string): Promise { + const rpcArgs: Record = { context: this._handle, tag }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/getStepsByTag', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for PipelineConfigurationContext that enables fluent chaining. + */ +export class PipelineConfigurationContextPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineConfigurationContext) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets pipeline steps with the specified tag */ + getStepsByTag(tag: string): Promise { + return this._promise.then(obj => obj.getStepsByTag(tag)); + } + +} + +// ============================================================================ +// PipelineStep +// ============================================================================ + +/** + * Type class for PipelineStep. + */ +export class PipelineStep { + constructor(private _handle: PipelineStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.name', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Description property */ + description = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.description', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setDescription', + { context: this._handle, value } + ); + } + }; + + /** Gets the DependsOnSteps property */ + private _dependsOnSteps?: AspireList; + get dependsOnSteps(): AspireList { + if (!this._dependsOnSteps) { + this._dependsOnSteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps', + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps' + ); + } + return this._dependsOnSteps; + } + + /** Gets the RequiredBySteps property */ + private _requiredBySteps?: AspireList; + get requiredBySteps(): AspireList { + if (!this._requiredBySteps) { + this._requiredBySteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps', + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps' + ); + } + return this._requiredBySteps; + } + + /** Gets the Tags property */ + private _tags?: AspireList; + get tags(): AspireList { + if (!this._tags) { + this._tags = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.tags', + 'Aspire.Hosting.Pipelines/PipelineStep.tags' + ); + } + return this._tags; + } + + /** Adds a dependency on another step by name */ + /** @internal */ + async _dependsOnInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/dependsOn', + rpcArgs + ); + return this; + } + + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._dependsOnInternal(stepName)); + } + + /** Specifies that another step requires this step by name */ + /** @internal */ + async _requiredByInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/requiredBy', + rpcArgs + ); + return this; + } + + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._requiredByInternal(stepName)); + } + +} + +/** + * Thenable wrapper for PipelineStep that enables fluent chaining. + */ +export class PipelineStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineStep) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a dependency on another step by name */ + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.dependsOn(stepName))); + } + + /** Specifies that another step requires this step by name */ + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.requiredBy(stepName))); + } + +} + +// ============================================================================ +// PipelineStepContext +// ============================================================================ + +/** + * Type class for PipelineStepContext. + */ +export class PipelineStepContext { + constructor(private _handle: PipelineStepContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// ProjectResourceOptions +// ============================================================================ + +/** + * Type class for ProjectResourceOptions. + */ +export class ProjectResourceOptions { + constructor(private _handle: ProjectResourceOptionsHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the LaunchProfileName property */ + launchProfileName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.launchProfileName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setLaunchProfileName', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeLaunchProfile property */ + excludeLaunchProfile = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeLaunchProfile', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeLaunchProfile', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeKestrelEndpoints property */ + excludeKestrelEndpoints = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeKestrelEndpoints', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeKestrelEndpoints', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// ReferenceExpressionBuilder +// ============================================================================ + +/** + * Type class for ReferenceExpressionBuilder. + */ +export class ReferenceExpressionBuilder { + constructor(private _handle: ReferenceExpressionBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the IsEmpty property */ + isEmpty = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ReferenceExpressionBuilder.isEmpty', + { context: this._handle } + ); + }, + }; + + /** Appends a literal string to the reference expression */ + /** @internal */ + async _appendLiteralInternal(value: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendLiteral', + rpcArgs + ); + return this; + } + + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._appendLiteralInternal(value)); + } + + /** Appends a formatted string value to the reference expression */ + /** @internal */ + async _appendFormattedInternal(value: string, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendFormatted', + rpcArgs + ); + return this; + } + + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendFormattedInternal(value, format)); + } + + /** Appends a value provider to the reference expression */ + /** @internal */ + async _appendValueProviderInternal(valueProvider: any, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, valueProvider }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendValueProvider', + rpcArgs + ); + return this; + } + + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendValueProviderInternal(valueProvider, format)); + } + + /** Builds the reference expression */ + async build(): Promise { + const rpcArgs: Record = { context: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/build', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ReferenceExpressionBuilder that enables fluent chaining. + */ +export class ReferenceExpressionBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReferenceExpressionBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Appends a literal string to the reference expression */ + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendLiteral(value))); + } + + /** Appends a formatted string value to the reference expression */ + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendFormatted(value, options))); + } + + /** Appends a value provider to the reference expression */ + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendValueProvider(valueProvider, options))); + } + + /** Builds the reference expression */ + build(): Promise { + return this._promise.then(obj => obj.build()); + } + +} + +// ============================================================================ +// ResourceUrlsCallbackContext +// ============================================================================ + +/** + * Type class for ResourceUrlsCallbackContext. + */ +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Builds the distributed application */ + /** @internal */ + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', + rpcArgs + ); + return new DistributedApplication(result, this._client); + } + + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); + } + + /** Adds a connection string with a builder callback */ + /** @internal */ + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionStringBuilder', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + } + + /** Adds a container registry resource */ + /** @internal */ + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + } + + /** Adds a container resource */ + /** @internal */ + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); + } + + /** Adds a container resource built from a Dockerfile */ + /** @internal */ + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); + } + + /** Adds a .NET tool resource */ + /** @internal */ + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + } + + /** Adds an executable resource */ + /** @internal */ + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + } + + /** Adds an external service resource */ + /** @internal */ + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); + } + + /** Adds a parameter resource */ + /** @internal */ + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); + } + + /** Adds a parameter sourced from configuration */ + /** @internal */ + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + } + + /** Adds a connection string resource */ + /** @internal */ + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + } + + /** Adds a .NET project resource */ + /** @internal */ + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + } + + /** Adds a project resource with configuration options */ + /** @internal */ + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + } + + /** Adds a C# application resource */ + /** @internal */ + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + } + + /** Adds a C# application resource with configuration options */ + /** @internal */ + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + */ +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); + } + + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + } + + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + } + + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + } + + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + } + + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + } + + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); + } + + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + } + + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); + } + + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + } + + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); + } + + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); + } + + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); + } + + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); + } + + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); + } + +} + +// ============================================================================ +// DistributedApplicationEventing +// ============================================================================ + +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Unsubscribe method */ + /** @internal */ + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + rpcArgs + ); + return this; + } + + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ + +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerResource +// ============================================================================ + +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + const exitCode = options?.exitCode; + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + const password = options?.password; + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// CSharpAppResource +// ============================================================================ + +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + const exitCode = options?.exitCode; + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + const commandOptions = options?.commandOptions; + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + const password = options?.password; + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + const iconVariant = options?.iconVariant; + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// DotnetToolResource +// ============================================================================ + +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + } + + /** @internal */ + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + } + + /** @internal */ + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + } + + /** @internal */ + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + } + + /** @internal */ + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + } + + /** @internal */ + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + const exitCode = options?.exitCode; + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + const commandOptions = options?.commandOptions; + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + const password = options?.password; + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + const iconVariant = options?.iconVariant; + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for DotnetToolResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExecutableResource +// ============================================================================ + +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerFilesDestinationResource +// ============================================================================ + +export class ContainerFilesDestinationResource extends ResourceBuilderBase { + constructor(handle: IContainerFilesDestinationResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ContainerFilesDestinationResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + +} + +/** + * Thenable wrapper for ContainerFilesDestinationResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerFilesDestinationResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerFilesDestinationResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + +} + +// ============================================================================ +// Resource +// ============================================================================ + +export class Resource extends ResourceBuilderBase { + constructor(handle: IResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + const helpLink = options?.helpLink; + return new ResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + const commandOptions = options?.commandOptions; + return new ResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + const iconVariant = options?.iconVariant; + return new ResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for Resource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Resource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ResourceWithArgs +// ============================================================================ + +export class ResourceWithArgs extends ResourceBuilderBase { + constructor(handle: IResourceWithArgsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackAsyncInternal(callback)); + } + +} + +/** + * Thenable wrapper for ResourceWithArgs that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithArgsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithArgs) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + +} + +// ============================================================================ +// ResourceWithConnectionString +// ============================================================================ + +export class ResourceWithConnectionString extends ResourceBuilderBase { + constructor(handle: IResourceWithConnectionStringHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyValueInternal(name, value)); + } + +} + +/** + * Thenable wrapper for ResourceWithConnectionString that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithConnectionStringPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithConnectionString) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + +} + +// ============================================================================ +// ResourceWithContainerFiles +// ============================================================================ + +export class ResourceWithContainerFiles extends ResourceBuilderBase { + constructor(handle: IResourceWithContainerFilesHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._clearContainerFilesSourcesInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithContainerFiles that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithContainerFilesPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithContainerFiles) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + +} + +// ============================================================================ +// ResourceWithEndpoints +// ============================================================================ + +export class ResourceWithEndpoints extends ResourceBuilderBase { + constructor(handle: IResourceWithEndpointsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ResourceWithEndpointsPromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + +} + +/** + * Thenable wrapper for ResourceWithEndpoints that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEndpointsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEndpoints) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + +} + +// ============================================================================ +// ResourceWithEnvironment +// ============================================================================ + +export class ResourceWithEnvironment extends ResourceBuilderBase { + constructor(handle: IResourceWithEnvironmentHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + const password = options?.password; + return new ResourceWithEnvironmentPromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withoutHttpsCertificateInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithEnvironment that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + +} + +// ============================================================================ +// ResourceWithServiceDiscovery +// ============================================================================ + +export class ResourceWithServiceDiscovery extends ResourceBuilderBase { + constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { + super(handle, client); + } + +} + +/** + * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithServiceDiscoveryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + +} + +// ============================================================================ +// ResourceWithWaitSupport +// ============================================================================ + +export class ResourceWithWaitSupport extends ResourceBuilderBase { + constructor(handle: IResourceWithWaitSupportHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + const exitCode = options?.exitCode; + return new ResourceWithWaitSupportPromise(this._waitForCompletionInternal(dependency, exitCode)); + } + +} + +/** + * Thenable wrapper for ResourceWithWaitSupport that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithWaitSupportPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithWaitSupport) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + +} + +// ============================================================================ +// Connection Helper +// ============================================================================ + +/** + * Creates and connects to the Aspire AppHost. + * Reads connection info from environment variables set by `aspire run`. + */ +export async function connect(): Promise { + const socketPath = process.env.REMOTE_APP_HOST_SOCKET_PATH; + if (!socketPath) { + throw new Error( + 'REMOTE_APP_HOST_SOCKET_PATH environment variable not set. ' + + 'Run this application using `aspire run`.' + ); + } + + const client = new AspireClientRpc(socketPath); + await client.connect(); + + // Exit the process if the server connection is lost + client.onDisconnect(() => { + console.error('Connection to AppHost lost. Exiting...'); + process.exit(1); + }); + + return client; +} + +/** + * Creates a new distributed application builder. + * This is the entry point for building Aspire applications. + * + * @param options - Optional configuration options for the builder + * @returns A DistributedApplicationBuilder instance + * + * @example + * const builder = await createBuilder(); + * builder.addRedis("cache"); + * builder.addContainer("api", "mcr.microsoft.com/dotnet/samples:aspnetapp"); + * const app = await builder.build(); + * await app.run(); + */ +export async function createBuilder(options?: CreateBuilderOptions): Promise { + const client = await connect(); + + // Default args, projectDirectory, and appHostFilePath if not provided + // ASPIRE_APPHOST_FILEPATH is set by the CLI for consistent socket hash computation + const effectiveOptions: CreateBuilderOptions = { + ...options, + args: options?.args ?? process.argv.slice(2), + projectDirectory: options?.projectDirectory ?? process.env.ASPIRE_PROJECT_DIRECTORY ?? process.cwd(), + appHostFilePath: options?.appHostFilePath ?? process.env.ASPIRE_APPHOST_FILEPATH + }; + + const handle = await client.invokeCapability( + 'Aspire.Hosting/createBuilderWithOptions', + { options: effectiveOptions } + ); + return new DistributedApplicationBuilder(handle, client); +} + +// Re-export commonly used types +export { Handle, CapabilityError, registerCallback } from './transport.js'; +export { refExpr, ReferenceExpression } from './base.js'; + +// ============================================================================ +// Global Error Handling +// ============================================================================ + +/** + * Set up global error handlers to ensure the process exits properly on errors. + * Node.js doesn't exit on unhandled rejections by default, so we need to handle them. + */ +process.on('unhandledRejection', (reason: unknown) => { + const error = reason instanceof Error ? reason : new Error(String(reason)); + + if (reason instanceof CapabilityError) { + console.error(`\n❌ Capability Error: ${error.message}`); + console.error(` Code: ${(reason as CapabilityError).code}`); + if ((reason as CapabilityError).capability) { + console.error(` Capability: ${(reason as CapabilityError).capability}`); + } + } else { + console.error(`\n❌ Unhandled Error: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + } + + process.exit(1); +}); + +process.on('uncaughtException', (error: Error) => { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + process.exit(1); +}); + +// ============================================================================ +// Handle Wrapper Registrations +// ============================================================================ + +// Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource', (handle, client) => new CSharpAppResource(handle as CSharpAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString', (handle, client) => new ResourceWithConnectionString(handle as IResourceWithConnectionStringHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); + diff --git a/samples/client-apps-integration/ts/.modules/base.ts b/samples/client-apps-integration/ts/.modules/base.ts new file mode 100644 index 00000000..7778b0f1 --- /dev/null +++ b/samples/client-apps-integration/ts/.modules/base.ts @@ -0,0 +1,473 @@ +// aspire.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle } from './transport.js'; + +// Re-export transport types for convenience +export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; +export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; + +// ============================================================================ +// Reference Expression +// ============================================================================ + +/** + * Represents a reference expression that can be passed to capabilities. + * + * Reference expressions are serialized in the protocol as: + * ```json + * { + * "$expr": { + * "format": "redis://{0}:{1}", + * "valueProviders": [ + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:1" }, + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:2" } + * ] + * } + * } + * ``` + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export class ReferenceExpression { + // Expression mode fields + private readonly _format?: string; + private readonly _valueProviders?: unknown[]; + + // Handle mode fields (when wrapping a server-returned handle) + private readonly _handle?: Handle; + private readonly _client?: AspireClient; + + constructor(format: string, valueProviders: unknown[]); + constructor(handle: Handle, client: AspireClient); + constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { + if (typeof handleOrFormat === 'string') { + this._format = handleOrFormat; + this._valueProviders = clientOrValueProviders as unknown[]; + } else { + this._handle = handleOrFormat; + this._client = clientOrValueProviders as AspireClient; + } + } + + /** + * Creates a reference expression from a tagged template literal. + * + * @param strings - The template literal string parts + * @param values - The interpolated values (handles to value providers) + * @returns A ReferenceExpression instance + */ + static create(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + // Build the format string with {0}, {1}, etc. placeholders + let format = ''; + for (let i = 0; i < strings.length; i++) { + format += strings[i]; + if (i < values.length) { + format += `{${i}}`; + } + } + + // Extract handles from values + const valueProviders = values.map(extractHandleForExpr); + + return new ReferenceExpression(format, valueProviders); + } + + /** + * Serializes the reference expression for JSON-RPC transport. + * In template-literal mode, uses the $expr format. + * In handle mode, delegates to the handle's serialization. + */ + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + if (this._handle) { + return this._handle.toJSON(); + } + + return { + $expr: { + format: this._format!, + valueProviders: this._valueProviders && this._valueProviders.length > 0 ? this._valueProviders : undefined + } + }; + } + + /** + * String representation for debugging. + */ + toString(): string { + if (this._handle) { + return `ReferenceExpression(handle)`; + } + return `ReferenceExpression(${this._format})`; + } +} + +/** + * Extracts a value for use in reference expressions. + * Supports handles (objects) and string literals. + * @internal + */ +function extractHandleForExpr(value: unknown): unknown { + if (value === null || value === undefined) { + throw new Error('Cannot use null or undefined in reference expression'); + } + + // String literals - include directly in the expression + if (typeof value === 'string') { + return value; + } + + // Number literals - convert to string + if (typeof value === 'number') { + return String(value); + } + + // Handle objects - get their JSON representation + if (value instanceof Handle) { + return value.toJSON(); + } + + // Objects with $handle property (already in handle format) + if (typeof value === 'object' && value !== null && '$handle' in value) { + return value; + } + + // Objects with toJSON that returns a handle + if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { + const json = value.toJSON(); + if (json && typeof json === 'object' && '$handle' in json) { + return json; + } + } + + throw new Error( + `Cannot use value of type ${typeof value} in reference expression. ` + + `Expected a Handle, string, or number.` + ); +} + +/** + * Tagged template function for creating reference expressions. + * + * Use this to create dynamic expressions that reference endpoints, parameters, and other + * value providers. The expression is evaluated at runtime by Aspire. + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression using the tagged template + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export function refExpr(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + return ReferenceExpression.create(strings, ...values); +} + +// ============================================================================ +// ResourceBuilderBase +// ============================================================================ + +/** + * Base class for resource builders (e.g., RedisBuilder, ContainerBuilder). + * Provides handle management and JSON serialization. + */ +export class ResourceBuilderBase { + constructor(protected _handle: THandle, protected _client: AspireClient) {} + + toJSON(): MarshalledHandle { return this._handle.toJSON(); } +} + +// ============================================================================ +// AspireList - Mutable List Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET List. + * Provides array-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const items = await resource.getItems(); // Returns AspireList + * const count = await items.count(); + * const first = await items.get(0); + * await items.add(newItem); + * ``` + */ +export class AspireList { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the list handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual list handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual list handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of elements in the list. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.length', { + list: handle + }) as number; + } + + /** + * Gets the element at the specified index. + */ + async get(index: number): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.get', { + list: handle, + index + }) as T; + } + + /** + * Adds an element to the end of the list. + */ + async add(item: T): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.add', { + list: handle, + item + }); + } + + /** + * Removes the element at the specified index. + */ + async removeAt(index: number): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.removeAt', { + list: handle, + index + }); + } + + /** + * Clears all elements from the list. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.clear', { + list: handle + }); + } + + /** + * Converts the list to an array (creates a copy). + */ + async toArray(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.toArray', { + list: handle + }) as T[]; + } + + toJSON(): MarshalledHandle { + if (this._resolvedHandle) { + return this._resolvedHandle.toJSON(); + } + return this._handleOrContext.toJSON(); + } +} + +// ============================================================================ +// AspireDict - Mutable Dictionary Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET Dictionary. + * Provides object-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const config = await resource.getConfig(); // Returns AspireDict + * const value = await config.get("key"); + * await config.set("key", "value"); + * const hasKey = await config.containsKey("key"); + * ``` + */ +export class AspireDict { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the dictionary handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual dictionary handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual dictionary handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of key-value pairs in the dictionary. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.count', { + dict: handle + }) as number; + } + + /** + * Gets the value associated with the specified key. + * @throws If the key is not found. + */ + async get(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.get', { + dict: handle, + key + }) as V; + } + + /** + * Sets the value for the specified key. + */ + async set(key: K, value: V): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.set', { + dict: handle, + key, + value + }); + } + + /** + * Determines whether the dictionary contains the specified key. + */ + async containsKey(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.has', { + dict: handle, + key + }) as boolean; + } + + /** + * Removes the value with the specified key. + * @returns True if the element was removed; false if the key was not found. + */ + async remove(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.remove', { + dict: handle, + key + }) as boolean; + } + + /** + * Clears all key-value pairs from the dictionary. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.clear', { + dict: handle + }); + } + + /** + * Gets all keys in the dictionary. + */ + async keys(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.keys', { + dict: handle + }) as K[]; + } + + /** + * Gets all values in the dictionary. + */ + async values(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.values', { + dict: handle + }) as V[]; + } + + /** + * Converts the dictionary to a plain object (creates a copy). + * Only works when K is string. + */ + async toObject(): Promise> { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.toObject', { + dict: handle + }) as Record; + } + + async toJSON(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } +} diff --git a/samples/client-apps-integration/ts/.modules/transport.ts b/samples/client-apps-integration/ts/.modules/transport.ts new file mode 100644 index 00000000..7bddd74b --- /dev/null +++ b/samples/client-apps-integration/ts/.modules/transport.ts @@ -0,0 +1,574 @@ +// transport.ts - ATS transport layer: RPC, Handle, errors, callbacks +import * as net from 'net'; +import * as rpc from 'vscode-jsonrpc/node.js'; + +// ============================================================================ +// Base Types +// ============================================================================ + +/** + * Type for callback functions that can be registered and invoked from .NET. + * Internal: receives args and client for handle wrapping. + */ +export type CallbackFunction = (args: unknown, client: AspireClient) => unknown | Promise; + +/** + * Represents a handle to a .NET object in the ATS system. + * Handles are typed references that can be passed between capabilities. + */ +export interface MarshalledHandle { + /** The handle ID (instance number) */ + $handle: string; + /** The ATS type ID */ + $type: string; +} + +/** + * Error details for ATS errors. + */ +export interface AtsErrorDetails { + /** The parameter that caused the error */ + parameter?: string; + /** The expected type or value */ + expected?: string; + /** The actual type or value */ + actual?: string; +} + +/** + * Structured error from ATS capability invocation. + */ +export interface AtsError { + /** Machine-readable error code */ + code: string; + /** Human-readable error message */ + message: string; + /** The capability that failed (if applicable) */ + capability?: string; + /** Additional error details */ + details?: AtsErrorDetails; +} + +/** + * ATS error codes returned by the server. + */ +export const AtsErrorCodes = { + /** Unknown capability ID */ + CapabilityNotFound: 'CAPABILITY_NOT_FOUND', + /** Handle ID doesn't exist or was disposed */ + HandleNotFound: 'HANDLE_NOT_FOUND', + /** Handle type doesn't satisfy capability's type constraint */ + TypeMismatch: 'TYPE_MISMATCH', + /** Missing required argument or wrong type */ + InvalidArgument: 'INVALID_ARGUMENT', + /** Argument value outside valid range */ + ArgumentOutOfRange: 'ARGUMENT_OUT_OF_RANGE', + /** Error occurred during callback invocation */ + CallbackError: 'CALLBACK_ERROR', + /** Unexpected error in capability execution */ + InternalError: 'INTERNAL_ERROR', +} as const; + +/** + * Type guard to check if a value is an ATS error response. + */ +export function isAtsError(value: unknown): value is { $error: AtsError } { + return ( + value !== null && + typeof value === 'object' && + '$error' in value && + typeof (value as { $error: unknown }).$error === 'object' + ); +} + +/** + * Type guard to check if a value is a marshalled handle. + */ +export function isMarshalledHandle(value: unknown): value is MarshalledHandle { + return ( + value !== null && + typeof value === 'object' && + '$handle' in value && + '$type' in value + ); +} + +// ============================================================================ +// Handle +// ============================================================================ + +/** + * A typed handle to a .NET object in the ATS system. + * Handles are opaque references that can be passed to capabilities. + * + * @typeParam T - The ATS type ID (e.g., "Aspire.Hosting/IDistributedApplicationBuilder") + */ +export class Handle { + private readonly _handleId: string; + private readonly _typeId: T; + + constructor(marshalled: MarshalledHandle) { + this._handleId = marshalled.$handle; + this._typeId = marshalled.$type as T; + } + + /** The handle ID (instance number) */ + get $handle(): string { + return this._handleId; + } + + /** The ATS type ID */ + get $type(): T { + return this._typeId; + } + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { + return { + $handle: this._handleId, + $type: this._typeId + }; + } + + /** String representation for debugging */ + toString(): string { + return `Handle<${this._typeId}>(${this._handleId})`; + } +} + +// ============================================================================ +// Handle Wrapper Registry +// ============================================================================ + +/** + * Factory function for creating typed wrapper instances from handles. + */ +export type HandleWrapperFactory = (handle: Handle, client: AspireClient) => unknown; + +/** + * Registry of handle wrapper factories by type ID. + * Generated code registers wrapper classes here so callback handles can be properly typed. + */ +const handleWrapperRegistry = new Map(); + +/** + * Register a wrapper factory for a type ID. + * Called by generated code to register wrapper classes. + */ +export function registerHandleWrapper(typeId: string, factory: HandleWrapperFactory): void { + handleWrapperRegistry.set(typeId, factory); +} + +/** + * Checks if a value is a marshalled handle and wraps it appropriately. + * Uses the wrapper registry to create typed wrapper instances when available. + * + * @param value - The value to potentially wrap + * @param client - Optional client for creating typed wrapper instances + */ +export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { + if (value && typeof value === 'object') { + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); + } + } + + return handle; + } + } + return value; +} + +// ============================================================================ +// Capability Error +// ============================================================================ + +/** + * Error thrown when an ATS capability invocation fails. + */ +export class CapabilityError extends Error { + constructor( + /** The structured error from the server */ + public readonly error: AtsError + ) { + super(error.message); + this.name = 'CapabilityError'; + } + + /** Machine-readable error code */ + get code(): string { + return this.error.code; + } + + /** The capability that failed (if applicable) */ + get capability(): string | undefined { + return this.error.capability; + } +} + +// ============================================================================ +// Callback Registry +// ============================================================================ + +const callbackRegistry = new Map(); +let callbackIdCounter = 0; + +/** + * Register a callback function that can be invoked from the .NET side. + * Returns a callback ID that should be passed to methods accepting callbacks. + * + * .NET passes arguments as an object with positional keys: `{ p0: value0, p1: value1, ... }` + * This function automatically extracts positional parameters and wraps handles. + * + * @example + * // Single parameter callback + * const id = registerCallback((ctx) => console.log(ctx)); + * // .NET sends: { p0: { $handle: "...", $type: "..." } } + * // Callback receives: Handle instance + * + * @example + * // Multi-parameter callback + * const id = registerCallback((a, b) => console.log(a, b)); + * // .NET sends: { p0: "hello", p1: 42 } + * // Callback receives: "hello", 42 + */ +export function registerCallback( + callback: (...args: any[]) => TResult | Promise +): string { + const callbackId = `callback_${++callbackIdCounter}_${Date.now()}`; + + // Wrap the callback to handle .NET's positional argument format + const wrapper: CallbackFunction = async (args: unknown, client: AspireClient) => { + // .NET sends args as object { p0: value0, p1: value1, ... } + if (args && typeof args === 'object' && !Array.isArray(args)) { + const argObj = args as Record; + const argArray: unknown[] = []; + + // Extract positional parameters (p0, p1, p2, ...) + for (let i = 0; ; i++) { + const key = `p${i}`; + if (key in argObj) { + argArray.push(wrapIfHandle(argObj[key], client)); + } else { + break; + } + } + + if (argArray.length > 0) { + // Spread positional arguments to callback + const result = await callback(...argArray); + // DTO writeback protocol: when a void callback returns undefined, we + // return the original args object so the .NET host can detect property + // mutations made by the callback and apply them back to the original + // C# DTO objects. DTO args are plain JS objects (not Handle wrappers), + // so any property changes the callback made are reflected in args. + // + // Non-void callbacks (result !== undefined) return their actual result. + // The .NET side only activates writeback for void delegates whose + // parameters include [AspireDto] types — all other cases discard the + // returned args object, so the extra wire payload is harmless. + // + // IMPORTANT: callbacks that intentionally return undefined will also + // trigger this path. For non-void delegate types, the C# proxy uses + // a result-unmarshalling path (not writeback), so returning args will + // cause an unmarshal error. Void callbacks should never return a + // meaningful value; non-void callbacks should always return one. + return result !== undefined ? result : args; + } + + // No positional params found — nothing to write back + return await callback(); + } + + // Null/undefined - call with no args + if (args === null || args === undefined) { + return await callback(); + } + + // Primitive value - pass as single arg (shouldn't happen with current protocol) + return await callback(wrapIfHandle(args, client)); + }; + + callbackRegistry.set(callbackId, wrapper); + return callbackId; +} + +/** + * Unregister a callback by its ID. + */ +export function unregisterCallback(callbackId: string): boolean { + return callbackRegistry.delete(callbackId); +} + +/** + * Get the number of registered callbacks. + */ +export function getCallbackCount(): number { + return callbackRegistry.size; +} + +// ============================================================================ +// Cancellation Token Registry +// ============================================================================ + +/** + * Registry for cancellation tokens. + * Maps cancellation IDs to cleanup functions. + */ +const cancellationRegistry = new Map void>(); +let cancellationIdCounter = 0; + +/** + * A reference to the current AspireClient for sending cancel requests. + * Set by AspireClient.connect(). + */ +let currentClient: AspireClient | null = null; + +/** + * Register an AbortSignal for cancellation support. + * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * + * When the AbortSignal is aborted, sends a cancelToken request to the host. + * + * @param signal - The AbortSignal to register (optional) + * @returns The cancellation ID, or undefined if no signal provided + * + * @example + * const controller = new AbortController(); + * const id = registerCancellation(controller.signal); + * // Pass id to capability invocation + * // Later: controller.abort() will cancel the operation + */ +export function registerCancellation(signal?: AbortSignal): string | undefined { + if (!signal) { + return undefined; + } + + // Already aborted? Don't register + if (signal.aborted) { + return undefined; + } + + const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; + + // Set up the abort listener + const onAbort = () => { + // Send cancel request to host + if (currentClient?.connected) { + currentClient.cancelToken(cancellationId).catch(() => { + // Ignore errors - the operation may have already completed + }); + } + // Clean up the listener + cancellationRegistry.delete(cancellationId); + }; + + // Listen for abort + signal.addEventListener('abort', onAbort, { once: true }); + + // Store cleanup function + cancellationRegistry.set(cancellationId, () => { + signal.removeEventListener('abort', onAbort); + }); + + return cancellationId; +} + +/** + * Unregister a cancellation token by its ID. + * Call this when the operation completes to clean up resources. + * + * @param cancellationId - The cancellation ID to unregister + */ +export function unregisterCancellation(cancellationId: string | undefined): void { + if (!cancellationId) { + return; + } + + const cleanup = cancellationRegistry.get(cancellationId); + if (cleanup) { + cleanup(); + cancellationRegistry.delete(cancellationId); + } +} + +// ============================================================================ +// AspireClient (JSON-RPC Connection) +// ============================================================================ + +/** + * Client for connecting to the Aspire AppHost via socket/named pipe. + */ +export class AspireClient { + private connection: rpc.MessageConnection | null = null; + private socket: net.Socket | null = null; + private disconnectCallbacks: (() => void)[] = []; + private _pendingCalls = 0; + + constructor(private socketPath: string) { } + + /** + * Register a callback to be called when the connection is lost + */ + onDisconnect(callback: () => void): void { + this.disconnectCallbacks.push(callback); + } + + private notifyDisconnect(): void { + for (const callback of this.disconnectCallbacks) { + try { + callback(); + } catch { + // Ignore callback errors + } + } + } + + connect(timeoutMs: number = 5000): Promise { + return new Promise((resolve, reject) => { + const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this.socket = net.createConnection(pipePath); + + this.socket.once('error', (error: Error) => { + clearTimeout(timeout); + reject(error); + }); + + this.socket.once('connect', () => { + clearTimeout(timeout); + try { + const reader = new rpc.SocketMessageReader(this.socket!); + const writer = new rpc.SocketMessageWriter(this.socket!); + this.connection = rpc.createMessageConnection(reader, writer); + + this.connection.onClose(() => { + this.connection = null; + this.notifyDisconnect(); + }); + this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); + + // Handle callback invocations from the .NET side + this.connection.onRequest('invokeCallback', async (callbackId: string, args: unknown) => { + const callback = callbackRegistry.get(callbackId); + if (!callback) { + throw new Error(`Callback not found: ${callbackId}`); + } + try { + // The registered wrapper handles arg unpacking and handle wrapping + // Pass this client so handles can be wrapped with typed wrapper classes + return await Promise.resolve(callback(args, this)); + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + throw new Error(`Callback execution failed: ${message}`); + } + }); + + this.connection.listen(); + + // Set the current client for cancellation registry + currentClient = this; + + resolve(); + } catch (e) { + reject(e); + } + }); + + this.socket.on('close', () => { + this.connection?.dispose(); + this.connection = null; + if (currentClient === this) { + currentClient = null; + } + this.notifyDisconnect(); + }); + }); + } + + ping(): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('ping'); + } + + /** + * Cancel a CancellationToken by its ID. + * Called when an AbortSignal is aborted. + * + * @param tokenId - The token ID to cancel + * @returns True if the token was found and cancelled, false otherwise + */ + cancelToken(tokenId: string): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('cancelToken', tokenId); + } + + /** + * Invoke an ATS capability by ID. + * + * Capabilities are operations exposed by [AspireExport] attributes. + * Results are automatically wrapped in Handle objects when applicable. + * + * @param capabilityId - The capability ID (e.g., "Aspire.Hosting/createBuilder") + * @param args - Arguments to pass to the capability + * @returns The capability result, wrapped as Handle if it's a handle type + * @throws CapabilityError if the capability fails + */ + async invokeCapability( + capabilityId: string, + args?: Record + ): Promise { + if (!this.connection) { + throw new Error('Not connected to AppHost'); + } + + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); + } + this._pendingCalls++; + + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + args ?? null + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } + } + + disconnect(): void { + try { this.connection?.dispose(); } finally { this.connection = null; } + try { this.socket?.end(); } finally { this.socket = null; } + } + + get connected(): boolean { + return this.connection !== null && this.socket !== null; + } +} diff --git a/samples/client-apps-integration/ts/package-lock.json b/samples/client-apps-integration/ts/package-lock.json new file mode 100644 index 00000000..c4d3800c --- /dev/null +++ b/samples/client-apps-integration/ts/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "ts", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/samples/container-build/ts/.modules/.codegen-hash b/samples/container-build/ts/.modules/.codegen-hash new file mode 100644 index 00000000..1369f62c --- /dev/null +++ b/samples/container-build/ts/.modules/.codegen-hash @@ -0,0 +1 @@ +385A37965F5742D9B7F75074E7065C879412F46A58CE04016D535C18DA21950E \ No newline at end of file diff --git a/samples/container-build/ts/.modules/aspire.ts b/samples/container-build/ts/.modules/aspire.ts new file mode 100644 index 00000000..73dc52d2 --- /dev/null +++ b/samples/container-build/ts/.modules/aspire.ts @@ -0,0 +1,13306 @@ +// aspire.ts - Capability-based Aspire SDK +// This SDK uses the ATS (Aspire Type System) capability API. +// Capabilities are endpoints like 'Aspire.Hosting/createBuilder'. +// +// GENERATED CODE - DO NOT EDIT + +import { + AspireClient as AspireClientRpc, + Handle, + MarshalledHandle, + CapabilityError, + registerCallback, + wrapIfHandle, + registerHandleWrapper +} from './transport.js'; + +import { + ResourceBuilderBase, + ReferenceExpression, + refExpr, + AspireDict, + AspireList +} from './base.js'; + +// ============================================================================ +// Handle Type Aliases (Internal - not exported to users) +// ============================================================================ + +/** Handle to CommandLineArgsCallbackContext */ +type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; + +/** Handle to ContainerRegistryResource */ +type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; + +/** Handle to ContainerResource */ +type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource'>; + +/** Handle to CSharpAppResource */ +type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; + +/** Handle to DotnetToolResource */ +type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; + +/** Handle to EndpointReference */ +type EndpointReferenceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference'>; + +/** Handle to EndpointReferenceExpression */ +type EndpointReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression'>; + +/** Handle to EnvironmentCallbackContext */ +type EnvironmentCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext'>; + +/** Handle to ExecutableResource */ +type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource'>; + +/** Handle to ExecuteCommandContext */ +type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; + +/** Handle to IContainerFilesDestinationResource */ +type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; + +/** Handle to IResource */ +type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; + +/** Handle to IResourceWithArgs */ +type IResourceWithArgsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs'>; + +/** Handle to IResourceWithConnectionString */ +type IResourceWithConnectionStringHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString'>; + +/** Handle to IResourceWithEndpoints */ +type IResourceWithEndpointsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints'>; + +/** Handle to IResourceWithEnvironment */ +type IResourceWithEnvironmentHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment'>; + +/** Handle to IResourceWithWaitSupport */ +type IResourceWithWaitSupportHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport'>; + +/** Handle to ParameterResource */ +type ParameterResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource'>; + +/** Handle to ProjectResource */ +type ProjectResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource'>; + +/** Handle to ReferenceExpression */ +type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression'>; + +/** Handle to ReferenceExpressionBuilder */ +type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; + +/** Handle to ResourceLoggerService */ +type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; + +/** Handle to ResourceNotificationService */ +type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; + +/** Handle to ResourceUrlsCallbackContext */ +type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; + +/** Handle to ConnectionStringResource */ +type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; + +/** Handle to DistributedApplication */ +type DistributedApplicationHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplication'>; + +/** Handle to DistributedApplicationExecutionContext */ +type DistributedApplicationExecutionContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext'>; + +/** Handle to DistributedApplicationEventSubscription */ +type DistributedApplicationEventSubscriptionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.DistributedApplicationEventSubscription'>; + +/** Handle to IDistributedApplicationEventing */ +type IDistributedApplicationEventingHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing'>; + +/** Handle to ExternalServiceResource */ +type ExternalServiceResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ExternalServiceResource'>; + +/** Handle to IDistributedApplicationBuilder */ +type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder'>; + +/** Handle to IResourceWithContainerFiles */ +type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; + +/** Handle to IResourceWithServiceDiscovery */ +type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; + +/** Handle to PipelineConfigurationContext */ +type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; + +/** Handle to PipelineStep */ +type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; + +/** Handle to PipelineStepContext */ +type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; + +/** Handle to ProjectResourceOptions */ +type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; + +/** Handle to Dict */ +type DictstringanyHandle = Handle<'Aspire.Hosting/Dict'>; + +/** Handle to List */ +type ListanyHandle = Handle<'Aspire.Hosting/List'>; + +/** Handle to IConfiguration */ +type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; + +/** Handle to IHostEnvironment */ +type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; + +/** Handle to ILogger */ +type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; + +/** Handle to string[] */ +type stringArrayHandle = Handle<'string[]'>; + +/** Handle to IServiceProvider */ +type IServiceProviderHandle = Handle<'System.ComponentModel/System.IServiceProvider'>; + +// ============================================================================ +// Enum Types +// ============================================================================ + +/** Enum type for CertificateTrustScope */ +export enum CertificateTrustScope { + None = "None", + Append = "Append", + Override = "Override", + System = "System", +} + +/** Enum type for ContainerLifetime */ +export enum ContainerLifetime { + Session = "Session", + Persistent = "Persistent", +} + +/** Enum type for DistributedApplicationOperation */ +export enum DistributedApplicationOperation { + Run = "Run", + Publish = "Publish", +} + +/** Enum type for EndpointProperty */ +export enum EndpointProperty { + Url = "Url", + Host = "Host", + IPV4Host = "IPV4Host", + Port = "Port", + Scheme = "Scheme", + TargetPort = "TargetPort", + HostAndPort = "HostAndPort", +} + +/** Enum type for IconVariant */ +export enum IconVariant { + Regular = "Regular", + Filled = "Filled", +} + +/** Enum type for ImagePullPolicy */ +export enum ImagePullPolicy { + Default = "Default", + Always = "Always", + Missing = "Missing", + Never = "Never", +} + +/** Enum type for OtlpProtocol */ +export enum OtlpProtocol { + Grpc = "Grpc", + HttpProtobuf = "HttpProtobuf", + HttpJson = "HttpJson", +} + +/** Enum type for ProbeType */ +export enum ProbeType { + Startup = "Startup", + Readiness = "Readiness", + Liveness = "Liveness", +} + +/** Enum type for ProtocolType */ +export enum ProtocolType { + IP = "IP", + IPv6HopByHopOptions = "IPv6HopByHopOptions", + Unspecified = "Unspecified", + Icmp = "Icmp", + Igmp = "Igmp", + Ggp = "Ggp", + IPv4 = "IPv4", + Tcp = "Tcp", + Pup = "Pup", + Udp = "Udp", + Idp = "Idp", + IPv6 = "IPv6", + IPv6RoutingHeader = "IPv6RoutingHeader", + IPv6FragmentHeader = "IPv6FragmentHeader", + IPSecEncapsulatingSecurityPayload = "IPSecEncapsulatingSecurityPayload", + IPSecAuthenticationHeader = "IPSecAuthenticationHeader", + IcmpV6 = "IcmpV6", + IPv6NoNextHeader = "IPv6NoNextHeader", + IPv6DestinationOptions = "IPv6DestinationOptions", + ND = "ND", + Raw = "Raw", + Ipx = "Ipx", + Spx = "Spx", + SpxII = "SpxII", + Unknown = "Unknown", +} + +/** Enum type for UrlDisplayLocation */ +export enum UrlDisplayLocation { + SummaryAndDetails = "SummaryAndDetails", + DetailsOnly = "DetailsOnly", +} + +/** Enum type for WaitBehavior */ +export enum WaitBehavior { + WaitOnResourceUnavailable = "WaitOnResourceUnavailable", + StopOnResourceUnavailable = "StopOnResourceUnavailable", +} + +// ============================================================================ +// DTO Interfaces +// ============================================================================ + +/** DTO interface for CommandOptions */ +export interface CommandOptions { + description?: string; + parameter?: any; + confirmationMessage?: string; + iconName?: string; + iconVariant?: IconVariant; + isHighlighted?: boolean; + updateState?: any; +} + +/** DTO interface for CreateBuilderOptions */ +export interface CreateBuilderOptions { + args?: string[]; + projectDirectory?: string; + appHostFilePath?: string; + containerRegistryOverride?: string; + disableDashboard?: boolean; + dashboardApplicationName?: string; + allowUnsecuredTransport?: boolean; + enableResourceLogging?: boolean; +} + +/** DTO interface for ExecuteCommandResult */ +export interface ExecuteCommandResult { + success?: boolean; + canceled?: boolean; + errorMessage?: string; +} + +/** DTO interface for ResourceEventDto */ +export interface ResourceEventDto { + resourceName?: string; + resourceId?: string; + state?: string; + stateStyle?: string; + healthStatus?: string; + exitCode?: number; +} + +/** DTO interface for ResourceUrlAnnotation */ +export interface ResourceUrlAnnotation { + url?: string; + displayText?: string; + endpoint?: EndpointReferenceHandle; + displayLocation?: UrlDisplayLocation; +} + +// ============================================================================ +// Options Interfaces +// ============================================================================ + +export interface AddConnectionStringOptions { + environmentVariableName?: string; +} + +export interface AddContainerRegistryOptions { + repository?: ParameterResource; +} + +export interface AddDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface AddParameterFromConfigurationOptions { + secret?: boolean; +} + +export interface AddParameterOptions { + secret?: boolean; +} + +export interface AppendFormattedOptions { + format?: string; +} + +export interface AppendValueProviderOptions { + format?: string; +} + +export interface GetValueAsyncOptions { + cancellationToken?: AbortSignal; +} + +export interface RunOptions { + cancellationToken?: AbortSignal; +} + +export interface WaitForCompletionOptions { + exitCode?: number; +} + +export interface WithBindMountOptions { + isReadOnly?: boolean; +} + +export interface WithCommandOptions { + commandOptions?: CommandOptions; +} + +export interface WithDescriptionOptions { + enableMarkdown?: boolean; +} + +export interface WithDockerfileBaseImageOptions { + buildImage?: string; + runtimeImage?: string; +} + +export interface WithDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface WithEndpointOptions { + port?: number; + targetPort?: number; + scheme?: string; + name?: string; + env?: string; + isProxied?: boolean; + isExternal?: boolean; + protocol?: ProtocolType; +} + +export interface WithExternalServiceHttpHealthCheckOptions { + path?: string; + statusCode?: number; +} + +export interface WithHttpEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithHttpHealthCheckOptions { + path?: string; + statusCode?: number; + endpointName?: string; +} + +export interface WithHttpProbeOptions { + path?: string; + initialDelaySeconds?: number; + periodSeconds?: number; + timeoutSeconds?: number; + failureThreshold?: number; + successThreshold?: number; + endpointName?: string; +} + +export interface WithHttpsDeveloperCertificateOptions { + password?: ParameterResource; +} + +export interface WithHttpsEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithIconNameOptions { + iconVariant?: IconVariant; +} + +export interface WithImageOptions { + tag?: string; +} + +export interface WithMcpServerOptions { + path?: string; + endpointName?: string; +} + +export interface WithPipelineStepFactoryOptions { + dependsOn?: string[]; + requiredBy?: string[]; + tags?: string[]; + description?: string; +} + +export interface WithReferenceOptions { + connectionName?: string; + optional?: boolean; +} + +export interface WithRequiredCommandOptions { + helpLink?: string; +} + +export interface WithUrlExpressionOptions { + displayText?: string; +} + +export interface WithUrlOptions { + displayText?: string; +} + +export interface WithVolumeOptions { + name?: string; + isReadOnly?: boolean; +} + +// ============================================================================ +// CommandLineArgsCallbackContext +// ============================================================================ + +/** + * Type class for CommandLineArgsCallbackContext. + */ +export class CommandLineArgsCallbackContext { + constructor(private _handle: CommandLineArgsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Args property */ + private _args?: AspireList; + get args(): AspireList { + if (!this._args) { + this._args = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args', + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args' + ); + } + return this._args; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplication +// ============================================================================ + +/** + * Type class for DistributedApplication. + */ +export class DistributedApplication { + constructor(private _handle: DistributedApplicationHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Runs the distributed application */ + /** @internal */ + async _runInternal(cancellationToken?: AbortSignal): Promise { + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + await this._client.invokeCapability( + 'Aspire.Hosting/run', + rpcArgs + ); + return this; + } + + run(options?: RunOptions): DistributedApplicationPromise { + const cancellationToken = options?.cancellationToken; + return new DistributedApplicationPromise(this._runInternal(cancellationToken)); + } + +} + +/** + * Thenable wrapper for DistributedApplication that enables fluent chaining. + */ +export class DistributedApplicationPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplication) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Runs the distributed application */ + run(options?: RunOptions): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.run(options))); + } + +} + +// ============================================================================ +// DistributedApplicationExecutionContext +// ============================================================================ + +/** + * Type class for DistributedApplicationExecutionContext. + */ +export class DistributedApplicationExecutionContext { + constructor(private _handle: DistributedApplicationExecutionContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PublisherName property */ + publisherName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.publisherName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.setPublisherName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Operation property */ + operation = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.operation', + { context: this._handle } + ); + }, + }; + + /** Gets the IsPublishMode property */ + isPublishMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isPublishMode', + { context: this._handle } + ); + }, + }; + + /** Gets the IsRunMode property */ + isRunMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isRunMode', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EndpointReference +// ============================================================================ + +/** + * Type class for EndpointReference. + */ +export class EndpointReference { + constructor(private _handle: EndpointReferenceHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EndpointName property */ + endpointName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.endpointName', + { context: this._handle } + ); + }, + }; + + /** Gets the ErrorMessage property */ + errorMessage = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.errorMessage', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.setErrorMessage', + { context: this._handle, value } + ); + } + }; + + /** Gets the IsAllocated property */ + isAllocated = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isAllocated', + { context: this._handle } + ); + }, + }; + + /** Gets the Exists property */ + exists = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.exists', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttp property */ + isHttp = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttp', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttps property */ + isHttps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttps', + { context: this._handle } + ); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.port', + { context: this._handle } + ); + }, + }; + + /** Gets the TargetPort property */ + targetPort = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.targetPort', + { context: this._handle } + ); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.host', + { context: this._handle } + ); + }, + }; + + /** Gets the Scheme property */ + scheme = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.scheme', + { context: this._handle } + ); + }, + }; + + /** Gets the Url property */ + url = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.url', + { context: this._handle } + ); + }, + }; + + /** Gets the URL of the endpoint asynchronously */ + async getValueAsync(options?: GetValueAsyncOptions): Promise { + const cancellationToken = options?.cancellationToken; + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValueAsync', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for EndpointReference that enables fluent chaining. + */ +export class EndpointReferencePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: EndpointReference) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets the URL of the endpoint asynchronously */ + getValueAsync(options?: GetValueAsyncOptions): Promise { + return this._promise.then(obj => obj.getValueAsync(options)); + } + +} + +// ============================================================================ +// EndpointReferenceExpression +// ============================================================================ + +/** + * Type class for EndpointReferenceExpression. + */ +export class EndpointReferenceExpression { + constructor(private _handle: EndpointReferenceExpressionHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Endpoint property */ + endpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.endpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Property property */ + property = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.property', + { context: this._handle } + ); + }, + }; + + /** Gets the ValueExpression property */ + valueExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.valueExpression', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EnvironmentCallbackContext +// ============================================================================ + +/** + * Type class for EnvironmentCallbackContext. + */ +export class EnvironmentCallbackContext { + constructor(private _handle: EnvironmentCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EnvironmentVariables property */ + private _environmentVariables?: AspireDict; + get environmentVariables(): AspireDict { + if (!this._environmentVariables) { + this._environmentVariables = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables', + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables' + ); + } + return this._environmentVariables; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ExecuteCommandContext +// ============================================================================ + +/** + * Type class for ExecuteCommandContext. + */ +export class ExecuteCommandContext { + constructor(private _handle: ExecuteCommandContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ResourceName property */ + resourceName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.resourceName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setResourceName', + { context: this._handle, value } + ); + } + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', + { context: this._handle } + ); + }, + set: async (value: AbortSignal): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + { context: this._handle } + ); + }, + set: async (value: PipelineStep[]): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', + { context: this._handle, value } + ); + } + }; + + /** Gets pipeline steps with the specified tag */ + async getStepsByTag(tag: string): Promise { + const rpcArgs: Record = { context: this._handle, tag }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/getStepsByTag', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for PipelineConfigurationContext that enables fluent chaining. + */ +export class PipelineConfigurationContextPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineConfigurationContext) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets pipeline steps with the specified tag */ + getStepsByTag(tag: string): Promise { + return this._promise.then(obj => obj.getStepsByTag(tag)); + } + +} + +// ============================================================================ +// PipelineStep +// ============================================================================ + +/** + * Type class for PipelineStep. + */ +export class PipelineStep { + constructor(private _handle: PipelineStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.name', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Description property */ + description = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.description', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setDescription', + { context: this._handle, value } + ); + } + }; + + /** Gets the DependsOnSteps property */ + private _dependsOnSteps?: AspireList; + get dependsOnSteps(): AspireList { + if (!this._dependsOnSteps) { + this._dependsOnSteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps', + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps' + ); + } + return this._dependsOnSteps; + } + + /** Gets the RequiredBySteps property */ + private _requiredBySteps?: AspireList; + get requiredBySteps(): AspireList { + if (!this._requiredBySteps) { + this._requiredBySteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps', + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps' + ); + } + return this._requiredBySteps; + } + + /** Gets the Tags property */ + private _tags?: AspireList; + get tags(): AspireList { + if (!this._tags) { + this._tags = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.tags', + 'Aspire.Hosting.Pipelines/PipelineStep.tags' + ); + } + return this._tags; + } + + /** Adds a dependency on another step by name */ + /** @internal */ + async _dependsOnInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/dependsOn', + rpcArgs + ); + return this; + } + + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._dependsOnInternal(stepName)); + } + + /** Specifies that another step requires this step by name */ + /** @internal */ + async _requiredByInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/requiredBy', + rpcArgs + ); + return this; + } + + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._requiredByInternal(stepName)); + } + +} + +/** + * Thenable wrapper for PipelineStep that enables fluent chaining. + */ +export class PipelineStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineStep) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a dependency on another step by name */ + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.dependsOn(stepName))); + } + + /** Specifies that another step requires this step by name */ + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.requiredBy(stepName))); + } + +} + +// ============================================================================ +// PipelineStepContext +// ============================================================================ + +/** + * Type class for PipelineStepContext. + */ +export class PipelineStepContext { + constructor(private _handle: PipelineStepContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// ProjectResourceOptions +// ============================================================================ + +/** + * Type class for ProjectResourceOptions. + */ +export class ProjectResourceOptions { + constructor(private _handle: ProjectResourceOptionsHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the LaunchProfileName property */ + launchProfileName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.launchProfileName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setLaunchProfileName', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeLaunchProfile property */ + excludeLaunchProfile = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeLaunchProfile', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeLaunchProfile', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeKestrelEndpoints property */ + excludeKestrelEndpoints = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeKestrelEndpoints', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeKestrelEndpoints', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// ReferenceExpressionBuilder +// ============================================================================ + +/** + * Type class for ReferenceExpressionBuilder. + */ +export class ReferenceExpressionBuilder { + constructor(private _handle: ReferenceExpressionBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the IsEmpty property */ + isEmpty = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ReferenceExpressionBuilder.isEmpty', + { context: this._handle } + ); + }, + }; + + /** Appends a literal string to the reference expression */ + /** @internal */ + async _appendLiteralInternal(value: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendLiteral', + rpcArgs + ); + return this; + } + + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._appendLiteralInternal(value)); + } + + /** Appends a formatted string value to the reference expression */ + /** @internal */ + async _appendFormattedInternal(value: string, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendFormatted', + rpcArgs + ); + return this; + } + + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendFormattedInternal(value, format)); + } + + /** Appends a value provider to the reference expression */ + /** @internal */ + async _appendValueProviderInternal(valueProvider: any, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, valueProvider }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendValueProvider', + rpcArgs + ); + return this; + } + + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendValueProviderInternal(valueProvider, format)); + } + + /** Builds the reference expression */ + async build(): Promise { + const rpcArgs: Record = { context: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/build', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ReferenceExpressionBuilder that enables fluent chaining. + */ +export class ReferenceExpressionBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReferenceExpressionBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Appends a literal string to the reference expression */ + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendLiteral(value))); + } + + /** Appends a formatted string value to the reference expression */ + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendFormatted(value, options))); + } + + /** Appends a value provider to the reference expression */ + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendValueProvider(valueProvider, options))); + } + + /** Builds the reference expression */ + build(): Promise { + return this._promise.then(obj => obj.build()); + } + +} + +// ============================================================================ +// ResourceUrlsCallbackContext +// ============================================================================ + +/** + * Type class for ResourceUrlsCallbackContext. + */ +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Builds the distributed application */ + /** @internal */ + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', + rpcArgs + ); + return new DistributedApplication(result, this._client); + } + + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); + } + + /** Adds a connection string with a builder callback */ + /** @internal */ + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionStringBuilder', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + } + + /** Adds a container registry resource */ + /** @internal */ + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + } + + /** Adds a container resource */ + /** @internal */ + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); + } + + /** Adds a container resource built from a Dockerfile */ + /** @internal */ + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); + } + + /** Adds a .NET tool resource */ + /** @internal */ + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + } + + /** Adds an executable resource */ + /** @internal */ + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + } + + /** Adds an external service resource */ + /** @internal */ + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); + } + + /** Adds a parameter resource */ + /** @internal */ + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); + } + + /** Adds a parameter sourced from configuration */ + /** @internal */ + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + } + + /** Adds a connection string resource */ + /** @internal */ + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + } + + /** Adds a .NET project resource */ + /** @internal */ + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + } + + /** Adds a project resource with configuration options */ + /** @internal */ + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + } + + /** Adds a C# application resource */ + /** @internal */ + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + } + + /** Adds a C# application resource with configuration options */ + /** @internal */ + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + */ +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); + } + + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + } + + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + } + + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + } + + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + } + + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + } + + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); + } + + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + } + + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); + } + + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + } + + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); + } + + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); + } + + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); + } + + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); + } + + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); + } + +} + +// ============================================================================ +// DistributedApplicationEventing +// ============================================================================ + +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Unsubscribe method */ + /** @internal */ + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + rpcArgs + ); + return this; + } + + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ + +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerResource +// ============================================================================ + +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + const exitCode = options?.exitCode; + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + const password = options?.password; + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// CSharpAppResource +// ============================================================================ + +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + const exitCode = options?.exitCode; + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + const commandOptions = options?.commandOptions; + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + const password = options?.password; + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + const iconVariant = options?.iconVariant; + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// DotnetToolResource +// ============================================================================ + +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + } + + /** @internal */ + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + } + + /** @internal */ + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + } + + /** @internal */ + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + } + + /** @internal */ + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + } + + /** @internal */ + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + const exitCode = options?.exitCode; + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + const commandOptions = options?.commandOptions; + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + const password = options?.password; + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + const iconVariant = options?.iconVariant; + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for DotnetToolResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExecutableResource +// ============================================================================ + +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerFilesDestinationResource +// ============================================================================ + +export class ContainerFilesDestinationResource extends ResourceBuilderBase { + constructor(handle: IContainerFilesDestinationResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ContainerFilesDestinationResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + +} + +/** + * Thenable wrapper for ContainerFilesDestinationResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerFilesDestinationResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerFilesDestinationResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + +} + +// ============================================================================ +// Resource +// ============================================================================ + +export class Resource extends ResourceBuilderBase { + constructor(handle: IResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + const helpLink = options?.helpLink; + return new ResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + const commandOptions = options?.commandOptions; + return new ResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + const iconVariant = options?.iconVariant; + return new ResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for Resource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Resource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ResourceWithArgs +// ============================================================================ + +export class ResourceWithArgs extends ResourceBuilderBase { + constructor(handle: IResourceWithArgsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackAsyncInternal(callback)); + } + +} + +/** + * Thenable wrapper for ResourceWithArgs that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithArgsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithArgs) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + +} + +// ============================================================================ +// ResourceWithConnectionString +// ============================================================================ + +export class ResourceWithConnectionString extends ResourceBuilderBase { + constructor(handle: IResourceWithConnectionStringHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyValueInternal(name, value)); + } + +} + +/** + * Thenable wrapper for ResourceWithConnectionString that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithConnectionStringPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithConnectionString) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + +} + +// ============================================================================ +// ResourceWithContainerFiles +// ============================================================================ + +export class ResourceWithContainerFiles extends ResourceBuilderBase { + constructor(handle: IResourceWithContainerFilesHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._clearContainerFilesSourcesInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithContainerFiles that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithContainerFilesPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithContainerFiles) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + +} + +// ============================================================================ +// ResourceWithEndpoints +// ============================================================================ + +export class ResourceWithEndpoints extends ResourceBuilderBase { + constructor(handle: IResourceWithEndpointsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ResourceWithEndpointsPromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + +} + +/** + * Thenable wrapper for ResourceWithEndpoints that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEndpointsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEndpoints) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + +} + +// ============================================================================ +// ResourceWithEnvironment +// ============================================================================ + +export class ResourceWithEnvironment extends ResourceBuilderBase { + constructor(handle: IResourceWithEnvironmentHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + const password = options?.password; + return new ResourceWithEnvironmentPromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withoutHttpsCertificateInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithEnvironment that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + +} + +// ============================================================================ +// ResourceWithServiceDiscovery +// ============================================================================ + +export class ResourceWithServiceDiscovery extends ResourceBuilderBase { + constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { + super(handle, client); + } + +} + +/** + * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithServiceDiscoveryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + +} + +// ============================================================================ +// ResourceWithWaitSupport +// ============================================================================ + +export class ResourceWithWaitSupport extends ResourceBuilderBase { + constructor(handle: IResourceWithWaitSupportHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + const exitCode = options?.exitCode; + return new ResourceWithWaitSupportPromise(this._waitForCompletionInternal(dependency, exitCode)); + } + +} + +/** + * Thenable wrapper for ResourceWithWaitSupport that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithWaitSupportPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithWaitSupport) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + +} + +// ============================================================================ +// Connection Helper +// ============================================================================ + +/** + * Creates and connects to the Aspire AppHost. + * Reads connection info from environment variables set by `aspire run`. + */ +export async function connect(): Promise { + const socketPath = process.env.REMOTE_APP_HOST_SOCKET_PATH; + if (!socketPath) { + throw new Error( + 'REMOTE_APP_HOST_SOCKET_PATH environment variable not set. ' + + 'Run this application using `aspire run`.' + ); + } + + const client = new AspireClientRpc(socketPath); + await client.connect(); + + // Exit the process if the server connection is lost + client.onDisconnect(() => { + console.error('Connection to AppHost lost. Exiting...'); + process.exit(1); + }); + + return client; +} + +/** + * Creates a new distributed application builder. + * This is the entry point for building Aspire applications. + * + * @param options - Optional configuration options for the builder + * @returns A DistributedApplicationBuilder instance + * + * @example + * const builder = await createBuilder(); + * builder.addRedis("cache"); + * builder.addContainer("api", "mcr.microsoft.com/dotnet/samples:aspnetapp"); + * const app = await builder.build(); + * await app.run(); + */ +export async function createBuilder(options?: CreateBuilderOptions): Promise { + const client = await connect(); + + // Default args, projectDirectory, and appHostFilePath if not provided + // ASPIRE_APPHOST_FILEPATH is set by the CLI for consistent socket hash computation + const effectiveOptions: CreateBuilderOptions = { + ...options, + args: options?.args ?? process.argv.slice(2), + projectDirectory: options?.projectDirectory ?? process.env.ASPIRE_PROJECT_DIRECTORY ?? process.cwd(), + appHostFilePath: options?.appHostFilePath ?? process.env.ASPIRE_APPHOST_FILEPATH + }; + + const handle = await client.invokeCapability( + 'Aspire.Hosting/createBuilderWithOptions', + { options: effectiveOptions } + ); + return new DistributedApplicationBuilder(handle, client); +} + +// Re-export commonly used types +export { Handle, CapabilityError, registerCallback } from './transport.js'; +export { refExpr, ReferenceExpression } from './base.js'; + +// ============================================================================ +// Global Error Handling +// ============================================================================ + +/** + * Set up global error handlers to ensure the process exits properly on errors. + * Node.js doesn't exit on unhandled rejections by default, so we need to handle them. + */ +process.on('unhandledRejection', (reason: unknown) => { + const error = reason instanceof Error ? reason : new Error(String(reason)); + + if (reason instanceof CapabilityError) { + console.error(`\n❌ Capability Error: ${error.message}`); + console.error(` Code: ${(reason as CapabilityError).code}`); + if ((reason as CapabilityError).capability) { + console.error(` Capability: ${(reason as CapabilityError).capability}`); + } + } else { + console.error(`\n❌ Unhandled Error: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + } + + process.exit(1); +}); + +process.on('uncaughtException', (error: Error) => { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + process.exit(1); +}); + +// ============================================================================ +// Handle Wrapper Registrations +// ============================================================================ + +// Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource', (handle, client) => new CSharpAppResource(handle as CSharpAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString', (handle, client) => new ResourceWithConnectionString(handle as IResourceWithConnectionStringHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); + diff --git a/samples/container-build/ts/.modules/base.ts b/samples/container-build/ts/.modules/base.ts new file mode 100644 index 00000000..7778b0f1 --- /dev/null +++ b/samples/container-build/ts/.modules/base.ts @@ -0,0 +1,473 @@ +// aspire.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle } from './transport.js'; + +// Re-export transport types for convenience +export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; +export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; + +// ============================================================================ +// Reference Expression +// ============================================================================ + +/** + * Represents a reference expression that can be passed to capabilities. + * + * Reference expressions are serialized in the protocol as: + * ```json + * { + * "$expr": { + * "format": "redis://{0}:{1}", + * "valueProviders": [ + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:1" }, + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:2" } + * ] + * } + * } + * ``` + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export class ReferenceExpression { + // Expression mode fields + private readonly _format?: string; + private readonly _valueProviders?: unknown[]; + + // Handle mode fields (when wrapping a server-returned handle) + private readonly _handle?: Handle; + private readonly _client?: AspireClient; + + constructor(format: string, valueProviders: unknown[]); + constructor(handle: Handle, client: AspireClient); + constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { + if (typeof handleOrFormat === 'string') { + this._format = handleOrFormat; + this._valueProviders = clientOrValueProviders as unknown[]; + } else { + this._handle = handleOrFormat; + this._client = clientOrValueProviders as AspireClient; + } + } + + /** + * Creates a reference expression from a tagged template literal. + * + * @param strings - The template literal string parts + * @param values - The interpolated values (handles to value providers) + * @returns A ReferenceExpression instance + */ + static create(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + // Build the format string with {0}, {1}, etc. placeholders + let format = ''; + for (let i = 0; i < strings.length; i++) { + format += strings[i]; + if (i < values.length) { + format += `{${i}}`; + } + } + + // Extract handles from values + const valueProviders = values.map(extractHandleForExpr); + + return new ReferenceExpression(format, valueProviders); + } + + /** + * Serializes the reference expression for JSON-RPC transport. + * In template-literal mode, uses the $expr format. + * In handle mode, delegates to the handle's serialization. + */ + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + if (this._handle) { + return this._handle.toJSON(); + } + + return { + $expr: { + format: this._format!, + valueProviders: this._valueProviders && this._valueProviders.length > 0 ? this._valueProviders : undefined + } + }; + } + + /** + * String representation for debugging. + */ + toString(): string { + if (this._handle) { + return `ReferenceExpression(handle)`; + } + return `ReferenceExpression(${this._format})`; + } +} + +/** + * Extracts a value for use in reference expressions. + * Supports handles (objects) and string literals. + * @internal + */ +function extractHandleForExpr(value: unknown): unknown { + if (value === null || value === undefined) { + throw new Error('Cannot use null or undefined in reference expression'); + } + + // String literals - include directly in the expression + if (typeof value === 'string') { + return value; + } + + // Number literals - convert to string + if (typeof value === 'number') { + return String(value); + } + + // Handle objects - get their JSON representation + if (value instanceof Handle) { + return value.toJSON(); + } + + // Objects with $handle property (already in handle format) + if (typeof value === 'object' && value !== null && '$handle' in value) { + return value; + } + + // Objects with toJSON that returns a handle + if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { + const json = value.toJSON(); + if (json && typeof json === 'object' && '$handle' in json) { + return json; + } + } + + throw new Error( + `Cannot use value of type ${typeof value} in reference expression. ` + + `Expected a Handle, string, or number.` + ); +} + +/** + * Tagged template function for creating reference expressions. + * + * Use this to create dynamic expressions that reference endpoints, parameters, and other + * value providers. The expression is evaluated at runtime by Aspire. + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression using the tagged template + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export function refExpr(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + return ReferenceExpression.create(strings, ...values); +} + +// ============================================================================ +// ResourceBuilderBase +// ============================================================================ + +/** + * Base class for resource builders (e.g., RedisBuilder, ContainerBuilder). + * Provides handle management and JSON serialization. + */ +export class ResourceBuilderBase { + constructor(protected _handle: THandle, protected _client: AspireClient) {} + + toJSON(): MarshalledHandle { return this._handle.toJSON(); } +} + +// ============================================================================ +// AspireList - Mutable List Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET List. + * Provides array-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const items = await resource.getItems(); // Returns AspireList + * const count = await items.count(); + * const first = await items.get(0); + * await items.add(newItem); + * ``` + */ +export class AspireList { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the list handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual list handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual list handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of elements in the list. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.length', { + list: handle + }) as number; + } + + /** + * Gets the element at the specified index. + */ + async get(index: number): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.get', { + list: handle, + index + }) as T; + } + + /** + * Adds an element to the end of the list. + */ + async add(item: T): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.add', { + list: handle, + item + }); + } + + /** + * Removes the element at the specified index. + */ + async removeAt(index: number): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.removeAt', { + list: handle, + index + }); + } + + /** + * Clears all elements from the list. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.clear', { + list: handle + }); + } + + /** + * Converts the list to an array (creates a copy). + */ + async toArray(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.toArray', { + list: handle + }) as T[]; + } + + toJSON(): MarshalledHandle { + if (this._resolvedHandle) { + return this._resolvedHandle.toJSON(); + } + return this._handleOrContext.toJSON(); + } +} + +// ============================================================================ +// AspireDict - Mutable Dictionary Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET Dictionary. + * Provides object-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const config = await resource.getConfig(); // Returns AspireDict + * const value = await config.get("key"); + * await config.set("key", "value"); + * const hasKey = await config.containsKey("key"); + * ``` + */ +export class AspireDict { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the dictionary handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual dictionary handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual dictionary handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of key-value pairs in the dictionary. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.count', { + dict: handle + }) as number; + } + + /** + * Gets the value associated with the specified key. + * @throws If the key is not found. + */ + async get(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.get', { + dict: handle, + key + }) as V; + } + + /** + * Sets the value for the specified key. + */ + async set(key: K, value: V): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.set', { + dict: handle, + key, + value + }); + } + + /** + * Determines whether the dictionary contains the specified key. + */ + async containsKey(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.has', { + dict: handle, + key + }) as boolean; + } + + /** + * Removes the value with the specified key. + * @returns True if the element was removed; false if the key was not found. + */ + async remove(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.remove', { + dict: handle, + key + }) as boolean; + } + + /** + * Clears all key-value pairs from the dictionary. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.clear', { + dict: handle + }); + } + + /** + * Gets all keys in the dictionary. + */ + async keys(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.keys', { + dict: handle + }) as K[]; + } + + /** + * Gets all values in the dictionary. + */ + async values(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.values', { + dict: handle + }) as V[]; + } + + /** + * Converts the dictionary to a plain object (creates a copy). + * Only works when K is string. + */ + async toObject(): Promise> { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.toObject', { + dict: handle + }) as Record; + } + + async toJSON(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } +} diff --git a/samples/container-build/ts/.modules/transport.ts b/samples/container-build/ts/.modules/transport.ts new file mode 100644 index 00000000..7bddd74b --- /dev/null +++ b/samples/container-build/ts/.modules/transport.ts @@ -0,0 +1,574 @@ +// transport.ts - ATS transport layer: RPC, Handle, errors, callbacks +import * as net from 'net'; +import * as rpc from 'vscode-jsonrpc/node.js'; + +// ============================================================================ +// Base Types +// ============================================================================ + +/** + * Type for callback functions that can be registered and invoked from .NET. + * Internal: receives args and client for handle wrapping. + */ +export type CallbackFunction = (args: unknown, client: AspireClient) => unknown | Promise; + +/** + * Represents a handle to a .NET object in the ATS system. + * Handles are typed references that can be passed between capabilities. + */ +export interface MarshalledHandle { + /** The handle ID (instance number) */ + $handle: string; + /** The ATS type ID */ + $type: string; +} + +/** + * Error details for ATS errors. + */ +export interface AtsErrorDetails { + /** The parameter that caused the error */ + parameter?: string; + /** The expected type or value */ + expected?: string; + /** The actual type or value */ + actual?: string; +} + +/** + * Structured error from ATS capability invocation. + */ +export interface AtsError { + /** Machine-readable error code */ + code: string; + /** Human-readable error message */ + message: string; + /** The capability that failed (if applicable) */ + capability?: string; + /** Additional error details */ + details?: AtsErrorDetails; +} + +/** + * ATS error codes returned by the server. + */ +export const AtsErrorCodes = { + /** Unknown capability ID */ + CapabilityNotFound: 'CAPABILITY_NOT_FOUND', + /** Handle ID doesn't exist or was disposed */ + HandleNotFound: 'HANDLE_NOT_FOUND', + /** Handle type doesn't satisfy capability's type constraint */ + TypeMismatch: 'TYPE_MISMATCH', + /** Missing required argument or wrong type */ + InvalidArgument: 'INVALID_ARGUMENT', + /** Argument value outside valid range */ + ArgumentOutOfRange: 'ARGUMENT_OUT_OF_RANGE', + /** Error occurred during callback invocation */ + CallbackError: 'CALLBACK_ERROR', + /** Unexpected error in capability execution */ + InternalError: 'INTERNAL_ERROR', +} as const; + +/** + * Type guard to check if a value is an ATS error response. + */ +export function isAtsError(value: unknown): value is { $error: AtsError } { + return ( + value !== null && + typeof value === 'object' && + '$error' in value && + typeof (value as { $error: unknown }).$error === 'object' + ); +} + +/** + * Type guard to check if a value is a marshalled handle. + */ +export function isMarshalledHandle(value: unknown): value is MarshalledHandle { + return ( + value !== null && + typeof value === 'object' && + '$handle' in value && + '$type' in value + ); +} + +// ============================================================================ +// Handle +// ============================================================================ + +/** + * A typed handle to a .NET object in the ATS system. + * Handles are opaque references that can be passed to capabilities. + * + * @typeParam T - The ATS type ID (e.g., "Aspire.Hosting/IDistributedApplicationBuilder") + */ +export class Handle { + private readonly _handleId: string; + private readonly _typeId: T; + + constructor(marshalled: MarshalledHandle) { + this._handleId = marshalled.$handle; + this._typeId = marshalled.$type as T; + } + + /** The handle ID (instance number) */ + get $handle(): string { + return this._handleId; + } + + /** The ATS type ID */ + get $type(): T { + return this._typeId; + } + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { + return { + $handle: this._handleId, + $type: this._typeId + }; + } + + /** String representation for debugging */ + toString(): string { + return `Handle<${this._typeId}>(${this._handleId})`; + } +} + +// ============================================================================ +// Handle Wrapper Registry +// ============================================================================ + +/** + * Factory function for creating typed wrapper instances from handles. + */ +export type HandleWrapperFactory = (handle: Handle, client: AspireClient) => unknown; + +/** + * Registry of handle wrapper factories by type ID. + * Generated code registers wrapper classes here so callback handles can be properly typed. + */ +const handleWrapperRegistry = new Map(); + +/** + * Register a wrapper factory for a type ID. + * Called by generated code to register wrapper classes. + */ +export function registerHandleWrapper(typeId: string, factory: HandleWrapperFactory): void { + handleWrapperRegistry.set(typeId, factory); +} + +/** + * Checks if a value is a marshalled handle and wraps it appropriately. + * Uses the wrapper registry to create typed wrapper instances when available. + * + * @param value - The value to potentially wrap + * @param client - Optional client for creating typed wrapper instances + */ +export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { + if (value && typeof value === 'object') { + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); + } + } + + return handle; + } + } + return value; +} + +// ============================================================================ +// Capability Error +// ============================================================================ + +/** + * Error thrown when an ATS capability invocation fails. + */ +export class CapabilityError extends Error { + constructor( + /** The structured error from the server */ + public readonly error: AtsError + ) { + super(error.message); + this.name = 'CapabilityError'; + } + + /** Machine-readable error code */ + get code(): string { + return this.error.code; + } + + /** The capability that failed (if applicable) */ + get capability(): string | undefined { + return this.error.capability; + } +} + +// ============================================================================ +// Callback Registry +// ============================================================================ + +const callbackRegistry = new Map(); +let callbackIdCounter = 0; + +/** + * Register a callback function that can be invoked from the .NET side. + * Returns a callback ID that should be passed to methods accepting callbacks. + * + * .NET passes arguments as an object with positional keys: `{ p0: value0, p1: value1, ... }` + * This function automatically extracts positional parameters and wraps handles. + * + * @example + * // Single parameter callback + * const id = registerCallback((ctx) => console.log(ctx)); + * // .NET sends: { p0: { $handle: "...", $type: "..." } } + * // Callback receives: Handle instance + * + * @example + * // Multi-parameter callback + * const id = registerCallback((a, b) => console.log(a, b)); + * // .NET sends: { p0: "hello", p1: 42 } + * // Callback receives: "hello", 42 + */ +export function registerCallback( + callback: (...args: any[]) => TResult | Promise +): string { + const callbackId = `callback_${++callbackIdCounter}_${Date.now()}`; + + // Wrap the callback to handle .NET's positional argument format + const wrapper: CallbackFunction = async (args: unknown, client: AspireClient) => { + // .NET sends args as object { p0: value0, p1: value1, ... } + if (args && typeof args === 'object' && !Array.isArray(args)) { + const argObj = args as Record; + const argArray: unknown[] = []; + + // Extract positional parameters (p0, p1, p2, ...) + for (let i = 0; ; i++) { + const key = `p${i}`; + if (key in argObj) { + argArray.push(wrapIfHandle(argObj[key], client)); + } else { + break; + } + } + + if (argArray.length > 0) { + // Spread positional arguments to callback + const result = await callback(...argArray); + // DTO writeback protocol: when a void callback returns undefined, we + // return the original args object so the .NET host can detect property + // mutations made by the callback and apply them back to the original + // C# DTO objects. DTO args are plain JS objects (not Handle wrappers), + // so any property changes the callback made are reflected in args. + // + // Non-void callbacks (result !== undefined) return their actual result. + // The .NET side only activates writeback for void delegates whose + // parameters include [AspireDto] types — all other cases discard the + // returned args object, so the extra wire payload is harmless. + // + // IMPORTANT: callbacks that intentionally return undefined will also + // trigger this path. For non-void delegate types, the C# proxy uses + // a result-unmarshalling path (not writeback), so returning args will + // cause an unmarshal error. Void callbacks should never return a + // meaningful value; non-void callbacks should always return one. + return result !== undefined ? result : args; + } + + // No positional params found — nothing to write back + return await callback(); + } + + // Null/undefined - call with no args + if (args === null || args === undefined) { + return await callback(); + } + + // Primitive value - pass as single arg (shouldn't happen with current protocol) + return await callback(wrapIfHandle(args, client)); + }; + + callbackRegistry.set(callbackId, wrapper); + return callbackId; +} + +/** + * Unregister a callback by its ID. + */ +export function unregisterCallback(callbackId: string): boolean { + return callbackRegistry.delete(callbackId); +} + +/** + * Get the number of registered callbacks. + */ +export function getCallbackCount(): number { + return callbackRegistry.size; +} + +// ============================================================================ +// Cancellation Token Registry +// ============================================================================ + +/** + * Registry for cancellation tokens. + * Maps cancellation IDs to cleanup functions. + */ +const cancellationRegistry = new Map void>(); +let cancellationIdCounter = 0; + +/** + * A reference to the current AspireClient for sending cancel requests. + * Set by AspireClient.connect(). + */ +let currentClient: AspireClient | null = null; + +/** + * Register an AbortSignal for cancellation support. + * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * + * When the AbortSignal is aborted, sends a cancelToken request to the host. + * + * @param signal - The AbortSignal to register (optional) + * @returns The cancellation ID, or undefined if no signal provided + * + * @example + * const controller = new AbortController(); + * const id = registerCancellation(controller.signal); + * // Pass id to capability invocation + * // Later: controller.abort() will cancel the operation + */ +export function registerCancellation(signal?: AbortSignal): string | undefined { + if (!signal) { + return undefined; + } + + // Already aborted? Don't register + if (signal.aborted) { + return undefined; + } + + const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; + + // Set up the abort listener + const onAbort = () => { + // Send cancel request to host + if (currentClient?.connected) { + currentClient.cancelToken(cancellationId).catch(() => { + // Ignore errors - the operation may have already completed + }); + } + // Clean up the listener + cancellationRegistry.delete(cancellationId); + }; + + // Listen for abort + signal.addEventListener('abort', onAbort, { once: true }); + + // Store cleanup function + cancellationRegistry.set(cancellationId, () => { + signal.removeEventListener('abort', onAbort); + }); + + return cancellationId; +} + +/** + * Unregister a cancellation token by its ID. + * Call this when the operation completes to clean up resources. + * + * @param cancellationId - The cancellation ID to unregister + */ +export function unregisterCancellation(cancellationId: string | undefined): void { + if (!cancellationId) { + return; + } + + const cleanup = cancellationRegistry.get(cancellationId); + if (cleanup) { + cleanup(); + cancellationRegistry.delete(cancellationId); + } +} + +// ============================================================================ +// AspireClient (JSON-RPC Connection) +// ============================================================================ + +/** + * Client for connecting to the Aspire AppHost via socket/named pipe. + */ +export class AspireClient { + private connection: rpc.MessageConnection | null = null; + private socket: net.Socket | null = null; + private disconnectCallbacks: (() => void)[] = []; + private _pendingCalls = 0; + + constructor(private socketPath: string) { } + + /** + * Register a callback to be called when the connection is lost + */ + onDisconnect(callback: () => void): void { + this.disconnectCallbacks.push(callback); + } + + private notifyDisconnect(): void { + for (const callback of this.disconnectCallbacks) { + try { + callback(); + } catch { + // Ignore callback errors + } + } + } + + connect(timeoutMs: number = 5000): Promise { + return new Promise((resolve, reject) => { + const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this.socket = net.createConnection(pipePath); + + this.socket.once('error', (error: Error) => { + clearTimeout(timeout); + reject(error); + }); + + this.socket.once('connect', () => { + clearTimeout(timeout); + try { + const reader = new rpc.SocketMessageReader(this.socket!); + const writer = new rpc.SocketMessageWriter(this.socket!); + this.connection = rpc.createMessageConnection(reader, writer); + + this.connection.onClose(() => { + this.connection = null; + this.notifyDisconnect(); + }); + this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); + + // Handle callback invocations from the .NET side + this.connection.onRequest('invokeCallback', async (callbackId: string, args: unknown) => { + const callback = callbackRegistry.get(callbackId); + if (!callback) { + throw new Error(`Callback not found: ${callbackId}`); + } + try { + // The registered wrapper handles arg unpacking and handle wrapping + // Pass this client so handles can be wrapped with typed wrapper classes + return await Promise.resolve(callback(args, this)); + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + throw new Error(`Callback execution failed: ${message}`); + } + }); + + this.connection.listen(); + + // Set the current client for cancellation registry + currentClient = this; + + resolve(); + } catch (e) { + reject(e); + } + }); + + this.socket.on('close', () => { + this.connection?.dispose(); + this.connection = null; + if (currentClient === this) { + currentClient = null; + } + this.notifyDisconnect(); + }); + }); + } + + ping(): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('ping'); + } + + /** + * Cancel a CancellationToken by its ID. + * Called when an AbortSignal is aborted. + * + * @param tokenId - The token ID to cancel + * @returns True if the token was found and cancelled, false otherwise + */ + cancelToken(tokenId: string): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('cancelToken', tokenId); + } + + /** + * Invoke an ATS capability by ID. + * + * Capabilities are operations exposed by [AspireExport] attributes. + * Results are automatically wrapped in Handle objects when applicable. + * + * @param capabilityId - The capability ID (e.g., "Aspire.Hosting/createBuilder") + * @param args - Arguments to pass to the capability + * @returns The capability result, wrapped as Handle if it's a handle type + * @throws CapabilityError if the capability fails + */ + async invokeCapability( + capabilityId: string, + args?: Record + ): Promise { + if (!this.connection) { + throw new Error('Not connected to AppHost'); + } + + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); + } + this._pendingCalls++; + + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + args ?? null + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } + } + + disconnect(): void { + try { this.connection?.dispose(); } finally { this.connection = null; } + try { this.socket?.end(); } finally { this.socket = null; } + } + + get connected(): boolean { + return this.connection !== null && this.socket !== null; + } +} diff --git a/samples/container-build/ts/package-lock.json b/samples/container-build/ts/package-lock.json new file mode 100644 index 00000000..c4d3800c --- /dev/null +++ b/samples/container-build/ts/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "ts", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/samples/custom-resources/ts/.modules/.codegen-hash b/samples/custom-resources/ts/.modules/.codegen-hash new file mode 100644 index 00000000..1369f62c --- /dev/null +++ b/samples/custom-resources/ts/.modules/.codegen-hash @@ -0,0 +1 @@ +385A37965F5742D9B7F75074E7065C879412F46A58CE04016D535C18DA21950E \ No newline at end of file diff --git a/samples/custom-resources/ts/.modules/aspire.ts b/samples/custom-resources/ts/.modules/aspire.ts new file mode 100644 index 00000000..73dc52d2 --- /dev/null +++ b/samples/custom-resources/ts/.modules/aspire.ts @@ -0,0 +1,13306 @@ +// aspire.ts - Capability-based Aspire SDK +// This SDK uses the ATS (Aspire Type System) capability API. +// Capabilities are endpoints like 'Aspire.Hosting/createBuilder'. +// +// GENERATED CODE - DO NOT EDIT + +import { + AspireClient as AspireClientRpc, + Handle, + MarshalledHandle, + CapabilityError, + registerCallback, + wrapIfHandle, + registerHandleWrapper +} from './transport.js'; + +import { + ResourceBuilderBase, + ReferenceExpression, + refExpr, + AspireDict, + AspireList +} from './base.js'; + +// ============================================================================ +// Handle Type Aliases (Internal - not exported to users) +// ============================================================================ + +/** Handle to CommandLineArgsCallbackContext */ +type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; + +/** Handle to ContainerRegistryResource */ +type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; + +/** Handle to ContainerResource */ +type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource'>; + +/** Handle to CSharpAppResource */ +type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; + +/** Handle to DotnetToolResource */ +type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; + +/** Handle to EndpointReference */ +type EndpointReferenceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference'>; + +/** Handle to EndpointReferenceExpression */ +type EndpointReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression'>; + +/** Handle to EnvironmentCallbackContext */ +type EnvironmentCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext'>; + +/** Handle to ExecutableResource */ +type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource'>; + +/** Handle to ExecuteCommandContext */ +type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; + +/** Handle to IContainerFilesDestinationResource */ +type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; + +/** Handle to IResource */ +type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; + +/** Handle to IResourceWithArgs */ +type IResourceWithArgsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs'>; + +/** Handle to IResourceWithConnectionString */ +type IResourceWithConnectionStringHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString'>; + +/** Handle to IResourceWithEndpoints */ +type IResourceWithEndpointsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints'>; + +/** Handle to IResourceWithEnvironment */ +type IResourceWithEnvironmentHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment'>; + +/** Handle to IResourceWithWaitSupport */ +type IResourceWithWaitSupportHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport'>; + +/** Handle to ParameterResource */ +type ParameterResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource'>; + +/** Handle to ProjectResource */ +type ProjectResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource'>; + +/** Handle to ReferenceExpression */ +type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression'>; + +/** Handle to ReferenceExpressionBuilder */ +type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; + +/** Handle to ResourceLoggerService */ +type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; + +/** Handle to ResourceNotificationService */ +type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; + +/** Handle to ResourceUrlsCallbackContext */ +type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; + +/** Handle to ConnectionStringResource */ +type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; + +/** Handle to DistributedApplication */ +type DistributedApplicationHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplication'>; + +/** Handle to DistributedApplicationExecutionContext */ +type DistributedApplicationExecutionContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext'>; + +/** Handle to DistributedApplicationEventSubscription */ +type DistributedApplicationEventSubscriptionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.DistributedApplicationEventSubscription'>; + +/** Handle to IDistributedApplicationEventing */ +type IDistributedApplicationEventingHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing'>; + +/** Handle to ExternalServiceResource */ +type ExternalServiceResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ExternalServiceResource'>; + +/** Handle to IDistributedApplicationBuilder */ +type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder'>; + +/** Handle to IResourceWithContainerFiles */ +type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; + +/** Handle to IResourceWithServiceDiscovery */ +type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; + +/** Handle to PipelineConfigurationContext */ +type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; + +/** Handle to PipelineStep */ +type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; + +/** Handle to PipelineStepContext */ +type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; + +/** Handle to ProjectResourceOptions */ +type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; + +/** Handle to Dict */ +type DictstringanyHandle = Handle<'Aspire.Hosting/Dict'>; + +/** Handle to List */ +type ListanyHandle = Handle<'Aspire.Hosting/List'>; + +/** Handle to IConfiguration */ +type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; + +/** Handle to IHostEnvironment */ +type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; + +/** Handle to ILogger */ +type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; + +/** Handle to string[] */ +type stringArrayHandle = Handle<'string[]'>; + +/** Handle to IServiceProvider */ +type IServiceProviderHandle = Handle<'System.ComponentModel/System.IServiceProvider'>; + +// ============================================================================ +// Enum Types +// ============================================================================ + +/** Enum type for CertificateTrustScope */ +export enum CertificateTrustScope { + None = "None", + Append = "Append", + Override = "Override", + System = "System", +} + +/** Enum type for ContainerLifetime */ +export enum ContainerLifetime { + Session = "Session", + Persistent = "Persistent", +} + +/** Enum type for DistributedApplicationOperation */ +export enum DistributedApplicationOperation { + Run = "Run", + Publish = "Publish", +} + +/** Enum type for EndpointProperty */ +export enum EndpointProperty { + Url = "Url", + Host = "Host", + IPV4Host = "IPV4Host", + Port = "Port", + Scheme = "Scheme", + TargetPort = "TargetPort", + HostAndPort = "HostAndPort", +} + +/** Enum type for IconVariant */ +export enum IconVariant { + Regular = "Regular", + Filled = "Filled", +} + +/** Enum type for ImagePullPolicy */ +export enum ImagePullPolicy { + Default = "Default", + Always = "Always", + Missing = "Missing", + Never = "Never", +} + +/** Enum type for OtlpProtocol */ +export enum OtlpProtocol { + Grpc = "Grpc", + HttpProtobuf = "HttpProtobuf", + HttpJson = "HttpJson", +} + +/** Enum type for ProbeType */ +export enum ProbeType { + Startup = "Startup", + Readiness = "Readiness", + Liveness = "Liveness", +} + +/** Enum type for ProtocolType */ +export enum ProtocolType { + IP = "IP", + IPv6HopByHopOptions = "IPv6HopByHopOptions", + Unspecified = "Unspecified", + Icmp = "Icmp", + Igmp = "Igmp", + Ggp = "Ggp", + IPv4 = "IPv4", + Tcp = "Tcp", + Pup = "Pup", + Udp = "Udp", + Idp = "Idp", + IPv6 = "IPv6", + IPv6RoutingHeader = "IPv6RoutingHeader", + IPv6FragmentHeader = "IPv6FragmentHeader", + IPSecEncapsulatingSecurityPayload = "IPSecEncapsulatingSecurityPayload", + IPSecAuthenticationHeader = "IPSecAuthenticationHeader", + IcmpV6 = "IcmpV6", + IPv6NoNextHeader = "IPv6NoNextHeader", + IPv6DestinationOptions = "IPv6DestinationOptions", + ND = "ND", + Raw = "Raw", + Ipx = "Ipx", + Spx = "Spx", + SpxII = "SpxII", + Unknown = "Unknown", +} + +/** Enum type for UrlDisplayLocation */ +export enum UrlDisplayLocation { + SummaryAndDetails = "SummaryAndDetails", + DetailsOnly = "DetailsOnly", +} + +/** Enum type for WaitBehavior */ +export enum WaitBehavior { + WaitOnResourceUnavailable = "WaitOnResourceUnavailable", + StopOnResourceUnavailable = "StopOnResourceUnavailable", +} + +// ============================================================================ +// DTO Interfaces +// ============================================================================ + +/** DTO interface for CommandOptions */ +export interface CommandOptions { + description?: string; + parameter?: any; + confirmationMessage?: string; + iconName?: string; + iconVariant?: IconVariant; + isHighlighted?: boolean; + updateState?: any; +} + +/** DTO interface for CreateBuilderOptions */ +export interface CreateBuilderOptions { + args?: string[]; + projectDirectory?: string; + appHostFilePath?: string; + containerRegistryOverride?: string; + disableDashboard?: boolean; + dashboardApplicationName?: string; + allowUnsecuredTransport?: boolean; + enableResourceLogging?: boolean; +} + +/** DTO interface for ExecuteCommandResult */ +export interface ExecuteCommandResult { + success?: boolean; + canceled?: boolean; + errorMessage?: string; +} + +/** DTO interface for ResourceEventDto */ +export interface ResourceEventDto { + resourceName?: string; + resourceId?: string; + state?: string; + stateStyle?: string; + healthStatus?: string; + exitCode?: number; +} + +/** DTO interface for ResourceUrlAnnotation */ +export interface ResourceUrlAnnotation { + url?: string; + displayText?: string; + endpoint?: EndpointReferenceHandle; + displayLocation?: UrlDisplayLocation; +} + +// ============================================================================ +// Options Interfaces +// ============================================================================ + +export interface AddConnectionStringOptions { + environmentVariableName?: string; +} + +export interface AddContainerRegistryOptions { + repository?: ParameterResource; +} + +export interface AddDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface AddParameterFromConfigurationOptions { + secret?: boolean; +} + +export interface AddParameterOptions { + secret?: boolean; +} + +export interface AppendFormattedOptions { + format?: string; +} + +export interface AppendValueProviderOptions { + format?: string; +} + +export interface GetValueAsyncOptions { + cancellationToken?: AbortSignal; +} + +export interface RunOptions { + cancellationToken?: AbortSignal; +} + +export interface WaitForCompletionOptions { + exitCode?: number; +} + +export interface WithBindMountOptions { + isReadOnly?: boolean; +} + +export interface WithCommandOptions { + commandOptions?: CommandOptions; +} + +export interface WithDescriptionOptions { + enableMarkdown?: boolean; +} + +export interface WithDockerfileBaseImageOptions { + buildImage?: string; + runtimeImage?: string; +} + +export interface WithDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface WithEndpointOptions { + port?: number; + targetPort?: number; + scheme?: string; + name?: string; + env?: string; + isProxied?: boolean; + isExternal?: boolean; + protocol?: ProtocolType; +} + +export interface WithExternalServiceHttpHealthCheckOptions { + path?: string; + statusCode?: number; +} + +export interface WithHttpEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithHttpHealthCheckOptions { + path?: string; + statusCode?: number; + endpointName?: string; +} + +export interface WithHttpProbeOptions { + path?: string; + initialDelaySeconds?: number; + periodSeconds?: number; + timeoutSeconds?: number; + failureThreshold?: number; + successThreshold?: number; + endpointName?: string; +} + +export interface WithHttpsDeveloperCertificateOptions { + password?: ParameterResource; +} + +export interface WithHttpsEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithIconNameOptions { + iconVariant?: IconVariant; +} + +export interface WithImageOptions { + tag?: string; +} + +export interface WithMcpServerOptions { + path?: string; + endpointName?: string; +} + +export interface WithPipelineStepFactoryOptions { + dependsOn?: string[]; + requiredBy?: string[]; + tags?: string[]; + description?: string; +} + +export interface WithReferenceOptions { + connectionName?: string; + optional?: boolean; +} + +export interface WithRequiredCommandOptions { + helpLink?: string; +} + +export interface WithUrlExpressionOptions { + displayText?: string; +} + +export interface WithUrlOptions { + displayText?: string; +} + +export interface WithVolumeOptions { + name?: string; + isReadOnly?: boolean; +} + +// ============================================================================ +// CommandLineArgsCallbackContext +// ============================================================================ + +/** + * Type class for CommandLineArgsCallbackContext. + */ +export class CommandLineArgsCallbackContext { + constructor(private _handle: CommandLineArgsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Args property */ + private _args?: AspireList; + get args(): AspireList { + if (!this._args) { + this._args = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args', + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args' + ); + } + return this._args; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplication +// ============================================================================ + +/** + * Type class for DistributedApplication. + */ +export class DistributedApplication { + constructor(private _handle: DistributedApplicationHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Runs the distributed application */ + /** @internal */ + async _runInternal(cancellationToken?: AbortSignal): Promise { + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + await this._client.invokeCapability( + 'Aspire.Hosting/run', + rpcArgs + ); + return this; + } + + run(options?: RunOptions): DistributedApplicationPromise { + const cancellationToken = options?.cancellationToken; + return new DistributedApplicationPromise(this._runInternal(cancellationToken)); + } + +} + +/** + * Thenable wrapper for DistributedApplication that enables fluent chaining. + */ +export class DistributedApplicationPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplication) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Runs the distributed application */ + run(options?: RunOptions): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.run(options))); + } + +} + +// ============================================================================ +// DistributedApplicationExecutionContext +// ============================================================================ + +/** + * Type class for DistributedApplicationExecutionContext. + */ +export class DistributedApplicationExecutionContext { + constructor(private _handle: DistributedApplicationExecutionContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PublisherName property */ + publisherName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.publisherName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.setPublisherName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Operation property */ + operation = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.operation', + { context: this._handle } + ); + }, + }; + + /** Gets the IsPublishMode property */ + isPublishMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isPublishMode', + { context: this._handle } + ); + }, + }; + + /** Gets the IsRunMode property */ + isRunMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isRunMode', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EndpointReference +// ============================================================================ + +/** + * Type class for EndpointReference. + */ +export class EndpointReference { + constructor(private _handle: EndpointReferenceHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EndpointName property */ + endpointName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.endpointName', + { context: this._handle } + ); + }, + }; + + /** Gets the ErrorMessage property */ + errorMessage = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.errorMessage', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.setErrorMessage', + { context: this._handle, value } + ); + } + }; + + /** Gets the IsAllocated property */ + isAllocated = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isAllocated', + { context: this._handle } + ); + }, + }; + + /** Gets the Exists property */ + exists = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.exists', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttp property */ + isHttp = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttp', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttps property */ + isHttps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttps', + { context: this._handle } + ); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.port', + { context: this._handle } + ); + }, + }; + + /** Gets the TargetPort property */ + targetPort = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.targetPort', + { context: this._handle } + ); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.host', + { context: this._handle } + ); + }, + }; + + /** Gets the Scheme property */ + scheme = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.scheme', + { context: this._handle } + ); + }, + }; + + /** Gets the Url property */ + url = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.url', + { context: this._handle } + ); + }, + }; + + /** Gets the URL of the endpoint asynchronously */ + async getValueAsync(options?: GetValueAsyncOptions): Promise { + const cancellationToken = options?.cancellationToken; + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValueAsync', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for EndpointReference that enables fluent chaining. + */ +export class EndpointReferencePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: EndpointReference) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets the URL of the endpoint asynchronously */ + getValueAsync(options?: GetValueAsyncOptions): Promise { + return this._promise.then(obj => obj.getValueAsync(options)); + } + +} + +// ============================================================================ +// EndpointReferenceExpression +// ============================================================================ + +/** + * Type class for EndpointReferenceExpression. + */ +export class EndpointReferenceExpression { + constructor(private _handle: EndpointReferenceExpressionHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Endpoint property */ + endpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.endpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Property property */ + property = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.property', + { context: this._handle } + ); + }, + }; + + /** Gets the ValueExpression property */ + valueExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.valueExpression', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EnvironmentCallbackContext +// ============================================================================ + +/** + * Type class for EnvironmentCallbackContext. + */ +export class EnvironmentCallbackContext { + constructor(private _handle: EnvironmentCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EnvironmentVariables property */ + private _environmentVariables?: AspireDict; + get environmentVariables(): AspireDict { + if (!this._environmentVariables) { + this._environmentVariables = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables', + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables' + ); + } + return this._environmentVariables; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ExecuteCommandContext +// ============================================================================ + +/** + * Type class for ExecuteCommandContext. + */ +export class ExecuteCommandContext { + constructor(private _handle: ExecuteCommandContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ResourceName property */ + resourceName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.resourceName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setResourceName', + { context: this._handle, value } + ); + } + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', + { context: this._handle } + ); + }, + set: async (value: AbortSignal): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + { context: this._handle } + ); + }, + set: async (value: PipelineStep[]): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', + { context: this._handle, value } + ); + } + }; + + /** Gets pipeline steps with the specified tag */ + async getStepsByTag(tag: string): Promise { + const rpcArgs: Record = { context: this._handle, tag }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/getStepsByTag', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for PipelineConfigurationContext that enables fluent chaining. + */ +export class PipelineConfigurationContextPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineConfigurationContext) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets pipeline steps with the specified tag */ + getStepsByTag(tag: string): Promise { + return this._promise.then(obj => obj.getStepsByTag(tag)); + } + +} + +// ============================================================================ +// PipelineStep +// ============================================================================ + +/** + * Type class for PipelineStep. + */ +export class PipelineStep { + constructor(private _handle: PipelineStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.name', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Description property */ + description = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.description', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setDescription', + { context: this._handle, value } + ); + } + }; + + /** Gets the DependsOnSteps property */ + private _dependsOnSteps?: AspireList; + get dependsOnSteps(): AspireList { + if (!this._dependsOnSteps) { + this._dependsOnSteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps', + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps' + ); + } + return this._dependsOnSteps; + } + + /** Gets the RequiredBySteps property */ + private _requiredBySteps?: AspireList; + get requiredBySteps(): AspireList { + if (!this._requiredBySteps) { + this._requiredBySteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps', + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps' + ); + } + return this._requiredBySteps; + } + + /** Gets the Tags property */ + private _tags?: AspireList; + get tags(): AspireList { + if (!this._tags) { + this._tags = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.tags', + 'Aspire.Hosting.Pipelines/PipelineStep.tags' + ); + } + return this._tags; + } + + /** Adds a dependency on another step by name */ + /** @internal */ + async _dependsOnInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/dependsOn', + rpcArgs + ); + return this; + } + + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._dependsOnInternal(stepName)); + } + + /** Specifies that another step requires this step by name */ + /** @internal */ + async _requiredByInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/requiredBy', + rpcArgs + ); + return this; + } + + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._requiredByInternal(stepName)); + } + +} + +/** + * Thenable wrapper for PipelineStep that enables fluent chaining. + */ +export class PipelineStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineStep) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a dependency on another step by name */ + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.dependsOn(stepName))); + } + + /** Specifies that another step requires this step by name */ + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.requiredBy(stepName))); + } + +} + +// ============================================================================ +// PipelineStepContext +// ============================================================================ + +/** + * Type class for PipelineStepContext. + */ +export class PipelineStepContext { + constructor(private _handle: PipelineStepContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// ProjectResourceOptions +// ============================================================================ + +/** + * Type class for ProjectResourceOptions. + */ +export class ProjectResourceOptions { + constructor(private _handle: ProjectResourceOptionsHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the LaunchProfileName property */ + launchProfileName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.launchProfileName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setLaunchProfileName', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeLaunchProfile property */ + excludeLaunchProfile = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeLaunchProfile', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeLaunchProfile', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeKestrelEndpoints property */ + excludeKestrelEndpoints = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeKestrelEndpoints', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeKestrelEndpoints', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// ReferenceExpressionBuilder +// ============================================================================ + +/** + * Type class for ReferenceExpressionBuilder. + */ +export class ReferenceExpressionBuilder { + constructor(private _handle: ReferenceExpressionBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the IsEmpty property */ + isEmpty = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ReferenceExpressionBuilder.isEmpty', + { context: this._handle } + ); + }, + }; + + /** Appends a literal string to the reference expression */ + /** @internal */ + async _appendLiteralInternal(value: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendLiteral', + rpcArgs + ); + return this; + } + + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._appendLiteralInternal(value)); + } + + /** Appends a formatted string value to the reference expression */ + /** @internal */ + async _appendFormattedInternal(value: string, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendFormatted', + rpcArgs + ); + return this; + } + + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendFormattedInternal(value, format)); + } + + /** Appends a value provider to the reference expression */ + /** @internal */ + async _appendValueProviderInternal(valueProvider: any, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, valueProvider }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendValueProvider', + rpcArgs + ); + return this; + } + + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendValueProviderInternal(valueProvider, format)); + } + + /** Builds the reference expression */ + async build(): Promise { + const rpcArgs: Record = { context: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/build', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ReferenceExpressionBuilder that enables fluent chaining. + */ +export class ReferenceExpressionBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReferenceExpressionBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Appends a literal string to the reference expression */ + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendLiteral(value))); + } + + /** Appends a formatted string value to the reference expression */ + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendFormatted(value, options))); + } + + /** Appends a value provider to the reference expression */ + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendValueProvider(valueProvider, options))); + } + + /** Builds the reference expression */ + build(): Promise { + return this._promise.then(obj => obj.build()); + } + +} + +// ============================================================================ +// ResourceUrlsCallbackContext +// ============================================================================ + +/** + * Type class for ResourceUrlsCallbackContext. + */ +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Builds the distributed application */ + /** @internal */ + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', + rpcArgs + ); + return new DistributedApplication(result, this._client); + } + + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); + } + + /** Adds a connection string with a builder callback */ + /** @internal */ + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionStringBuilder', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + } + + /** Adds a container registry resource */ + /** @internal */ + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + } + + /** Adds a container resource */ + /** @internal */ + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); + } + + /** Adds a container resource built from a Dockerfile */ + /** @internal */ + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); + } + + /** Adds a .NET tool resource */ + /** @internal */ + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + } + + /** Adds an executable resource */ + /** @internal */ + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + } + + /** Adds an external service resource */ + /** @internal */ + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); + } + + /** Adds a parameter resource */ + /** @internal */ + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); + } + + /** Adds a parameter sourced from configuration */ + /** @internal */ + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + } + + /** Adds a connection string resource */ + /** @internal */ + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + } + + /** Adds a .NET project resource */ + /** @internal */ + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + } + + /** Adds a project resource with configuration options */ + /** @internal */ + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + } + + /** Adds a C# application resource */ + /** @internal */ + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + } + + /** Adds a C# application resource with configuration options */ + /** @internal */ + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + */ +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); + } + + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + } + + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + } + + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + } + + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + } + + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + } + + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); + } + + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + } + + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); + } + + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + } + + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); + } + + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); + } + + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); + } + + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); + } + + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); + } + +} + +// ============================================================================ +// DistributedApplicationEventing +// ============================================================================ + +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Unsubscribe method */ + /** @internal */ + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + rpcArgs + ); + return this; + } + + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ + +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerResource +// ============================================================================ + +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + const exitCode = options?.exitCode; + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + const password = options?.password; + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// CSharpAppResource +// ============================================================================ + +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + const exitCode = options?.exitCode; + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + const commandOptions = options?.commandOptions; + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + const password = options?.password; + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + const iconVariant = options?.iconVariant; + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// DotnetToolResource +// ============================================================================ + +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + } + + /** @internal */ + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + } + + /** @internal */ + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + } + + /** @internal */ + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + } + + /** @internal */ + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + } + + /** @internal */ + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + const exitCode = options?.exitCode; + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + const commandOptions = options?.commandOptions; + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + const password = options?.password; + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + const iconVariant = options?.iconVariant; + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for DotnetToolResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExecutableResource +// ============================================================================ + +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerFilesDestinationResource +// ============================================================================ + +export class ContainerFilesDestinationResource extends ResourceBuilderBase { + constructor(handle: IContainerFilesDestinationResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ContainerFilesDestinationResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + +} + +/** + * Thenable wrapper for ContainerFilesDestinationResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerFilesDestinationResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerFilesDestinationResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + +} + +// ============================================================================ +// Resource +// ============================================================================ + +export class Resource extends ResourceBuilderBase { + constructor(handle: IResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + const helpLink = options?.helpLink; + return new ResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + const commandOptions = options?.commandOptions; + return new ResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + const iconVariant = options?.iconVariant; + return new ResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for Resource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Resource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ResourceWithArgs +// ============================================================================ + +export class ResourceWithArgs extends ResourceBuilderBase { + constructor(handle: IResourceWithArgsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackAsyncInternal(callback)); + } + +} + +/** + * Thenable wrapper for ResourceWithArgs that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithArgsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithArgs) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + +} + +// ============================================================================ +// ResourceWithConnectionString +// ============================================================================ + +export class ResourceWithConnectionString extends ResourceBuilderBase { + constructor(handle: IResourceWithConnectionStringHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyValueInternal(name, value)); + } + +} + +/** + * Thenable wrapper for ResourceWithConnectionString that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithConnectionStringPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithConnectionString) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + +} + +// ============================================================================ +// ResourceWithContainerFiles +// ============================================================================ + +export class ResourceWithContainerFiles extends ResourceBuilderBase { + constructor(handle: IResourceWithContainerFilesHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._clearContainerFilesSourcesInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithContainerFiles that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithContainerFilesPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithContainerFiles) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + +} + +// ============================================================================ +// ResourceWithEndpoints +// ============================================================================ + +export class ResourceWithEndpoints extends ResourceBuilderBase { + constructor(handle: IResourceWithEndpointsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ResourceWithEndpointsPromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + +} + +/** + * Thenable wrapper for ResourceWithEndpoints that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEndpointsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEndpoints) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + +} + +// ============================================================================ +// ResourceWithEnvironment +// ============================================================================ + +export class ResourceWithEnvironment extends ResourceBuilderBase { + constructor(handle: IResourceWithEnvironmentHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + const password = options?.password; + return new ResourceWithEnvironmentPromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withoutHttpsCertificateInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithEnvironment that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + +} + +// ============================================================================ +// ResourceWithServiceDiscovery +// ============================================================================ + +export class ResourceWithServiceDiscovery extends ResourceBuilderBase { + constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { + super(handle, client); + } + +} + +/** + * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithServiceDiscoveryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + +} + +// ============================================================================ +// ResourceWithWaitSupport +// ============================================================================ + +export class ResourceWithWaitSupport extends ResourceBuilderBase { + constructor(handle: IResourceWithWaitSupportHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + const exitCode = options?.exitCode; + return new ResourceWithWaitSupportPromise(this._waitForCompletionInternal(dependency, exitCode)); + } + +} + +/** + * Thenable wrapper for ResourceWithWaitSupport that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithWaitSupportPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithWaitSupport) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + +} + +// ============================================================================ +// Connection Helper +// ============================================================================ + +/** + * Creates and connects to the Aspire AppHost. + * Reads connection info from environment variables set by `aspire run`. + */ +export async function connect(): Promise { + const socketPath = process.env.REMOTE_APP_HOST_SOCKET_PATH; + if (!socketPath) { + throw new Error( + 'REMOTE_APP_HOST_SOCKET_PATH environment variable not set. ' + + 'Run this application using `aspire run`.' + ); + } + + const client = new AspireClientRpc(socketPath); + await client.connect(); + + // Exit the process if the server connection is lost + client.onDisconnect(() => { + console.error('Connection to AppHost lost. Exiting...'); + process.exit(1); + }); + + return client; +} + +/** + * Creates a new distributed application builder. + * This is the entry point for building Aspire applications. + * + * @param options - Optional configuration options for the builder + * @returns A DistributedApplicationBuilder instance + * + * @example + * const builder = await createBuilder(); + * builder.addRedis("cache"); + * builder.addContainer("api", "mcr.microsoft.com/dotnet/samples:aspnetapp"); + * const app = await builder.build(); + * await app.run(); + */ +export async function createBuilder(options?: CreateBuilderOptions): Promise { + const client = await connect(); + + // Default args, projectDirectory, and appHostFilePath if not provided + // ASPIRE_APPHOST_FILEPATH is set by the CLI for consistent socket hash computation + const effectiveOptions: CreateBuilderOptions = { + ...options, + args: options?.args ?? process.argv.slice(2), + projectDirectory: options?.projectDirectory ?? process.env.ASPIRE_PROJECT_DIRECTORY ?? process.cwd(), + appHostFilePath: options?.appHostFilePath ?? process.env.ASPIRE_APPHOST_FILEPATH + }; + + const handle = await client.invokeCapability( + 'Aspire.Hosting/createBuilderWithOptions', + { options: effectiveOptions } + ); + return new DistributedApplicationBuilder(handle, client); +} + +// Re-export commonly used types +export { Handle, CapabilityError, registerCallback } from './transport.js'; +export { refExpr, ReferenceExpression } from './base.js'; + +// ============================================================================ +// Global Error Handling +// ============================================================================ + +/** + * Set up global error handlers to ensure the process exits properly on errors. + * Node.js doesn't exit on unhandled rejections by default, so we need to handle them. + */ +process.on('unhandledRejection', (reason: unknown) => { + const error = reason instanceof Error ? reason : new Error(String(reason)); + + if (reason instanceof CapabilityError) { + console.error(`\n❌ Capability Error: ${error.message}`); + console.error(` Code: ${(reason as CapabilityError).code}`); + if ((reason as CapabilityError).capability) { + console.error(` Capability: ${(reason as CapabilityError).capability}`); + } + } else { + console.error(`\n❌ Unhandled Error: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + } + + process.exit(1); +}); + +process.on('uncaughtException', (error: Error) => { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + process.exit(1); +}); + +// ============================================================================ +// Handle Wrapper Registrations +// ============================================================================ + +// Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource', (handle, client) => new CSharpAppResource(handle as CSharpAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString', (handle, client) => new ResourceWithConnectionString(handle as IResourceWithConnectionStringHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); + diff --git a/samples/custom-resources/ts/.modules/base.ts b/samples/custom-resources/ts/.modules/base.ts new file mode 100644 index 00000000..7778b0f1 --- /dev/null +++ b/samples/custom-resources/ts/.modules/base.ts @@ -0,0 +1,473 @@ +// aspire.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle } from './transport.js'; + +// Re-export transport types for convenience +export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; +export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; + +// ============================================================================ +// Reference Expression +// ============================================================================ + +/** + * Represents a reference expression that can be passed to capabilities. + * + * Reference expressions are serialized in the protocol as: + * ```json + * { + * "$expr": { + * "format": "redis://{0}:{1}", + * "valueProviders": [ + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:1" }, + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:2" } + * ] + * } + * } + * ``` + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export class ReferenceExpression { + // Expression mode fields + private readonly _format?: string; + private readonly _valueProviders?: unknown[]; + + // Handle mode fields (when wrapping a server-returned handle) + private readonly _handle?: Handle; + private readonly _client?: AspireClient; + + constructor(format: string, valueProviders: unknown[]); + constructor(handle: Handle, client: AspireClient); + constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { + if (typeof handleOrFormat === 'string') { + this._format = handleOrFormat; + this._valueProviders = clientOrValueProviders as unknown[]; + } else { + this._handle = handleOrFormat; + this._client = clientOrValueProviders as AspireClient; + } + } + + /** + * Creates a reference expression from a tagged template literal. + * + * @param strings - The template literal string parts + * @param values - The interpolated values (handles to value providers) + * @returns A ReferenceExpression instance + */ + static create(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + // Build the format string with {0}, {1}, etc. placeholders + let format = ''; + for (let i = 0; i < strings.length; i++) { + format += strings[i]; + if (i < values.length) { + format += `{${i}}`; + } + } + + // Extract handles from values + const valueProviders = values.map(extractHandleForExpr); + + return new ReferenceExpression(format, valueProviders); + } + + /** + * Serializes the reference expression for JSON-RPC transport. + * In template-literal mode, uses the $expr format. + * In handle mode, delegates to the handle's serialization. + */ + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + if (this._handle) { + return this._handle.toJSON(); + } + + return { + $expr: { + format: this._format!, + valueProviders: this._valueProviders && this._valueProviders.length > 0 ? this._valueProviders : undefined + } + }; + } + + /** + * String representation for debugging. + */ + toString(): string { + if (this._handle) { + return `ReferenceExpression(handle)`; + } + return `ReferenceExpression(${this._format})`; + } +} + +/** + * Extracts a value for use in reference expressions. + * Supports handles (objects) and string literals. + * @internal + */ +function extractHandleForExpr(value: unknown): unknown { + if (value === null || value === undefined) { + throw new Error('Cannot use null or undefined in reference expression'); + } + + // String literals - include directly in the expression + if (typeof value === 'string') { + return value; + } + + // Number literals - convert to string + if (typeof value === 'number') { + return String(value); + } + + // Handle objects - get their JSON representation + if (value instanceof Handle) { + return value.toJSON(); + } + + // Objects with $handle property (already in handle format) + if (typeof value === 'object' && value !== null && '$handle' in value) { + return value; + } + + // Objects with toJSON that returns a handle + if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { + const json = value.toJSON(); + if (json && typeof json === 'object' && '$handle' in json) { + return json; + } + } + + throw new Error( + `Cannot use value of type ${typeof value} in reference expression. ` + + `Expected a Handle, string, or number.` + ); +} + +/** + * Tagged template function for creating reference expressions. + * + * Use this to create dynamic expressions that reference endpoints, parameters, and other + * value providers. The expression is evaluated at runtime by Aspire. + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression using the tagged template + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export function refExpr(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + return ReferenceExpression.create(strings, ...values); +} + +// ============================================================================ +// ResourceBuilderBase +// ============================================================================ + +/** + * Base class for resource builders (e.g., RedisBuilder, ContainerBuilder). + * Provides handle management and JSON serialization. + */ +export class ResourceBuilderBase { + constructor(protected _handle: THandle, protected _client: AspireClient) {} + + toJSON(): MarshalledHandle { return this._handle.toJSON(); } +} + +// ============================================================================ +// AspireList - Mutable List Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET List. + * Provides array-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const items = await resource.getItems(); // Returns AspireList + * const count = await items.count(); + * const first = await items.get(0); + * await items.add(newItem); + * ``` + */ +export class AspireList { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the list handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual list handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual list handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of elements in the list. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.length', { + list: handle + }) as number; + } + + /** + * Gets the element at the specified index. + */ + async get(index: number): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.get', { + list: handle, + index + }) as T; + } + + /** + * Adds an element to the end of the list. + */ + async add(item: T): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.add', { + list: handle, + item + }); + } + + /** + * Removes the element at the specified index. + */ + async removeAt(index: number): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.removeAt', { + list: handle, + index + }); + } + + /** + * Clears all elements from the list. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.clear', { + list: handle + }); + } + + /** + * Converts the list to an array (creates a copy). + */ + async toArray(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.toArray', { + list: handle + }) as T[]; + } + + toJSON(): MarshalledHandle { + if (this._resolvedHandle) { + return this._resolvedHandle.toJSON(); + } + return this._handleOrContext.toJSON(); + } +} + +// ============================================================================ +// AspireDict - Mutable Dictionary Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET Dictionary. + * Provides object-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const config = await resource.getConfig(); // Returns AspireDict + * const value = await config.get("key"); + * await config.set("key", "value"); + * const hasKey = await config.containsKey("key"); + * ``` + */ +export class AspireDict { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the dictionary handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual dictionary handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual dictionary handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of key-value pairs in the dictionary. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.count', { + dict: handle + }) as number; + } + + /** + * Gets the value associated with the specified key. + * @throws If the key is not found. + */ + async get(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.get', { + dict: handle, + key + }) as V; + } + + /** + * Sets the value for the specified key. + */ + async set(key: K, value: V): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.set', { + dict: handle, + key, + value + }); + } + + /** + * Determines whether the dictionary contains the specified key. + */ + async containsKey(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.has', { + dict: handle, + key + }) as boolean; + } + + /** + * Removes the value with the specified key. + * @returns True if the element was removed; false if the key was not found. + */ + async remove(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.remove', { + dict: handle, + key + }) as boolean; + } + + /** + * Clears all key-value pairs from the dictionary. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.clear', { + dict: handle + }); + } + + /** + * Gets all keys in the dictionary. + */ + async keys(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.keys', { + dict: handle + }) as K[]; + } + + /** + * Gets all values in the dictionary. + */ + async values(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.values', { + dict: handle + }) as V[]; + } + + /** + * Converts the dictionary to a plain object (creates a copy). + * Only works when K is string. + */ + async toObject(): Promise> { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.toObject', { + dict: handle + }) as Record; + } + + async toJSON(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } +} diff --git a/samples/custom-resources/ts/.modules/transport.ts b/samples/custom-resources/ts/.modules/transport.ts new file mode 100644 index 00000000..7bddd74b --- /dev/null +++ b/samples/custom-resources/ts/.modules/transport.ts @@ -0,0 +1,574 @@ +// transport.ts - ATS transport layer: RPC, Handle, errors, callbacks +import * as net from 'net'; +import * as rpc from 'vscode-jsonrpc/node.js'; + +// ============================================================================ +// Base Types +// ============================================================================ + +/** + * Type for callback functions that can be registered and invoked from .NET. + * Internal: receives args and client for handle wrapping. + */ +export type CallbackFunction = (args: unknown, client: AspireClient) => unknown | Promise; + +/** + * Represents a handle to a .NET object in the ATS system. + * Handles are typed references that can be passed between capabilities. + */ +export interface MarshalledHandle { + /** The handle ID (instance number) */ + $handle: string; + /** The ATS type ID */ + $type: string; +} + +/** + * Error details for ATS errors. + */ +export interface AtsErrorDetails { + /** The parameter that caused the error */ + parameter?: string; + /** The expected type or value */ + expected?: string; + /** The actual type or value */ + actual?: string; +} + +/** + * Structured error from ATS capability invocation. + */ +export interface AtsError { + /** Machine-readable error code */ + code: string; + /** Human-readable error message */ + message: string; + /** The capability that failed (if applicable) */ + capability?: string; + /** Additional error details */ + details?: AtsErrorDetails; +} + +/** + * ATS error codes returned by the server. + */ +export const AtsErrorCodes = { + /** Unknown capability ID */ + CapabilityNotFound: 'CAPABILITY_NOT_FOUND', + /** Handle ID doesn't exist or was disposed */ + HandleNotFound: 'HANDLE_NOT_FOUND', + /** Handle type doesn't satisfy capability's type constraint */ + TypeMismatch: 'TYPE_MISMATCH', + /** Missing required argument or wrong type */ + InvalidArgument: 'INVALID_ARGUMENT', + /** Argument value outside valid range */ + ArgumentOutOfRange: 'ARGUMENT_OUT_OF_RANGE', + /** Error occurred during callback invocation */ + CallbackError: 'CALLBACK_ERROR', + /** Unexpected error in capability execution */ + InternalError: 'INTERNAL_ERROR', +} as const; + +/** + * Type guard to check if a value is an ATS error response. + */ +export function isAtsError(value: unknown): value is { $error: AtsError } { + return ( + value !== null && + typeof value === 'object' && + '$error' in value && + typeof (value as { $error: unknown }).$error === 'object' + ); +} + +/** + * Type guard to check if a value is a marshalled handle. + */ +export function isMarshalledHandle(value: unknown): value is MarshalledHandle { + return ( + value !== null && + typeof value === 'object' && + '$handle' in value && + '$type' in value + ); +} + +// ============================================================================ +// Handle +// ============================================================================ + +/** + * A typed handle to a .NET object in the ATS system. + * Handles are opaque references that can be passed to capabilities. + * + * @typeParam T - The ATS type ID (e.g., "Aspire.Hosting/IDistributedApplicationBuilder") + */ +export class Handle { + private readonly _handleId: string; + private readonly _typeId: T; + + constructor(marshalled: MarshalledHandle) { + this._handleId = marshalled.$handle; + this._typeId = marshalled.$type as T; + } + + /** The handle ID (instance number) */ + get $handle(): string { + return this._handleId; + } + + /** The ATS type ID */ + get $type(): T { + return this._typeId; + } + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { + return { + $handle: this._handleId, + $type: this._typeId + }; + } + + /** String representation for debugging */ + toString(): string { + return `Handle<${this._typeId}>(${this._handleId})`; + } +} + +// ============================================================================ +// Handle Wrapper Registry +// ============================================================================ + +/** + * Factory function for creating typed wrapper instances from handles. + */ +export type HandleWrapperFactory = (handle: Handle, client: AspireClient) => unknown; + +/** + * Registry of handle wrapper factories by type ID. + * Generated code registers wrapper classes here so callback handles can be properly typed. + */ +const handleWrapperRegistry = new Map(); + +/** + * Register a wrapper factory for a type ID. + * Called by generated code to register wrapper classes. + */ +export function registerHandleWrapper(typeId: string, factory: HandleWrapperFactory): void { + handleWrapperRegistry.set(typeId, factory); +} + +/** + * Checks if a value is a marshalled handle and wraps it appropriately. + * Uses the wrapper registry to create typed wrapper instances when available. + * + * @param value - The value to potentially wrap + * @param client - Optional client for creating typed wrapper instances + */ +export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { + if (value && typeof value === 'object') { + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); + } + } + + return handle; + } + } + return value; +} + +// ============================================================================ +// Capability Error +// ============================================================================ + +/** + * Error thrown when an ATS capability invocation fails. + */ +export class CapabilityError extends Error { + constructor( + /** The structured error from the server */ + public readonly error: AtsError + ) { + super(error.message); + this.name = 'CapabilityError'; + } + + /** Machine-readable error code */ + get code(): string { + return this.error.code; + } + + /** The capability that failed (if applicable) */ + get capability(): string | undefined { + return this.error.capability; + } +} + +// ============================================================================ +// Callback Registry +// ============================================================================ + +const callbackRegistry = new Map(); +let callbackIdCounter = 0; + +/** + * Register a callback function that can be invoked from the .NET side. + * Returns a callback ID that should be passed to methods accepting callbacks. + * + * .NET passes arguments as an object with positional keys: `{ p0: value0, p1: value1, ... }` + * This function automatically extracts positional parameters and wraps handles. + * + * @example + * // Single parameter callback + * const id = registerCallback((ctx) => console.log(ctx)); + * // .NET sends: { p0: { $handle: "...", $type: "..." } } + * // Callback receives: Handle instance + * + * @example + * // Multi-parameter callback + * const id = registerCallback((a, b) => console.log(a, b)); + * // .NET sends: { p0: "hello", p1: 42 } + * // Callback receives: "hello", 42 + */ +export function registerCallback( + callback: (...args: any[]) => TResult | Promise +): string { + const callbackId = `callback_${++callbackIdCounter}_${Date.now()}`; + + // Wrap the callback to handle .NET's positional argument format + const wrapper: CallbackFunction = async (args: unknown, client: AspireClient) => { + // .NET sends args as object { p0: value0, p1: value1, ... } + if (args && typeof args === 'object' && !Array.isArray(args)) { + const argObj = args as Record; + const argArray: unknown[] = []; + + // Extract positional parameters (p0, p1, p2, ...) + for (let i = 0; ; i++) { + const key = `p${i}`; + if (key in argObj) { + argArray.push(wrapIfHandle(argObj[key], client)); + } else { + break; + } + } + + if (argArray.length > 0) { + // Spread positional arguments to callback + const result = await callback(...argArray); + // DTO writeback protocol: when a void callback returns undefined, we + // return the original args object so the .NET host can detect property + // mutations made by the callback and apply them back to the original + // C# DTO objects. DTO args are plain JS objects (not Handle wrappers), + // so any property changes the callback made are reflected in args. + // + // Non-void callbacks (result !== undefined) return their actual result. + // The .NET side only activates writeback for void delegates whose + // parameters include [AspireDto] types — all other cases discard the + // returned args object, so the extra wire payload is harmless. + // + // IMPORTANT: callbacks that intentionally return undefined will also + // trigger this path. For non-void delegate types, the C# proxy uses + // a result-unmarshalling path (not writeback), so returning args will + // cause an unmarshal error. Void callbacks should never return a + // meaningful value; non-void callbacks should always return one. + return result !== undefined ? result : args; + } + + // No positional params found — nothing to write back + return await callback(); + } + + // Null/undefined - call with no args + if (args === null || args === undefined) { + return await callback(); + } + + // Primitive value - pass as single arg (shouldn't happen with current protocol) + return await callback(wrapIfHandle(args, client)); + }; + + callbackRegistry.set(callbackId, wrapper); + return callbackId; +} + +/** + * Unregister a callback by its ID. + */ +export function unregisterCallback(callbackId: string): boolean { + return callbackRegistry.delete(callbackId); +} + +/** + * Get the number of registered callbacks. + */ +export function getCallbackCount(): number { + return callbackRegistry.size; +} + +// ============================================================================ +// Cancellation Token Registry +// ============================================================================ + +/** + * Registry for cancellation tokens. + * Maps cancellation IDs to cleanup functions. + */ +const cancellationRegistry = new Map void>(); +let cancellationIdCounter = 0; + +/** + * A reference to the current AspireClient for sending cancel requests. + * Set by AspireClient.connect(). + */ +let currentClient: AspireClient | null = null; + +/** + * Register an AbortSignal for cancellation support. + * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * + * When the AbortSignal is aborted, sends a cancelToken request to the host. + * + * @param signal - The AbortSignal to register (optional) + * @returns The cancellation ID, or undefined if no signal provided + * + * @example + * const controller = new AbortController(); + * const id = registerCancellation(controller.signal); + * // Pass id to capability invocation + * // Later: controller.abort() will cancel the operation + */ +export function registerCancellation(signal?: AbortSignal): string | undefined { + if (!signal) { + return undefined; + } + + // Already aborted? Don't register + if (signal.aborted) { + return undefined; + } + + const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; + + // Set up the abort listener + const onAbort = () => { + // Send cancel request to host + if (currentClient?.connected) { + currentClient.cancelToken(cancellationId).catch(() => { + // Ignore errors - the operation may have already completed + }); + } + // Clean up the listener + cancellationRegistry.delete(cancellationId); + }; + + // Listen for abort + signal.addEventListener('abort', onAbort, { once: true }); + + // Store cleanup function + cancellationRegistry.set(cancellationId, () => { + signal.removeEventListener('abort', onAbort); + }); + + return cancellationId; +} + +/** + * Unregister a cancellation token by its ID. + * Call this when the operation completes to clean up resources. + * + * @param cancellationId - The cancellation ID to unregister + */ +export function unregisterCancellation(cancellationId: string | undefined): void { + if (!cancellationId) { + return; + } + + const cleanup = cancellationRegistry.get(cancellationId); + if (cleanup) { + cleanup(); + cancellationRegistry.delete(cancellationId); + } +} + +// ============================================================================ +// AspireClient (JSON-RPC Connection) +// ============================================================================ + +/** + * Client for connecting to the Aspire AppHost via socket/named pipe. + */ +export class AspireClient { + private connection: rpc.MessageConnection | null = null; + private socket: net.Socket | null = null; + private disconnectCallbacks: (() => void)[] = []; + private _pendingCalls = 0; + + constructor(private socketPath: string) { } + + /** + * Register a callback to be called when the connection is lost + */ + onDisconnect(callback: () => void): void { + this.disconnectCallbacks.push(callback); + } + + private notifyDisconnect(): void { + for (const callback of this.disconnectCallbacks) { + try { + callback(); + } catch { + // Ignore callback errors + } + } + } + + connect(timeoutMs: number = 5000): Promise { + return new Promise((resolve, reject) => { + const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this.socket = net.createConnection(pipePath); + + this.socket.once('error', (error: Error) => { + clearTimeout(timeout); + reject(error); + }); + + this.socket.once('connect', () => { + clearTimeout(timeout); + try { + const reader = new rpc.SocketMessageReader(this.socket!); + const writer = new rpc.SocketMessageWriter(this.socket!); + this.connection = rpc.createMessageConnection(reader, writer); + + this.connection.onClose(() => { + this.connection = null; + this.notifyDisconnect(); + }); + this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); + + // Handle callback invocations from the .NET side + this.connection.onRequest('invokeCallback', async (callbackId: string, args: unknown) => { + const callback = callbackRegistry.get(callbackId); + if (!callback) { + throw new Error(`Callback not found: ${callbackId}`); + } + try { + // The registered wrapper handles arg unpacking and handle wrapping + // Pass this client so handles can be wrapped with typed wrapper classes + return await Promise.resolve(callback(args, this)); + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + throw new Error(`Callback execution failed: ${message}`); + } + }); + + this.connection.listen(); + + // Set the current client for cancellation registry + currentClient = this; + + resolve(); + } catch (e) { + reject(e); + } + }); + + this.socket.on('close', () => { + this.connection?.dispose(); + this.connection = null; + if (currentClient === this) { + currentClient = null; + } + this.notifyDisconnect(); + }); + }); + } + + ping(): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('ping'); + } + + /** + * Cancel a CancellationToken by its ID. + * Called when an AbortSignal is aborted. + * + * @param tokenId - The token ID to cancel + * @returns True if the token was found and cancelled, false otherwise + */ + cancelToken(tokenId: string): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('cancelToken', tokenId); + } + + /** + * Invoke an ATS capability by ID. + * + * Capabilities are operations exposed by [AspireExport] attributes. + * Results are automatically wrapped in Handle objects when applicable. + * + * @param capabilityId - The capability ID (e.g., "Aspire.Hosting/createBuilder") + * @param args - Arguments to pass to the capability + * @returns The capability result, wrapped as Handle if it's a handle type + * @throws CapabilityError if the capability fails + */ + async invokeCapability( + capabilityId: string, + args?: Record + ): Promise { + if (!this.connection) { + throw new Error('Not connected to AppHost'); + } + + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); + } + this._pendingCalls++; + + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + args ?? null + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } + } + + disconnect(): void { + try { this.connection?.dispose(); } finally { this.connection = null; } + try { this.socket?.end(); } finally { this.socket = null; } + } + + get connected(): boolean { + return this.connection !== null && this.socket !== null; + } +} diff --git a/samples/custom-resources/ts/package-lock.json b/samples/custom-resources/ts/package-lock.json new file mode 100644 index 00000000..c4d3800c --- /dev/null +++ b/samples/custom-resources/ts/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "ts", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/samples/database-containers/ts/.aspire/settings.json b/samples/database-containers/ts/.aspire/settings.json index a60c25b1..3d90acd9 100644 --- a/samples/database-containers/ts/.aspire/settings.json +++ b/samples/database-containers/ts/.aspire/settings.json @@ -1,3 +1,9 @@ { - "appHostPath": "../apphost.ts" + "appHostPath": "../apphost.ts", + "sdkVersion": "13.2.0-preview.1.26159.1", + "packages": { + "Aspire.Hosting.MySql": "13.1.2", + "Aspire.Hosting.SqlServer": "13.1.2", + "Aspire.Hosting.PostgreSQL": "13.1.2" + } } \ No newline at end of file diff --git a/samples/database-containers/ts/.modules/.codegen-hash b/samples/database-containers/ts/.modules/.codegen-hash new file mode 100644 index 00000000..9fb31b57 --- /dev/null +++ b/samples/database-containers/ts/.modules/.codegen-hash @@ -0,0 +1 @@ +439EC44FA3F8231EA4FBF2309D5FFA8169BD7BD369E27A4E5BCCA77D54BBAF23 \ No newline at end of file diff --git a/samples/database-containers/ts/.modules/aspire.ts b/samples/database-containers/ts/.modules/aspire.ts new file mode 100644 index 00000000..73dc52d2 --- /dev/null +++ b/samples/database-containers/ts/.modules/aspire.ts @@ -0,0 +1,13306 @@ +// aspire.ts - Capability-based Aspire SDK +// This SDK uses the ATS (Aspire Type System) capability API. +// Capabilities are endpoints like 'Aspire.Hosting/createBuilder'. +// +// GENERATED CODE - DO NOT EDIT + +import { + AspireClient as AspireClientRpc, + Handle, + MarshalledHandle, + CapabilityError, + registerCallback, + wrapIfHandle, + registerHandleWrapper +} from './transport.js'; + +import { + ResourceBuilderBase, + ReferenceExpression, + refExpr, + AspireDict, + AspireList +} from './base.js'; + +// ============================================================================ +// Handle Type Aliases (Internal - not exported to users) +// ============================================================================ + +/** Handle to CommandLineArgsCallbackContext */ +type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; + +/** Handle to ContainerRegistryResource */ +type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; + +/** Handle to ContainerResource */ +type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource'>; + +/** Handle to CSharpAppResource */ +type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; + +/** Handle to DotnetToolResource */ +type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; + +/** Handle to EndpointReference */ +type EndpointReferenceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference'>; + +/** Handle to EndpointReferenceExpression */ +type EndpointReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression'>; + +/** Handle to EnvironmentCallbackContext */ +type EnvironmentCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext'>; + +/** Handle to ExecutableResource */ +type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource'>; + +/** Handle to ExecuteCommandContext */ +type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; + +/** Handle to IContainerFilesDestinationResource */ +type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; + +/** Handle to IResource */ +type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; + +/** Handle to IResourceWithArgs */ +type IResourceWithArgsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs'>; + +/** Handle to IResourceWithConnectionString */ +type IResourceWithConnectionStringHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString'>; + +/** Handle to IResourceWithEndpoints */ +type IResourceWithEndpointsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints'>; + +/** Handle to IResourceWithEnvironment */ +type IResourceWithEnvironmentHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment'>; + +/** Handle to IResourceWithWaitSupport */ +type IResourceWithWaitSupportHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport'>; + +/** Handle to ParameterResource */ +type ParameterResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource'>; + +/** Handle to ProjectResource */ +type ProjectResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource'>; + +/** Handle to ReferenceExpression */ +type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression'>; + +/** Handle to ReferenceExpressionBuilder */ +type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; + +/** Handle to ResourceLoggerService */ +type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; + +/** Handle to ResourceNotificationService */ +type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; + +/** Handle to ResourceUrlsCallbackContext */ +type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; + +/** Handle to ConnectionStringResource */ +type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; + +/** Handle to DistributedApplication */ +type DistributedApplicationHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplication'>; + +/** Handle to DistributedApplicationExecutionContext */ +type DistributedApplicationExecutionContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext'>; + +/** Handle to DistributedApplicationEventSubscription */ +type DistributedApplicationEventSubscriptionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.DistributedApplicationEventSubscription'>; + +/** Handle to IDistributedApplicationEventing */ +type IDistributedApplicationEventingHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing'>; + +/** Handle to ExternalServiceResource */ +type ExternalServiceResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ExternalServiceResource'>; + +/** Handle to IDistributedApplicationBuilder */ +type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder'>; + +/** Handle to IResourceWithContainerFiles */ +type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; + +/** Handle to IResourceWithServiceDiscovery */ +type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; + +/** Handle to PipelineConfigurationContext */ +type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; + +/** Handle to PipelineStep */ +type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; + +/** Handle to PipelineStepContext */ +type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; + +/** Handle to ProjectResourceOptions */ +type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; + +/** Handle to Dict */ +type DictstringanyHandle = Handle<'Aspire.Hosting/Dict'>; + +/** Handle to List */ +type ListanyHandle = Handle<'Aspire.Hosting/List'>; + +/** Handle to IConfiguration */ +type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; + +/** Handle to IHostEnvironment */ +type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; + +/** Handle to ILogger */ +type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; + +/** Handle to string[] */ +type stringArrayHandle = Handle<'string[]'>; + +/** Handle to IServiceProvider */ +type IServiceProviderHandle = Handle<'System.ComponentModel/System.IServiceProvider'>; + +// ============================================================================ +// Enum Types +// ============================================================================ + +/** Enum type for CertificateTrustScope */ +export enum CertificateTrustScope { + None = "None", + Append = "Append", + Override = "Override", + System = "System", +} + +/** Enum type for ContainerLifetime */ +export enum ContainerLifetime { + Session = "Session", + Persistent = "Persistent", +} + +/** Enum type for DistributedApplicationOperation */ +export enum DistributedApplicationOperation { + Run = "Run", + Publish = "Publish", +} + +/** Enum type for EndpointProperty */ +export enum EndpointProperty { + Url = "Url", + Host = "Host", + IPV4Host = "IPV4Host", + Port = "Port", + Scheme = "Scheme", + TargetPort = "TargetPort", + HostAndPort = "HostAndPort", +} + +/** Enum type for IconVariant */ +export enum IconVariant { + Regular = "Regular", + Filled = "Filled", +} + +/** Enum type for ImagePullPolicy */ +export enum ImagePullPolicy { + Default = "Default", + Always = "Always", + Missing = "Missing", + Never = "Never", +} + +/** Enum type for OtlpProtocol */ +export enum OtlpProtocol { + Grpc = "Grpc", + HttpProtobuf = "HttpProtobuf", + HttpJson = "HttpJson", +} + +/** Enum type for ProbeType */ +export enum ProbeType { + Startup = "Startup", + Readiness = "Readiness", + Liveness = "Liveness", +} + +/** Enum type for ProtocolType */ +export enum ProtocolType { + IP = "IP", + IPv6HopByHopOptions = "IPv6HopByHopOptions", + Unspecified = "Unspecified", + Icmp = "Icmp", + Igmp = "Igmp", + Ggp = "Ggp", + IPv4 = "IPv4", + Tcp = "Tcp", + Pup = "Pup", + Udp = "Udp", + Idp = "Idp", + IPv6 = "IPv6", + IPv6RoutingHeader = "IPv6RoutingHeader", + IPv6FragmentHeader = "IPv6FragmentHeader", + IPSecEncapsulatingSecurityPayload = "IPSecEncapsulatingSecurityPayload", + IPSecAuthenticationHeader = "IPSecAuthenticationHeader", + IcmpV6 = "IcmpV6", + IPv6NoNextHeader = "IPv6NoNextHeader", + IPv6DestinationOptions = "IPv6DestinationOptions", + ND = "ND", + Raw = "Raw", + Ipx = "Ipx", + Spx = "Spx", + SpxII = "SpxII", + Unknown = "Unknown", +} + +/** Enum type for UrlDisplayLocation */ +export enum UrlDisplayLocation { + SummaryAndDetails = "SummaryAndDetails", + DetailsOnly = "DetailsOnly", +} + +/** Enum type for WaitBehavior */ +export enum WaitBehavior { + WaitOnResourceUnavailable = "WaitOnResourceUnavailable", + StopOnResourceUnavailable = "StopOnResourceUnavailable", +} + +// ============================================================================ +// DTO Interfaces +// ============================================================================ + +/** DTO interface for CommandOptions */ +export interface CommandOptions { + description?: string; + parameter?: any; + confirmationMessage?: string; + iconName?: string; + iconVariant?: IconVariant; + isHighlighted?: boolean; + updateState?: any; +} + +/** DTO interface for CreateBuilderOptions */ +export interface CreateBuilderOptions { + args?: string[]; + projectDirectory?: string; + appHostFilePath?: string; + containerRegistryOverride?: string; + disableDashboard?: boolean; + dashboardApplicationName?: string; + allowUnsecuredTransport?: boolean; + enableResourceLogging?: boolean; +} + +/** DTO interface for ExecuteCommandResult */ +export interface ExecuteCommandResult { + success?: boolean; + canceled?: boolean; + errorMessage?: string; +} + +/** DTO interface for ResourceEventDto */ +export interface ResourceEventDto { + resourceName?: string; + resourceId?: string; + state?: string; + stateStyle?: string; + healthStatus?: string; + exitCode?: number; +} + +/** DTO interface for ResourceUrlAnnotation */ +export interface ResourceUrlAnnotation { + url?: string; + displayText?: string; + endpoint?: EndpointReferenceHandle; + displayLocation?: UrlDisplayLocation; +} + +// ============================================================================ +// Options Interfaces +// ============================================================================ + +export interface AddConnectionStringOptions { + environmentVariableName?: string; +} + +export interface AddContainerRegistryOptions { + repository?: ParameterResource; +} + +export interface AddDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface AddParameterFromConfigurationOptions { + secret?: boolean; +} + +export interface AddParameterOptions { + secret?: boolean; +} + +export interface AppendFormattedOptions { + format?: string; +} + +export interface AppendValueProviderOptions { + format?: string; +} + +export interface GetValueAsyncOptions { + cancellationToken?: AbortSignal; +} + +export interface RunOptions { + cancellationToken?: AbortSignal; +} + +export interface WaitForCompletionOptions { + exitCode?: number; +} + +export interface WithBindMountOptions { + isReadOnly?: boolean; +} + +export interface WithCommandOptions { + commandOptions?: CommandOptions; +} + +export interface WithDescriptionOptions { + enableMarkdown?: boolean; +} + +export interface WithDockerfileBaseImageOptions { + buildImage?: string; + runtimeImage?: string; +} + +export interface WithDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface WithEndpointOptions { + port?: number; + targetPort?: number; + scheme?: string; + name?: string; + env?: string; + isProxied?: boolean; + isExternal?: boolean; + protocol?: ProtocolType; +} + +export interface WithExternalServiceHttpHealthCheckOptions { + path?: string; + statusCode?: number; +} + +export interface WithHttpEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithHttpHealthCheckOptions { + path?: string; + statusCode?: number; + endpointName?: string; +} + +export interface WithHttpProbeOptions { + path?: string; + initialDelaySeconds?: number; + periodSeconds?: number; + timeoutSeconds?: number; + failureThreshold?: number; + successThreshold?: number; + endpointName?: string; +} + +export interface WithHttpsDeveloperCertificateOptions { + password?: ParameterResource; +} + +export interface WithHttpsEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithIconNameOptions { + iconVariant?: IconVariant; +} + +export interface WithImageOptions { + tag?: string; +} + +export interface WithMcpServerOptions { + path?: string; + endpointName?: string; +} + +export interface WithPipelineStepFactoryOptions { + dependsOn?: string[]; + requiredBy?: string[]; + tags?: string[]; + description?: string; +} + +export interface WithReferenceOptions { + connectionName?: string; + optional?: boolean; +} + +export interface WithRequiredCommandOptions { + helpLink?: string; +} + +export interface WithUrlExpressionOptions { + displayText?: string; +} + +export interface WithUrlOptions { + displayText?: string; +} + +export interface WithVolumeOptions { + name?: string; + isReadOnly?: boolean; +} + +// ============================================================================ +// CommandLineArgsCallbackContext +// ============================================================================ + +/** + * Type class for CommandLineArgsCallbackContext. + */ +export class CommandLineArgsCallbackContext { + constructor(private _handle: CommandLineArgsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Args property */ + private _args?: AspireList; + get args(): AspireList { + if (!this._args) { + this._args = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args', + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args' + ); + } + return this._args; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplication +// ============================================================================ + +/** + * Type class for DistributedApplication. + */ +export class DistributedApplication { + constructor(private _handle: DistributedApplicationHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Runs the distributed application */ + /** @internal */ + async _runInternal(cancellationToken?: AbortSignal): Promise { + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + await this._client.invokeCapability( + 'Aspire.Hosting/run', + rpcArgs + ); + return this; + } + + run(options?: RunOptions): DistributedApplicationPromise { + const cancellationToken = options?.cancellationToken; + return new DistributedApplicationPromise(this._runInternal(cancellationToken)); + } + +} + +/** + * Thenable wrapper for DistributedApplication that enables fluent chaining. + */ +export class DistributedApplicationPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplication) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Runs the distributed application */ + run(options?: RunOptions): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.run(options))); + } + +} + +// ============================================================================ +// DistributedApplicationExecutionContext +// ============================================================================ + +/** + * Type class for DistributedApplicationExecutionContext. + */ +export class DistributedApplicationExecutionContext { + constructor(private _handle: DistributedApplicationExecutionContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PublisherName property */ + publisherName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.publisherName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.setPublisherName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Operation property */ + operation = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.operation', + { context: this._handle } + ); + }, + }; + + /** Gets the IsPublishMode property */ + isPublishMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isPublishMode', + { context: this._handle } + ); + }, + }; + + /** Gets the IsRunMode property */ + isRunMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isRunMode', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EndpointReference +// ============================================================================ + +/** + * Type class for EndpointReference. + */ +export class EndpointReference { + constructor(private _handle: EndpointReferenceHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EndpointName property */ + endpointName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.endpointName', + { context: this._handle } + ); + }, + }; + + /** Gets the ErrorMessage property */ + errorMessage = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.errorMessage', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.setErrorMessage', + { context: this._handle, value } + ); + } + }; + + /** Gets the IsAllocated property */ + isAllocated = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isAllocated', + { context: this._handle } + ); + }, + }; + + /** Gets the Exists property */ + exists = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.exists', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttp property */ + isHttp = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttp', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttps property */ + isHttps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttps', + { context: this._handle } + ); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.port', + { context: this._handle } + ); + }, + }; + + /** Gets the TargetPort property */ + targetPort = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.targetPort', + { context: this._handle } + ); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.host', + { context: this._handle } + ); + }, + }; + + /** Gets the Scheme property */ + scheme = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.scheme', + { context: this._handle } + ); + }, + }; + + /** Gets the Url property */ + url = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.url', + { context: this._handle } + ); + }, + }; + + /** Gets the URL of the endpoint asynchronously */ + async getValueAsync(options?: GetValueAsyncOptions): Promise { + const cancellationToken = options?.cancellationToken; + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValueAsync', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for EndpointReference that enables fluent chaining. + */ +export class EndpointReferencePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: EndpointReference) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets the URL of the endpoint asynchronously */ + getValueAsync(options?: GetValueAsyncOptions): Promise { + return this._promise.then(obj => obj.getValueAsync(options)); + } + +} + +// ============================================================================ +// EndpointReferenceExpression +// ============================================================================ + +/** + * Type class for EndpointReferenceExpression. + */ +export class EndpointReferenceExpression { + constructor(private _handle: EndpointReferenceExpressionHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Endpoint property */ + endpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.endpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Property property */ + property = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.property', + { context: this._handle } + ); + }, + }; + + /** Gets the ValueExpression property */ + valueExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.valueExpression', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EnvironmentCallbackContext +// ============================================================================ + +/** + * Type class for EnvironmentCallbackContext. + */ +export class EnvironmentCallbackContext { + constructor(private _handle: EnvironmentCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EnvironmentVariables property */ + private _environmentVariables?: AspireDict; + get environmentVariables(): AspireDict { + if (!this._environmentVariables) { + this._environmentVariables = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables', + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables' + ); + } + return this._environmentVariables; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ExecuteCommandContext +// ============================================================================ + +/** + * Type class for ExecuteCommandContext. + */ +export class ExecuteCommandContext { + constructor(private _handle: ExecuteCommandContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ResourceName property */ + resourceName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.resourceName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setResourceName', + { context: this._handle, value } + ); + } + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', + { context: this._handle } + ); + }, + set: async (value: AbortSignal): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + { context: this._handle } + ); + }, + set: async (value: PipelineStep[]): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', + { context: this._handle, value } + ); + } + }; + + /** Gets pipeline steps with the specified tag */ + async getStepsByTag(tag: string): Promise { + const rpcArgs: Record = { context: this._handle, tag }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/getStepsByTag', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for PipelineConfigurationContext that enables fluent chaining. + */ +export class PipelineConfigurationContextPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineConfigurationContext) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets pipeline steps with the specified tag */ + getStepsByTag(tag: string): Promise { + return this._promise.then(obj => obj.getStepsByTag(tag)); + } + +} + +// ============================================================================ +// PipelineStep +// ============================================================================ + +/** + * Type class for PipelineStep. + */ +export class PipelineStep { + constructor(private _handle: PipelineStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.name', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Description property */ + description = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.description', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setDescription', + { context: this._handle, value } + ); + } + }; + + /** Gets the DependsOnSteps property */ + private _dependsOnSteps?: AspireList; + get dependsOnSteps(): AspireList { + if (!this._dependsOnSteps) { + this._dependsOnSteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps', + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps' + ); + } + return this._dependsOnSteps; + } + + /** Gets the RequiredBySteps property */ + private _requiredBySteps?: AspireList; + get requiredBySteps(): AspireList { + if (!this._requiredBySteps) { + this._requiredBySteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps', + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps' + ); + } + return this._requiredBySteps; + } + + /** Gets the Tags property */ + private _tags?: AspireList; + get tags(): AspireList { + if (!this._tags) { + this._tags = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.tags', + 'Aspire.Hosting.Pipelines/PipelineStep.tags' + ); + } + return this._tags; + } + + /** Adds a dependency on another step by name */ + /** @internal */ + async _dependsOnInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/dependsOn', + rpcArgs + ); + return this; + } + + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._dependsOnInternal(stepName)); + } + + /** Specifies that another step requires this step by name */ + /** @internal */ + async _requiredByInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/requiredBy', + rpcArgs + ); + return this; + } + + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._requiredByInternal(stepName)); + } + +} + +/** + * Thenable wrapper for PipelineStep that enables fluent chaining. + */ +export class PipelineStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineStep) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a dependency on another step by name */ + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.dependsOn(stepName))); + } + + /** Specifies that another step requires this step by name */ + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.requiredBy(stepName))); + } + +} + +// ============================================================================ +// PipelineStepContext +// ============================================================================ + +/** + * Type class for PipelineStepContext. + */ +export class PipelineStepContext { + constructor(private _handle: PipelineStepContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// ProjectResourceOptions +// ============================================================================ + +/** + * Type class for ProjectResourceOptions. + */ +export class ProjectResourceOptions { + constructor(private _handle: ProjectResourceOptionsHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the LaunchProfileName property */ + launchProfileName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.launchProfileName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setLaunchProfileName', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeLaunchProfile property */ + excludeLaunchProfile = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeLaunchProfile', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeLaunchProfile', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeKestrelEndpoints property */ + excludeKestrelEndpoints = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeKestrelEndpoints', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeKestrelEndpoints', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// ReferenceExpressionBuilder +// ============================================================================ + +/** + * Type class for ReferenceExpressionBuilder. + */ +export class ReferenceExpressionBuilder { + constructor(private _handle: ReferenceExpressionBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the IsEmpty property */ + isEmpty = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ReferenceExpressionBuilder.isEmpty', + { context: this._handle } + ); + }, + }; + + /** Appends a literal string to the reference expression */ + /** @internal */ + async _appendLiteralInternal(value: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendLiteral', + rpcArgs + ); + return this; + } + + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._appendLiteralInternal(value)); + } + + /** Appends a formatted string value to the reference expression */ + /** @internal */ + async _appendFormattedInternal(value: string, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendFormatted', + rpcArgs + ); + return this; + } + + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendFormattedInternal(value, format)); + } + + /** Appends a value provider to the reference expression */ + /** @internal */ + async _appendValueProviderInternal(valueProvider: any, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, valueProvider }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendValueProvider', + rpcArgs + ); + return this; + } + + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendValueProviderInternal(valueProvider, format)); + } + + /** Builds the reference expression */ + async build(): Promise { + const rpcArgs: Record = { context: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/build', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ReferenceExpressionBuilder that enables fluent chaining. + */ +export class ReferenceExpressionBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReferenceExpressionBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Appends a literal string to the reference expression */ + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendLiteral(value))); + } + + /** Appends a formatted string value to the reference expression */ + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendFormatted(value, options))); + } + + /** Appends a value provider to the reference expression */ + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendValueProvider(valueProvider, options))); + } + + /** Builds the reference expression */ + build(): Promise { + return this._promise.then(obj => obj.build()); + } + +} + +// ============================================================================ +// ResourceUrlsCallbackContext +// ============================================================================ + +/** + * Type class for ResourceUrlsCallbackContext. + */ +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Builds the distributed application */ + /** @internal */ + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', + rpcArgs + ); + return new DistributedApplication(result, this._client); + } + + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); + } + + /** Adds a connection string with a builder callback */ + /** @internal */ + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionStringBuilder', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + } + + /** Adds a container registry resource */ + /** @internal */ + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + } + + /** Adds a container resource */ + /** @internal */ + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); + } + + /** Adds a container resource built from a Dockerfile */ + /** @internal */ + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); + } + + /** Adds a .NET tool resource */ + /** @internal */ + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + } + + /** Adds an executable resource */ + /** @internal */ + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + } + + /** Adds an external service resource */ + /** @internal */ + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); + } + + /** Adds a parameter resource */ + /** @internal */ + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); + } + + /** Adds a parameter sourced from configuration */ + /** @internal */ + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + } + + /** Adds a connection string resource */ + /** @internal */ + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + } + + /** Adds a .NET project resource */ + /** @internal */ + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + } + + /** Adds a project resource with configuration options */ + /** @internal */ + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + } + + /** Adds a C# application resource */ + /** @internal */ + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + } + + /** Adds a C# application resource with configuration options */ + /** @internal */ + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + */ +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); + } + + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + } + + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + } + + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + } + + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + } + + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + } + + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); + } + + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + } + + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); + } + + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + } + + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); + } + + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); + } + + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); + } + + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); + } + + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); + } + +} + +// ============================================================================ +// DistributedApplicationEventing +// ============================================================================ + +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Unsubscribe method */ + /** @internal */ + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + rpcArgs + ); + return this; + } + + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ + +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerResource +// ============================================================================ + +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + const exitCode = options?.exitCode; + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + const password = options?.password; + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// CSharpAppResource +// ============================================================================ + +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + const exitCode = options?.exitCode; + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + const commandOptions = options?.commandOptions; + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + const password = options?.password; + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + const iconVariant = options?.iconVariant; + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// DotnetToolResource +// ============================================================================ + +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + } + + /** @internal */ + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + } + + /** @internal */ + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + } + + /** @internal */ + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + } + + /** @internal */ + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + } + + /** @internal */ + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + const exitCode = options?.exitCode; + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + const commandOptions = options?.commandOptions; + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + const password = options?.password; + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + const iconVariant = options?.iconVariant; + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for DotnetToolResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExecutableResource +// ============================================================================ + +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerFilesDestinationResource +// ============================================================================ + +export class ContainerFilesDestinationResource extends ResourceBuilderBase { + constructor(handle: IContainerFilesDestinationResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ContainerFilesDestinationResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + +} + +/** + * Thenable wrapper for ContainerFilesDestinationResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerFilesDestinationResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerFilesDestinationResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + +} + +// ============================================================================ +// Resource +// ============================================================================ + +export class Resource extends ResourceBuilderBase { + constructor(handle: IResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + const helpLink = options?.helpLink; + return new ResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + const commandOptions = options?.commandOptions; + return new ResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + const iconVariant = options?.iconVariant; + return new ResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for Resource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Resource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ResourceWithArgs +// ============================================================================ + +export class ResourceWithArgs extends ResourceBuilderBase { + constructor(handle: IResourceWithArgsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackAsyncInternal(callback)); + } + +} + +/** + * Thenable wrapper for ResourceWithArgs that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithArgsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithArgs) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + +} + +// ============================================================================ +// ResourceWithConnectionString +// ============================================================================ + +export class ResourceWithConnectionString extends ResourceBuilderBase { + constructor(handle: IResourceWithConnectionStringHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyValueInternal(name, value)); + } + +} + +/** + * Thenable wrapper for ResourceWithConnectionString that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithConnectionStringPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithConnectionString) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + +} + +// ============================================================================ +// ResourceWithContainerFiles +// ============================================================================ + +export class ResourceWithContainerFiles extends ResourceBuilderBase { + constructor(handle: IResourceWithContainerFilesHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._clearContainerFilesSourcesInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithContainerFiles that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithContainerFilesPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithContainerFiles) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + +} + +// ============================================================================ +// ResourceWithEndpoints +// ============================================================================ + +export class ResourceWithEndpoints extends ResourceBuilderBase { + constructor(handle: IResourceWithEndpointsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ResourceWithEndpointsPromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + +} + +/** + * Thenable wrapper for ResourceWithEndpoints that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEndpointsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEndpoints) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + +} + +// ============================================================================ +// ResourceWithEnvironment +// ============================================================================ + +export class ResourceWithEnvironment extends ResourceBuilderBase { + constructor(handle: IResourceWithEnvironmentHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + const password = options?.password; + return new ResourceWithEnvironmentPromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withoutHttpsCertificateInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithEnvironment that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + +} + +// ============================================================================ +// ResourceWithServiceDiscovery +// ============================================================================ + +export class ResourceWithServiceDiscovery extends ResourceBuilderBase { + constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { + super(handle, client); + } + +} + +/** + * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithServiceDiscoveryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + +} + +// ============================================================================ +// ResourceWithWaitSupport +// ============================================================================ + +export class ResourceWithWaitSupport extends ResourceBuilderBase { + constructor(handle: IResourceWithWaitSupportHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + const exitCode = options?.exitCode; + return new ResourceWithWaitSupportPromise(this._waitForCompletionInternal(dependency, exitCode)); + } + +} + +/** + * Thenable wrapper for ResourceWithWaitSupport that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithWaitSupportPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithWaitSupport) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + +} + +// ============================================================================ +// Connection Helper +// ============================================================================ + +/** + * Creates and connects to the Aspire AppHost. + * Reads connection info from environment variables set by `aspire run`. + */ +export async function connect(): Promise { + const socketPath = process.env.REMOTE_APP_HOST_SOCKET_PATH; + if (!socketPath) { + throw new Error( + 'REMOTE_APP_HOST_SOCKET_PATH environment variable not set. ' + + 'Run this application using `aspire run`.' + ); + } + + const client = new AspireClientRpc(socketPath); + await client.connect(); + + // Exit the process if the server connection is lost + client.onDisconnect(() => { + console.error('Connection to AppHost lost. Exiting...'); + process.exit(1); + }); + + return client; +} + +/** + * Creates a new distributed application builder. + * This is the entry point for building Aspire applications. + * + * @param options - Optional configuration options for the builder + * @returns A DistributedApplicationBuilder instance + * + * @example + * const builder = await createBuilder(); + * builder.addRedis("cache"); + * builder.addContainer("api", "mcr.microsoft.com/dotnet/samples:aspnetapp"); + * const app = await builder.build(); + * await app.run(); + */ +export async function createBuilder(options?: CreateBuilderOptions): Promise { + const client = await connect(); + + // Default args, projectDirectory, and appHostFilePath if not provided + // ASPIRE_APPHOST_FILEPATH is set by the CLI for consistent socket hash computation + const effectiveOptions: CreateBuilderOptions = { + ...options, + args: options?.args ?? process.argv.slice(2), + projectDirectory: options?.projectDirectory ?? process.env.ASPIRE_PROJECT_DIRECTORY ?? process.cwd(), + appHostFilePath: options?.appHostFilePath ?? process.env.ASPIRE_APPHOST_FILEPATH + }; + + const handle = await client.invokeCapability( + 'Aspire.Hosting/createBuilderWithOptions', + { options: effectiveOptions } + ); + return new DistributedApplicationBuilder(handle, client); +} + +// Re-export commonly used types +export { Handle, CapabilityError, registerCallback } from './transport.js'; +export { refExpr, ReferenceExpression } from './base.js'; + +// ============================================================================ +// Global Error Handling +// ============================================================================ + +/** + * Set up global error handlers to ensure the process exits properly on errors. + * Node.js doesn't exit on unhandled rejections by default, so we need to handle them. + */ +process.on('unhandledRejection', (reason: unknown) => { + const error = reason instanceof Error ? reason : new Error(String(reason)); + + if (reason instanceof CapabilityError) { + console.error(`\n❌ Capability Error: ${error.message}`); + console.error(` Code: ${(reason as CapabilityError).code}`); + if ((reason as CapabilityError).capability) { + console.error(` Capability: ${(reason as CapabilityError).capability}`); + } + } else { + console.error(`\n❌ Unhandled Error: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + } + + process.exit(1); +}); + +process.on('uncaughtException', (error: Error) => { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + process.exit(1); +}); + +// ============================================================================ +// Handle Wrapper Registrations +// ============================================================================ + +// Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource', (handle, client) => new CSharpAppResource(handle as CSharpAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString', (handle, client) => new ResourceWithConnectionString(handle as IResourceWithConnectionStringHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); + diff --git a/samples/database-containers/ts/.modules/base.ts b/samples/database-containers/ts/.modules/base.ts new file mode 100644 index 00000000..7778b0f1 --- /dev/null +++ b/samples/database-containers/ts/.modules/base.ts @@ -0,0 +1,473 @@ +// aspire.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle } from './transport.js'; + +// Re-export transport types for convenience +export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; +export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; + +// ============================================================================ +// Reference Expression +// ============================================================================ + +/** + * Represents a reference expression that can be passed to capabilities. + * + * Reference expressions are serialized in the protocol as: + * ```json + * { + * "$expr": { + * "format": "redis://{0}:{1}", + * "valueProviders": [ + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:1" }, + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:2" } + * ] + * } + * } + * ``` + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export class ReferenceExpression { + // Expression mode fields + private readonly _format?: string; + private readonly _valueProviders?: unknown[]; + + // Handle mode fields (when wrapping a server-returned handle) + private readonly _handle?: Handle; + private readonly _client?: AspireClient; + + constructor(format: string, valueProviders: unknown[]); + constructor(handle: Handle, client: AspireClient); + constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { + if (typeof handleOrFormat === 'string') { + this._format = handleOrFormat; + this._valueProviders = clientOrValueProviders as unknown[]; + } else { + this._handle = handleOrFormat; + this._client = clientOrValueProviders as AspireClient; + } + } + + /** + * Creates a reference expression from a tagged template literal. + * + * @param strings - The template literal string parts + * @param values - The interpolated values (handles to value providers) + * @returns A ReferenceExpression instance + */ + static create(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + // Build the format string with {0}, {1}, etc. placeholders + let format = ''; + for (let i = 0; i < strings.length; i++) { + format += strings[i]; + if (i < values.length) { + format += `{${i}}`; + } + } + + // Extract handles from values + const valueProviders = values.map(extractHandleForExpr); + + return new ReferenceExpression(format, valueProviders); + } + + /** + * Serializes the reference expression for JSON-RPC transport. + * In template-literal mode, uses the $expr format. + * In handle mode, delegates to the handle's serialization. + */ + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + if (this._handle) { + return this._handle.toJSON(); + } + + return { + $expr: { + format: this._format!, + valueProviders: this._valueProviders && this._valueProviders.length > 0 ? this._valueProviders : undefined + } + }; + } + + /** + * String representation for debugging. + */ + toString(): string { + if (this._handle) { + return `ReferenceExpression(handle)`; + } + return `ReferenceExpression(${this._format})`; + } +} + +/** + * Extracts a value for use in reference expressions. + * Supports handles (objects) and string literals. + * @internal + */ +function extractHandleForExpr(value: unknown): unknown { + if (value === null || value === undefined) { + throw new Error('Cannot use null or undefined in reference expression'); + } + + // String literals - include directly in the expression + if (typeof value === 'string') { + return value; + } + + // Number literals - convert to string + if (typeof value === 'number') { + return String(value); + } + + // Handle objects - get their JSON representation + if (value instanceof Handle) { + return value.toJSON(); + } + + // Objects with $handle property (already in handle format) + if (typeof value === 'object' && value !== null && '$handle' in value) { + return value; + } + + // Objects with toJSON that returns a handle + if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { + const json = value.toJSON(); + if (json && typeof json === 'object' && '$handle' in json) { + return json; + } + } + + throw new Error( + `Cannot use value of type ${typeof value} in reference expression. ` + + `Expected a Handle, string, or number.` + ); +} + +/** + * Tagged template function for creating reference expressions. + * + * Use this to create dynamic expressions that reference endpoints, parameters, and other + * value providers. The expression is evaluated at runtime by Aspire. + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression using the tagged template + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export function refExpr(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + return ReferenceExpression.create(strings, ...values); +} + +// ============================================================================ +// ResourceBuilderBase +// ============================================================================ + +/** + * Base class for resource builders (e.g., RedisBuilder, ContainerBuilder). + * Provides handle management and JSON serialization. + */ +export class ResourceBuilderBase { + constructor(protected _handle: THandle, protected _client: AspireClient) {} + + toJSON(): MarshalledHandle { return this._handle.toJSON(); } +} + +// ============================================================================ +// AspireList - Mutable List Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET List. + * Provides array-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const items = await resource.getItems(); // Returns AspireList + * const count = await items.count(); + * const first = await items.get(0); + * await items.add(newItem); + * ``` + */ +export class AspireList { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the list handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual list handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual list handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of elements in the list. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.length', { + list: handle + }) as number; + } + + /** + * Gets the element at the specified index. + */ + async get(index: number): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.get', { + list: handle, + index + }) as T; + } + + /** + * Adds an element to the end of the list. + */ + async add(item: T): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.add', { + list: handle, + item + }); + } + + /** + * Removes the element at the specified index. + */ + async removeAt(index: number): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.removeAt', { + list: handle, + index + }); + } + + /** + * Clears all elements from the list. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.clear', { + list: handle + }); + } + + /** + * Converts the list to an array (creates a copy). + */ + async toArray(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.toArray', { + list: handle + }) as T[]; + } + + toJSON(): MarshalledHandle { + if (this._resolvedHandle) { + return this._resolvedHandle.toJSON(); + } + return this._handleOrContext.toJSON(); + } +} + +// ============================================================================ +// AspireDict - Mutable Dictionary Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET Dictionary. + * Provides object-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const config = await resource.getConfig(); // Returns AspireDict + * const value = await config.get("key"); + * await config.set("key", "value"); + * const hasKey = await config.containsKey("key"); + * ``` + */ +export class AspireDict { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the dictionary handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual dictionary handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual dictionary handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of key-value pairs in the dictionary. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.count', { + dict: handle + }) as number; + } + + /** + * Gets the value associated with the specified key. + * @throws If the key is not found. + */ + async get(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.get', { + dict: handle, + key + }) as V; + } + + /** + * Sets the value for the specified key. + */ + async set(key: K, value: V): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.set', { + dict: handle, + key, + value + }); + } + + /** + * Determines whether the dictionary contains the specified key. + */ + async containsKey(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.has', { + dict: handle, + key + }) as boolean; + } + + /** + * Removes the value with the specified key. + * @returns True if the element was removed; false if the key was not found. + */ + async remove(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.remove', { + dict: handle, + key + }) as boolean; + } + + /** + * Clears all key-value pairs from the dictionary. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.clear', { + dict: handle + }); + } + + /** + * Gets all keys in the dictionary. + */ + async keys(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.keys', { + dict: handle + }) as K[]; + } + + /** + * Gets all values in the dictionary. + */ + async values(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.values', { + dict: handle + }) as V[]; + } + + /** + * Converts the dictionary to a plain object (creates a copy). + * Only works when K is string. + */ + async toObject(): Promise> { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.toObject', { + dict: handle + }) as Record; + } + + async toJSON(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } +} diff --git a/samples/database-containers/ts/.modules/transport.ts b/samples/database-containers/ts/.modules/transport.ts new file mode 100644 index 00000000..7bddd74b --- /dev/null +++ b/samples/database-containers/ts/.modules/transport.ts @@ -0,0 +1,574 @@ +// transport.ts - ATS transport layer: RPC, Handle, errors, callbacks +import * as net from 'net'; +import * as rpc from 'vscode-jsonrpc/node.js'; + +// ============================================================================ +// Base Types +// ============================================================================ + +/** + * Type for callback functions that can be registered and invoked from .NET. + * Internal: receives args and client for handle wrapping. + */ +export type CallbackFunction = (args: unknown, client: AspireClient) => unknown | Promise; + +/** + * Represents a handle to a .NET object in the ATS system. + * Handles are typed references that can be passed between capabilities. + */ +export interface MarshalledHandle { + /** The handle ID (instance number) */ + $handle: string; + /** The ATS type ID */ + $type: string; +} + +/** + * Error details for ATS errors. + */ +export interface AtsErrorDetails { + /** The parameter that caused the error */ + parameter?: string; + /** The expected type or value */ + expected?: string; + /** The actual type or value */ + actual?: string; +} + +/** + * Structured error from ATS capability invocation. + */ +export interface AtsError { + /** Machine-readable error code */ + code: string; + /** Human-readable error message */ + message: string; + /** The capability that failed (if applicable) */ + capability?: string; + /** Additional error details */ + details?: AtsErrorDetails; +} + +/** + * ATS error codes returned by the server. + */ +export const AtsErrorCodes = { + /** Unknown capability ID */ + CapabilityNotFound: 'CAPABILITY_NOT_FOUND', + /** Handle ID doesn't exist or was disposed */ + HandleNotFound: 'HANDLE_NOT_FOUND', + /** Handle type doesn't satisfy capability's type constraint */ + TypeMismatch: 'TYPE_MISMATCH', + /** Missing required argument or wrong type */ + InvalidArgument: 'INVALID_ARGUMENT', + /** Argument value outside valid range */ + ArgumentOutOfRange: 'ARGUMENT_OUT_OF_RANGE', + /** Error occurred during callback invocation */ + CallbackError: 'CALLBACK_ERROR', + /** Unexpected error in capability execution */ + InternalError: 'INTERNAL_ERROR', +} as const; + +/** + * Type guard to check if a value is an ATS error response. + */ +export function isAtsError(value: unknown): value is { $error: AtsError } { + return ( + value !== null && + typeof value === 'object' && + '$error' in value && + typeof (value as { $error: unknown }).$error === 'object' + ); +} + +/** + * Type guard to check if a value is a marshalled handle. + */ +export function isMarshalledHandle(value: unknown): value is MarshalledHandle { + return ( + value !== null && + typeof value === 'object' && + '$handle' in value && + '$type' in value + ); +} + +// ============================================================================ +// Handle +// ============================================================================ + +/** + * A typed handle to a .NET object in the ATS system. + * Handles are opaque references that can be passed to capabilities. + * + * @typeParam T - The ATS type ID (e.g., "Aspire.Hosting/IDistributedApplicationBuilder") + */ +export class Handle { + private readonly _handleId: string; + private readonly _typeId: T; + + constructor(marshalled: MarshalledHandle) { + this._handleId = marshalled.$handle; + this._typeId = marshalled.$type as T; + } + + /** The handle ID (instance number) */ + get $handle(): string { + return this._handleId; + } + + /** The ATS type ID */ + get $type(): T { + return this._typeId; + } + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { + return { + $handle: this._handleId, + $type: this._typeId + }; + } + + /** String representation for debugging */ + toString(): string { + return `Handle<${this._typeId}>(${this._handleId})`; + } +} + +// ============================================================================ +// Handle Wrapper Registry +// ============================================================================ + +/** + * Factory function for creating typed wrapper instances from handles. + */ +export type HandleWrapperFactory = (handle: Handle, client: AspireClient) => unknown; + +/** + * Registry of handle wrapper factories by type ID. + * Generated code registers wrapper classes here so callback handles can be properly typed. + */ +const handleWrapperRegistry = new Map(); + +/** + * Register a wrapper factory for a type ID. + * Called by generated code to register wrapper classes. + */ +export function registerHandleWrapper(typeId: string, factory: HandleWrapperFactory): void { + handleWrapperRegistry.set(typeId, factory); +} + +/** + * Checks if a value is a marshalled handle and wraps it appropriately. + * Uses the wrapper registry to create typed wrapper instances when available. + * + * @param value - The value to potentially wrap + * @param client - Optional client for creating typed wrapper instances + */ +export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { + if (value && typeof value === 'object') { + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); + } + } + + return handle; + } + } + return value; +} + +// ============================================================================ +// Capability Error +// ============================================================================ + +/** + * Error thrown when an ATS capability invocation fails. + */ +export class CapabilityError extends Error { + constructor( + /** The structured error from the server */ + public readonly error: AtsError + ) { + super(error.message); + this.name = 'CapabilityError'; + } + + /** Machine-readable error code */ + get code(): string { + return this.error.code; + } + + /** The capability that failed (if applicable) */ + get capability(): string | undefined { + return this.error.capability; + } +} + +// ============================================================================ +// Callback Registry +// ============================================================================ + +const callbackRegistry = new Map(); +let callbackIdCounter = 0; + +/** + * Register a callback function that can be invoked from the .NET side. + * Returns a callback ID that should be passed to methods accepting callbacks. + * + * .NET passes arguments as an object with positional keys: `{ p0: value0, p1: value1, ... }` + * This function automatically extracts positional parameters and wraps handles. + * + * @example + * // Single parameter callback + * const id = registerCallback((ctx) => console.log(ctx)); + * // .NET sends: { p0: { $handle: "...", $type: "..." } } + * // Callback receives: Handle instance + * + * @example + * // Multi-parameter callback + * const id = registerCallback((a, b) => console.log(a, b)); + * // .NET sends: { p0: "hello", p1: 42 } + * // Callback receives: "hello", 42 + */ +export function registerCallback( + callback: (...args: any[]) => TResult | Promise +): string { + const callbackId = `callback_${++callbackIdCounter}_${Date.now()}`; + + // Wrap the callback to handle .NET's positional argument format + const wrapper: CallbackFunction = async (args: unknown, client: AspireClient) => { + // .NET sends args as object { p0: value0, p1: value1, ... } + if (args && typeof args === 'object' && !Array.isArray(args)) { + const argObj = args as Record; + const argArray: unknown[] = []; + + // Extract positional parameters (p0, p1, p2, ...) + for (let i = 0; ; i++) { + const key = `p${i}`; + if (key in argObj) { + argArray.push(wrapIfHandle(argObj[key], client)); + } else { + break; + } + } + + if (argArray.length > 0) { + // Spread positional arguments to callback + const result = await callback(...argArray); + // DTO writeback protocol: when a void callback returns undefined, we + // return the original args object so the .NET host can detect property + // mutations made by the callback and apply them back to the original + // C# DTO objects. DTO args are plain JS objects (not Handle wrappers), + // so any property changes the callback made are reflected in args. + // + // Non-void callbacks (result !== undefined) return their actual result. + // The .NET side only activates writeback for void delegates whose + // parameters include [AspireDto] types — all other cases discard the + // returned args object, so the extra wire payload is harmless. + // + // IMPORTANT: callbacks that intentionally return undefined will also + // trigger this path. For non-void delegate types, the C# proxy uses + // a result-unmarshalling path (not writeback), so returning args will + // cause an unmarshal error. Void callbacks should never return a + // meaningful value; non-void callbacks should always return one. + return result !== undefined ? result : args; + } + + // No positional params found — nothing to write back + return await callback(); + } + + // Null/undefined - call with no args + if (args === null || args === undefined) { + return await callback(); + } + + // Primitive value - pass as single arg (shouldn't happen with current protocol) + return await callback(wrapIfHandle(args, client)); + }; + + callbackRegistry.set(callbackId, wrapper); + return callbackId; +} + +/** + * Unregister a callback by its ID. + */ +export function unregisterCallback(callbackId: string): boolean { + return callbackRegistry.delete(callbackId); +} + +/** + * Get the number of registered callbacks. + */ +export function getCallbackCount(): number { + return callbackRegistry.size; +} + +// ============================================================================ +// Cancellation Token Registry +// ============================================================================ + +/** + * Registry for cancellation tokens. + * Maps cancellation IDs to cleanup functions. + */ +const cancellationRegistry = new Map void>(); +let cancellationIdCounter = 0; + +/** + * A reference to the current AspireClient for sending cancel requests. + * Set by AspireClient.connect(). + */ +let currentClient: AspireClient | null = null; + +/** + * Register an AbortSignal for cancellation support. + * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * + * When the AbortSignal is aborted, sends a cancelToken request to the host. + * + * @param signal - The AbortSignal to register (optional) + * @returns The cancellation ID, or undefined if no signal provided + * + * @example + * const controller = new AbortController(); + * const id = registerCancellation(controller.signal); + * // Pass id to capability invocation + * // Later: controller.abort() will cancel the operation + */ +export function registerCancellation(signal?: AbortSignal): string | undefined { + if (!signal) { + return undefined; + } + + // Already aborted? Don't register + if (signal.aborted) { + return undefined; + } + + const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; + + // Set up the abort listener + const onAbort = () => { + // Send cancel request to host + if (currentClient?.connected) { + currentClient.cancelToken(cancellationId).catch(() => { + // Ignore errors - the operation may have already completed + }); + } + // Clean up the listener + cancellationRegistry.delete(cancellationId); + }; + + // Listen for abort + signal.addEventListener('abort', onAbort, { once: true }); + + // Store cleanup function + cancellationRegistry.set(cancellationId, () => { + signal.removeEventListener('abort', onAbort); + }); + + return cancellationId; +} + +/** + * Unregister a cancellation token by its ID. + * Call this when the operation completes to clean up resources. + * + * @param cancellationId - The cancellation ID to unregister + */ +export function unregisterCancellation(cancellationId: string | undefined): void { + if (!cancellationId) { + return; + } + + const cleanup = cancellationRegistry.get(cancellationId); + if (cleanup) { + cleanup(); + cancellationRegistry.delete(cancellationId); + } +} + +// ============================================================================ +// AspireClient (JSON-RPC Connection) +// ============================================================================ + +/** + * Client for connecting to the Aspire AppHost via socket/named pipe. + */ +export class AspireClient { + private connection: rpc.MessageConnection | null = null; + private socket: net.Socket | null = null; + private disconnectCallbacks: (() => void)[] = []; + private _pendingCalls = 0; + + constructor(private socketPath: string) { } + + /** + * Register a callback to be called when the connection is lost + */ + onDisconnect(callback: () => void): void { + this.disconnectCallbacks.push(callback); + } + + private notifyDisconnect(): void { + for (const callback of this.disconnectCallbacks) { + try { + callback(); + } catch { + // Ignore callback errors + } + } + } + + connect(timeoutMs: number = 5000): Promise { + return new Promise((resolve, reject) => { + const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this.socket = net.createConnection(pipePath); + + this.socket.once('error', (error: Error) => { + clearTimeout(timeout); + reject(error); + }); + + this.socket.once('connect', () => { + clearTimeout(timeout); + try { + const reader = new rpc.SocketMessageReader(this.socket!); + const writer = new rpc.SocketMessageWriter(this.socket!); + this.connection = rpc.createMessageConnection(reader, writer); + + this.connection.onClose(() => { + this.connection = null; + this.notifyDisconnect(); + }); + this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); + + // Handle callback invocations from the .NET side + this.connection.onRequest('invokeCallback', async (callbackId: string, args: unknown) => { + const callback = callbackRegistry.get(callbackId); + if (!callback) { + throw new Error(`Callback not found: ${callbackId}`); + } + try { + // The registered wrapper handles arg unpacking and handle wrapping + // Pass this client so handles can be wrapped with typed wrapper classes + return await Promise.resolve(callback(args, this)); + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + throw new Error(`Callback execution failed: ${message}`); + } + }); + + this.connection.listen(); + + // Set the current client for cancellation registry + currentClient = this; + + resolve(); + } catch (e) { + reject(e); + } + }); + + this.socket.on('close', () => { + this.connection?.dispose(); + this.connection = null; + if (currentClient === this) { + currentClient = null; + } + this.notifyDisconnect(); + }); + }); + } + + ping(): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('ping'); + } + + /** + * Cancel a CancellationToken by its ID. + * Called when an AbortSignal is aborted. + * + * @param tokenId - The token ID to cancel + * @returns True if the token was found and cancelled, false otherwise + */ + cancelToken(tokenId: string): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('cancelToken', tokenId); + } + + /** + * Invoke an ATS capability by ID. + * + * Capabilities are operations exposed by [AspireExport] attributes. + * Results are automatically wrapped in Handle objects when applicable. + * + * @param capabilityId - The capability ID (e.g., "Aspire.Hosting/createBuilder") + * @param args - Arguments to pass to the capability + * @returns The capability result, wrapped as Handle if it's a handle type + * @throws CapabilityError if the capability fails + */ + async invokeCapability( + capabilityId: string, + args?: Record + ): Promise { + if (!this.connection) { + throw new Error('Not connected to AppHost'); + } + + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); + } + this._pendingCalls++; + + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + args ?? null + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } + } + + disconnect(): void { + try { this.connection?.dispose(); } finally { this.connection = null; } + try { this.socket?.end(); } finally { this.socket = null; } + } + + get connected(): boolean { + return this.connection !== null && this.socket !== null; + } +} diff --git a/samples/database-containers/ts/package-lock.json b/samples/database-containers/ts/package-lock.json new file mode 100644 index 00000000..c4d3800c --- /dev/null +++ b/samples/database-containers/ts/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "ts", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/samples/database-migrations/ts/.aspire/settings.json b/samples/database-migrations/ts/.aspire/settings.json index a60c25b1..a0a8820b 100644 --- a/samples/database-migrations/ts/.aspire/settings.json +++ b/samples/database-migrations/ts/.aspire/settings.json @@ -1,3 +1,7 @@ { - "appHostPath": "../apphost.ts" + "appHostPath": "../apphost.ts", + "sdkVersion": "13.2.0-preview.1.26159.1", + "packages": { + "Aspire.Hosting.SqlServer": "13.1.2" + } } \ No newline at end of file diff --git a/samples/database-migrations/ts/.modules/.codegen-hash b/samples/database-migrations/ts/.modules/.codegen-hash new file mode 100644 index 00000000..57778ed0 --- /dev/null +++ b/samples/database-migrations/ts/.modules/.codegen-hash @@ -0,0 +1 @@ +23D2045F98131678EA8334C41B1A65173035209D6EC7F218631F84915E06E6EE \ No newline at end of file diff --git a/samples/database-migrations/ts/.modules/aspire.ts b/samples/database-migrations/ts/.modules/aspire.ts new file mode 100644 index 00000000..73dc52d2 --- /dev/null +++ b/samples/database-migrations/ts/.modules/aspire.ts @@ -0,0 +1,13306 @@ +// aspire.ts - Capability-based Aspire SDK +// This SDK uses the ATS (Aspire Type System) capability API. +// Capabilities are endpoints like 'Aspire.Hosting/createBuilder'. +// +// GENERATED CODE - DO NOT EDIT + +import { + AspireClient as AspireClientRpc, + Handle, + MarshalledHandle, + CapabilityError, + registerCallback, + wrapIfHandle, + registerHandleWrapper +} from './transport.js'; + +import { + ResourceBuilderBase, + ReferenceExpression, + refExpr, + AspireDict, + AspireList +} from './base.js'; + +// ============================================================================ +// Handle Type Aliases (Internal - not exported to users) +// ============================================================================ + +/** Handle to CommandLineArgsCallbackContext */ +type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; + +/** Handle to ContainerRegistryResource */ +type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; + +/** Handle to ContainerResource */ +type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource'>; + +/** Handle to CSharpAppResource */ +type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; + +/** Handle to DotnetToolResource */ +type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; + +/** Handle to EndpointReference */ +type EndpointReferenceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference'>; + +/** Handle to EndpointReferenceExpression */ +type EndpointReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression'>; + +/** Handle to EnvironmentCallbackContext */ +type EnvironmentCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext'>; + +/** Handle to ExecutableResource */ +type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource'>; + +/** Handle to ExecuteCommandContext */ +type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; + +/** Handle to IContainerFilesDestinationResource */ +type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; + +/** Handle to IResource */ +type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; + +/** Handle to IResourceWithArgs */ +type IResourceWithArgsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs'>; + +/** Handle to IResourceWithConnectionString */ +type IResourceWithConnectionStringHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString'>; + +/** Handle to IResourceWithEndpoints */ +type IResourceWithEndpointsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints'>; + +/** Handle to IResourceWithEnvironment */ +type IResourceWithEnvironmentHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment'>; + +/** Handle to IResourceWithWaitSupport */ +type IResourceWithWaitSupportHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport'>; + +/** Handle to ParameterResource */ +type ParameterResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource'>; + +/** Handle to ProjectResource */ +type ProjectResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource'>; + +/** Handle to ReferenceExpression */ +type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression'>; + +/** Handle to ReferenceExpressionBuilder */ +type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; + +/** Handle to ResourceLoggerService */ +type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; + +/** Handle to ResourceNotificationService */ +type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; + +/** Handle to ResourceUrlsCallbackContext */ +type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; + +/** Handle to ConnectionStringResource */ +type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; + +/** Handle to DistributedApplication */ +type DistributedApplicationHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplication'>; + +/** Handle to DistributedApplicationExecutionContext */ +type DistributedApplicationExecutionContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext'>; + +/** Handle to DistributedApplicationEventSubscription */ +type DistributedApplicationEventSubscriptionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.DistributedApplicationEventSubscription'>; + +/** Handle to IDistributedApplicationEventing */ +type IDistributedApplicationEventingHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing'>; + +/** Handle to ExternalServiceResource */ +type ExternalServiceResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ExternalServiceResource'>; + +/** Handle to IDistributedApplicationBuilder */ +type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder'>; + +/** Handle to IResourceWithContainerFiles */ +type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; + +/** Handle to IResourceWithServiceDiscovery */ +type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; + +/** Handle to PipelineConfigurationContext */ +type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; + +/** Handle to PipelineStep */ +type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; + +/** Handle to PipelineStepContext */ +type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; + +/** Handle to ProjectResourceOptions */ +type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; + +/** Handle to Dict */ +type DictstringanyHandle = Handle<'Aspire.Hosting/Dict'>; + +/** Handle to List */ +type ListanyHandle = Handle<'Aspire.Hosting/List'>; + +/** Handle to IConfiguration */ +type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; + +/** Handle to IHostEnvironment */ +type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; + +/** Handle to ILogger */ +type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; + +/** Handle to string[] */ +type stringArrayHandle = Handle<'string[]'>; + +/** Handle to IServiceProvider */ +type IServiceProviderHandle = Handle<'System.ComponentModel/System.IServiceProvider'>; + +// ============================================================================ +// Enum Types +// ============================================================================ + +/** Enum type for CertificateTrustScope */ +export enum CertificateTrustScope { + None = "None", + Append = "Append", + Override = "Override", + System = "System", +} + +/** Enum type for ContainerLifetime */ +export enum ContainerLifetime { + Session = "Session", + Persistent = "Persistent", +} + +/** Enum type for DistributedApplicationOperation */ +export enum DistributedApplicationOperation { + Run = "Run", + Publish = "Publish", +} + +/** Enum type for EndpointProperty */ +export enum EndpointProperty { + Url = "Url", + Host = "Host", + IPV4Host = "IPV4Host", + Port = "Port", + Scheme = "Scheme", + TargetPort = "TargetPort", + HostAndPort = "HostAndPort", +} + +/** Enum type for IconVariant */ +export enum IconVariant { + Regular = "Regular", + Filled = "Filled", +} + +/** Enum type for ImagePullPolicy */ +export enum ImagePullPolicy { + Default = "Default", + Always = "Always", + Missing = "Missing", + Never = "Never", +} + +/** Enum type for OtlpProtocol */ +export enum OtlpProtocol { + Grpc = "Grpc", + HttpProtobuf = "HttpProtobuf", + HttpJson = "HttpJson", +} + +/** Enum type for ProbeType */ +export enum ProbeType { + Startup = "Startup", + Readiness = "Readiness", + Liveness = "Liveness", +} + +/** Enum type for ProtocolType */ +export enum ProtocolType { + IP = "IP", + IPv6HopByHopOptions = "IPv6HopByHopOptions", + Unspecified = "Unspecified", + Icmp = "Icmp", + Igmp = "Igmp", + Ggp = "Ggp", + IPv4 = "IPv4", + Tcp = "Tcp", + Pup = "Pup", + Udp = "Udp", + Idp = "Idp", + IPv6 = "IPv6", + IPv6RoutingHeader = "IPv6RoutingHeader", + IPv6FragmentHeader = "IPv6FragmentHeader", + IPSecEncapsulatingSecurityPayload = "IPSecEncapsulatingSecurityPayload", + IPSecAuthenticationHeader = "IPSecAuthenticationHeader", + IcmpV6 = "IcmpV6", + IPv6NoNextHeader = "IPv6NoNextHeader", + IPv6DestinationOptions = "IPv6DestinationOptions", + ND = "ND", + Raw = "Raw", + Ipx = "Ipx", + Spx = "Spx", + SpxII = "SpxII", + Unknown = "Unknown", +} + +/** Enum type for UrlDisplayLocation */ +export enum UrlDisplayLocation { + SummaryAndDetails = "SummaryAndDetails", + DetailsOnly = "DetailsOnly", +} + +/** Enum type for WaitBehavior */ +export enum WaitBehavior { + WaitOnResourceUnavailable = "WaitOnResourceUnavailable", + StopOnResourceUnavailable = "StopOnResourceUnavailable", +} + +// ============================================================================ +// DTO Interfaces +// ============================================================================ + +/** DTO interface for CommandOptions */ +export interface CommandOptions { + description?: string; + parameter?: any; + confirmationMessage?: string; + iconName?: string; + iconVariant?: IconVariant; + isHighlighted?: boolean; + updateState?: any; +} + +/** DTO interface for CreateBuilderOptions */ +export interface CreateBuilderOptions { + args?: string[]; + projectDirectory?: string; + appHostFilePath?: string; + containerRegistryOverride?: string; + disableDashboard?: boolean; + dashboardApplicationName?: string; + allowUnsecuredTransport?: boolean; + enableResourceLogging?: boolean; +} + +/** DTO interface for ExecuteCommandResult */ +export interface ExecuteCommandResult { + success?: boolean; + canceled?: boolean; + errorMessage?: string; +} + +/** DTO interface for ResourceEventDto */ +export interface ResourceEventDto { + resourceName?: string; + resourceId?: string; + state?: string; + stateStyle?: string; + healthStatus?: string; + exitCode?: number; +} + +/** DTO interface for ResourceUrlAnnotation */ +export interface ResourceUrlAnnotation { + url?: string; + displayText?: string; + endpoint?: EndpointReferenceHandle; + displayLocation?: UrlDisplayLocation; +} + +// ============================================================================ +// Options Interfaces +// ============================================================================ + +export interface AddConnectionStringOptions { + environmentVariableName?: string; +} + +export interface AddContainerRegistryOptions { + repository?: ParameterResource; +} + +export interface AddDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface AddParameterFromConfigurationOptions { + secret?: boolean; +} + +export interface AddParameterOptions { + secret?: boolean; +} + +export interface AppendFormattedOptions { + format?: string; +} + +export interface AppendValueProviderOptions { + format?: string; +} + +export interface GetValueAsyncOptions { + cancellationToken?: AbortSignal; +} + +export interface RunOptions { + cancellationToken?: AbortSignal; +} + +export interface WaitForCompletionOptions { + exitCode?: number; +} + +export interface WithBindMountOptions { + isReadOnly?: boolean; +} + +export interface WithCommandOptions { + commandOptions?: CommandOptions; +} + +export interface WithDescriptionOptions { + enableMarkdown?: boolean; +} + +export interface WithDockerfileBaseImageOptions { + buildImage?: string; + runtimeImage?: string; +} + +export interface WithDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface WithEndpointOptions { + port?: number; + targetPort?: number; + scheme?: string; + name?: string; + env?: string; + isProxied?: boolean; + isExternal?: boolean; + protocol?: ProtocolType; +} + +export interface WithExternalServiceHttpHealthCheckOptions { + path?: string; + statusCode?: number; +} + +export interface WithHttpEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithHttpHealthCheckOptions { + path?: string; + statusCode?: number; + endpointName?: string; +} + +export interface WithHttpProbeOptions { + path?: string; + initialDelaySeconds?: number; + periodSeconds?: number; + timeoutSeconds?: number; + failureThreshold?: number; + successThreshold?: number; + endpointName?: string; +} + +export interface WithHttpsDeveloperCertificateOptions { + password?: ParameterResource; +} + +export interface WithHttpsEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithIconNameOptions { + iconVariant?: IconVariant; +} + +export interface WithImageOptions { + tag?: string; +} + +export interface WithMcpServerOptions { + path?: string; + endpointName?: string; +} + +export interface WithPipelineStepFactoryOptions { + dependsOn?: string[]; + requiredBy?: string[]; + tags?: string[]; + description?: string; +} + +export interface WithReferenceOptions { + connectionName?: string; + optional?: boolean; +} + +export interface WithRequiredCommandOptions { + helpLink?: string; +} + +export interface WithUrlExpressionOptions { + displayText?: string; +} + +export interface WithUrlOptions { + displayText?: string; +} + +export interface WithVolumeOptions { + name?: string; + isReadOnly?: boolean; +} + +// ============================================================================ +// CommandLineArgsCallbackContext +// ============================================================================ + +/** + * Type class for CommandLineArgsCallbackContext. + */ +export class CommandLineArgsCallbackContext { + constructor(private _handle: CommandLineArgsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Args property */ + private _args?: AspireList; + get args(): AspireList { + if (!this._args) { + this._args = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args', + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args' + ); + } + return this._args; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplication +// ============================================================================ + +/** + * Type class for DistributedApplication. + */ +export class DistributedApplication { + constructor(private _handle: DistributedApplicationHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Runs the distributed application */ + /** @internal */ + async _runInternal(cancellationToken?: AbortSignal): Promise { + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + await this._client.invokeCapability( + 'Aspire.Hosting/run', + rpcArgs + ); + return this; + } + + run(options?: RunOptions): DistributedApplicationPromise { + const cancellationToken = options?.cancellationToken; + return new DistributedApplicationPromise(this._runInternal(cancellationToken)); + } + +} + +/** + * Thenable wrapper for DistributedApplication that enables fluent chaining. + */ +export class DistributedApplicationPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplication) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Runs the distributed application */ + run(options?: RunOptions): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.run(options))); + } + +} + +// ============================================================================ +// DistributedApplicationExecutionContext +// ============================================================================ + +/** + * Type class for DistributedApplicationExecutionContext. + */ +export class DistributedApplicationExecutionContext { + constructor(private _handle: DistributedApplicationExecutionContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PublisherName property */ + publisherName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.publisherName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.setPublisherName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Operation property */ + operation = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.operation', + { context: this._handle } + ); + }, + }; + + /** Gets the IsPublishMode property */ + isPublishMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isPublishMode', + { context: this._handle } + ); + }, + }; + + /** Gets the IsRunMode property */ + isRunMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isRunMode', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EndpointReference +// ============================================================================ + +/** + * Type class for EndpointReference. + */ +export class EndpointReference { + constructor(private _handle: EndpointReferenceHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EndpointName property */ + endpointName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.endpointName', + { context: this._handle } + ); + }, + }; + + /** Gets the ErrorMessage property */ + errorMessage = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.errorMessage', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.setErrorMessage', + { context: this._handle, value } + ); + } + }; + + /** Gets the IsAllocated property */ + isAllocated = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isAllocated', + { context: this._handle } + ); + }, + }; + + /** Gets the Exists property */ + exists = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.exists', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttp property */ + isHttp = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttp', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttps property */ + isHttps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttps', + { context: this._handle } + ); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.port', + { context: this._handle } + ); + }, + }; + + /** Gets the TargetPort property */ + targetPort = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.targetPort', + { context: this._handle } + ); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.host', + { context: this._handle } + ); + }, + }; + + /** Gets the Scheme property */ + scheme = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.scheme', + { context: this._handle } + ); + }, + }; + + /** Gets the Url property */ + url = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.url', + { context: this._handle } + ); + }, + }; + + /** Gets the URL of the endpoint asynchronously */ + async getValueAsync(options?: GetValueAsyncOptions): Promise { + const cancellationToken = options?.cancellationToken; + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValueAsync', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for EndpointReference that enables fluent chaining. + */ +export class EndpointReferencePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: EndpointReference) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets the URL of the endpoint asynchronously */ + getValueAsync(options?: GetValueAsyncOptions): Promise { + return this._promise.then(obj => obj.getValueAsync(options)); + } + +} + +// ============================================================================ +// EndpointReferenceExpression +// ============================================================================ + +/** + * Type class for EndpointReferenceExpression. + */ +export class EndpointReferenceExpression { + constructor(private _handle: EndpointReferenceExpressionHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Endpoint property */ + endpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.endpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Property property */ + property = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.property', + { context: this._handle } + ); + }, + }; + + /** Gets the ValueExpression property */ + valueExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.valueExpression', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EnvironmentCallbackContext +// ============================================================================ + +/** + * Type class for EnvironmentCallbackContext. + */ +export class EnvironmentCallbackContext { + constructor(private _handle: EnvironmentCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EnvironmentVariables property */ + private _environmentVariables?: AspireDict; + get environmentVariables(): AspireDict { + if (!this._environmentVariables) { + this._environmentVariables = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables', + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables' + ); + } + return this._environmentVariables; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ExecuteCommandContext +// ============================================================================ + +/** + * Type class for ExecuteCommandContext. + */ +export class ExecuteCommandContext { + constructor(private _handle: ExecuteCommandContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ResourceName property */ + resourceName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.resourceName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setResourceName', + { context: this._handle, value } + ); + } + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', + { context: this._handle } + ); + }, + set: async (value: AbortSignal): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + { context: this._handle } + ); + }, + set: async (value: PipelineStep[]): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', + { context: this._handle, value } + ); + } + }; + + /** Gets pipeline steps with the specified tag */ + async getStepsByTag(tag: string): Promise { + const rpcArgs: Record = { context: this._handle, tag }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/getStepsByTag', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for PipelineConfigurationContext that enables fluent chaining. + */ +export class PipelineConfigurationContextPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineConfigurationContext) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets pipeline steps with the specified tag */ + getStepsByTag(tag: string): Promise { + return this._promise.then(obj => obj.getStepsByTag(tag)); + } + +} + +// ============================================================================ +// PipelineStep +// ============================================================================ + +/** + * Type class for PipelineStep. + */ +export class PipelineStep { + constructor(private _handle: PipelineStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.name', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Description property */ + description = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.description', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setDescription', + { context: this._handle, value } + ); + } + }; + + /** Gets the DependsOnSteps property */ + private _dependsOnSteps?: AspireList; + get dependsOnSteps(): AspireList { + if (!this._dependsOnSteps) { + this._dependsOnSteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps', + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps' + ); + } + return this._dependsOnSteps; + } + + /** Gets the RequiredBySteps property */ + private _requiredBySteps?: AspireList; + get requiredBySteps(): AspireList { + if (!this._requiredBySteps) { + this._requiredBySteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps', + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps' + ); + } + return this._requiredBySteps; + } + + /** Gets the Tags property */ + private _tags?: AspireList; + get tags(): AspireList { + if (!this._tags) { + this._tags = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.tags', + 'Aspire.Hosting.Pipelines/PipelineStep.tags' + ); + } + return this._tags; + } + + /** Adds a dependency on another step by name */ + /** @internal */ + async _dependsOnInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/dependsOn', + rpcArgs + ); + return this; + } + + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._dependsOnInternal(stepName)); + } + + /** Specifies that another step requires this step by name */ + /** @internal */ + async _requiredByInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/requiredBy', + rpcArgs + ); + return this; + } + + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._requiredByInternal(stepName)); + } + +} + +/** + * Thenable wrapper for PipelineStep that enables fluent chaining. + */ +export class PipelineStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineStep) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a dependency on another step by name */ + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.dependsOn(stepName))); + } + + /** Specifies that another step requires this step by name */ + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.requiredBy(stepName))); + } + +} + +// ============================================================================ +// PipelineStepContext +// ============================================================================ + +/** + * Type class for PipelineStepContext. + */ +export class PipelineStepContext { + constructor(private _handle: PipelineStepContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// ProjectResourceOptions +// ============================================================================ + +/** + * Type class for ProjectResourceOptions. + */ +export class ProjectResourceOptions { + constructor(private _handle: ProjectResourceOptionsHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the LaunchProfileName property */ + launchProfileName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.launchProfileName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setLaunchProfileName', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeLaunchProfile property */ + excludeLaunchProfile = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeLaunchProfile', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeLaunchProfile', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeKestrelEndpoints property */ + excludeKestrelEndpoints = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeKestrelEndpoints', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeKestrelEndpoints', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// ReferenceExpressionBuilder +// ============================================================================ + +/** + * Type class for ReferenceExpressionBuilder. + */ +export class ReferenceExpressionBuilder { + constructor(private _handle: ReferenceExpressionBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the IsEmpty property */ + isEmpty = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ReferenceExpressionBuilder.isEmpty', + { context: this._handle } + ); + }, + }; + + /** Appends a literal string to the reference expression */ + /** @internal */ + async _appendLiteralInternal(value: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendLiteral', + rpcArgs + ); + return this; + } + + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._appendLiteralInternal(value)); + } + + /** Appends a formatted string value to the reference expression */ + /** @internal */ + async _appendFormattedInternal(value: string, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendFormatted', + rpcArgs + ); + return this; + } + + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendFormattedInternal(value, format)); + } + + /** Appends a value provider to the reference expression */ + /** @internal */ + async _appendValueProviderInternal(valueProvider: any, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, valueProvider }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendValueProvider', + rpcArgs + ); + return this; + } + + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendValueProviderInternal(valueProvider, format)); + } + + /** Builds the reference expression */ + async build(): Promise { + const rpcArgs: Record = { context: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/build', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ReferenceExpressionBuilder that enables fluent chaining. + */ +export class ReferenceExpressionBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReferenceExpressionBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Appends a literal string to the reference expression */ + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendLiteral(value))); + } + + /** Appends a formatted string value to the reference expression */ + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendFormatted(value, options))); + } + + /** Appends a value provider to the reference expression */ + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendValueProvider(valueProvider, options))); + } + + /** Builds the reference expression */ + build(): Promise { + return this._promise.then(obj => obj.build()); + } + +} + +// ============================================================================ +// ResourceUrlsCallbackContext +// ============================================================================ + +/** + * Type class for ResourceUrlsCallbackContext. + */ +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Builds the distributed application */ + /** @internal */ + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', + rpcArgs + ); + return new DistributedApplication(result, this._client); + } + + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); + } + + /** Adds a connection string with a builder callback */ + /** @internal */ + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionStringBuilder', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + } + + /** Adds a container registry resource */ + /** @internal */ + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + } + + /** Adds a container resource */ + /** @internal */ + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); + } + + /** Adds a container resource built from a Dockerfile */ + /** @internal */ + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); + } + + /** Adds a .NET tool resource */ + /** @internal */ + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + } + + /** Adds an executable resource */ + /** @internal */ + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + } + + /** Adds an external service resource */ + /** @internal */ + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); + } + + /** Adds a parameter resource */ + /** @internal */ + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); + } + + /** Adds a parameter sourced from configuration */ + /** @internal */ + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + } + + /** Adds a connection string resource */ + /** @internal */ + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + } + + /** Adds a .NET project resource */ + /** @internal */ + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + } + + /** Adds a project resource with configuration options */ + /** @internal */ + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + } + + /** Adds a C# application resource */ + /** @internal */ + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + } + + /** Adds a C# application resource with configuration options */ + /** @internal */ + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + */ +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); + } + + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + } + + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + } + + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + } + + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + } + + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + } + + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); + } + + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + } + + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); + } + + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + } + + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); + } + + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); + } + + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); + } + + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); + } + + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); + } + +} + +// ============================================================================ +// DistributedApplicationEventing +// ============================================================================ + +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Unsubscribe method */ + /** @internal */ + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + rpcArgs + ); + return this; + } + + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ + +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerResource +// ============================================================================ + +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + const exitCode = options?.exitCode; + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + const password = options?.password; + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// CSharpAppResource +// ============================================================================ + +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + const exitCode = options?.exitCode; + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + const commandOptions = options?.commandOptions; + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + const password = options?.password; + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + const iconVariant = options?.iconVariant; + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// DotnetToolResource +// ============================================================================ + +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + } + + /** @internal */ + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + } + + /** @internal */ + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + } + + /** @internal */ + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + } + + /** @internal */ + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + } + + /** @internal */ + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + const exitCode = options?.exitCode; + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + const commandOptions = options?.commandOptions; + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + const password = options?.password; + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + const iconVariant = options?.iconVariant; + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for DotnetToolResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExecutableResource +// ============================================================================ + +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerFilesDestinationResource +// ============================================================================ + +export class ContainerFilesDestinationResource extends ResourceBuilderBase { + constructor(handle: IContainerFilesDestinationResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ContainerFilesDestinationResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + +} + +/** + * Thenable wrapper for ContainerFilesDestinationResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerFilesDestinationResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerFilesDestinationResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + +} + +// ============================================================================ +// Resource +// ============================================================================ + +export class Resource extends ResourceBuilderBase { + constructor(handle: IResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + const helpLink = options?.helpLink; + return new ResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + const commandOptions = options?.commandOptions; + return new ResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + const iconVariant = options?.iconVariant; + return new ResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for Resource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Resource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ResourceWithArgs +// ============================================================================ + +export class ResourceWithArgs extends ResourceBuilderBase { + constructor(handle: IResourceWithArgsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackAsyncInternal(callback)); + } + +} + +/** + * Thenable wrapper for ResourceWithArgs that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithArgsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithArgs) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + +} + +// ============================================================================ +// ResourceWithConnectionString +// ============================================================================ + +export class ResourceWithConnectionString extends ResourceBuilderBase { + constructor(handle: IResourceWithConnectionStringHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyValueInternal(name, value)); + } + +} + +/** + * Thenable wrapper for ResourceWithConnectionString that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithConnectionStringPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithConnectionString) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + +} + +// ============================================================================ +// ResourceWithContainerFiles +// ============================================================================ + +export class ResourceWithContainerFiles extends ResourceBuilderBase { + constructor(handle: IResourceWithContainerFilesHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._clearContainerFilesSourcesInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithContainerFiles that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithContainerFilesPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithContainerFiles) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + +} + +// ============================================================================ +// ResourceWithEndpoints +// ============================================================================ + +export class ResourceWithEndpoints extends ResourceBuilderBase { + constructor(handle: IResourceWithEndpointsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ResourceWithEndpointsPromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + +} + +/** + * Thenable wrapper for ResourceWithEndpoints that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEndpointsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEndpoints) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + +} + +// ============================================================================ +// ResourceWithEnvironment +// ============================================================================ + +export class ResourceWithEnvironment extends ResourceBuilderBase { + constructor(handle: IResourceWithEnvironmentHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + const password = options?.password; + return new ResourceWithEnvironmentPromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withoutHttpsCertificateInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithEnvironment that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + +} + +// ============================================================================ +// ResourceWithServiceDiscovery +// ============================================================================ + +export class ResourceWithServiceDiscovery extends ResourceBuilderBase { + constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { + super(handle, client); + } + +} + +/** + * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithServiceDiscoveryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + +} + +// ============================================================================ +// ResourceWithWaitSupport +// ============================================================================ + +export class ResourceWithWaitSupport extends ResourceBuilderBase { + constructor(handle: IResourceWithWaitSupportHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + const exitCode = options?.exitCode; + return new ResourceWithWaitSupportPromise(this._waitForCompletionInternal(dependency, exitCode)); + } + +} + +/** + * Thenable wrapper for ResourceWithWaitSupport that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithWaitSupportPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithWaitSupport) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + +} + +// ============================================================================ +// Connection Helper +// ============================================================================ + +/** + * Creates and connects to the Aspire AppHost. + * Reads connection info from environment variables set by `aspire run`. + */ +export async function connect(): Promise { + const socketPath = process.env.REMOTE_APP_HOST_SOCKET_PATH; + if (!socketPath) { + throw new Error( + 'REMOTE_APP_HOST_SOCKET_PATH environment variable not set. ' + + 'Run this application using `aspire run`.' + ); + } + + const client = new AspireClientRpc(socketPath); + await client.connect(); + + // Exit the process if the server connection is lost + client.onDisconnect(() => { + console.error('Connection to AppHost lost. Exiting...'); + process.exit(1); + }); + + return client; +} + +/** + * Creates a new distributed application builder. + * This is the entry point for building Aspire applications. + * + * @param options - Optional configuration options for the builder + * @returns A DistributedApplicationBuilder instance + * + * @example + * const builder = await createBuilder(); + * builder.addRedis("cache"); + * builder.addContainer("api", "mcr.microsoft.com/dotnet/samples:aspnetapp"); + * const app = await builder.build(); + * await app.run(); + */ +export async function createBuilder(options?: CreateBuilderOptions): Promise { + const client = await connect(); + + // Default args, projectDirectory, and appHostFilePath if not provided + // ASPIRE_APPHOST_FILEPATH is set by the CLI for consistent socket hash computation + const effectiveOptions: CreateBuilderOptions = { + ...options, + args: options?.args ?? process.argv.slice(2), + projectDirectory: options?.projectDirectory ?? process.env.ASPIRE_PROJECT_DIRECTORY ?? process.cwd(), + appHostFilePath: options?.appHostFilePath ?? process.env.ASPIRE_APPHOST_FILEPATH + }; + + const handle = await client.invokeCapability( + 'Aspire.Hosting/createBuilderWithOptions', + { options: effectiveOptions } + ); + return new DistributedApplicationBuilder(handle, client); +} + +// Re-export commonly used types +export { Handle, CapabilityError, registerCallback } from './transport.js'; +export { refExpr, ReferenceExpression } from './base.js'; + +// ============================================================================ +// Global Error Handling +// ============================================================================ + +/** + * Set up global error handlers to ensure the process exits properly on errors. + * Node.js doesn't exit on unhandled rejections by default, so we need to handle them. + */ +process.on('unhandledRejection', (reason: unknown) => { + const error = reason instanceof Error ? reason : new Error(String(reason)); + + if (reason instanceof CapabilityError) { + console.error(`\n❌ Capability Error: ${error.message}`); + console.error(` Code: ${(reason as CapabilityError).code}`); + if ((reason as CapabilityError).capability) { + console.error(` Capability: ${(reason as CapabilityError).capability}`); + } + } else { + console.error(`\n❌ Unhandled Error: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + } + + process.exit(1); +}); + +process.on('uncaughtException', (error: Error) => { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + process.exit(1); +}); + +// ============================================================================ +// Handle Wrapper Registrations +// ============================================================================ + +// Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource', (handle, client) => new CSharpAppResource(handle as CSharpAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString', (handle, client) => new ResourceWithConnectionString(handle as IResourceWithConnectionStringHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); + diff --git a/samples/database-migrations/ts/.modules/base.ts b/samples/database-migrations/ts/.modules/base.ts new file mode 100644 index 00000000..7778b0f1 --- /dev/null +++ b/samples/database-migrations/ts/.modules/base.ts @@ -0,0 +1,473 @@ +// aspire.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle } from './transport.js'; + +// Re-export transport types for convenience +export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; +export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; + +// ============================================================================ +// Reference Expression +// ============================================================================ + +/** + * Represents a reference expression that can be passed to capabilities. + * + * Reference expressions are serialized in the protocol as: + * ```json + * { + * "$expr": { + * "format": "redis://{0}:{1}", + * "valueProviders": [ + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:1" }, + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:2" } + * ] + * } + * } + * ``` + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export class ReferenceExpression { + // Expression mode fields + private readonly _format?: string; + private readonly _valueProviders?: unknown[]; + + // Handle mode fields (when wrapping a server-returned handle) + private readonly _handle?: Handle; + private readonly _client?: AspireClient; + + constructor(format: string, valueProviders: unknown[]); + constructor(handle: Handle, client: AspireClient); + constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { + if (typeof handleOrFormat === 'string') { + this._format = handleOrFormat; + this._valueProviders = clientOrValueProviders as unknown[]; + } else { + this._handle = handleOrFormat; + this._client = clientOrValueProviders as AspireClient; + } + } + + /** + * Creates a reference expression from a tagged template literal. + * + * @param strings - The template literal string parts + * @param values - The interpolated values (handles to value providers) + * @returns A ReferenceExpression instance + */ + static create(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + // Build the format string with {0}, {1}, etc. placeholders + let format = ''; + for (let i = 0; i < strings.length; i++) { + format += strings[i]; + if (i < values.length) { + format += `{${i}}`; + } + } + + // Extract handles from values + const valueProviders = values.map(extractHandleForExpr); + + return new ReferenceExpression(format, valueProviders); + } + + /** + * Serializes the reference expression for JSON-RPC transport. + * In template-literal mode, uses the $expr format. + * In handle mode, delegates to the handle's serialization. + */ + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + if (this._handle) { + return this._handle.toJSON(); + } + + return { + $expr: { + format: this._format!, + valueProviders: this._valueProviders && this._valueProviders.length > 0 ? this._valueProviders : undefined + } + }; + } + + /** + * String representation for debugging. + */ + toString(): string { + if (this._handle) { + return `ReferenceExpression(handle)`; + } + return `ReferenceExpression(${this._format})`; + } +} + +/** + * Extracts a value for use in reference expressions. + * Supports handles (objects) and string literals. + * @internal + */ +function extractHandleForExpr(value: unknown): unknown { + if (value === null || value === undefined) { + throw new Error('Cannot use null or undefined in reference expression'); + } + + // String literals - include directly in the expression + if (typeof value === 'string') { + return value; + } + + // Number literals - convert to string + if (typeof value === 'number') { + return String(value); + } + + // Handle objects - get their JSON representation + if (value instanceof Handle) { + return value.toJSON(); + } + + // Objects with $handle property (already in handle format) + if (typeof value === 'object' && value !== null && '$handle' in value) { + return value; + } + + // Objects with toJSON that returns a handle + if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { + const json = value.toJSON(); + if (json && typeof json === 'object' && '$handle' in json) { + return json; + } + } + + throw new Error( + `Cannot use value of type ${typeof value} in reference expression. ` + + `Expected a Handle, string, or number.` + ); +} + +/** + * Tagged template function for creating reference expressions. + * + * Use this to create dynamic expressions that reference endpoints, parameters, and other + * value providers. The expression is evaluated at runtime by Aspire. + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression using the tagged template + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export function refExpr(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + return ReferenceExpression.create(strings, ...values); +} + +// ============================================================================ +// ResourceBuilderBase +// ============================================================================ + +/** + * Base class for resource builders (e.g., RedisBuilder, ContainerBuilder). + * Provides handle management and JSON serialization. + */ +export class ResourceBuilderBase { + constructor(protected _handle: THandle, protected _client: AspireClient) {} + + toJSON(): MarshalledHandle { return this._handle.toJSON(); } +} + +// ============================================================================ +// AspireList - Mutable List Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET List. + * Provides array-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const items = await resource.getItems(); // Returns AspireList + * const count = await items.count(); + * const first = await items.get(0); + * await items.add(newItem); + * ``` + */ +export class AspireList { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the list handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual list handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual list handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of elements in the list. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.length', { + list: handle + }) as number; + } + + /** + * Gets the element at the specified index. + */ + async get(index: number): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.get', { + list: handle, + index + }) as T; + } + + /** + * Adds an element to the end of the list. + */ + async add(item: T): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.add', { + list: handle, + item + }); + } + + /** + * Removes the element at the specified index. + */ + async removeAt(index: number): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.removeAt', { + list: handle, + index + }); + } + + /** + * Clears all elements from the list. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.clear', { + list: handle + }); + } + + /** + * Converts the list to an array (creates a copy). + */ + async toArray(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.toArray', { + list: handle + }) as T[]; + } + + toJSON(): MarshalledHandle { + if (this._resolvedHandle) { + return this._resolvedHandle.toJSON(); + } + return this._handleOrContext.toJSON(); + } +} + +// ============================================================================ +// AspireDict - Mutable Dictionary Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET Dictionary. + * Provides object-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const config = await resource.getConfig(); // Returns AspireDict + * const value = await config.get("key"); + * await config.set("key", "value"); + * const hasKey = await config.containsKey("key"); + * ``` + */ +export class AspireDict { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the dictionary handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual dictionary handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual dictionary handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of key-value pairs in the dictionary. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.count', { + dict: handle + }) as number; + } + + /** + * Gets the value associated with the specified key. + * @throws If the key is not found. + */ + async get(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.get', { + dict: handle, + key + }) as V; + } + + /** + * Sets the value for the specified key. + */ + async set(key: K, value: V): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.set', { + dict: handle, + key, + value + }); + } + + /** + * Determines whether the dictionary contains the specified key. + */ + async containsKey(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.has', { + dict: handle, + key + }) as boolean; + } + + /** + * Removes the value with the specified key. + * @returns True if the element was removed; false if the key was not found. + */ + async remove(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.remove', { + dict: handle, + key + }) as boolean; + } + + /** + * Clears all key-value pairs from the dictionary. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.clear', { + dict: handle + }); + } + + /** + * Gets all keys in the dictionary. + */ + async keys(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.keys', { + dict: handle + }) as K[]; + } + + /** + * Gets all values in the dictionary. + */ + async values(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.values', { + dict: handle + }) as V[]; + } + + /** + * Converts the dictionary to a plain object (creates a copy). + * Only works when K is string. + */ + async toObject(): Promise> { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.toObject', { + dict: handle + }) as Record; + } + + async toJSON(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } +} diff --git a/samples/database-migrations/ts/.modules/transport.ts b/samples/database-migrations/ts/.modules/transport.ts new file mode 100644 index 00000000..7bddd74b --- /dev/null +++ b/samples/database-migrations/ts/.modules/transport.ts @@ -0,0 +1,574 @@ +// transport.ts - ATS transport layer: RPC, Handle, errors, callbacks +import * as net from 'net'; +import * as rpc from 'vscode-jsonrpc/node.js'; + +// ============================================================================ +// Base Types +// ============================================================================ + +/** + * Type for callback functions that can be registered and invoked from .NET. + * Internal: receives args and client for handle wrapping. + */ +export type CallbackFunction = (args: unknown, client: AspireClient) => unknown | Promise; + +/** + * Represents a handle to a .NET object in the ATS system. + * Handles are typed references that can be passed between capabilities. + */ +export interface MarshalledHandle { + /** The handle ID (instance number) */ + $handle: string; + /** The ATS type ID */ + $type: string; +} + +/** + * Error details for ATS errors. + */ +export interface AtsErrorDetails { + /** The parameter that caused the error */ + parameter?: string; + /** The expected type or value */ + expected?: string; + /** The actual type or value */ + actual?: string; +} + +/** + * Structured error from ATS capability invocation. + */ +export interface AtsError { + /** Machine-readable error code */ + code: string; + /** Human-readable error message */ + message: string; + /** The capability that failed (if applicable) */ + capability?: string; + /** Additional error details */ + details?: AtsErrorDetails; +} + +/** + * ATS error codes returned by the server. + */ +export const AtsErrorCodes = { + /** Unknown capability ID */ + CapabilityNotFound: 'CAPABILITY_NOT_FOUND', + /** Handle ID doesn't exist or was disposed */ + HandleNotFound: 'HANDLE_NOT_FOUND', + /** Handle type doesn't satisfy capability's type constraint */ + TypeMismatch: 'TYPE_MISMATCH', + /** Missing required argument or wrong type */ + InvalidArgument: 'INVALID_ARGUMENT', + /** Argument value outside valid range */ + ArgumentOutOfRange: 'ARGUMENT_OUT_OF_RANGE', + /** Error occurred during callback invocation */ + CallbackError: 'CALLBACK_ERROR', + /** Unexpected error in capability execution */ + InternalError: 'INTERNAL_ERROR', +} as const; + +/** + * Type guard to check if a value is an ATS error response. + */ +export function isAtsError(value: unknown): value is { $error: AtsError } { + return ( + value !== null && + typeof value === 'object' && + '$error' in value && + typeof (value as { $error: unknown }).$error === 'object' + ); +} + +/** + * Type guard to check if a value is a marshalled handle. + */ +export function isMarshalledHandle(value: unknown): value is MarshalledHandle { + return ( + value !== null && + typeof value === 'object' && + '$handle' in value && + '$type' in value + ); +} + +// ============================================================================ +// Handle +// ============================================================================ + +/** + * A typed handle to a .NET object in the ATS system. + * Handles are opaque references that can be passed to capabilities. + * + * @typeParam T - The ATS type ID (e.g., "Aspire.Hosting/IDistributedApplicationBuilder") + */ +export class Handle { + private readonly _handleId: string; + private readonly _typeId: T; + + constructor(marshalled: MarshalledHandle) { + this._handleId = marshalled.$handle; + this._typeId = marshalled.$type as T; + } + + /** The handle ID (instance number) */ + get $handle(): string { + return this._handleId; + } + + /** The ATS type ID */ + get $type(): T { + return this._typeId; + } + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { + return { + $handle: this._handleId, + $type: this._typeId + }; + } + + /** String representation for debugging */ + toString(): string { + return `Handle<${this._typeId}>(${this._handleId})`; + } +} + +// ============================================================================ +// Handle Wrapper Registry +// ============================================================================ + +/** + * Factory function for creating typed wrapper instances from handles. + */ +export type HandleWrapperFactory = (handle: Handle, client: AspireClient) => unknown; + +/** + * Registry of handle wrapper factories by type ID. + * Generated code registers wrapper classes here so callback handles can be properly typed. + */ +const handleWrapperRegistry = new Map(); + +/** + * Register a wrapper factory for a type ID. + * Called by generated code to register wrapper classes. + */ +export function registerHandleWrapper(typeId: string, factory: HandleWrapperFactory): void { + handleWrapperRegistry.set(typeId, factory); +} + +/** + * Checks if a value is a marshalled handle and wraps it appropriately. + * Uses the wrapper registry to create typed wrapper instances when available. + * + * @param value - The value to potentially wrap + * @param client - Optional client for creating typed wrapper instances + */ +export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { + if (value && typeof value === 'object') { + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); + } + } + + return handle; + } + } + return value; +} + +// ============================================================================ +// Capability Error +// ============================================================================ + +/** + * Error thrown when an ATS capability invocation fails. + */ +export class CapabilityError extends Error { + constructor( + /** The structured error from the server */ + public readonly error: AtsError + ) { + super(error.message); + this.name = 'CapabilityError'; + } + + /** Machine-readable error code */ + get code(): string { + return this.error.code; + } + + /** The capability that failed (if applicable) */ + get capability(): string | undefined { + return this.error.capability; + } +} + +// ============================================================================ +// Callback Registry +// ============================================================================ + +const callbackRegistry = new Map(); +let callbackIdCounter = 0; + +/** + * Register a callback function that can be invoked from the .NET side. + * Returns a callback ID that should be passed to methods accepting callbacks. + * + * .NET passes arguments as an object with positional keys: `{ p0: value0, p1: value1, ... }` + * This function automatically extracts positional parameters and wraps handles. + * + * @example + * // Single parameter callback + * const id = registerCallback((ctx) => console.log(ctx)); + * // .NET sends: { p0: { $handle: "...", $type: "..." } } + * // Callback receives: Handle instance + * + * @example + * // Multi-parameter callback + * const id = registerCallback((a, b) => console.log(a, b)); + * // .NET sends: { p0: "hello", p1: 42 } + * // Callback receives: "hello", 42 + */ +export function registerCallback( + callback: (...args: any[]) => TResult | Promise +): string { + const callbackId = `callback_${++callbackIdCounter}_${Date.now()}`; + + // Wrap the callback to handle .NET's positional argument format + const wrapper: CallbackFunction = async (args: unknown, client: AspireClient) => { + // .NET sends args as object { p0: value0, p1: value1, ... } + if (args && typeof args === 'object' && !Array.isArray(args)) { + const argObj = args as Record; + const argArray: unknown[] = []; + + // Extract positional parameters (p0, p1, p2, ...) + for (let i = 0; ; i++) { + const key = `p${i}`; + if (key in argObj) { + argArray.push(wrapIfHandle(argObj[key], client)); + } else { + break; + } + } + + if (argArray.length > 0) { + // Spread positional arguments to callback + const result = await callback(...argArray); + // DTO writeback protocol: when a void callback returns undefined, we + // return the original args object so the .NET host can detect property + // mutations made by the callback and apply them back to the original + // C# DTO objects. DTO args are plain JS objects (not Handle wrappers), + // so any property changes the callback made are reflected in args. + // + // Non-void callbacks (result !== undefined) return their actual result. + // The .NET side only activates writeback for void delegates whose + // parameters include [AspireDto] types — all other cases discard the + // returned args object, so the extra wire payload is harmless. + // + // IMPORTANT: callbacks that intentionally return undefined will also + // trigger this path. For non-void delegate types, the C# proxy uses + // a result-unmarshalling path (not writeback), so returning args will + // cause an unmarshal error. Void callbacks should never return a + // meaningful value; non-void callbacks should always return one. + return result !== undefined ? result : args; + } + + // No positional params found — nothing to write back + return await callback(); + } + + // Null/undefined - call with no args + if (args === null || args === undefined) { + return await callback(); + } + + // Primitive value - pass as single arg (shouldn't happen with current protocol) + return await callback(wrapIfHandle(args, client)); + }; + + callbackRegistry.set(callbackId, wrapper); + return callbackId; +} + +/** + * Unregister a callback by its ID. + */ +export function unregisterCallback(callbackId: string): boolean { + return callbackRegistry.delete(callbackId); +} + +/** + * Get the number of registered callbacks. + */ +export function getCallbackCount(): number { + return callbackRegistry.size; +} + +// ============================================================================ +// Cancellation Token Registry +// ============================================================================ + +/** + * Registry for cancellation tokens. + * Maps cancellation IDs to cleanup functions. + */ +const cancellationRegistry = new Map void>(); +let cancellationIdCounter = 0; + +/** + * A reference to the current AspireClient for sending cancel requests. + * Set by AspireClient.connect(). + */ +let currentClient: AspireClient | null = null; + +/** + * Register an AbortSignal for cancellation support. + * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * + * When the AbortSignal is aborted, sends a cancelToken request to the host. + * + * @param signal - The AbortSignal to register (optional) + * @returns The cancellation ID, or undefined if no signal provided + * + * @example + * const controller = new AbortController(); + * const id = registerCancellation(controller.signal); + * // Pass id to capability invocation + * // Later: controller.abort() will cancel the operation + */ +export function registerCancellation(signal?: AbortSignal): string | undefined { + if (!signal) { + return undefined; + } + + // Already aborted? Don't register + if (signal.aborted) { + return undefined; + } + + const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; + + // Set up the abort listener + const onAbort = () => { + // Send cancel request to host + if (currentClient?.connected) { + currentClient.cancelToken(cancellationId).catch(() => { + // Ignore errors - the operation may have already completed + }); + } + // Clean up the listener + cancellationRegistry.delete(cancellationId); + }; + + // Listen for abort + signal.addEventListener('abort', onAbort, { once: true }); + + // Store cleanup function + cancellationRegistry.set(cancellationId, () => { + signal.removeEventListener('abort', onAbort); + }); + + return cancellationId; +} + +/** + * Unregister a cancellation token by its ID. + * Call this when the operation completes to clean up resources. + * + * @param cancellationId - The cancellation ID to unregister + */ +export function unregisterCancellation(cancellationId: string | undefined): void { + if (!cancellationId) { + return; + } + + const cleanup = cancellationRegistry.get(cancellationId); + if (cleanup) { + cleanup(); + cancellationRegistry.delete(cancellationId); + } +} + +// ============================================================================ +// AspireClient (JSON-RPC Connection) +// ============================================================================ + +/** + * Client for connecting to the Aspire AppHost via socket/named pipe. + */ +export class AspireClient { + private connection: rpc.MessageConnection | null = null; + private socket: net.Socket | null = null; + private disconnectCallbacks: (() => void)[] = []; + private _pendingCalls = 0; + + constructor(private socketPath: string) { } + + /** + * Register a callback to be called when the connection is lost + */ + onDisconnect(callback: () => void): void { + this.disconnectCallbacks.push(callback); + } + + private notifyDisconnect(): void { + for (const callback of this.disconnectCallbacks) { + try { + callback(); + } catch { + // Ignore callback errors + } + } + } + + connect(timeoutMs: number = 5000): Promise { + return new Promise((resolve, reject) => { + const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this.socket = net.createConnection(pipePath); + + this.socket.once('error', (error: Error) => { + clearTimeout(timeout); + reject(error); + }); + + this.socket.once('connect', () => { + clearTimeout(timeout); + try { + const reader = new rpc.SocketMessageReader(this.socket!); + const writer = new rpc.SocketMessageWriter(this.socket!); + this.connection = rpc.createMessageConnection(reader, writer); + + this.connection.onClose(() => { + this.connection = null; + this.notifyDisconnect(); + }); + this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); + + // Handle callback invocations from the .NET side + this.connection.onRequest('invokeCallback', async (callbackId: string, args: unknown) => { + const callback = callbackRegistry.get(callbackId); + if (!callback) { + throw new Error(`Callback not found: ${callbackId}`); + } + try { + // The registered wrapper handles arg unpacking and handle wrapping + // Pass this client so handles can be wrapped with typed wrapper classes + return await Promise.resolve(callback(args, this)); + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + throw new Error(`Callback execution failed: ${message}`); + } + }); + + this.connection.listen(); + + // Set the current client for cancellation registry + currentClient = this; + + resolve(); + } catch (e) { + reject(e); + } + }); + + this.socket.on('close', () => { + this.connection?.dispose(); + this.connection = null; + if (currentClient === this) { + currentClient = null; + } + this.notifyDisconnect(); + }); + }); + } + + ping(): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('ping'); + } + + /** + * Cancel a CancellationToken by its ID. + * Called when an AbortSignal is aborted. + * + * @param tokenId - The token ID to cancel + * @returns True if the token was found and cancelled, false otherwise + */ + cancelToken(tokenId: string): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('cancelToken', tokenId); + } + + /** + * Invoke an ATS capability by ID. + * + * Capabilities are operations exposed by [AspireExport] attributes. + * Results are automatically wrapped in Handle objects when applicable. + * + * @param capabilityId - The capability ID (e.g., "Aspire.Hosting/createBuilder") + * @param args - Arguments to pass to the capability + * @returns The capability result, wrapped as Handle if it's a handle type + * @throws CapabilityError if the capability fails + */ + async invokeCapability( + capabilityId: string, + args?: Record + ): Promise { + if (!this.connection) { + throw new Error('Not connected to AppHost'); + } + + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); + } + this._pendingCalls++; + + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + args ?? null + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } + } + + disconnect(): void { + try { this.connection?.dispose(); } finally { this.connection = null; } + try { this.socket?.end(); } finally { this.socket = null; } + } + + get connected(): boolean { + return this.connection !== null && this.socket !== null; + } +} diff --git a/samples/database-migrations/ts/package-lock.json b/samples/database-migrations/ts/package-lock.json new file mode 100644 index 00000000..c4d3800c --- /dev/null +++ b/samples/database-migrations/ts/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "ts", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/samples/health-checks-ui/ts/.aspire/settings.json b/samples/health-checks-ui/ts/.aspire/settings.json index a60c25b1..9dfecf35 100644 --- a/samples/health-checks-ui/ts/.aspire/settings.json +++ b/samples/health-checks-ui/ts/.aspire/settings.json @@ -1,3 +1,8 @@ { - "appHostPath": "../apphost.ts" + "appHostPath": "../apphost.ts", + "sdkVersion": "13.2.0-preview.1.26159.1", + "packages": { + "Aspire.Hosting.Redis": "13.1.2", + "Aspire.Hosting.Docker": "13.1.2-preview.1.26125.13" + } } \ No newline at end of file diff --git a/samples/health-checks-ui/ts/.modules/.codegen-hash b/samples/health-checks-ui/ts/.modules/.codegen-hash new file mode 100644 index 00000000..97328095 --- /dev/null +++ b/samples/health-checks-ui/ts/.modules/.codegen-hash @@ -0,0 +1 @@ +77D2D99D9A6D8891BA4E3557755A508847E488D10B955BB8D1A887611E28AFB8 \ No newline at end of file diff --git a/samples/health-checks-ui/ts/.modules/aspire.ts b/samples/health-checks-ui/ts/.modules/aspire.ts new file mode 100644 index 00000000..73dc52d2 --- /dev/null +++ b/samples/health-checks-ui/ts/.modules/aspire.ts @@ -0,0 +1,13306 @@ +// aspire.ts - Capability-based Aspire SDK +// This SDK uses the ATS (Aspire Type System) capability API. +// Capabilities are endpoints like 'Aspire.Hosting/createBuilder'. +// +// GENERATED CODE - DO NOT EDIT + +import { + AspireClient as AspireClientRpc, + Handle, + MarshalledHandle, + CapabilityError, + registerCallback, + wrapIfHandle, + registerHandleWrapper +} from './transport.js'; + +import { + ResourceBuilderBase, + ReferenceExpression, + refExpr, + AspireDict, + AspireList +} from './base.js'; + +// ============================================================================ +// Handle Type Aliases (Internal - not exported to users) +// ============================================================================ + +/** Handle to CommandLineArgsCallbackContext */ +type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; + +/** Handle to ContainerRegistryResource */ +type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; + +/** Handle to ContainerResource */ +type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource'>; + +/** Handle to CSharpAppResource */ +type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; + +/** Handle to DotnetToolResource */ +type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; + +/** Handle to EndpointReference */ +type EndpointReferenceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference'>; + +/** Handle to EndpointReferenceExpression */ +type EndpointReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression'>; + +/** Handle to EnvironmentCallbackContext */ +type EnvironmentCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext'>; + +/** Handle to ExecutableResource */ +type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource'>; + +/** Handle to ExecuteCommandContext */ +type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; + +/** Handle to IContainerFilesDestinationResource */ +type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; + +/** Handle to IResource */ +type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; + +/** Handle to IResourceWithArgs */ +type IResourceWithArgsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs'>; + +/** Handle to IResourceWithConnectionString */ +type IResourceWithConnectionStringHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString'>; + +/** Handle to IResourceWithEndpoints */ +type IResourceWithEndpointsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints'>; + +/** Handle to IResourceWithEnvironment */ +type IResourceWithEnvironmentHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment'>; + +/** Handle to IResourceWithWaitSupport */ +type IResourceWithWaitSupportHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport'>; + +/** Handle to ParameterResource */ +type ParameterResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource'>; + +/** Handle to ProjectResource */ +type ProjectResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource'>; + +/** Handle to ReferenceExpression */ +type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression'>; + +/** Handle to ReferenceExpressionBuilder */ +type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; + +/** Handle to ResourceLoggerService */ +type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; + +/** Handle to ResourceNotificationService */ +type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; + +/** Handle to ResourceUrlsCallbackContext */ +type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; + +/** Handle to ConnectionStringResource */ +type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; + +/** Handle to DistributedApplication */ +type DistributedApplicationHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplication'>; + +/** Handle to DistributedApplicationExecutionContext */ +type DistributedApplicationExecutionContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext'>; + +/** Handle to DistributedApplicationEventSubscription */ +type DistributedApplicationEventSubscriptionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.DistributedApplicationEventSubscription'>; + +/** Handle to IDistributedApplicationEventing */ +type IDistributedApplicationEventingHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing'>; + +/** Handle to ExternalServiceResource */ +type ExternalServiceResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ExternalServiceResource'>; + +/** Handle to IDistributedApplicationBuilder */ +type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder'>; + +/** Handle to IResourceWithContainerFiles */ +type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; + +/** Handle to IResourceWithServiceDiscovery */ +type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; + +/** Handle to PipelineConfigurationContext */ +type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; + +/** Handle to PipelineStep */ +type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; + +/** Handle to PipelineStepContext */ +type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; + +/** Handle to ProjectResourceOptions */ +type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; + +/** Handle to Dict */ +type DictstringanyHandle = Handle<'Aspire.Hosting/Dict'>; + +/** Handle to List */ +type ListanyHandle = Handle<'Aspire.Hosting/List'>; + +/** Handle to IConfiguration */ +type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; + +/** Handle to IHostEnvironment */ +type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; + +/** Handle to ILogger */ +type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; + +/** Handle to string[] */ +type stringArrayHandle = Handle<'string[]'>; + +/** Handle to IServiceProvider */ +type IServiceProviderHandle = Handle<'System.ComponentModel/System.IServiceProvider'>; + +// ============================================================================ +// Enum Types +// ============================================================================ + +/** Enum type for CertificateTrustScope */ +export enum CertificateTrustScope { + None = "None", + Append = "Append", + Override = "Override", + System = "System", +} + +/** Enum type for ContainerLifetime */ +export enum ContainerLifetime { + Session = "Session", + Persistent = "Persistent", +} + +/** Enum type for DistributedApplicationOperation */ +export enum DistributedApplicationOperation { + Run = "Run", + Publish = "Publish", +} + +/** Enum type for EndpointProperty */ +export enum EndpointProperty { + Url = "Url", + Host = "Host", + IPV4Host = "IPV4Host", + Port = "Port", + Scheme = "Scheme", + TargetPort = "TargetPort", + HostAndPort = "HostAndPort", +} + +/** Enum type for IconVariant */ +export enum IconVariant { + Regular = "Regular", + Filled = "Filled", +} + +/** Enum type for ImagePullPolicy */ +export enum ImagePullPolicy { + Default = "Default", + Always = "Always", + Missing = "Missing", + Never = "Never", +} + +/** Enum type for OtlpProtocol */ +export enum OtlpProtocol { + Grpc = "Grpc", + HttpProtobuf = "HttpProtobuf", + HttpJson = "HttpJson", +} + +/** Enum type for ProbeType */ +export enum ProbeType { + Startup = "Startup", + Readiness = "Readiness", + Liveness = "Liveness", +} + +/** Enum type for ProtocolType */ +export enum ProtocolType { + IP = "IP", + IPv6HopByHopOptions = "IPv6HopByHopOptions", + Unspecified = "Unspecified", + Icmp = "Icmp", + Igmp = "Igmp", + Ggp = "Ggp", + IPv4 = "IPv4", + Tcp = "Tcp", + Pup = "Pup", + Udp = "Udp", + Idp = "Idp", + IPv6 = "IPv6", + IPv6RoutingHeader = "IPv6RoutingHeader", + IPv6FragmentHeader = "IPv6FragmentHeader", + IPSecEncapsulatingSecurityPayload = "IPSecEncapsulatingSecurityPayload", + IPSecAuthenticationHeader = "IPSecAuthenticationHeader", + IcmpV6 = "IcmpV6", + IPv6NoNextHeader = "IPv6NoNextHeader", + IPv6DestinationOptions = "IPv6DestinationOptions", + ND = "ND", + Raw = "Raw", + Ipx = "Ipx", + Spx = "Spx", + SpxII = "SpxII", + Unknown = "Unknown", +} + +/** Enum type for UrlDisplayLocation */ +export enum UrlDisplayLocation { + SummaryAndDetails = "SummaryAndDetails", + DetailsOnly = "DetailsOnly", +} + +/** Enum type for WaitBehavior */ +export enum WaitBehavior { + WaitOnResourceUnavailable = "WaitOnResourceUnavailable", + StopOnResourceUnavailable = "StopOnResourceUnavailable", +} + +// ============================================================================ +// DTO Interfaces +// ============================================================================ + +/** DTO interface for CommandOptions */ +export interface CommandOptions { + description?: string; + parameter?: any; + confirmationMessage?: string; + iconName?: string; + iconVariant?: IconVariant; + isHighlighted?: boolean; + updateState?: any; +} + +/** DTO interface for CreateBuilderOptions */ +export interface CreateBuilderOptions { + args?: string[]; + projectDirectory?: string; + appHostFilePath?: string; + containerRegistryOverride?: string; + disableDashboard?: boolean; + dashboardApplicationName?: string; + allowUnsecuredTransport?: boolean; + enableResourceLogging?: boolean; +} + +/** DTO interface for ExecuteCommandResult */ +export interface ExecuteCommandResult { + success?: boolean; + canceled?: boolean; + errorMessage?: string; +} + +/** DTO interface for ResourceEventDto */ +export interface ResourceEventDto { + resourceName?: string; + resourceId?: string; + state?: string; + stateStyle?: string; + healthStatus?: string; + exitCode?: number; +} + +/** DTO interface for ResourceUrlAnnotation */ +export interface ResourceUrlAnnotation { + url?: string; + displayText?: string; + endpoint?: EndpointReferenceHandle; + displayLocation?: UrlDisplayLocation; +} + +// ============================================================================ +// Options Interfaces +// ============================================================================ + +export interface AddConnectionStringOptions { + environmentVariableName?: string; +} + +export interface AddContainerRegistryOptions { + repository?: ParameterResource; +} + +export interface AddDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface AddParameterFromConfigurationOptions { + secret?: boolean; +} + +export interface AddParameterOptions { + secret?: boolean; +} + +export interface AppendFormattedOptions { + format?: string; +} + +export interface AppendValueProviderOptions { + format?: string; +} + +export interface GetValueAsyncOptions { + cancellationToken?: AbortSignal; +} + +export interface RunOptions { + cancellationToken?: AbortSignal; +} + +export interface WaitForCompletionOptions { + exitCode?: number; +} + +export interface WithBindMountOptions { + isReadOnly?: boolean; +} + +export interface WithCommandOptions { + commandOptions?: CommandOptions; +} + +export interface WithDescriptionOptions { + enableMarkdown?: boolean; +} + +export interface WithDockerfileBaseImageOptions { + buildImage?: string; + runtimeImage?: string; +} + +export interface WithDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface WithEndpointOptions { + port?: number; + targetPort?: number; + scheme?: string; + name?: string; + env?: string; + isProxied?: boolean; + isExternal?: boolean; + protocol?: ProtocolType; +} + +export interface WithExternalServiceHttpHealthCheckOptions { + path?: string; + statusCode?: number; +} + +export interface WithHttpEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithHttpHealthCheckOptions { + path?: string; + statusCode?: number; + endpointName?: string; +} + +export interface WithHttpProbeOptions { + path?: string; + initialDelaySeconds?: number; + periodSeconds?: number; + timeoutSeconds?: number; + failureThreshold?: number; + successThreshold?: number; + endpointName?: string; +} + +export interface WithHttpsDeveloperCertificateOptions { + password?: ParameterResource; +} + +export interface WithHttpsEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithIconNameOptions { + iconVariant?: IconVariant; +} + +export interface WithImageOptions { + tag?: string; +} + +export interface WithMcpServerOptions { + path?: string; + endpointName?: string; +} + +export interface WithPipelineStepFactoryOptions { + dependsOn?: string[]; + requiredBy?: string[]; + tags?: string[]; + description?: string; +} + +export interface WithReferenceOptions { + connectionName?: string; + optional?: boolean; +} + +export interface WithRequiredCommandOptions { + helpLink?: string; +} + +export interface WithUrlExpressionOptions { + displayText?: string; +} + +export interface WithUrlOptions { + displayText?: string; +} + +export interface WithVolumeOptions { + name?: string; + isReadOnly?: boolean; +} + +// ============================================================================ +// CommandLineArgsCallbackContext +// ============================================================================ + +/** + * Type class for CommandLineArgsCallbackContext. + */ +export class CommandLineArgsCallbackContext { + constructor(private _handle: CommandLineArgsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Args property */ + private _args?: AspireList; + get args(): AspireList { + if (!this._args) { + this._args = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args', + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args' + ); + } + return this._args; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplication +// ============================================================================ + +/** + * Type class for DistributedApplication. + */ +export class DistributedApplication { + constructor(private _handle: DistributedApplicationHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Runs the distributed application */ + /** @internal */ + async _runInternal(cancellationToken?: AbortSignal): Promise { + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + await this._client.invokeCapability( + 'Aspire.Hosting/run', + rpcArgs + ); + return this; + } + + run(options?: RunOptions): DistributedApplicationPromise { + const cancellationToken = options?.cancellationToken; + return new DistributedApplicationPromise(this._runInternal(cancellationToken)); + } + +} + +/** + * Thenable wrapper for DistributedApplication that enables fluent chaining. + */ +export class DistributedApplicationPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplication) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Runs the distributed application */ + run(options?: RunOptions): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.run(options))); + } + +} + +// ============================================================================ +// DistributedApplicationExecutionContext +// ============================================================================ + +/** + * Type class for DistributedApplicationExecutionContext. + */ +export class DistributedApplicationExecutionContext { + constructor(private _handle: DistributedApplicationExecutionContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PublisherName property */ + publisherName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.publisherName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.setPublisherName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Operation property */ + operation = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.operation', + { context: this._handle } + ); + }, + }; + + /** Gets the IsPublishMode property */ + isPublishMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isPublishMode', + { context: this._handle } + ); + }, + }; + + /** Gets the IsRunMode property */ + isRunMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isRunMode', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EndpointReference +// ============================================================================ + +/** + * Type class for EndpointReference. + */ +export class EndpointReference { + constructor(private _handle: EndpointReferenceHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EndpointName property */ + endpointName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.endpointName', + { context: this._handle } + ); + }, + }; + + /** Gets the ErrorMessage property */ + errorMessage = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.errorMessage', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.setErrorMessage', + { context: this._handle, value } + ); + } + }; + + /** Gets the IsAllocated property */ + isAllocated = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isAllocated', + { context: this._handle } + ); + }, + }; + + /** Gets the Exists property */ + exists = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.exists', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttp property */ + isHttp = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttp', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttps property */ + isHttps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttps', + { context: this._handle } + ); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.port', + { context: this._handle } + ); + }, + }; + + /** Gets the TargetPort property */ + targetPort = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.targetPort', + { context: this._handle } + ); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.host', + { context: this._handle } + ); + }, + }; + + /** Gets the Scheme property */ + scheme = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.scheme', + { context: this._handle } + ); + }, + }; + + /** Gets the Url property */ + url = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.url', + { context: this._handle } + ); + }, + }; + + /** Gets the URL of the endpoint asynchronously */ + async getValueAsync(options?: GetValueAsyncOptions): Promise { + const cancellationToken = options?.cancellationToken; + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValueAsync', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for EndpointReference that enables fluent chaining. + */ +export class EndpointReferencePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: EndpointReference) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets the URL of the endpoint asynchronously */ + getValueAsync(options?: GetValueAsyncOptions): Promise { + return this._promise.then(obj => obj.getValueAsync(options)); + } + +} + +// ============================================================================ +// EndpointReferenceExpression +// ============================================================================ + +/** + * Type class for EndpointReferenceExpression. + */ +export class EndpointReferenceExpression { + constructor(private _handle: EndpointReferenceExpressionHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Endpoint property */ + endpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.endpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Property property */ + property = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.property', + { context: this._handle } + ); + }, + }; + + /** Gets the ValueExpression property */ + valueExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.valueExpression', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EnvironmentCallbackContext +// ============================================================================ + +/** + * Type class for EnvironmentCallbackContext. + */ +export class EnvironmentCallbackContext { + constructor(private _handle: EnvironmentCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EnvironmentVariables property */ + private _environmentVariables?: AspireDict; + get environmentVariables(): AspireDict { + if (!this._environmentVariables) { + this._environmentVariables = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables', + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables' + ); + } + return this._environmentVariables; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ExecuteCommandContext +// ============================================================================ + +/** + * Type class for ExecuteCommandContext. + */ +export class ExecuteCommandContext { + constructor(private _handle: ExecuteCommandContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ResourceName property */ + resourceName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.resourceName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setResourceName', + { context: this._handle, value } + ); + } + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', + { context: this._handle } + ); + }, + set: async (value: AbortSignal): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + { context: this._handle } + ); + }, + set: async (value: PipelineStep[]): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', + { context: this._handle, value } + ); + } + }; + + /** Gets pipeline steps with the specified tag */ + async getStepsByTag(tag: string): Promise { + const rpcArgs: Record = { context: this._handle, tag }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/getStepsByTag', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for PipelineConfigurationContext that enables fluent chaining. + */ +export class PipelineConfigurationContextPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineConfigurationContext) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets pipeline steps with the specified tag */ + getStepsByTag(tag: string): Promise { + return this._promise.then(obj => obj.getStepsByTag(tag)); + } + +} + +// ============================================================================ +// PipelineStep +// ============================================================================ + +/** + * Type class for PipelineStep. + */ +export class PipelineStep { + constructor(private _handle: PipelineStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.name', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Description property */ + description = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.description', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setDescription', + { context: this._handle, value } + ); + } + }; + + /** Gets the DependsOnSteps property */ + private _dependsOnSteps?: AspireList; + get dependsOnSteps(): AspireList { + if (!this._dependsOnSteps) { + this._dependsOnSteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps', + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps' + ); + } + return this._dependsOnSteps; + } + + /** Gets the RequiredBySteps property */ + private _requiredBySteps?: AspireList; + get requiredBySteps(): AspireList { + if (!this._requiredBySteps) { + this._requiredBySteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps', + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps' + ); + } + return this._requiredBySteps; + } + + /** Gets the Tags property */ + private _tags?: AspireList; + get tags(): AspireList { + if (!this._tags) { + this._tags = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.tags', + 'Aspire.Hosting.Pipelines/PipelineStep.tags' + ); + } + return this._tags; + } + + /** Adds a dependency on another step by name */ + /** @internal */ + async _dependsOnInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/dependsOn', + rpcArgs + ); + return this; + } + + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._dependsOnInternal(stepName)); + } + + /** Specifies that another step requires this step by name */ + /** @internal */ + async _requiredByInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/requiredBy', + rpcArgs + ); + return this; + } + + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._requiredByInternal(stepName)); + } + +} + +/** + * Thenable wrapper for PipelineStep that enables fluent chaining. + */ +export class PipelineStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineStep) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a dependency on another step by name */ + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.dependsOn(stepName))); + } + + /** Specifies that another step requires this step by name */ + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.requiredBy(stepName))); + } + +} + +// ============================================================================ +// PipelineStepContext +// ============================================================================ + +/** + * Type class for PipelineStepContext. + */ +export class PipelineStepContext { + constructor(private _handle: PipelineStepContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// ProjectResourceOptions +// ============================================================================ + +/** + * Type class for ProjectResourceOptions. + */ +export class ProjectResourceOptions { + constructor(private _handle: ProjectResourceOptionsHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the LaunchProfileName property */ + launchProfileName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.launchProfileName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setLaunchProfileName', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeLaunchProfile property */ + excludeLaunchProfile = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeLaunchProfile', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeLaunchProfile', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeKestrelEndpoints property */ + excludeKestrelEndpoints = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeKestrelEndpoints', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeKestrelEndpoints', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// ReferenceExpressionBuilder +// ============================================================================ + +/** + * Type class for ReferenceExpressionBuilder. + */ +export class ReferenceExpressionBuilder { + constructor(private _handle: ReferenceExpressionBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the IsEmpty property */ + isEmpty = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ReferenceExpressionBuilder.isEmpty', + { context: this._handle } + ); + }, + }; + + /** Appends a literal string to the reference expression */ + /** @internal */ + async _appendLiteralInternal(value: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendLiteral', + rpcArgs + ); + return this; + } + + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._appendLiteralInternal(value)); + } + + /** Appends a formatted string value to the reference expression */ + /** @internal */ + async _appendFormattedInternal(value: string, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendFormatted', + rpcArgs + ); + return this; + } + + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendFormattedInternal(value, format)); + } + + /** Appends a value provider to the reference expression */ + /** @internal */ + async _appendValueProviderInternal(valueProvider: any, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, valueProvider }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendValueProvider', + rpcArgs + ); + return this; + } + + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendValueProviderInternal(valueProvider, format)); + } + + /** Builds the reference expression */ + async build(): Promise { + const rpcArgs: Record = { context: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/build', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ReferenceExpressionBuilder that enables fluent chaining. + */ +export class ReferenceExpressionBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReferenceExpressionBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Appends a literal string to the reference expression */ + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendLiteral(value))); + } + + /** Appends a formatted string value to the reference expression */ + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendFormatted(value, options))); + } + + /** Appends a value provider to the reference expression */ + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendValueProvider(valueProvider, options))); + } + + /** Builds the reference expression */ + build(): Promise { + return this._promise.then(obj => obj.build()); + } + +} + +// ============================================================================ +// ResourceUrlsCallbackContext +// ============================================================================ + +/** + * Type class for ResourceUrlsCallbackContext. + */ +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Builds the distributed application */ + /** @internal */ + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', + rpcArgs + ); + return new DistributedApplication(result, this._client); + } + + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); + } + + /** Adds a connection string with a builder callback */ + /** @internal */ + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionStringBuilder', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + } + + /** Adds a container registry resource */ + /** @internal */ + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + } + + /** Adds a container resource */ + /** @internal */ + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); + } + + /** Adds a container resource built from a Dockerfile */ + /** @internal */ + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); + } + + /** Adds a .NET tool resource */ + /** @internal */ + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + } + + /** Adds an executable resource */ + /** @internal */ + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + } + + /** Adds an external service resource */ + /** @internal */ + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); + } + + /** Adds a parameter resource */ + /** @internal */ + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); + } + + /** Adds a parameter sourced from configuration */ + /** @internal */ + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + } + + /** Adds a connection string resource */ + /** @internal */ + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + } + + /** Adds a .NET project resource */ + /** @internal */ + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + } + + /** Adds a project resource with configuration options */ + /** @internal */ + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + } + + /** Adds a C# application resource */ + /** @internal */ + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + } + + /** Adds a C# application resource with configuration options */ + /** @internal */ + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + */ +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); + } + + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + } + + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + } + + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + } + + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + } + + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + } + + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); + } + + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + } + + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); + } + + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + } + + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); + } + + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); + } + + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); + } + + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); + } + + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); + } + +} + +// ============================================================================ +// DistributedApplicationEventing +// ============================================================================ + +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Unsubscribe method */ + /** @internal */ + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + rpcArgs + ); + return this; + } + + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ + +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerResource +// ============================================================================ + +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + const exitCode = options?.exitCode; + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + const password = options?.password; + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// CSharpAppResource +// ============================================================================ + +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + const exitCode = options?.exitCode; + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + const commandOptions = options?.commandOptions; + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + const password = options?.password; + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + const iconVariant = options?.iconVariant; + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// DotnetToolResource +// ============================================================================ + +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + } + + /** @internal */ + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + } + + /** @internal */ + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + } + + /** @internal */ + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + } + + /** @internal */ + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + } + + /** @internal */ + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + const exitCode = options?.exitCode; + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + const commandOptions = options?.commandOptions; + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + const password = options?.password; + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + const iconVariant = options?.iconVariant; + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for DotnetToolResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExecutableResource +// ============================================================================ + +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerFilesDestinationResource +// ============================================================================ + +export class ContainerFilesDestinationResource extends ResourceBuilderBase { + constructor(handle: IContainerFilesDestinationResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ContainerFilesDestinationResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + +} + +/** + * Thenable wrapper for ContainerFilesDestinationResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerFilesDestinationResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerFilesDestinationResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + +} + +// ============================================================================ +// Resource +// ============================================================================ + +export class Resource extends ResourceBuilderBase { + constructor(handle: IResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + const helpLink = options?.helpLink; + return new ResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + const commandOptions = options?.commandOptions; + return new ResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + const iconVariant = options?.iconVariant; + return new ResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for Resource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Resource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ResourceWithArgs +// ============================================================================ + +export class ResourceWithArgs extends ResourceBuilderBase { + constructor(handle: IResourceWithArgsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackAsyncInternal(callback)); + } + +} + +/** + * Thenable wrapper for ResourceWithArgs that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithArgsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithArgs) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + +} + +// ============================================================================ +// ResourceWithConnectionString +// ============================================================================ + +export class ResourceWithConnectionString extends ResourceBuilderBase { + constructor(handle: IResourceWithConnectionStringHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyValueInternal(name, value)); + } + +} + +/** + * Thenable wrapper for ResourceWithConnectionString that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithConnectionStringPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithConnectionString) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + +} + +// ============================================================================ +// ResourceWithContainerFiles +// ============================================================================ + +export class ResourceWithContainerFiles extends ResourceBuilderBase { + constructor(handle: IResourceWithContainerFilesHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._clearContainerFilesSourcesInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithContainerFiles that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithContainerFilesPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithContainerFiles) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + +} + +// ============================================================================ +// ResourceWithEndpoints +// ============================================================================ + +export class ResourceWithEndpoints extends ResourceBuilderBase { + constructor(handle: IResourceWithEndpointsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ResourceWithEndpointsPromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + +} + +/** + * Thenable wrapper for ResourceWithEndpoints that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEndpointsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEndpoints) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + +} + +// ============================================================================ +// ResourceWithEnvironment +// ============================================================================ + +export class ResourceWithEnvironment extends ResourceBuilderBase { + constructor(handle: IResourceWithEnvironmentHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + const password = options?.password; + return new ResourceWithEnvironmentPromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withoutHttpsCertificateInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithEnvironment that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + +} + +// ============================================================================ +// ResourceWithServiceDiscovery +// ============================================================================ + +export class ResourceWithServiceDiscovery extends ResourceBuilderBase { + constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { + super(handle, client); + } + +} + +/** + * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithServiceDiscoveryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + +} + +// ============================================================================ +// ResourceWithWaitSupport +// ============================================================================ + +export class ResourceWithWaitSupport extends ResourceBuilderBase { + constructor(handle: IResourceWithWaitSupportHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + const exitCode = options?.exitCode; + return new ResourceWithWaitSupportPromise(this._waitForCompletionInternal(dependency, exitCode)); + } + +} + +/** + * Thenable wrapper for ResourceWithWaitSupport that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithWaitSupportPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithWaitSupport) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + +} + +// ============================================================================ +// Connection Helper +// ============================================================================ + +/** + * Creates and connects to the Aspire AppHost. + * Reads connection info from environment variables set by `aspire run`. + */ +export async function connect(): Promise { + const socketPath = process.env.REMOTE_APP_HOST_SOCKET_PATH; + if (!socketPath) { + throw new Error( + 'REMOTE_APP_HOST_SOCKET_PATH environment variable not set. ' + + 'Run this application using `aspire run`.' + ); + } + + const client = new AspireClientRpc(socketPath); + await client.connect(); + + // Exit the process if the server connection is lost + client.onDisconnect(() => { + console.error('Connection to AppHost lost. Exiting...'); + process.exit(1); + }); + + return client; +} + +/** + * Creates a new distributed application builder. + * This is the entry point for building Aspire applications. + * + * @param options - Optional configuration options for the builder + * @returns A DistributedApplicationBuilder instance + * + * @example + * const builder = await createBuilder(); + * builder.addRedis("cache"); + * builder.addContainer("api", "mcr.microsoft.com/dotnet/samples:aspnetapp"); + * const app = await builder.build(); + * await app.run(); + */ +export async function createBuilder(options?: CreateBuilderOptions): Promise { + const client = await connect(); + + // Default args, projectDirectory, and appHostFilePath if not provided + // ASPIRE_APPHOST_FILEPATH is set by the CLI for consistent socket hash computation + const effectiveOptions: CreateBuilderOptions = { + ...options, + args: options?.args ?? process.argv.slice(2), + projectDirectory: options?.projectDirectory ?? process.env.ASPIRE_PROJECT_DIRECTORY ?? process.cwd(), + appHostFilePath: options?.appHostFilePath ?? process.env.ASPIRE_APPHOST_FILEPATH + }; + + const handle = await client.invokeCapability( + 'Aspire.Hosting/createBuilderWithOptions', + { options: effectiveOptions } + ); + return new DistributedApplicationBuilder(handle, client); +} + +// Re-export commonly used types +export { Handle, CapabilityError, registerCallback } from './transport.js'; +export { refExpr, ReferenceExpression } from './base.js'; + +// ============================================================================ +// Global Error Handling +// ============================================================================ + +/** + * Set up global error handlers to ensure the process exits properly on errors. + * Node.js doesn't exit on unhandled rejections by default, so we need to handle them. + */ +process.on('unhandledRejection', (reason: unknown) => { + const error = reason instanceof Error ? reason : new Error(String(reason)); + + if (reason instanceof CapabilityError) { + console.error(`\n❌ Capability Error: ${error.message}`); + console.error(` Code: ${(reason as CapabilityError).code}`); + if ((reason as CapabilityError).capability) { + console.error(` Capability: ${(reason as CapabilityError).capability}`); + } + } else { + console.error(`\n❌ Unhandled Error: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + } + + process.exit(1); +}); + +process.on('uncaughtException', (error: Error) => { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + process.exit(1); +}); + +// ============================================================================ +// Handle Wrapper Registrations +// ============================================================================ + +// Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource', (handle, client) => new CSharpAppResource(handle as CSharpAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString', (handle, client) => new ResourceWithConnectionString(handle as IResourceWithConnectionStringHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); + diff --git a/samples/health-checks-ui/ts/.modules/base.ts b/samples/health-checks-ui/ts/.modules/base.ts new file mode 100644 index 00000000..7778b0f1 --- /dev/null +++ b/samples/health-checks-ui/ts/.modules/base.ts @@ -0,0 +1,473 @@ +// aspire.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle } from './transport.js'; + +// Re-export transport types for convenience +export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; +export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; + +// ============================================================================ +// Reference Expression +// ============================================================================ + +/** + * Represents a reference expression that can be passed to capabilities. + * + * Reference expressions are serialized in the protocol as: + * ```json + * { + * "$expr": { + * "format": "redis://{0}:{1}", + * "valueProviders": [ + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:1" }, + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:2" } + * ] + * } + * } + * ``` + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export class ReferenceExpression { + // Expression mode fields + private readonly _format?: string; + private readonly _valueProviders?: unknown[]; + + // Handle mode fields (when wrapping a server-returned handle) + private readonly _handle?: Handle; + private readonly _client?: AspireClient; + + constructor(format: string, valueProviders: unknown[]); + constructor(handle: Handle, client: AspireClient); + constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { + if (typeof handleOrFormat === 'string') { + this._format = handleOrFormat; + this._valueProviders = clientOrValueProviders as unknown[]; + } else { + this._handle = handleOrFormat; + this._client = clientOrValueProviders as AspireClient; + } + } + + /** + * Creates a reference expression from a tagged template literal. + * + * @param strings - The template literal string parts + * @param values - The interpolated values (handles to value providers) + * @returns A ReferenceExpression instance + */ + static create(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + // Build the format string with {0}, {1}, etc. placeholders + let format = ''; + for (let i = 0; i < strings.length; i++) { + format += strings[i]; + if (i < values.length) { + format += `{${i}}`; + } + } + + // Extract handles from values + const valueProviders = values.map(extractHandleForExpr); + + return new ReferenceExpression(format, valueProviders); + } + + /** + * Serializes the reference expression for JSON-RPC transport. + * In template-literal mode, uses the $expr format. + * In handle mode, delegates to the handle's serialization. + */ + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + if (this._handle) { + return this._handle.toJSON(); + } + + return { + $expr: { + format: this._format!, + valueProviders: this._valueProviders && this._valueProviders.length > 0 ? this._valueProviders : undefined + } + }; + } + + /** + * String representation for debugging. + */ + toString(): string { + if (this._handle) { + return `ReferenceExpression(handle)`; + } + return `ReferenceExpression(${this._format})`; + } +} + +/** + * Extracts a value for use in reference expressions. + * Supports handles (objects) and string literals. + * @internal + */ +function extractHandleForExpr(value: unknown): unknown { + if (value === null || value === undefined) { + throw new Error('Cannot use null or undefined in reference expression'); + } + + // String literals - include directly in the expression + if (typeof value === 'string') { + return value; + } + + // Number literals - convert to string + if (typeof value === 'number') { + return String(value); + } + + // Handle objects - get their JSON representation + if (value instanceof Handle) { + return value.toJSON(); + } + + // Objects with $handle property (already in handle format) + if (typeof value === 'object' && value !== null && '$handle' in value) { + return value; + } + + // Objects with toJSON that returns a handle + if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { + const json = value.toJSON(); + if (json && typeof json === 'object' && '$handle' in json) { + return json; + } + } + + throw new Error( + `Cannot use value of type ${typeof value} in reference expression. ` + + `Expected a Handle, string, or number.` + ); +} + +/** + * Tagged template function for creating reference expressions. + * + * Use this to create dynamic expressions that reference endpoints, parameters, and other + * value providers. The expression is evaluated at runtime by Aspire. + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression using the tagged template + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export function refExpr(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + return ReferenceExpression.create(strings, ...values); +} + +// ============================================================================ +// ResourceBuilderBase +// ============================================================================ + +/** + * Base class for resource builders (e.g., RedisBuilder, ContainerBuilder). + * Provides handle management and JSON serialization. + */ +export class ResourceBuilderBase { + constructor(protected _handle: THandle, protected _client: AspireClient) {} + + toJSON(): MarshalledHandle { return this._handle.toJSON(); } +} + +// ============================================================================ +// AspireList - Mutable List Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET List. + * Provides array-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const items = await resource.getItems(); // Returns AspireList + * const count = await items.count(); + * const first = await items.get(0); + * await items.add(newItem); + * ``` + */ +export class AspireList { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the list handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual list handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual list handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of elements in the list. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.length', { + list: handle + }) as number; + } + + /** + * Gets the element at the specified index. + */ + async get(index: number): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.get', { + list: handle, + index + }) as T; + } + + /** + * Adds an element to the end of the list. + */ + async add(item: T): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.add', { + list: handle, + item + }); + } + + /** + * Removes the element at the specified index. + */ + async removeAt(index: number): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.removeAt', { + list: handle, + index + }); + } + + /** + * Clears all elements from the list. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.clear', { + list: handle + }); + } + + /** + * Converts the list to an array (creates a copy). + */ + async toArray(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.toArray', { + list: handle + }) as T[]; + } + + toJSON(): MarshalledHandle { + if (this._resolvedHandle) { + return this._resolvedHandle.toJSON(); + } + return this._handleOrContext.toJSON(); + } +} + +// ============================================================================ +// AspireDict - Mutable Dictionary Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET Dictionary. + * Provides object-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const config = await resource.getConfig(); // Returns AspireDict + * const value = await config.get("key"); + * await config.set("key", "value"); + * const hasKey = await config.containsKey("key"); + * ``` + */ +export class AspireDict { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the dictionary handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual dictionary handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual dictionary handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of key-value pairs in the dictionary. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.count', { + dict: handle + }) as number; + } + + /** + * Gets the value associated with the specified key. + * @throws If the key is not found. + */ + async get(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.get', { + dict: handle, + key + }) as V; + } + + /** + * Sets the value for the specified key. + */ + async set(key: K, value: V): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.set', { + dict: handle, + key, + value + }); + } + + /** + * Determines whether the dictionary contains the specified key. + */ + async containsKey(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.has', { + dict: handle, + key + }) as boolean; + } + + /** + * Removes the value with the specified key. + * @returns True if the element was removed; false if the key was not found. + */ + async remove(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.remove', { + dict: handle, + key + }) as boolean; + } + + /** + * Clears all key-value pairs from the dictionary. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.clear', { + dict: handle + }); + } + + /** + * Gets all keys in the dictionary. + */ + async keys(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.keys', { + dict: handle + }) as K[]; + } + + /** + * Gets all values in the dictionary. + */ + async values(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.values', { + dict: handle + }) as V[]; + } + + /** + * Converts the dictionary to a plain object (creates a copy). + * Only works when K is string. + */ + async toObject(): Promise> { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.toObject', { + dict: handle + }) as Record; + } + + async toJSON(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } +} diff --git a/samples/health-checks-ui/ts/.modules/transport.ts b/samples/health-checks-ui/ts/.modules/transport.ts new file mode 100644 index 00000000..7bddd74b --- /dev/null +++ b/samples/health-checks-ui/ts/.modules/transport.ts @@ -0,0 +1,574 @@ +// transport.ts - ATS transport layer: RPC, Handle, errors, callbacks +import * as net from 'net'; +import * as rpc from 'vscode-jsonrpc/node.js'; + +// ============================================================================ +// Base Types +// ============================================================================ + +/** + * Type for callback functions that can be registered and invoked from .NET. + * Internal: receives args and client for handle wrapping. + */ +export type CallbackFunction = (args: unknown, client: AspireClient) => unknown | Promise; + +/** + * Represents a handle to a .NET object in the ATS system. + * Handles are typed references that can be passed between capabilities. + */ +export interface MarshalledHandle { + /** The handle ID (instance number) */ + $handle: string; + /** The ATS type ID */ + $type: string; +} + +/** + * Error details for ATS errors. + */ +export interface AtsErrorDetails { + /** The parameter that caused the error */ + parameter?: string; + /** The expected type or value */ + expected?: string; + /** The actual type or value */ + actual?: string; +} + +/** + * Structured error from ATS capability invocation. + */ +export interface AtsError { + /** Machine-readable error code */ + code: string; + /** Human-readable error message */ + message: string; + /** The capability that failed (if applicable) */ + capability?: string; + /** Additional error details */ + details?: AtsErrorDetails; +} + +/** + * ATS error codes returned by the server. + */ +export const AtsErrorCodes = { + /** Unknown capability ID */ + CapabilityNotFound: 'CAPABILITY_NOT_FOUND', + /** Handle ID doesn't exist or was disposed */ + HandleNotFound: 'HANDLE_NOT_FOUND', + /** Handle type doesn't satisfy capability's type constraint */ + TypeMismatch: 'TYPE_MISMATCH', + /** Missing required argument or wrong type */ + InvalidArgument: 'INVALID_ARGUMENT', + /** Argument value outside valid range */ + ArgumentOutOfRange: 'ARGUMENT_OUT_OF_RANGE', + /** Error occurred during callback invocation */ + CallbackError: 'CALLBACK_ERROR', + /** Unexpected error in capability execution */ + InternalError: 'INTERNAL_ERROR', +} as const; + +/** + * Type guard to check if a value is an ATS error response. + */ +export function isAtsError(value: unknown): value is { $error: AtsError } { + return ( + value !== null && + typeof value === 'object' && + '$error' in value && + typeof (value as { $error: unknown }).$error === 'object' + ); +} + +/** + * Type guard to check if a value is a marshalled handle. + */ +export function isMarshalledHandle(value: unknown): value is MarshalledHandle { + return ( + value !== null && + typeof value === 'object' && + '$handle' in value && + '$type' in value + ); +} + +// ============================================================================ +// Handle +// ============================================================================ + +/** + * A typed handle to a .NET object in the ATS system. + * Handles are opaque references that can be passed to capabilities. + * + * @typeParam T - The ATS type ID (e.g., "Aspire.Hosting/IDistributedApplicationBuilder") + */ +export class Handle { + private readonly _handleId: string; + private readonly _typeId: T; + + constructor(marshalled: MarshalledHandle) { + this._handleId = marshalled.$handle; + this._typeId = marshalled.$type as T; + } + + /** The handle ID (instance number) */ + get $handle(): string { + return this._handleId; + } + + /** The ATS type ID */ + get $type(): T { + return this._typeId; + } + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { + return { + $handle: this._handleId, + $type: this._typeId + }; + } + + /** String representation for debugging */ + toString(): string { + return `Handle<${this._typeId}>(${this._handleId})`; + } +} + +// ============================================================================ +// Handle Wrapper Registry +// ============================================================================ + +/** + * Factory function for creating typed wrapper instances from handles. + */ +export type HandleWrapperFactory = (handle: Handle, client: AspireClient) => unknown; + +/** + * Registry of handle wrapper factories by type ID. + * Generated code registers wrapper classes here so callback handles can be properly typed. + */ +const handleWrapperRegistry = new Map(); + +/** + * Register a wrapper factory for a type ID. + * Called by generated code to register wrapper classes. + */ +export function registerHandleWrapper(typeId: string, factory: HandleWrapperFactory): void { + handleWrapperRegistry.set(typeId, factory); +} + +/** + * Checks if a value is a marshalled handle and wraps it appropriately. + * Uses the wrapper registry to create typed wrapper instances when available. + * + * @param value - The value to potentially wrap + * @param client - Optional client for creating typed wrapper instances + */ +export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { + if (value && typeof value === 'object') { + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); + } + } + + return handle; + } + } + return value; +} + +// ============================================================================ +// Capability Error +// ============================================================================ + +/** + * Error thrown when an ATS capability invocation fails. + */ +export class CapabilityError extends Error { + constructor( + /** The structured error from the server */ + public readonly error: AtsError + ) { + super(error.message); + this.name = 'CapabilityError'; + } + + /** Machine-readable error code */ + get code(): string { + return this.error.code; + } + + /** The capability that failed (if applicable) */ + get capability(): string | undefined { + return this.error.capability; + } +} + +// ============================================================================ +// Callback Registry +// ============================================================================ + +const callbackRegistry = new Map(); +let callbackIdCounter = 0; + +/** + * Register a callback function that can be invoked from the .NET side. + * Returns a callback ID that should be passed to methods accepting callbacks. + * + * .NET passes arguments as an object with positional keys: `{ p0: value0, p1: value1, ... }` + * This function automatically extracts positional parameters and wraps handles. + * + * @example + * // Single parameter callback + * const id = registerCallback((ctx) => console.log(ctx)); + * // .NET sends: { p0: { $handle: "...", $type: "..." } } + * // Callback receives: Handle instance + * + * @example + * // Multi-parameter callback + * const id = registerCallback((a, b) => console.log(a, b)); + * // .NET sends: { p0: "hello", p1: 42 } + * // Callback receives: "hello", 42 + */ +export function registerCallback( + callback: (...args: any[]) => TResult | Promise +): string { + const callbackId = `callback_${++callbackIdCounter}_${Date.now()}`; + + // Wrap the callback to handle .NET's positional argument format + const wrapper: CallbackFunction = async (args: unknown, client: AspireClient) => { + // .NET sends args as object { p0: value0, p1: value1, ... } + if (args && typeof args === 'object' && !Array.isArray(args)) { + const argObj = args as Record; + const argArray: unknown[] = []; + + // Extract positional parameters (p0, p1, p2, ...) + for (let i = 0; ; i++) { + const key = `p${i}`; + if (key in argObj) { + argArray.push(wrapIfHandle(argObj[key], client)); + } else { + break; + } + } + + if (argArray.length > 0) { + // Spread positional arguments to callback + const result = await callback(...argArray); + // DTO writeback protocol: when a void callback returns undefined, we + // return the original args object so the .NET host can detect property + // mutations made by the callback and apply them back to the original + // C# DTO objects. DTO args are plain JS objects (not Handle wrappers), + // so any property changes the callback made are reflected in args. + // + // Non-void callbacks (result !== undefined) return their actual result. + // The .NET side only activates writeback for void delegates whose + // parameters include [AspireDto] types — all other cases discard the + // returned args object, so the extra wire payload is harmless. + // + // IMPORTANT: callbacks that intentionally return undefined will also + // trigger this path. For non-void delegate types, the C# proxy uses + // a result-unmarshalling path (not writeback), so returning args will + // cause an unmarshal error. Void callbacks should never return a + // meaningful value; non-void callbacks should always return one. + return result !== undefined ? result : args; + } + + // No positional params found — nothing to write back + return await callback(); + } + + // Null/undefined - call with no args + if (args === null || args === undefined) { + return await callback(); + } + + // Primitive value - pass as single arg (shouldn't happen with current protocol) + return await callback(wrapIfHandle(args, client)); + }; + + callbackRegistry.set(callbackId, wrapper); + return callbackId; +} + +/** + * Unregister a callback by its ID. + */ +export function unregisterCallback(callbackId: string): boolean { + return callbackRegistry.delete(callbackId); +} + +/** + * Get the number of registered callbacks. + */ +export function getCallbackCount(): number { + return callbackRegistry.size; +} + +// ============================================================================ +// Cancellation Token Registry +// ============================================================================ + +/** + * Registry for cancellation tokens. + * Maps cancellation IDs to cleanup functions. + */ +const cancellationRegistry = new Map void>(); +let cancellationIdCounter = 0; + +/** + * A reference to the current AspireClient for sending cancel requests. + * Set by AspireClient.connect(). + */ +let currentClient: AspireClient | null = null; + +/** + * Register an AbortSignal for cancellation support. + * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * + * When the AbortSignal is aborted, sends a cancelToken request to the host. + * + * @param signal - The AbortSignal to register (optional) + * @returns The cancellation ID, or undefined if no signal provided + * + * @example + * const controller = new AbortController(); + * const id = registerCancellation(controller.signal); + * // Pass id to capability invocation + * // Later: controller.abort() will cancel the operation + */ +export function registerCancellation(signal?: AbortSignal): string | undefined { + if (!signal) { + return undefined; + } + + // Already aborted? Don't register + if (signal.aborted) { + return undefined; + } + + const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; + + // Set up the abort listener + const onAbort = () => { + // Send cancel request to host + if (currentClient?.connected) { + currentClient.cancelToken(cancellationId).catch(() => { + // Ignore errors - the operation may have already completed + }); + } + // Clean up the listener + cancellationRegistry.delete(cancellationId); + }; + + // Listen for abort + signal.addEventListener('abort', onAbort, { once: true }); + + // Store cleanup function + cancellationRegistry.set(cancellationId, () => { + signal.removeEventListener('abort', onAbort); + }); + + return cancellationId; +} + +/** + * Unregister a cancellation token by its ID. + * Call this when the operation completes to clean up resources. + * + * @param cancellationId - The cancellation ID to unregister + */ +export function unregisterCancellation(cancellationId: string | undefined): void { + if (!cancellationId) { + return; + } + + const cleanup = cancellationRegistry.get(cancellationId); + if (cleanup) { + cleanup(); + cancellationRegistry.delete(cancellationId); + } +} + +// ============================================================================ +// AspireClient (JSON-RPC Connection) +// ============================================================================ + +/** + * Client for connecting to the Aspire AppHost via socket/named pipe. + */ +export class AspireClient { + private connection: rpc.MessageConnection | null = null; + private socket: net.Socket | null = null; + private disconnectCallbacks: (() => void)[] = []; + private _pendingCalls = 0; + + constructor(private socketPath: string) { } + + /** + * Register a callback to be called when the connection is lost + */ + onDisconnect(callback: () => void): void { + this.disconnectCallbacks.push(callback); + } + + private notifyDisconnect(): void { + for (const callback of this.disconnectCallbacks) { + try { + callback(); + } catch { + // Ignore callback errors + } + } + } + + connect(timeoutMs: number = 5000): Promise { + return new Promise((resolve, reject) => { + const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this.socket = net.createConnection(pipePath); + + this.socket.once('error', (error: Error) => { + clearTimeout(timeout); + reject(error); + }); + + this.socket.once('connect', () => { + clearTimeout(timeout); + try { + const reader = new rpc.SocketMessageReader(this.socket!); + const writer = new rpc.SocketMessageWriter(this.socket!); + this.connection = rpc.createMessageConnection(reader, writer); + + this.connection.onClose(() => { + this.connection = null; + this.notifyDisconnect(); + }); + this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); + + // Handle callback invocations from the .NET side + this.connection.onRequest('invokeCallback', async (callbackId: string, args: unknown) => { + const callback = callbackRegistry.get(callbackId); + if (!callback) { + throw new Error(`Callback not found: ${callbackId}`); + } + try { + // The registered wrapper handles arg unpacking and handle wrapping + // Pass this client so handles can be wrapped with typed wrapper classes + return await Promise.resolve(callback(args, this)); + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + throw new Error(`Callback execution failed: ${message}`); + } + }); + + this.connection.listen(); + + // Set the current client for cancellation registry + currentClient = this; + + resolve(); + } catch (e) { + reject(e); + } + }); + + this.socket.on('close', () => { + this.connection?.dispose(); + this.connection = null; + if (currentClient === this) { + currentClient = null; + } + this.notifyDisconnect(); + }); + }); + } + + ping(): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('ping'); + } + + /** + * Cancel a CancellationToken by its ID. + * Called when an AbortSignal is aborted. + * + * @param tokenId - The token ID to cancel + * @returns True if the token was found and cancelled, false otherwise + */ + cancelToken(tokenId: string): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('cancelToken', tokenId); + } + + /** + * Invoke an ATS capability by ID. + * + * Capabilities are operations exposed by [AspireExport] attributes. + * Results are automatically wrapped in Handle objects when applicable. + * + * @param capabilityId - The capability ID (e.g., "Aspire.Hosting/createBuilder") + * @param args - Arguments to pass to the capability + * @returns The capability result, wrapped as Handle if it's a handle type + * @throws CapabilityError if the capability fails + */ + async invokeCapability( + capabilityId: string, + args?: Record + ): Promise { + if (!this.connection) { + throw new Error('Not connected to AppHost'); + } + + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); + } + this._pendingCalls++; + + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + args ?? null + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } + } + + disconnect(): void { + try { this.connection?.dispose(); } finally { this.connection = null; } + try { this.socket?.end(); } finally { this.socket = null; } + } + + get connected(): boolean { + return this.connection !== null && this.socket !== null; + } +} diff --git a/samples/health-checks-ui/ts/package-lock.json b/samples/health-checks-ui/ts/package-lock.json new file mode 100644 index 00000000..c4d3800c --- /dev/null +++ b/samples/health-checks-ui/ts/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "ts", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/samples/orleans-voting/ts/.aspire/settings.json b/samples/orleans-voting/ts/.aspire/settings.json index a60c25b1..3a9d225e 100644 --- a/samples/orleans-voting/ts/.aspire/settings.json +++ b/samples/orleans-voting/ts/.aspire/settings.json @@ -1,3 +1,8 @@ { - "appHostPath": "../apphost.ts" + "appHostPath": "../apphost.ts", + "sdkVersion": "13.2.0-preview.1.26159.1", + "packages": { + "Aspire.Hosting.Redis": "13.1.2", + "Aspire.Hosting.Orleans": "13.1.2" + } } \ No newline at end of file diff --git a/samples/orleans-voting/ts/.modules/.codegen-hash b/samples/orleans-voting/ts/.modules/.codegen-hash new file mode 100644 index 00000000..dd6c8838 --- /dev/null +++ b/samples/orleans-voting/ts/.modules/.codegen-hash @@ -0,0 +1 @@ +CE101936110C8B56C4297D7C7545E8984957FCEB4E670953C016D56A8BF4FFF5 \ No newline at end of file diff --git a/samples/orleans-voting/ts/.modules/aspire.ts b/samples/orleans-voting/ts/.modules/aspire.ts new file mode 100644 index 00000000..73dc52d2 --- /dev/null +++ b/samples/orleans-voting/ts/.modules/aspire.ts @@ -0,0 +1,13306 @@ +// aspire.ts - Capability-based Aspire SDK +// This SDK uses the ATS (Aspire Type System) capability API. +// Capabilities are endpoints like 'Aspire.Hosting/createBuilder'. +// +// GENERATED CODE - DO NOT EDIT + +import { + AspireClient as AspireClientRpc, + Handle, + MarshalledHandle, + CapabilityError, + registerCallback, + wrapIfHandle, + registerHandleWrapper +} from './transport.js'; + +import { + ResourceBuilderBase, + ReferenceExpression, + refExpr, + AspireDict, + AspireList +} from './base.js'; + +// ============================================================================ +// Handle Type Aliases (Internal - not exported to users) +// ============================================================================ + +/** Handle to CommandLineArgsCallbackContext */ +type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; + +/** Handle to ContainerRegistryResource */ +type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; + +/** Handle to ContainerResource */ +type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource'>; + +/** Handle to CSharpAppResource */ +type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; + +/** Handle to DotnetToolResource */ +type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; + +/** Handle to EndpointReference */ +type EndpointReferenceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference'>; + +/** Handle to EndpointReferenceExpression */ +type EndpointReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression'>; + +/** Handle to EnvironmentCallbackContext */ +type EnvironmentCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext'>; + +/** Handle to ExecutableResource */ +type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource'>; + +/** Handle to ExecuteCommandContext */ +type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; + +/** Handle to IContainerFilesDestinationResource */ +type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; + +/** Handle to IResource */ +type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; + +/** Handle to IResourceWithArgs */ +type IResourceWithArgsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs'>; + +/** Handle to IResourceWithConnectionString */ +type IResourceWithConnectionStringHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString'>; + +/** Handle to IResourceWithEndpoints */ +type IResourceWithEndpointsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints'>; + +/** Handle to IResourceWithEnvironment */ +type IResourceWithEnvironmentHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment'>; + +/** Handle to IResourceWithWaitSupport */ +type IResourceWithWaitSupportHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport'>; + +/** Handle to ParameterResource */ +type ParameterResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource'>; + +/** Handle to ProjectResource */ +type ProjectResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource'>; + +/** Handle to ReferenceExpression */ +type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression'>; + +/** Handle to ReferenceExpressionBuilder */ +type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; + +/** Handle to ResourceLoggerService */ +type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; + +/** Handle to ResourceNotificationService */ +type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; + +/** Handle to ResourceUrlsCallbackContext */ +type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; + +/** Handle to ConnectionStringResource */ +type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; + +/** Handle to DistributedApplication */ +type DistributedApplicationHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplication'>; + +/** Handle to DistributedApplicationExecutionContext */ +type DistributedApplicationExecutionContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext'>; + +/** Handle to DistributedApplicationEventSubscription */ +type DistributedApplicationEventSubscriptionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.DistributedApplicationEventSubscription'>; + +/** Handle to IDistributedApplicationEventing */ +type IDistributedApplicationEventingHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing'>; + +/** Handle to ExternalServiceResource */ +type ExternalServiceResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ExternalServiceResource'>; + +/** Handle to IDistributedApplicationBuilder */ +type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder'>; + +/** Handle to IResourceWithContainerFiles */ +type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; + +/** Handle to IResourceWithServiceDiscovery */ +type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; + +/** Handle to PipelineConfigurationContext */ +type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; + +/** Handle to PipelineStep */ +type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; + +/** Handle to PipelineStepContext */ +type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; + +/** Handle to ProjectResourceOptions */ +type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; + +/** Handle to Dict */ +type DictstringanyHandle = Handle<'Aspire.Hosting/Dict'>; + +/** Handle to List */ +type ListanyHandle = Handle<'Aspire.Hosting/List'>; + +/** Handle to IConfiguration */ +type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; + +/** Handle to IHostEnvironment */ +type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; + +/** Handle to ILogger */ +type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; + +/** Handle to string[] */ +type stringArrayHandle = Handle<'string[]'>; + +/** Handle to IServiceProvider */ +type IServiceProviderHandle = Handle<'System.ComponentModel/System.IServiceProvider'>; + +// ============================================================================ +// Enum Types +// ============================================================================ + +/** Enum type for CertificateTrustScope */ +export enum CertificateTrustScope { + None = "None", + Append = "Append", + Override = "Override", + System = "System", +} + +/** Enum type for ContainerLifetime */ +export enum ContainerLifetime { + Session = "Session", + Persistent = "Persistent", +} + +/** Enum type for DistributedApplicationOperation */ +export enum DistributedApplicationOperation { + Run = "Run", + Publish = "Publish", +} + +/** Enum type for EndpointProperty */ +export enum EndpointProperty { + Url = "Url", + Host = "Host", + IPV4Host = "IPV4Host", + Port = "Port", + Scheme = "Scheme", + TargetPort = "TargetPort", + HostAndPort = "HostAndPort", +} + +/** Enum type for IconVariant */ +export enum IconVariant { + Regular = "Regular", + Filled = "Filled", +} + +/** Enum type for ImagePullPolicy */ +export enum ImagePullPolicy { + Default = "Default", + Always = "Always", + Missing = "Missing", + Never = "Never", +} + +/** Enum type for OtlpProtocol */ +export enum OtlpProtocol { + Grpc = "Grpc", + HttpProtobuf = "HttpProtobuf", + HttpJson = "HttpJson", +} + +/** Enum type for ProbeType */ +export enum ProbeType { + Startup = "Startup", + Readiness = "Readiness", + Liveness = "Liveness", +} + +/** Enum type for ProtocolType */ +export enum ProtocolType { + IP = "IP", + IPv6HopByHopOptions = "IPv6HopByHopOptions", + Unspecified = "Unspecified", + Icmp = "Icmp", + Igmp = "Igmp", + Ggp = "Ggp", + IPv4 = "IPv4", + Tcp = "Tcp", + Pup = "Pup", + Udp = "Udp", + Idp = "Idp", + IPv6 = "IPv6", + IPv6RoutingHeader = "IPv6RoutingHeader", + IPv6FragmentHeader = "IPv6FragmentHeader", + IPSecEncapsulatingSecurityPayload = "IPSecEncapsulatingSecurityPayload", + IPSecAuthenticationHeader = "IPSecAuthenticationHeader", + IcmpV6 = "IcmpV6", + IPv6NoNextHeader = "IPv6NoNextHeader", + IPv6DestinationOptions = "IPv6DestinationOptions", + ND = "ND", + Raw = "Raw", + Ipx = "Ipx", + Spx = "Spx", + SpxII = "SpxII", + Unknown = "Unknown", +} + +/** Enum type for UrlDisplayLocation */ +export enum UrlDisplayLocation { + SummaryAndDetails = "SummaryAndDetails", + DetailsOnly = "DetailsOnly", +} + +/** Enum type for WaitBehavior */ +export enum WaitBehavior { + WaitOnResourceUnavailable = "WaitOnResourceUnavailable", + StopOnResourceUnavailable = "StopOnResourceUnavailable", +} + +// ============================================================================ +// DTO Interfaces +// ============================================================================ + +/** DTO interface for CommandOptions */ +export interface CommandOptions { + description?: string; + parameter?: any; + confirmationMessage?: string; + iconName?: string; + iconVariant?: IconVariant; + isHighlighted?: boolean; + updateState?: any; +} + +/** DTO interface for CreateBuilderOptions */ +export interface CreateBuilderOptions { + args?: string[]; + projectDirectory?: string; + appHostFilePath?: string; + containerRegistryOverride?: string; + disableDashboard?: boolean; + dashboardApplicationName?: string; + allowUnsecuredTransport?: boolean; + enableResourceLogging?: boolean; +} + +/** DTO interface for ExecuteCommandResult */ +export interface ExecuteCommandResult { + success?: boolean; + canceled?: boolean; + errorMessage?: string; +} + +/** DTO interface for ResourceEventDto */ +export interface ResourceEventDto { + resourceName?: string; + resourceId?: string; + state?: string; + stateStyle?: string; + healthStatus?: string; + exitCode?: number; +} + +/** DTO interface for ResourceUrlAnnotation */ +export interface ResourceUrlAnnotation { + url?: string; + displayText?: string; + endpoint?: EndpointReferenceHandle; + displayLocation?: UrlDisplayLocation; +} + +// ============================================================================ +// Options Interfaces +// ============================================================================ + +export interface AddConnectionStringOptions { + environmentVariableName?: string; +} + +export interface AddContainerRegistryOptions { + repository?: ParameterResource; +} + +export interface AddDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface AddParameterFromConfigurationOptions { + secret?: boolean; +} + +export interface AddParameterOptions { + secret?: boolean; +} + +export interface AppendFormattedOptions { + format?: string; +} + +export interface AppendValueProviderOptions { + format?: string; +} + +export interface GetValueAsyncOptions { + cancellationToken?: AbortSignal; +} + +export interface RunOptions { + cancellationToken?: AbortSignal; +} + +export interface WaitForCompletionOptions { + exitCode?: number; +} + +export interface WithBindMountOptions { + isReadOnly?: boolean; +} + +export interface WithCommandOptions { + commandOptions?: CommandOptions; +} + +export interface WithDescriptionOptions { + enableMarkdown?: boolean; +} + +export interface WithDockerfileBaseImageOptions { + buildImage?: string; + runtimeImage?: string; +} + +export interface WithDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface WithEndpointOptions { + port?: number; + targetPort?: number; + scheme?: string; + name?: string; + env?: string; + isProxied?: boolean; + isExternal?: boolean; + protocol?: ProtocolType; +} + +export interface WithExternalServiceHttpHealthCheckOptions { + path?: string; + statusCode?: number; +} + +export interface WithHttpEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithHttpHealthCheckOptions { + path?: string; + statusCode?: number; + endpointName?: string; +} + +export interface WithHttpProbeOptions { + path?: string; + initialDelaySeconds?: number; + periodSeconds?: number; + timeoutSeconds?: number; + failureThreshold?: number; + successThreshold?: number; + endpointName?: string; +} + +export interface WithHttpsDeveloperCertificateOptions { + password?: ParameterResource; +} + +export interface WithHttpsEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithIconNameOptions { + iconVariant?: IconVariant; +} + +export interface WithImageOptions { + tag?: string; +} + +export interface WithMcpServerOptions { + path?: string; + endpointName?: string; +} + +export interface WithPipelineStepFactoryOptions { + dependsOn?: string[]; + requiredBy?: string[]; + tags?: string[]; + description?: string; +} + +export interface WithReferenceOptions { + connectionName?: string; + optional?: boolean; +} + +export interface WithRequiredCommandOptions { + helpLink?: string; +} + +export interface WithUrlExpressionOptions { + displayText?: string; +} + +export interface WithUrlOptions { + displayText?: string; +} + +export interface WithVolumeOptions { + name?: string; + isReadOnly?: boolean; +} + +// ============================================================================ +// CommandLineArgsCallbackContext +// ============================================================================ + +/** + * Type class for CommandLineArgsCallbackContext. + */ +export class CommandLineArgsCallbackContext { + constructor(private _handle: CommandLineArgsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Args property */ + private _args?: AspireList; + get args(): AspireList { + if (!this._args) { + this._args = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args', + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args' + ); + } + return this._args; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplication +// ============================================================================ + +/** + * Type class for DistributedApplication. + */ +export class DistributedApplication { + constructor(private _handle: DistributedApplicationHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Runs the distributed application */ + /** @internal */ + async _runInternal(cancellationToken?: AbortSignal): Promise { + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + await this._client.invokeCapability( + 'Aspire.Hosting/run', + rpcArgs + ); + return this; + } + + run(options?: RunOptions): DistributedApplicationPromise { + const cancellationToken = options?.cancellationToken; + return new DistributedApplicationPromise(this._runInternal(cancellationToken)); + } + +} + +/** + * Thenable wrapper for DistributedApplication that enables fluent chaining. + */ +export class DistributedApplicationPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplication) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Runs the distributed application */ + run(options?: RunOptions): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.run(options))); + } + +} + +// ============================================================================ +// DistributedApplicationExecutionContext +// ============================================================================ + +/** + * Type class for DistributedApplicationExecutionContext. + */ +export class DistributedApplicationExecutionContext { + constructor(private _handle: DistributedApplicationExecutionContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PublisherName property */ + publisherName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.publisherName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.setPublisherName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Operation property */ + operation = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.operation', + { context: this._handle } + ); + }, + }; + + /** Gets the IsPublishMode property */ + isPublishMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isPublishMode', + { context: this._handle } + ); + }, + }; + + /** Gets the IsRunMode property */ + isRunMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isRunMode', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EndpointReference +// ============================================================================ + +/** + * Type class for EndpointReference. + */ +export class EndpointReference { + constructor(private _handle: EndpointReferenceHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EndpointName property */ + endpointName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.endpointName', + { context: this._handle } + ); + }, + }; + + /** Gets the ErrorMessage property */ + errorMessage = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.errorMessage', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.setErrorMessage', + { context: this._handle, value } + ); + } + }; + + /** Gets the IsAllocated property */ + isAllocated = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isAllocated', + { context: this._handle } + ); + }, + }; + + /** Gets the Exists property */ + exists = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.exists', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttp property */ + isHttp = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttp', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttps property */ + isHttps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttps', + { context: this._handle } + ); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.port', + { context: this._handle } + ); + }, + }; + + /** Gets the TargetPort property */ + targetPort = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.targetPort', + { context: this._handle } + ); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.host', + { context: this._handle } + ); + }, + }; + + /** Gets the Scheme property */ + scheme = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.scheme', + { context: this._handle } + ); + }, + }; + + /** Gets the Url property */ + url = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.url', + { context: this._handle } + ); + }, + }; + + /** Gets the URL of the endpoint asynchronously */ + async getValueAsync(options?: GetValueAsyncOptions): Promise { + const cancellationToken = options?.cancellationToken; + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValueAsync', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for EndpointReference that enables fluent chaining. + */ +export class EndpointReferencePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: EndpointReference) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets the URL of the endpoint asynchronously */ + getValueAsync(options?: GetValueAsyncOptions): Promise { + return this._promise.then(obj => obj.getValueAsync(options)); + } + +} + +// ============================================================================ +// EndpointReferenceExpression +// ============================================================================ + +/** + * Type class for EndpointReferenceExpression. + */ +export class EndpointReferenceExpression { + constructor(private _handle: EndpointReferenceExpressionHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Endpoint property */ + endpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.endpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Property property */ + property = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.property', + { context: this._handle } + ); + }, + }; + + /** Gets the ValueExpression property */ + valueExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.valueExpression', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EnvironmentCallbackContext +// ============================================================================ + +/** + * Type class for EnvironmentCallbackContext. + */ +export class EnvironmentCallbackContext { + constructor(private _handle: EnvironmentCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EnvironmentVariables property */ + private _environmentVariables?: AspireDict; + get environmentVariables(): AspireDict { + if (!this._environmentVariables) { + this._environmentVariables = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables', + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables' + ); + } + return this._environmentVariables; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ExecuteCommandContext +// ============================================================================ + +/** + * Type class for ExecuteCommandContext. + */ +export class ExecuteCommandContext { + constructor(private _handle: ExecuteCommandContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ResourceName property */ + resourceName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.resourceName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setResourceName', + { context: this._handle, value } + ); + } + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', + { context: this._handle } + ); + }, + set: async (value: AbortSignal): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + { context: this._handle } + ); + }, + set: async (value: PipelineStep[]): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', + { context: this._handle, value } + ); + } + }; + + /** Gets pipeline steps with the specified tag */ + async getStepsByTag(tag: string): Promise { + const rpcArgs: Record = { context: this._handle, tag }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/getStepsByTag', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for PipelineConfigurationContext that enables fluent chaining. + */ +export class PipelineConfigurationContextPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineConfigurationContext) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets pipeline steps with the specified tag */ + getStepsByTag(tag: string): Promise { + return this._promise.then(obj => obj.getStepsByTag(tag)); + } + +} + +// ============================================================================ +// PipelineStep +// ============================================================================ + +/** + * Type class for PipelineStep. + */ +export class PipelineStep { + constructor(private _handle: PipelineStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.name', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Description property */ + description = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.description', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setDescription', + { context: this._handle, value } + ); + } + }; + + /** Gets the DependsOnSteps property */ + private _dependsOnSteps?: AspireList; + get dependsOnSteps(): AspireList { + if (!this._dependsOnSteps) { + this._dependsOnSteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps', + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps' + ); + } + return this._dependsOnSteps; + } + + /** Gets the RequiredBySteps property */ + private _requiredBySteps?: AspireList; + get requiredBySteps(): AspireList { + if (!this._requiredBySteps) { + this._requiredBySteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps', + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps' + ); + } + return this._requiredBySteps; + } + + /** Gets the Tags property */ + private _tags?: AspireList; + get tags(): AspireList { + if (!this._tags) { + this._tags = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.tags', + 'Aspire.Hosting.Pipelines/PipelineStep.tags' + ); + } + return this._tags; + } + + /** Adds a dependency on another step by name */ + /** @internal */ + async _dependsOnInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/dependsOn', + rpcArgs + ); + return this; + } + + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._dependsOnInternal(stepName)); + } + + /** Specifies that another step requires this step by name */ + /** @internal */ + async _requiredByInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/requiredBy', + rpcArgs + ); + return this; + } + + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._requiredByInternal(stepName)); + } + +} + +/** + * Thenable wrapper for PipelineStep that enables fluent chaining. + */ +export class PipelineStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineStep) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a dependency on another step by name */ + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.dependsOn(stepName))); + } + + /** Specifies that another step requires this step by name */ + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.requiredBy(stepName))); + } + +} + +// ============================================================================ +// PipelineStepContext +// ============================================================================ + +/** + * Type class for PipelineStepContext. + */ +export class PipelineStepContext { + constructor(private _handle: PipelineStepContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// ProjectResourceOptions +// ============================================================================ + +/** + * Type class for ProjectResourceOptions. + */ +export class ProjectResourceOptions { + constructor(private _handle: ProjectResourceOptionsHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the LaunchProfileName property */ + launchProfileName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.launchProfileName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setLaunchProfileName', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeLaunchProfile property */ + excludeLaunchProfile = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeLaunchProfile', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeLaunchProfile', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeKestrelEndpoints property */ + excludeKestrelEndpoints = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeKestrelEndpoints', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeKestrelEndpoints', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// ReferenceExpressionBuilder +// ============================================================================ + +/** + * Type class for ReferenceExpressionBuilder. + */ +export class ReferenceExpressionBuilder { + constructor(private _handle: ReferenceExpressionBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the IsEmpty property */ + isEmpty = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ReferenceExpressionBuilder.isEmpty', + { context: this._handle } + ); + }, + }; + + /** Appends a literal string to the reference expression */ + /** @internal */ + async _appendLiteralInternal(value: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendLiteral', + rpcArgs + ); + return this; + } + + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._appendLiteralInternal(value)); + } + + /** Appends a formatted string value to the reference expression */ + /** @internal */ + async _appendFormattedInternal(value: string, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendFormatted', + rpcArgs + ); + return this; + } + + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendFormattedInternal(value, format)); + } + + /** Appends a value provider to the reference expression */ + /** @internal */ + async _appendValueProviderInternal(valueProvider: any, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, valueProvider }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendValueProvider', + rpcArgs + ); + return this; + } + + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendValueProviderInternal(valueProvider, format)); + } + + /** Builds the reference expression */ + async build(): Promise { + const rpcArgs: Record = { context: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/build', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ReferenceExpressionBuilder that enables fluent chaining. + */ +export class ReferenceExpressionBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReferenceExpressionBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Appends a literal string to the reference expression */ + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendLiteral(value))); + } + + /** Appends a formatted string value to the reference expression */ + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendFormatted(value, options))); + } + + /** Appends a value provider to the reference expression */ + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendValueProvider(valueProvider, options))); + } + + /** Builds the reference expression */ + build(): Promise { + return this._promise.then(obj => obj.build()); + } + +} + +// ============================================================================ +// ResourceUrlsCallbackContext +// ============================================================================ + +/** + * Type class for ResourceUrlsCallbackContext. + */ +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Builds the distributed application */ + /** @internal */ + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', + rpcArgs + ); + return new DistributedApplication(result, this._client); + } + + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); + } + + /** Adds a connection string with a builder callback */ + /** @internal */ + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionStringBuilder', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + } + + /** Adds a container registry resource */ + /** @internal */ + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + } + + /** Adds a container resource */ + /** @internal */ + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); + } + + /** Adds a container resource built from a Dockerfile */ + /** @internal */ + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); + } + + /** Adds a .NET tool resource */ + /** @internal */ + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + } + + /** Adds an executable resource */ + /** @internal */ + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + } + + /** Adds an external service resource */ + /** @internal */ + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); + } + + /** Adds a parameter resource */ + /** @internal */ + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); + } + + /** Adds a parameter sourced from configuration */ + /** @internal */ + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + } + + /** Adds a connection string resource */ + /** @internal */ + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + } + + /** Adds a .NET project resource */ + /** @internal */ + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + } + + /** Adds a project resource with configuration options */ + /** @internal */ + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + } + + /** Adds a C# application resource */ + /** @internal */ + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + } + + /** Adds a C# application resource with configuration options */ + /** @internal */ + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + */ +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); + } + + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + } + + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + } + + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + } + + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + } + + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + } + + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); + } + + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + } + + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); + } + + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + } + + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); + } + + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); + } + + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); + } + + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); + } + + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); + } + +} + +// ============================================================================ +// DistributedApplicationEventing +// ============================================================================ + +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Unsubscribe method */ + /** @internal */ + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + rpcArgs + ); + return this; + } + + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ + +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerResource +// ============================================================================ + +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + const exitCode = options?.exitCode; + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + const password = options?.password; + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// CSharpAppResource +// ============================================================================ + +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + const exitCode = options?.exitCode; + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + const commandOptions = options?.commandOptions; + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + const password = options?.password; + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + const iconVariant = options?.iconVariant; + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// DotnetToolResource +// ============================================================================ + +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + } + + /** @internal */ + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + } + + /** @internal */ + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + } + + /** @internal */ + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + } + + /** @internal */ + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + } + + /** @internal */ + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + const exitCode = options?.exitCode; + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + const commandOptions = options?.commandOptions; + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + const password = options?.password; + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + const iconVariant = options?.iconVariant; + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for DotnetToolResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExecutableResource +// ============================================================================ + +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerFilesDestinationResource +// ============================================================================ + +export class ContainerFilesDestinationResource extends ResourceBuilderBase { + constructor(handle: IContainerFilesDestinationResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ContainerFilesDestinationResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + +} + +/** + * Thenable wrapper for ContainerFilesDestinationResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerFilesDestinationResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerFilesDestinationResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + +} + +// ============================================================================ +// Resource +// ============================================================================ + +export class Resource extends ResourceBuilderBase { + constructor(handle: IResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + const helpLink = options?.helpLink; + return new ResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + const commandOptions = options?.commandOptions; + return new ResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + const iconVariant = options?.iconVariant; + return new ResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for Resource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Resource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ResourceWithArgs +// ============================================================================ + +export class ResourceWithArgs extends ResourceBuilderBase { + constructor(handle: IResourceWithArgsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackAsyncInternal(callback)); + } + +} + +/** + * Thenable wrapper for ResourceWithArgs that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithArgsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithArgs) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + +} + +// ============================================================================ +// ResourceWithConnectionString +// ============================================================================ + +export class ResourceWithConnectionString extends ResourceBuilderBase { + constructor(handle: IResourceWithConnectionStringHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyValueInternal(name, value)); + } + +} + +/** + * Thenable wrapper for ResourceWithConnectionString that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithConnectionStringPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithConnectionString) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + +} + +// ============================================================================ +// ResourceWithContainerFiles +// ============================================================================ + +export class ResourceWithContainerFiles extends ResourceBuilderBase { + constructor(handle: IResourceWithContainerFilesHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._clearContainerFilesSourcesInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithContainerFiles that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithContainerFilesPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithContainerFiles) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + +} + +// ============================================================================ +// ResourceWithEndpoints +// ============================================================================ + +export class ResourceWithEndpoints extends ResourceBuilderBase { + constructor(handle: IResourceWithEndpointsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ResourceWithEndpointsPromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + +} + +/** + * Thenable wrapper for ResourceWithEndpoints that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEndpointsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEndpoints) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + +} + +// ============================================================================ +// ResourceWithEnvironment +// ============================================================================ + +export class ResourceWithEnvironment extends ResourceBuilderBase { + constructor(handle: IResourceWithEnvironmentHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + const password = options?.password; + return new ResourceWithEnvironmentPromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withoutHttpsCertificateInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithEnvironment that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + +} + +// ============================================================================ +// ResourceWithServiceDiscovery +// ============================================================================ + +export class ResourceWithServiceDiscovery extends ResourceBuilderBase { + constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { + super(handle, client); + } + +} + +/** + * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithServiceDiscoveryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + +} + +// ============================================================================ +// ResourceWithWaitSupport +// ============================================================================ + +export class ResourceWithWaitSupport extends ResourceBuilderBase { + constructor(handle: IResourceWithWaitSupportHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + const exitCode = options?.exitCode; + return new ResourceWithWaitSupportPromise(this._waitForCompletionInternal(dependency, exitCode)); + } + +} + +/** + * Thenable wrapper for ResourceWithWaitSupport that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithWaitSupportPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithWaitSupport) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + +} + +// ============================================================================ +// Connection Helper +// ============================================================================ + +/** + * Creates and connects to the Aspire AppHost. + * Reads connection info from environment variables set by `aspire run`. + */ +export async function connect(): Promise { + const socketPath = process.env.REMOTE_APP_HOST_SOCKET_PATH; + if (!socketPath) { + throw new Error( + 'REMOTE_APP_HOST_SOCKET_PATH environment variable not set. ' + + 'Run this application using `aspire run`.' + ); + } + + const client = new AspireClientRpc(socketPath); + await client.connect(); + + // Exit the process if the server connection is lost + client.onDisconnect(() => { + console.error('Connection to AppHost lost. Exiting...'); + process.exit(1); + }); + + return client; +} + +/** + * Creates a new distributed application builder. + * This is the entry point for building Aspire applications. + * + * @param options - Optional configuration options for the builder + * @returns A DistributedApplicationBuilder instance + * + * @example + * const builder = await createBuilder(); + * builder.addRedis("cache"); + * builder.addContainer("api", "mcr.microsoft.com/dotnet/samples:aspnetapp"); + * const app = await builder.build(); + * await app.run(); + */ +export async function createBuilder(options?: CreateBuilderOptions): Promise { + const client = await connect(); + + // Default args, projectDirectory, and appHostFilePath if not provided + // ASPIRE_APPHOST_FILEPATH is set by the CLI for consistent socket hash computation + const effectiveOptions: CreateBuilderOptions = { + ...options, + args: options?.args ?? process.argv.slice(2), + projectDirectory: options?.projectDirectory ?? process.env.ASPIRE_PROJECT_DIRECTORY ?? process.cwd(), + appHostFilePath: options?.appHostFilePath ?? process.env.ASPIRE_APPHOST_FILEPATH + }; + + const handle = await client.invokeCapability( + 'Aspire.Hosting/createBuilderWithOptions', + { options: effectiveOptions } + ); + return new DistributedApplicationBuilder(handle, client); +} + +// Re-export commonly used types +export { Handle, CapabilityError, registerCallback } from './transport.js'; +export { refExpr, ReferenceExpression } from './base.js'; + +// ============================================================================ +// Global Error Handling +// ============================================================================ + +/** + * Set up global error handlers to ensure the process exits properly on errors. + * Node.js doesn't exit on unhandled rejections by default, so we need to handle them. + */ +process.on('unhandledRejection', (reason: unknown) => { + const error = reason instanceof Error ? reason : new Error(String(reason)); + + if (reason instanceof CapabilityError) { + console.error(`\n❌ Capability Error: ${error.message}`); + console.error(` Code: ${(reason as CapabilityError).code}`); + if ((reason as CapabilityError).capability) { + console.error(` Capability: ${(reason as CapabilityError).capability}`); + } + } else { + console.error(`\n❌ Unhandled Error: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + } + + process.exit(1); +}); + +process.on('uncaughtException', (error: Error) => { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + process.exit(1); +}); + +// ============================================================================ +// Handle Wrapper Registrations +// ============================================================================ + +// Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource', (handle, client) => new CSharpAppResource(handle as CSharpAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString', (handle, client) => new ResourceWithConnectionString(handle as IResourceWithConnectionStringHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); + diff --git a/samples/orleans-voting/ts/.modules/base.ts b/samples/orleans-voting/ts/.modules/base.ts new file mode 100644 index 00000000..7778b0f1 --- /dev/null +++ b/samples/orleans-voting/ts/.modules/base.ts @@ -0,0 +1,473 @@ +// aspire.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle } from './transport.js'; + +// Re-export transport types for convenience +export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; +export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; + +// ============================================================================ +// Reference Expression +// ============================================================================ + +/** + * Represents a reference expression that can be passed to capabilities. + * + * Reference expressions are serialized in the protocol as: + * ```json + * { + * "$expr": { + * "format": "redis://{0}:{1}", + * "valueProviders": [ + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:1" }, + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:2" } + * ] + * } + * } + * ``` + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export class ReferenceExpression { + // Expression mode fields + private readonly _format?: string; + private readonly _valueProviders?: unknown[]; + + // Handle mode fields (when wrapping a server-returned handle) + private readonly _handle?: Handle; + private readonly _client?: AspireClient; + + constructor(format: string, valueProviders: unknown[]); + constructor(handle: Handle, client: AspireClient); + constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { + if (typeof handleOrFormat === 'string') { + this._format = handleOrFormat; + this._valueProviders = clientOrValueProviders as unknown[]; + } else { + this._handle = handleOrFormat; + this._client = clientOrValueProviders as AspireClient; + } + } + + /** + * Creates a reference expression from a tagged template literal. + * + * @param strings - The template literal string parts + * @param values - The interpolated values (handles to value providers) + * @returns A ReferenceExpression instance + */ + static create(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + // Build the format string with {0}, {1}, etc. placeholders + let format = ''; + for (let i = 0; i < strings.length; i++) { + format += strings[i]; + if (i < values.length) { + format += `{${i}}`; + } + } + + // Extract handles from values + const valueProviders = values.map(extractHandleForExpr); + + return new ReferenceExpression(format, valueProviders); + } + + /** + * Serializes the reference expression for JSON-RPC transport. + * In template-literal mode, uses the $expr format. + * In handle mode, delegates to the handle's serialization. + */ + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + if (this._handle) { + return this._handle.toJSON(); + } + + return { + $expr: { + format: this._format!, + valueProviders: this._valueProviders && this._valueProviders.length > 0 ? this._valueProviders : undefined + } + }; + } + + /** + * String representation for debugging. + */ + toString(): string { + if (this._handle) { + return `ReferenceExpression(handle)`; + } + return `ReferenceExpression(${this._format})`; + } +} + +/** + * Extracts a value for use in reference expressions. + * Supports handles (objects) and string literals. + * @internal + */ +function extractHandleForExpr(value: unknown): unknown { + if (value === null || value === undefined) { + throw new Error('Cannot use null or undefined in reference expression'); + } + + // String literals - include directly in the expression + if (typeof value === 'string') { + return value; + } + + // Number literals - convert to string + if (typeof value === 'number') { + return String(value); + } + + // Handle objects - get their JSON representation + if (value instanceof Handle) { + return value.toJSON(); + } + + // Objects with $handle property (already in handle format) + if (typeof value === 'object' && value !== null && '$handle' in value) { + return value; + } + + // Objects with toJSON that returns a handle + if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { + const json = value.toJSON(); + if (json && typeof json === 'object' && '$handle' in json) { + return json; + } + } + + throw new Error( + `Cannot use value of type ${typeof value} in reference expression. ` + + `Expected a Handle, string, or number.` + ); +} + +/** + * Tagged template function for creating reference expressions. + * + * Use this to create dynamic expressions that reference endpoints, parameters, and other + * value providers. The expression is evaluated at runtime by Aspire. + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression using the tagged template + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export function refExpr(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + return ReferenceExpression.create(strings, ...values); +} + +// ============================================================================ +// ResourceBuilderBase +// ============================================================================ + +/** + * Base class for resource builders (e.g., RedisBuilder, ContainerBuilder). + * Provides handle management and JSON serialization. + */ +export class ResourceBuilderBase { + constructor(protected _handle: THandle, protected _client: AspireClient) {} + + toJSON(): MarshalledHandle { return this._handle.toJSON(); } +} + +// ============================================================================ +// AspireList - Mutable List Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET List. + * Provides array-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const items = await resource.getItems(); // Returns AspireList + * const count = await items.count(); + * const first = await items.get(0); + * await items.add(newItem); + * ``` + */ +export class AspireList { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the list handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual list handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual list handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of elements in the list. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.length', { + list: handle + }) as number; + } + + /** + * Gets the element at the specified index. + */ + async get(index: number): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.get', { + list: handle, + index + }) as T; + } + + /** + * Adds an element to the end of the list. + */ + async add(item: T): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.add', { + list: handle, + item + }); + } + + /** + * Removes the element at the specified index. + */ + async removeAt(index: number): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.removeAt', { + list: handle, + index + }); + } + + /** + * Clears all elements from the list. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.clear', { + list: handle + }); + } + + /** + * Converts the list to an array (creates a copy). + */ + async toArray(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.toArray', { + list: handle + }) as T[]; + } + + toJSON(): MarshalledHandle { + if (this._resolvedHandle) { + return this._resolvedHandle.toJSON(); + } + return this._handleOrContext.toJSON(); + } +} + +// ============================================================================ +// AspireDict - Mutable Dictionary Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET Dictionary. + * Provides object-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const config = await resource.getConfig(); // Returns AspireDict + * const value = await config.get("key"); + * await config.set("key", "value"); + * const hasKey = await config.containsKey("key"); + * ``` + */ +export class AspireDict { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the dictionary handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual dictionary handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual dictionary handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of key-value pairs in the dictionary. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.count', { + dict: handle + }) as number; + } + + /** + * Gets the value associated with the specified key. + * @throws If the key is not found. + */ + async get(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.get', { + dict: handle, + key + }) as V; + } + + /** + * Sets the value for the specified key. + */ + async set(key: K, value: V): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.set', { + dict: handle, + key, + value + }); + } + + /** + * Determines whether the dictionary contains the specified key. + */ + async containsKey(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.has', { + dict: handle, + key + }) as boolean; + } + + /** + * Removes the value with the specified key. + * @returns True if the element was removed; false if the key was not found. + */ + async remove(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.remove', { + dict: handle, + key + }) as boolean; + } + + /** + * Clears all key-value pairs from the dictionary. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.clear', { + dict: handle + }); + } + + /** + * Gets all keys in the dictionary. + */ + async keys(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.keys', { + dict: handle + }) as K[]; + } + + /** + * Gets all values in the dictionary. + */ + async values(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.values', { + dict: handle + }) as V[]; + } + + /** + * Converts the dictionary to a plain object (creates a copy). + * Only works when K is string. + */ + async toObject(): Promise> { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.toObject', { + dict: handle + }) as Record; + } + + async toJSON(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } +} diff --git a/samples/orleans-voting/ts/.modules/transport.ts b/samples/orleans-voting/ts/.modules/transport.ts new file mode 100644 index 00000000..7bddd74b --- /dev/null +++ b/samples/orleans-voting/ts/.modules/transport.ts @@ -0,0 +1,574 @@ +// transport.ts - ATS transport layer: RPC, Handle, errors, callbacks +import * as net from 'net'; +import * as rpc from 'vscode-jsonrpc/node.js'; + +// ============================================================================ +// Base Types +// ============================================================================ + +/** + * Type for callback functions that can be registered and invoked from .NET. + * Internal: receives args and client for handle wrapping. + */ +export type CallbackFunction = (args: unknown, client: AspireClient) => unknown | Promise; + +/** + * Represents a handle to a .NET object in the ATS system. + * Handles are typed references that can be passed between capabilities. + */ +export interface MarshalledHandle { + /** The handle ID (instance number) */ + $handle: string; + /** The ATS type ID */ + $type: string; +} + +/** + * Error details for ATS errors. + */ +export interface AtsErrorDetails { + /** The parameter that caused the error */ + parameter?: string; + /** The expected type or value */ + expected?: string; + /** The actual type or value */ + actual?: string; +} + +/** + * Structured error from ATS capability invocation. + */ +export interface AtsError { + /** Machine-readable error code */ + code: string; + /** Human-readable error message */ + message: string; + /** The capability that failed (if applicable) */ + capability?: string; + /** Additional error details */ + details?: AtsErrorDetails; +} + +/** + * ATS error codes returned by the server. + */ +export const AtsErrorCodes = { + /** Unknown capability ID */ + CapabilityNotFound: 'CAPABILITY_NOT_FOUND', + /** Handle ID doesn't exist or was disposed */ + HandleNotFound: 'HANDLE_NOT_FOUND', + /** Handle type doesn't satisfy capability's type constraint */ + TypeMismatch: 'TYPE_MISMATCH', + /** Missing required argument or wrong type */ + InvalidArgument: 'INVALID_ARGUMENT', + /** Argument value outside valid range */ + ArgumentOutOfRange: 'ARGUMENT_OUT_OF_RANGE', + /** Error occurred during callback invocation */ + CallbackError: 'CALLBACK_ERROR', + /** Unexpected error in capability execution */ + InternalError: 'INTERNAL_ERROR', +} as const; + +/** + * Type guard to check if a value is an ATS error response. + */ +export function isAtsError(value: unknown): value is { $error: AtsError } { + return ( + value !== null && + typeof value === 'object' && + '$error' in value && + typeof (value as { $error: unknown }).$error === 'object' + ); +} + +/** + * Type guard to check if a value is a marshalled handle. + */ +export function isMarshalledHandle(value: unknown): value is MarshalledHandle { + return ( + value !== null && + typeof value === 'object' && + '$handle' in value && + '$type' in value + ); +} + +// ============================================================================ +// Handle +// ============================================================================ + +/** + * A typed handle to a .NET object in the ATS system. + * Handles are opaque references that can be passed to capabilities. + * + * @typeParam T - The ATS type ID (e.g., "Aspire.Hosting/IDistributedApplicationBuilder") + */ +export class Handle { + private readonly _handleId: string; + private readonly _typeId: T; + + constructor(marshalled: MarshalledHandle) { + this._handleId = marshalled.$handle; + this._typeId = marshalled.$type as T; + } + + /** The handle ID (instance number) */ + get $handle(): string { + return this._handleId; + } + + /** The ATS type ID */ + get $type(): T { + return this._typeId; + } + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { + return { + $handle: this._handleId, + $type: this._typeId + }; + } + + /** String representation for debugging */ + toString(): string { + return `Handle<${this._typeId}>(${this._handleId})`; + } +} + +// ============================================================================ +// Handle Wrapper Registry +// ============================================================================ + +/** + * Factory function for creating typed wrapper instances from handles. + */ +export type HandleWrapperFactory = (handle: Handle, client: AspireClient) => unknown; + +/** + * Registry of handle wrapper factories by type ID. + * Generated code registers wrapper classes here so callback handles can be properly typed. + */ +const handleWrapperRegistry = new Map(); + +/** + * Register a wrapper factory for a type ID. + * Called by generated code to register wrapper classes. + */ +export function registerHandleWrapper(typeId: string, factory: HandleWrapperFactory): void { + handleWrapperRegistry.set(typeId, factory); +} + +/** + * Checks if a value is a marshalled handle and wraps it appropriately. + * Uses the wrapper registry to create typed wrapper instances when available. + * + * @param value - The value to potentially wrap + * @param client - Optional client for creating typed wrapper instances + */ +export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { + if (value && typeof value === 'object') { + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); + } + } + + return handle; + } + } + return value; +} + +// ============================================================================ +// Capability Error +// ============================================================================ + +/** + * Error thrown when an ATS capability invocation fails. + */ +export class CapabilityError extends Error { + constructor( + /** The structured error from the server */ + public readonly error: AtsError + ) { + super(error.message); + this.name = 'CapabilityError'; + } + + /** Machine-readable error code */ + get code(): string { + return this.error.code; + } + + /** The capability that failed (if applicable) */ + get capability(): string | undefined { + return this.error.capability; + } +} + +// ============================================================================ +// Callback Registry +// ============================================================================ + +const callbackRegistry = new Map(); +let callbackIdCounter = 0; + +/** + * Register a callback function that can be invoked from the .NET side. + * Returns a callback ID that should be passed to methods accepting callbacks. + * + * .NET passes arguments as an object with positional keys: `{ p0: value0, p1: value1, ... }` + * This function automatically extracts positional parameters and wraps handles. + * + * @example + * // Single parameter callback + * const id = registerCallback((ctx) => console.log(ctx)); + * // .NET sends: { p0: { $handle: "...", $type: "..." } } + * // Callback receives: Handle instance + * + * @example + * // Multi-parameter callback + * const id = registerCallback((a, b) => console.log(a, b)); + * // .NET sends: { p0: "hello", p1: 42 } + * // Callback receives: "hello", 42 + */ +export function registerCallback( + callback: (...args: any[]) => TResult | Promise +): string { + const callbackId = `callback_${++callbackIdCounter}_${Date.now()}`; + + // Wrap the callback to handle .NET's positional argument format + const wrapper: CallbackFunction = async (args: unknown, client: AspireClient) => { + // .NET sends args as object { p0: value0, p1: value1, ... } + if (args && typeof args === 'object' && !Array.isArray(args)) { + const argObj = args as Record; + const argArray: unknown[] = []; + + // Extract positional parameters (p0, p1, p2, ...) + for (let i = 0; ; i++) { + const key = `p${i}`; + if (key in argObj) { + argArray.push(wrapIfHandle(argObj[key], client)); + } else { + break; + } + } + + if (argArray.length > 0) { + // Spread positional arguments to callback + const result = await callback(...argArray); + // DTO writeback protocol: when a void callback returns undefined, we + // return the original args object so the .NET host can detect property + // mutations made by the callback and apply them back to the original + // C# DTO objects. DTO args are plain JS objects (not Handle wrappers), + // so any property changes the callback made are reflected in args. + // + // Non-void callbacks (result !== undefined) return their actual result. + // The .NET side only activates writeback for void delegates whose + // parameters include [AspireDto] types — all other cases discard the + // returned args object, so the extra wire payload is harmless. + // + // IMPORTANT: callbacks that intentionally return undefined will also + // trigger this path. For non-void delegate types, the C# proxy uses + // a result-unmarshalling path (not writeback), so returning args will + // cause an unmarshal error. Void callbacks should never return a + // meaningful value; non-void callbacks should always return one. + return result !== undefined ? result : args; + } + + // No positional params found — nothing to write back + return await callback(); + } + + // Null/undefined - call with no args + if (args === null || args === undefined) { + return await callback(); + } + + // Primitive value - pass as single arg (shouldn't happen with current protocol) + return await callback(wrapIfHandle(args, client)); + }; + + callbackRegistry.set(callbackId, wrapper); + return callbackId; +} + +/** + * Unregister a callback by its ID. + */ +export function unregisterCallback(callbackId: string): boolean { + return callbackRegistry.delete(callbackId); +} + +/** + * Get the number of registered callbacks. + */ +export function getCallbackCount(): number { + return callbackRegistry.size; +} + +// ============================================================================ +// Cancellation Token Registry +// ============================================================================ + +/** + * Registry for cancellation tokens. + * Maps cancellation IDs to cleanup functions. + */ +const cancellationRegistry = new Map void>(); +let cancellationIdCounter = 0; + +/** + * A reference to the current AspireClient for sending cancel requests. + * Set by AspireClient.connect(). + */ +let currentClient: AspireClient | null = null; + +/** + * Register an AbortSignal for cancellation support. + * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * + * When the AbortSignal is aborted, sends a cancelToken request to the host. + * + * @param signal - The AbortSignal to register (optional) + * @returns The cancellation ID, or undefined if no signal provided + * + * @example + * const controller = new AbortController(); + * const id = registerCancellation(controller.signal); + * // Pass id to capability invocation + * // Later: controller.abort() will cancel the operation + */ +export function registerCancellation(signal?: AbortSignal): string | undefined { + if (!signal) { + return undefined; + } + + // Already aborted? Don't register + if (signal.aborted) { + return undefined; + } + + const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; + + // Set up the abort listener + const onAbort = () => { + // Send cancel request to host + if (currentClient?.connected) { + currentClient.cancelToken(cancellationId).catch(() => { + // Ignore errors - the operation may have already completed + }); + } + // Clean up the listener + cancellationRegistry.delete(cancellationId); + }; + + // Listen for abort + signal.addEventListener('abort', onAbort, { once: true }); + + // Store cleanup function + cancellationRegistry.set(cancellationId, () => { + signal.removeEventListener('abort', onAbort); + }); + + return cancellationId; +} + +/** + * Unregister a cancellation token by its ID. + * Call this when the operation completes to clean up resources. + * + * @param cancellationId - The cancellation ID to unregister + */ +export function unregisterCancellation(cancellationId: string | undefined): void { + if (!cancellationId) { + return; + } + + const cleanup = cancellationRegistry.get(cancellationId); + if (cleanup) { + cleanup(); + cancellationRegistry.delete(cancellationId); + } +} + +// ============================================================================ +// AspireClient (JSON-RPC Connection) +// ============================================================================ + +/** + * Client for connecting to the Aspire AppHost via socket/named pipe. + */ +export class AspireClient { + private connection: rpc.MessageConnection | null = null; + private socket: net.Socket | null = null; + private disconnectCallbacks: (() => void)[] = []; + private _pendingCalls = 0; + + constructor(private socketPath: string) { } + + /** + * Register a callback to be called when the connection is lost + */ + onDisconnect(callback: () => void): void { + this.disconnectCallbacks.push(callback); + } + + private notifyDisconnect(): void { + for (const callback of this.disconnectCallbacks) { + try { + callback(); + } catch { + // Ignore callback errors + } + } + } + + connect(timeoutMs: number = 5000): Promise { + return new Promise((resolve, reject) => { + const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this.socket = net.createConnection(pipePath); + + this.socket.once('error', (error: Error) => { + clearTimeout(timeout); + reject(error); + }); + + this.socket.once('connect', () => { + clearTimeout(timeout); + try { + const reader = new rpc.SocketMessageReader(this.socket!); + const writer = new rpc.SocketMessageWriter(this.socket!); + this.connection = rpc.createMessageConnection(reader, writer); + + this.connection.onClose(() => { + this.connection = null; + this.notifyDisconnect(); + }); + this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); + + // Handle callback invocations from the .NET side + this.connection.onRequest('invokeCallback', async (callbackId: string, args: unknown) => { + const callback = callbackRegistry.get(callbackId); + if (!callback) { + throw new Error(`Callback not found: ${callbackId}`); + } + try { + // The registered wrapper handles arg unpacking and handle wrapping + // Pass this client so handles can be wrapped with typed wrapper classes + return await Promise.resolve(callback(args, this)); + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + throw new Error(`Callback execution failed: ${message}`); + } + }); + + this.connection.listen(); + + // Set the current client for cancellation registry + currentClient = this; + + resolve(); + } catch (e) { + reject(e); + } + }); + + this.socket.on('close', () => { + this.connection?.dispose(); + this.connection = null; + if (currentClient === this) { + currentClient = null; + } + this.notifyDisconnect(); + }); + }); + } + + ping(): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('ping'); + } + + /** + * Cancel a CancellationToken by its ID. + * Called when an AbortSignal is aborted. + * + * @param tokenId - The token ID to cancel + * @returns True if the token was found and cancelled, false otherwise + */ + cancelToken(tokenId: string): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('cancelToken', tokenId); + } + + /** + * Invoke an ATS capability by ID. + * + * Capabilities are operations exposed by [AspireExport] attributes. + * Results are automatically wrapped in Handle objects when applicable. + * + * @param capabilityId - The capability ID (e.g., "Aspire.Hosting/createBuilder") + * @param args - Arguments to pass to the capability + * @returns The capability result, wrapped as Handle if it's a handle type + * @throws CapabilityError if the capability fails + */ + async invokeCapability( + capabilityId: string, + args?: Record + ): Promise { + if (!this.connection) { + throw new Error('Not connected to AppHost'); + } + + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); + } + this._pendingCalls++; + + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + args ?? null + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } + } + + disconnect(): void { + try { this.connection?.dispose(); } finally { this.connection = null; } + try { this.socket?.end(); } finally { this.socket = null; } + } + + get connected(): boolean { + return this.connection !== null && this.socket !== null; + } +} diff --git a/samples/orleans-voting/ts/package-lock.json b/samples/orleans-voting/ts/package-lock.json new file mode 100644 index 00000000..c4d3800c --- /dev/null +++ b/samples/orleans-voting/ts/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "ts", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/samples/volume-mount/ts/.aspire/settings.json b/samples/volume-mount/ts/.aspire/settings.json index a60c25b1..ef8ae858 100644 --- a/samples/volume-mount/ts/.aspire/settings.json +++ b/samples/volume-mount/ts/.aspire/settings.json @@ -1,3 +1,8 @@ { - "appHostPath": "../apphost.ts" + "appHostPath": "../apphost.ts", + "sdkVersion": "13.2.0-preview.1.26159.1", + "packages": { + "Aspire.Hosting.SqlServer": "13.1.2", + "Aspire.Hosting.Azure.Storage": "13.1.2" + } } \ No newline at end of file diff --git a/samples/volume-mount/ts/.modules/.codegen-hash b/samples/volume-mount/ts/.modules/.codegen-hash new file mode 100644 index 00000000..2a5d6507 --- /dev/null +++ b/samples/volume-mount/ts/.modules/.codegen-hash @@ -0,0 +1 @@ +0CA325CC136F8BB0FC38B839BD64C8D81521D5299613710FDEF9138B8AD90EF8 \ No newline at end of file diff --git a/samples/volume-mount/ts/.modules/aspire.ts b/samples/volume-mount/ts/.modules/aspire.ts new file mode 100644 index 00000000..73dc52d2 --- /dev/null +++ b/samples/volume-mount/ts/.modules/aspire.ts @@ -0,0 +1,13306 @@ +// aspire.ts - Capability-based Aspire SDK +// This SDK uses the ATS (Aspire Type System) capability API. +// Capabilities are endpoints like 'Aspire.Hosting/createBuilder'. +// +// GENERATED CODE - DO NOT EDIT + +import { + AspireClient as AspireClientRpc, + Handle, + MarshalledHandle, + CapabilityError, + registerCallback, + wrapIfHandle, + registerHandleWrapper +} from './transport.js'; + +import { + ResourceBuilderBase, + ReferenceExpression, + refExpr, + AspireDict, + AspireList +} from './base.js'; + +// ============================================================================ +// Handle Type Aliases (Internal - not exported to users) +// ============================================================================ + +/** Handle to CommandLineArgsCallbackContext */ +type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; + +/** Handle to ContainerRegistryResource */ +type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; + +/** Handle to ContainerResource */ +type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource'>; + +/** Handle to CSharpAppResource */ +type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; + +/** Handle to DotnetToolResource */ +type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; + +/** Handle to EndpointReference */ +type EndpointReferenceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference'>; + +/** Handle to EndpointReferenceExpression */ +type EndpointReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression'>; + +/** Handle to EnvironmentCallbackContext */ +type EnvironmentCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext'>; + +/** Handle to ExecutableResource */ +type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource'>; + +/** Handle to ExecuteCommandContext */ +type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; + +/** Handle to IContainerFilesDestinationResource */ +type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; + +/** Handle to IResource */ +type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; + +/** Handle to IResourceWithArgs */ +type IResourceWithArgsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs'>; + +/** Handle to IResourceWithConnectionString */ +type IResourceWithConnectionStringHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString'>; + +/** Handle to IResourceWithEndpoints */ +type IResourceWithEndpointsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints'>; + +/** Handle to IResourceWithEnvironment */ +type IResourceWithEnvironmentHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment'>; + +/** Handle to IResourceWithWaitSupport */ +type IResourceWithWaitSupportHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport'>; + +/** Handle to ParameterResource */ +type ParameterResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource'>; + +/** Handle to ProjectResource */ +type ProjectResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource'>; + +/** Handle to ReferenceExpression */ +type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression'>; + +/** Handle to ReferenceExpressionBuilder */ +type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; + +/** Handle to ResourceLoggerService */ +type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; + +/** Handle to ResourceNotificationService */ +type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; + +/** Handle to ResourceUrlsCallbackContext */ +type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; + +/** Handle to ConnectionStringResource */ +type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; + +/** Handle to DistributedApplication */ +type DistributedApplicationHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplication'>; + +/** Handle to DistributedApplicationExecutionContext */ +type DistributedApplicationExecutionContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext'>; + +/** Handle to DistributedApplicationEventSubscription */ +type DistributedApplicationEventSubscriptionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.DistributedApplicationEventSubscription'>; + +/** Handle to IDistributedApplicationEventing */ +type IDistributedApplicationEventingHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing'>; + +/** Handle to ExternalServiceResource */ +type ExternalServiceResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ExternalServiceResource'>; + +/** Handle to IDistributedApplicationBuilder */ +type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder'>; + +/** Handle to IResourceWithContainerFiles */ +type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; + +/** Handle to IResourceWithServiceDiscovery */ +type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; + +/** Handle to PipelineConfigurationContext */ +type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; + +/** Handle to PipelineStep */ +type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; + +/** Handle to PipelineStepContext */ +type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; + +/** Handle to ProjectResourceOptions */ +type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; + +/** Handle to Dict */ +type DictstringanyHandle = Handle<'Aspire.Hosting/Dict'>; + +/** Handle to List */ +type ListanyHandle = Handle<'Aspire.Hosting/List'>; + +/** Handle to IConfiguration */ +type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; + +/** Handle to IHostEnvironment */ +type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; + +/** Handle to ILogger */ +type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; + +/** Handle to string[] */ +type stringArrayHandle = Handle<'string[]'>; + +/** Handle to IServiceProvider */ +type IServiceProviderHandle = Handle<'System.ComponentModel/System.IServiceProvider'>; + +// ============================================================================ +// Enum Types +// ============================================================================ + +/** Enum type for CertificateTrustScope */ +export enum CertificateTrustScope { + None = "None", + Append = "Append", + Override = "Override", + System = "System", +} + +/** Enum type for ContainerLifetime */ +export enum ContainerLifetime { + Session = "Session", + Persistent = "Persistent", +} + +/** Enum type for DistributedApplicationOperation */ +export enum DistributedApplicationOperation { + Run = "Run", + Publish = "Publish", +} + +/** Enum type for EndpointProperty */ +export enum EndpointProperty { + Url = "Url", + Host = "Host", + IPV4Host = "IPV4Host", + Port = "Port", + Scheme = "Scheme", + TargetPort = "TargetPort", + HostAndPort = "HostAndPort", +} + +/** Enum type for IconVariant */ +export enum IconVariant { + Regular = "Regular", + Filled = "Filled", +} + +/** Enum type for ImagePullPolicy */ +export enum ImagePullPolicy { + Default = "Default", + Always = "Always", + Missing = "Missing", + Never = "Never", +} + +/** Enum type for OtlpProtocol */ +export enum OtlpProtocol { + Grpc = "Grpc", + HttpProtobuf = "HttpProtobuf", + HttpJson = "HttpJson", +} + +/** Enum type for ProbeType */ +export enum ProbeType { + Startup = "Startup", + Readiness = "Readiness", + Liveness = "Liveness", +} + +/** Enum type for ProtocolType */ +export enum ProtocolType { + IP = "IP", + IPv6HopByHopOptions = "IPv6HopByHopOptions", + Unspecified = "Unspecified", + Icmp = "Icmp", + Igmp = "Igmp", + Ggp = "Ggp", + IPv4 = "IPv4", + Tcp = "Tcp", + Pup = "Pup", + Udp = "Udp", + Idp = "Idp", + IPv6 = "IPv6", + IPv6RoutingHeader = "IPv6RoutingHeader", + IPv6FragmentHeader = "IPv6FragmentHeader", + IPSecEncapsulatingSecurityPayload = "IPSecEncapsulatingSecurityPayload", + IPSecAuthenticationHeader = "IPSecAuthenticationHeader", + IcmpV6 = "IcmpV6", + IPv6NoNextHeader = "IPv6NoNextHeader", + IPv6DestinationOptions = "IPv6DestinationOptions", + ND = "ND", + Raw = "Raw", + Ipx = "Ipx", + Spx = "Spx", + SpxII = "SpxII", + Unknown = "Unknown", +} + +/** Enum type for UrlDisplayLocation */ +export enum UrlDisplayLocation { + SummaryAndDetails = "SummaryAndDetails", + DetailsOnly = "DetailsOnly", +} + +/** Enum type for WaitBehavior */ +export enum WaitBehavior { + WaitOnResourceUnavailable = "WaitOnResourceUnavailable", + StopOnResourceUnavailable = "StopOnResourceUnavailable", +} + +// ============================================================================ +// DTO Interfaces +// ============================================================================ + +/** DTO interface for CommandOptions */ +export interface CommandOptions { + description?: string; + parameter?: any; + confirmationMessage?: string; + iconName?: string; + iconVariant?: IconVariant; + isHighlighted?: boolean; + updateState?: any; +} + +/** DTO interface for CreateBuilderOptions */ +export interface CreateBuilderOptions { + args?: string[]; + projectDirectory?: string; + appHostFilePath?: string; + containerRegistryOverride?: string; + disableDashboard?: boolean; + dashboardApplicationName?: string; + allowUnsecuredTransport?: boolean; + enableResourceLogging?: boolean; +} + +/** DTO interface for ExecuteCommandResult */ +export interface ExecuteCommandResult { + success?: boolean; + canceled?: boolean; + errorMessage?: string; +} + +/** DTO interface for ResourceEventDto */ +export interface ResourceEventDto { + resourceName?: string; + resourceId?: string; + state?: string; + stateStyle?: string; + healthStatus?: string; + exitCode?: number; +} + +/** DTO interface for ResourceUrlAnnotation */ +export interface ResourceUrlAnnotation { + url?: string; + displayText?: string; + endpoint?: EndpointReferenceHandle; + displayLocation?: UrlDisplayLocation; +} + +// ============================================================================ +// Options Interfaces +// ============================================================================ + +export interface AddConnectionStringOptions { + environmentVariableName?: string; +} + +export interface AddContainerRegistryOptions { + repository?: ParameterResource; +} + +export interface AddDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface AddParameterFromConfigurationOptions { + secret?: boolean; +} + +export interface AddParameterOptions { + secret?: boolean; +} + +export interface AppendFormattedOptions { + format?: string; +} + +export interface AppendValueProviderOptions { + format?: string; +} + +export interface GetValueAsyncOptions { + cancellationToken?: AbortSignal; +} + +export interface RunOptions { + cancellationToken?: AbortSignal; +} + +export interface WaitForCompletionOptions { + exitCode?: number; +} + +export interface WithBindMountOptions { + isReadOnly?: boolean; +} + +export interface WithCommandOptions { + commandOptions?: CommandOptions; +} + +export interface WithDescriptionOptions { + enableMarkdown?: boolean; +} + +export interface WithDockerfileBaseImageOptions { + buildImage?: string; + runtimeImage?: string; +} + +export interface WithDockerfileOptions { + dockerfilePath?: string; + stage?: string; +} + +export interface WithEndpointOptions { + port?: number; + targetPort?: number; + scheme?: string; + name?: string; + env?: string; + isProxied?: boolean; + isExternal?: boolean; + protocol?: ProtocolType; +} + +export interface WithExternalServiceHttpHealthCheckOptions { + path?: string; + statusCode?: number; +} + +export interface WithHttpEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithHttpHealthCheckOptions { + path?: string; + statusCode?: number; + endpointName?: string; +} + +export interface WithHttpProbeOptions { + path?: string; + initialDelaySeconds?: number; + periodSeconds?: number; + timeoutSeconds?: number; + failureThreshold?: number; + successThreshold?: number; + endpointName?: string; +} + +export interface WithHttpsDeveloperCertificateOptions { + password?: ParameterResource; +} + +export interface WithHttpsEndpointOptions { + port?: number; + targetPort?: number; + name?: string; + env?: string; + isProxied?: boolean; +} + +export interface WithIconNameOptions { + iconVariant?: IconVariant; +} + +export interface WithImageOptions { + tag?: string; +} + +export interface WithMcpServerOptions { + path?: string; + endpointName?: string; +} + +export interface WithPipelineStepFactoryOptions { + dependsOn?: string[]; + requiredBy?: string[]; + tags?: string[]; + description?: string; +} + +export interface WithReferenceOptions { + connectionName?: string; + optional?: boolean; +} + +export interface WithRequiredCommandOptions { + helpLink?: string; +} + +export interface WithUrlExpressionOptions { + displayText?: string; +} + +export interface WithUrlOptions { + displayText?: string; +} + +export interface WithVolumeOptions { + name?: string; + isReadOnly?: boolean; +} + +// ============================================================================ +// CommandLineArgsCallbackContext +// ============================================================================ + +/** + * Type class for CommandLineArgsCallbackContext. + */ +export class CommandLineArgsCallbackContext { + constructor(private _handle: CommandLineArgsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Args property */ + private _args?: AspireList; + get args(): AspireList { + if (!this._args) { + this._args = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args', + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args' + ); + } + return this._args; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplication +// ============================================================================ + +/** + * Type class for DistributedApplication. + */ +export class DistributedApplication { + constructor(private _handle: DistributedApplicationHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Runs the distributed application */ + /** @internal */ + async _runInternal(cancellationToken?: AbortSignal): Promise { + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + await this._client.invokeCapability( + 'Aspire.Hosting/run', + rpcArgs + ); + return this; + } + + run(options?: RunOptions): DistributedApplicationPromise { + const cancellationToken = options?.cancellationToken; + return new DistributedApplicationPromise(this._runInternal(cancellationToken)); + } + +} + +/** + * Thenable wrapper for DistributedApplication that enables fluent chaining. + */ +export class DistributedApplicationPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplication) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Runs the distributed application */ + run(options?: RunOptions): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.run(options))); + } + +} + +// ============================================================================ +// DistributedApplicationExecutionContext +// ============================================================================ + +/** + * Type class for DistributedApplicationExecutionContext. + */ +export class DistributedApplicationExecutionContext { + constructor(private _handle: DistributedApplicationExecutionContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PublisherName property */ + publisherName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.publisherName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.setPublisherName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Operation property */ + operation = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.operation', + { context: this._handle } + ); + }, + }; + + /** Gets the IsPublishMode property */ + isPublishMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isPublishMode', + { context: this._handle } + ); + }, + }; + + /** Gets the IsRunMode property */ + isRunMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.isRunMode', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EndpointReference +// ============================================================================ + +/** + * Type class for EndpointReference. + */ +export class EndpointReference { + constructor(private _handle: EndpointReferenceHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EndpointName property */ + endpointName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.endpointName', + { context: this._handle } + ); + }, + }; + + /** Gets the ErrorMessage property */ + errorMessage = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.errorMessage', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.setErrorMessage', + { context: this._handle, value } + ); + } + }; + + /** Gets the IsAllocated property */ + isAllocated = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isAllocated', + { context: this._handle } + ); + }, + }; + + /** Gets the Exists property */ + exists = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.exists', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttp property */ + isHttp = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttp', + { context: this._handle } + ); + }, + }; + + /** Gets the IsHttps property */ + isHttps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.isHttps', + { context: this._handle } + ); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.port', + { context: this._handle } + ); + }, + }; + + /** Gets the TargetPort property */ + targetPort = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.targetPort', + { context: this._handle } + ); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.host', + { context: this._handle } + ); + }, + }; + + /** Gets the Scheme property */ + scheme = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.scheme', + { context: this._handle } + ); + }, + }; + + /** Gets the Url property */ + url = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.url', + { context: this._handle } + ); + }, + }; + + /** Gets the URL of the endpoint asynchronously */ + async getValueAsync(options?: GetValueAsyncOptions): Promise { + const cancellationToken = options?.cancellationToken; + const rpcArgs: Record = { context: this._handle }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValueAsync', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for EndpointReference that enables fluent chaining. + */ +export class EndpointReferencePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: EndpointReference) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets the URL of the endpoint asynchronously */ + getValueAsync(options?: GetValueAsyncOptions): Promise { + return this._promise.then(obj => obj.getValueAsync(options)); + } + +} + +// ============================================================================ +// EndpointReferenceExpression +// ============================================================================ + +/** + * Type class for EndpointReferenceExpression. + */ +export class EndpointReferenceExpression { + constructor(private _handle: EndpointReferenceExpressionHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Endpoint property */ + endpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.endpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Property property */ + property = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.property', + { context: this._handle } + ); + }, + }; + + /** Gets the ValueExpression property */ + valueExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.valueExpression', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// EnvironmentCallbackContext +// ============================================================================ + +/** + * Type class for EnvironmentCallbackContext. + */ +export class EnvironmentCallbackContext { + constructor(private _handle: EnvironmentCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the EnvironmentVariables property */ + private _environmentVariables?: AspireDict; + get environmentVariables(): AspireDict { + if (!this._environmentVariables) { + this._environmentVariables = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables', + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables' + ); + } + return this._environmentVariables; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ExecuteCommandContext +// ============================================================================ + +/** + * Type class for ExecuteCommandContext. + */ +export class ExecuteCommandContext { + constructor(private _handle: ExecuteCommandContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ResourceName property */ + resourceName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.resourceName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setResourceName', + { context: this._handle, value } + ); + } + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', + { context: this._handle } + ); + }, + set: async (value: AbortSignal): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + { context: this._handle } + ); + }, + set: async (value: PipelineStep[]): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', + { context: this._handle, value } + ); + } + }; + + /** Gets pipeline steps with the specified tag */ + async getStepsByTag(tag: string): Promise { + const rpcArgs: Record = { context: this._handle, tag }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/getStepsByTag', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for PipelineConfigurationContext that enables fluent chaining. + */ +export class PipelineConfigurationContextPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineConfigurationContext) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets pipeline steps with the specified tag */ + getStepsByTag(tag: string): Promise { + return this._promise.then(obj => obj.getStepsByTag(tag)); + } + +} + +// ============================================================================ +// PipelineStep +// ============================================================================ + +/** + * Type class for PipelineStep. + */ +export class PipelineStep { + constructor(private _handle: PipelineStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.name', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setName', + { context: this._handle, value } + ); + } + }; + + /** Gets the Description property */ + description = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.description', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setDescription', + { context: this._handle, value } + ); + } + }; + + /** Gets the DependsOnSteps property */ + private _dependsOnSteps?: AspireList; + get dependsOnSteps(): AspireList { + if (!this._dependsOnSteps) { + this._dependsOnSteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps', + 'Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps' + ); + } + return this._dependsOnSteps; + } + + /** Gets the RequiredBySteps property */ + private _requiredBySteps?: AspireList; + get requiredBySteps(): AspireList { + if (!this._requiredBySteps) { + this._requiredBySteps = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps', + 'Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps' + ); + } + return this._requiredBySteps; + } + + /** Gets the Tags property */ + private _tags?: AspireList; + get tags(): AspireList { + if (!this._tags) { + this._tags = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Pipelines/PipelineStep.tags', + 'Aspire.Hosting.Pipelines/PipelineStep.tags' + ); + } + return this._tags; + } + + /** Adds a dependency on another step by name */ + /** @internal */ + async _dependsOnInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/dependsOn', + rpcArgs + ); + return this; + } + + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._dependsOnInternal(stepName)); + } + + /** Specifies that another step requires this step by name */ + /** @internal */ + async _requiredByInternal(stepName: string): Promise { + const rpcArgs: Record = { context: this._handle, stepName }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/requiredBy', + rpcArgs + ); + return this; + } + + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._requiredByInternal(stepName)); + } + +} + +/** + * Thenable wrapper for PipelineStep that enables fluent chaining. + */ +export class PipelineStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineStep) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a dependency on another step by name */ + dependsOn(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.dependsOn(stepName))); + } + + /** Specifies that another step requires this step by name */ + requiredBy(stepName: string): PipelineStepPromise { + return new PipelineStepPromise(this._promise.then(obj => obj.requiredBy(stepName))); + } + +} + +// ============================================================================ +// PipelineStepContext +// ============================================================================ + +/** + * Type class for PipelineStepContext. + */ +export class PipelineStepContext { + constructor(private _handle: PipelineStepContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', + { context: this._handle } + ); + }, + }; + +} + +// ============================================================================ +// ProjectResourceOptions +// ============================================================================ + +/** + * Type class for ProjectResourceOptions. + */ +export class ProjectResourceOptions { + constructor(private _handle: ProjectResourceOptionsHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the LaunchProfileName property */ + launchProfileName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.launchProfileName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setLaunchProfileName', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeLaunchProfile property */ + excludeLaunchProfile = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeLaunchProfile', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeLaunchProfile', + { context: this._handle, value } + ); + } + }; + + /** Gets the ExcludeKestrelEndpoints property */ + excludeKestrelEndpoints = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.excludeKestrelEndpoints', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting/ProjectResourceOptions.setExcludeKestrelEndpoints', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// ReferenceExpressionBuilder +// ============================================================================ + +/** + * Type class for ReferenceExpressionBuilder. + */ +export class ReferenceExpressionBuilder { + constructor(private _handle: ReferenceExpressionBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the IsEmpty property */ + isEmpty = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ReferenceExpressionBuilder.isEmpty', + { context: this._handle } + ); + }, + }; + + /** Appends a literal string to the reference expression */ + /** @internal */ + async _appendLiteralInternal(value: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendLiteral', + rpcArgs + ); + return this; + } + + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._appendLiteralInternal(value)); + } + + /** Appends a formatted string value to the reference expression */ + /** @internal */ + async _appendFormattedInternal(value: string, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, value }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendFormatted', + rpcArgs + ); + return this; + } + + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendFormattedInternal(value, format)); + } + + /** Appends a value provider to the reference expression */ + /** @internal */ + async _appendValueProviderInternal(valueProvider: any, format?: string): Promise { + const rpcArgs: Record = { context: this._handle, valueProvider }; + if (format !== undefined) rpcArgs.format = format; + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/appendValueProvider', + rpcArgs + ); + return this; + } + + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + const format = options?.format; + return new ReferenceExpressionBuilderPromise(this._appendValueProviderInternal(valueProvider, format)); + } + + /** Builds the reference expression */ + async build(): Promise { + const rpcArgs: Record = { context: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/build', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ReferenceExpressionBuilder that enables fluent chaining. + */ +export class ReferenceExpressionBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReferenceExpressionBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Appends a literal string to the reference expression */ + appendLiteral(value: string): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendLiteral(value))); + } + + /** Appends a formatted string value to the reference expression */ + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendFormatted(value, options))); + } + + /** Appends a value provider to the reference expression */ + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { + return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendValueProvider(valueProvider, options))); + } + + /** Builds the reference expression */ + build(): Promise { + return this._promise.then(obj => obj.build()); + } + +} + +// ============================================================================ +// ResourceUrlsCallbackContext +// ============================================================================ + +/** + * Type class for ResourceUrlsCallbackContext. + */ +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Builds the distributed application */ + /** @internal */ + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', + rpcArgs + ); + return new DistributedApplication(result, this._client); + } + + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); + } + + /** Adds a connection string with a builder callback */ + /** @internal */ + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionStringBuilder', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + } + + /** Adds a container registry resource */ + /** @internal */ + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + } + + /** Adds a container resource */ + /** @internal */ + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); + } + + /** Adds a container resource built from a Dockerfile */ + /** @internal */ + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); + } + + /** Adds a .NET tool resource */ + /** @internal */ + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + } + + /** Adds an executable resource */ + /** @internal */ + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + } + + /** Adds an external service resource */ + /** @internal */ + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); + } + + /** Adds a parameter resource */ + /** @internal */ + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); + } + + /** Adds a parameter sourced from configuration */ + /** @internal */ + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + } + + /** Adds a connection string resource */ + /** @internal */ + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + } + + /** Adds a .NET project resource */ + /** @internal */ + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + } + + /** Adds a project resource with configuration options */ + /** @internal */ + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + } + + /** Adds a C# application resource */ + /** @internal */ + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + } + + /** Adds a C# application resource with configuration options */ + /** @internal */ + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + */ +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); + } + + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + } + + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + } + + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + } + + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + } + + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + } + + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); + } + + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + } + + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); + } + + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + } + + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); + } + + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); + } + + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); + } + + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); + } + + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); + } + +} + +// ============================================================================ +// DistributedApplicationEventing +// ============================================================================ + +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Unsubscribe method */ + /** @internal */ + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + rpcArgs + ); + return this; + } + + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ + +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerResource +// ============================================================================ + +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + const exitCode = options?.exitCode; + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + const password = options?.password; + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// CSharpAppResource +// ============================================================================ + +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + const exitCode = options?.exitCode; + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + const commandOptions = options?.commandOptions; + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + const password = options?.password; + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + const iconVariant = options?.iconVariant; + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// DotnetToolResource +// ============================================================================ + +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + } + + /** @internal */ + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + } + + /** @internal */ + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + } + + /** @internal */ + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + } + + /** @internal */ + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + } + + /** @internal */ + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + const exitCode = options?.exitCode; + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + const commandOptions = options?.commandOptions; + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + const password = options?.password; + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + const iconVariant = options?.iconVariant; + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for DotnetToolResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExecutableResource +// ============================================================================ + +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerFilesDestinationResource +// ============================================================================ + +export class ContainerFilesDestinationResource extends ResourceBuilderBase { + constructor(handle: IContainerFilesDestinationResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ContainerFilesDestinationResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + +} + +/** + * Thenable wrapper for ContainerFilesDestinationResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerFilesDestinationResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerFilesDestinationResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + +} + +// ============================================================================ +// Resource +// ============================================================================ + +export class Resource extends ResourceBuilderBase { + constructor(handle: IResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + const helpLink = options?.helpLink; + return new ResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + const displayText = options?.displayText; + return new ResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + const commandOptions = options?.commandOptions; + return new ResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + const iconVariant = options?.iconVariant; + return new ResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for Resource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Resource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ResourceWithArgs +// ============================================================================ + +export class ResourceWithArgs extends ResourceBuilderBase { + constructor(handle: IResourceWithArgsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ResourceWithArgs(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._withArgsCallbackAsyncInternal(callback)); + } + +} + +/** + * Thenable wrapper for ResourceWithArgs that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithArgsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithArgs) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds arguments */ + withArgs(args: string[]): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { + return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + +} + +// ============================================================================ +// ResourceWithConnectionString +// ============================================================================ + +export class ResourceWithConnectionString extends ResourceBuilderBase { + constructor(handle: IResourceWithConnectionStringHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._withConnectionPropertyValueInternal(name, value)); + } + +} + +/** + * Thenable wrapper for ResourceWithConnectionString that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithConnectionStringPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithConnectionString) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + +} + +// ============================================================================ +// ResourceWithContainerFiles +// ============================================================================ + +export class ResourceWithContainerFiles extends ResourceBuilderBase { + constructor(handle: IResourceWithContainerFilesHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new ResourceWithContainerFiles(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._clearContainerFilesSourcesInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithContainerFiles that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithContainerFilesPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithContainerFiles) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ResourceWithContainerFilesPromise { + return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + +} + +// ============================================================================ +// ResourceWithEndpoints +// ============================================================================ + +export class ResourceWithEndpoints extends ResourceBuilderBase { + constructor(handle: IResourceWithEndpointsHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ResourceWithEndpointsPromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ResourceWithEndpointsPromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ResourceWithEndpointsPromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + +} + +/** + * Thenable wrapper for ResourceWithEndpoints that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEndpointsPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEndpoints) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + +} + +// ============================================================================ +// ResourceWithEnvironment +// ============================================================================ + +export class ResourceWithEnvironment extends ResourceBuilderBase { + constructor(handle: IResourceWithEnvironmentHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + const password = options?.password; + return new ResourceWithEnvironmentPromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withoutHttpsCertificateInternal()); + } + +} + +/** + * Thenable wrapper for ResourceWithEnvironment that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + +} + +// ============================================================================ +// ResourceWithServiceDiscovery +// ============================================================================ + +export class ResourceWithServiceDiscovery extends ResourceBuilderBase { + constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { + super(handle, client); + } + +} + +/** + * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithServiceDiscoveryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + +} + +// ============================================================================ +// ResourceWithWaitSupport +// ============================================================================ + +export class ResourceWithWaitSupport extends ResourceBuilderBase { + constructor(handle: IResourceWithWaitSupportHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ResourceWithWaitSupport(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + const exitCode = options?.exitCode; + return new ResourceWithWaitSupportPromise(this._waitForCompletionInternal(dependency, exitCode)); + } + +} + +/** + * Thenable wrapper for ResourceWithWaitSupport that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ResourceWithWaitSupportPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceWithWaitSupport) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + +} + +// ============================================================================ +// Connection Helper +// ============================================================================ + +/** + * Creates and connects to the Aspire AppHost. + * Reads connection info from environment variables set by `aspire run`. + */ +export async function connect(): Promise { + const socketPath = process.env.REMOTE_APP_HOST_SOCKET_PATH; + if (!socketPath) { + throw new Error( + 'REMOTE_APP_HOST_SOCKET_PATH environment variable not set. ' + + 'Run this application using `aspire run`.' + ); + } + + const client = new AspireClientRpc(socketPath); + await client.connect(); + + // Exit the process if the server connection is lost + client.onDisconnect(() => { + console.error('Connection to AppHost lost. Exiting...'); + process.exit(1); + }); + + return client; +} + +/** + * Creates a new distributed application builder. + * This is the entry point for building Aspire applications. + * + * @param options - Optional configuration options for the builder + * @returns A DistributedApplicationBuilder instance + * + * @example + * const builder = await createBuilder(); + * builder.addRedis("cache"); + * builder.addContainer("api", "mcr.microsoft.com/dotnet/samples:aspnetapp"); + * const app = await builder.build(); + * await app.run(); + */ +export async function createBuilder(options?: CreateBuilderOptions): Promise { + const client = await connect(); + + // Default args, projectDirectory, and appHostFilePath if not provided + // ASPIRE_APPHOST_FILEPATH is set by the CLI for consistent socket hash computation + const effectiveOptions: CreateBuilderOptions = { + ...options, + args: options?.args ?? process.argv.slice(2), + projectDirectory: options?.projectDirectory ?? process.env.ASPIRE_PROJECT_DIRECTORY ?? process.cwd(), + appHostFilePath: options?.appHostFilePath ?? process.env.ASPIRE_APPHOST_FILEPATH + }; + + const handle = await client.invokeCapability( + 'Aspire.Hosting/createBuilderWithOptions', + { options: effectiveOptions } + ); + return new DistributedApplicationBuilder(handle, client); +} + +// Re-export commonly used types +export { Handle, CapabilityError, registerCallback } from './transport.js'; +export { refExpr, ReferenceExpression } from './base.js'; + +// ============================================================================ +// Global Error Handling +// ============================================================================ + +/** + * Set up global error handlers to ensure the process exits properly on errors. + * Node.js doesn't exit on unhandled rejections by default, so we need to handle them. + */ +process.on('unhandledRejection', (reason: unknown) => { + const error = reason instanceof Error ? reason : new Error(String(reason)); + + if (reason instanceof CapabilityError) { + console.error(`\n❌ Capability Error: ${error.message}`); + console.error(` Code: ${(reason as CapabilityError).code}`); + if ((reason as CapabilityError).capability) { + console.error(` Capability: ${(reason as CapabilityError).capability}`); + } + } else { + console.error(`\n❌ Unhandled Error: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + } + + process.exit(1); +}); + +process.on('uncaughtException', (error: Error) => { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + if (error.stack) { + console.error(error.stack); + } + process.exit(1); +}); + +// ============================================================================ +// Handle Wrapper Registrations +// ============================================================================ + +// Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource', (handle, client) => new CSharpAppResource(handle as CSharpAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString', (handle, client) => new ResourceWithConnectionString(handle as IResourceWithConnectionStringHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); + diff --git a/samples/volume-mount/ts/.modules/base.ts b/samples/volume-mount/ts/.modules/base.ts new file mode 100644 index 00000000..7778b0f1 --- /dev/null +++ b/samples/volume-mount/ts/.modules/base.ts @@ -0,0 +1,473 @@ +// aspire.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle } from './transport.js'; + +// Re-export transport types for convenience +export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; +export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; + +// ============================================================================ +// Reference Expression +// ============================================================================ + +/** + * Represents a reference expression that can be passed to capabilities. + * + * Reference expressions are serialized in the protocol as: + * ```json + * { + * "$expr": { + * "format": "redis://{0}:{1}", + * "valueProviders": [ + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:1" }, + * { "$handle": "Aspire.Hosting.ApplicationModel/EndpointReference:2" } + * ] + * } + * } + * ``` + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export class ReferenceExpression { + // Expression mode fields + private readonly _format?: string; + private readonly _valueProviders?: unknown[]; + + // Handle mode fields (when wrapping a server-returned handle) + private readonly _handle?: Handle; + private readonly _client?: AspireClient; + + constructor(format: string, valueProviders: unknown[]); + constructor(handle: Handle, client: AspireClient); + constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { + if (typeof handleOrFormat === 'string') { + this._format = handleOrFormat; + this._valueProviders = clientOrValueProviders as unknown[]; + } else { + this._handle = handleOrFormat; + this._client = clientOrValueProviders as AspireClient; + } + } + + /** + * Creates a reference expression from a tagged template literal. + * + * @param strings - The template literal string parts + * @param values - The interpolated values (handles to value providers) + * @returns A ReferenceExpression instance + */ + static create(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + // Build the format string with {0}, {1}, etc. placeholders + let format = ''; + for (let i = 0; i < strings.length; i++) { + format += strings[i]; + if (i < values.length) { + format += `{${i}}`; + } + } + + // Extract handles from values + const valueProviders = values.map(extractHandleForExpr); + + return new ReferenceExpression(format, valueProviders); + } + + /** + * Serializes the reference expression for JSON-RPC transport. + * In template-literal mode, uses the $expr format. + * In handle mode, delegates to the handle's serialization. + */ + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + if (this._handle) { + return this._handle.toJSON(); + } + + return { + $expr: { + format: this._format!, + valueProviders: this._valueProviders && this._valueProviders.length > 0 ? this._valueProviders : undefined + } + }; + } + + /** + * String representation for debugging. + */ + toString(): string { + if (this._handle) { + return `ReferenceExpression(handle)`; + } + return `ReferenceExpression(${this._format})`; + } +} + +/** + * Extracts a value for use in reference expressions. + * Supports handles (objects) and string literals. + * @internal + */ +function extractHandleForExpr(value: unknown): unknown { + if (value === null || value === undefined) { + throw new Error('Cannot use null or undefined in reference expression'); + } + + // String literals - include directly in the expression + if (typeof value === 'string') { + return value; + } + + // Number literals - convert to string + if (typeof value === 'number') { + return String(value); + } + + // Handle objects - get their JSON representation + if (value instanceof Handle) { + return value.toJSON(); + } + + // Objects with $handle property (already in handle format) + if (typeof value === 'object' && value !== null && '$handle' in value) { + return value; + } + + // Objects with toJSON that returns a handle + if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { + const json = value.toJSON(); + if (json && typeof json === 'object' && '$handle' in json) { + return json; + } + } + + throw new Error( + `Cannot use value of type ${typeof value} in reference expression. ` + + `Expected a Handle, string, or number.` + ); +} + +/** + * Tagged template function for creating reference expressions. + * + * Use this to create dynamic expressions that reference endpoints, parameters, and other + * value providers. The expression is evaluated at runtime by Aspire. + * + * @example + * ```typescript + * const redis = await builder.addRedis("cache"); + * const endpoint = await redis.getEndpoint("tcp"); + * + * // Create a reference expression using the tagged template + * const expr = refExpr`redis://${endpoint}:6379`; + * + * // Use it in an environment variable + * await api.withEnvironment("REDIS_URL", expr); + * ``` + */ +export function refExpr(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + return ReferenceExpression.create(strings, ...values); +} + +// ============================================================================ +// ResourceBuilderBase +// ============================================================================ + +/** + * Base class for resource builders (e.g., RedisBuilder, ContainerBuilder). + * Provides handle management and JSON serialization. + */ +export class ResourceBuilderBase { + constructor(protected _handle: THandle, protected _client: AspireClient) {} + + toJSON(): MarshalledHandle { return this._handle.toJSON(); } +} + +// ============================================================================ +// AspireList - Mutable List Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET List. + * Provides array-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const items = await resource.getItems(); // Returns AspireList + * const count = await items.count(); + * const first = await items.get(0); + * await items.add(newItem); + * ``` + */ +export class AspireList { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the list handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual list handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual list handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of elements in the list. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.length', { + list: handle + }) as number; + } + + /** + * Gets the element at the specified index. + */ + async get(index: number): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.get', { + list: handle, + index + }) as T; + } + + /** + * Adds an element to the end of the list. + */ + async add(item: T): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.add', { + list: handle, + item + }); + } + + /** + * Removes the element at the specified index. + */ + async removeAt(index: number): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.removeAt', { + list: handle, + index + }); + } + + /** + * Clears all elements from the list. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/List.clear', { + list: handle + }); + } + + /** + * Converts the list to an array (creates a copy). + */ + async toArray(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/List.toArray', { + list: handle + }) as T[]; + } + + toJSON(): MarshalledHandle { + if (this._resolvedHandle) { + return this._resolvedHandle.toJSON(); + } + return this._handleOrContext.toJSON(); + } +} + +// ============================================================================ +// AspireDict - Mutable Dictionary Wrapper +// ============================================================================ + +/** + * Wrapper for a mutable .NET Dictionary. + * Provides object-like methods that invoke capabilities on the underlying collection. + * + * @example + * ```typescript + * const config = await resource.getConfig(); // Returns AspireDict + * const value = await config.get("key"); + * await config.set("key", "value"); + * const hasKey = await config.containsKey("key"); + * ``` + */ +export class AspireDict { + private _resolvedHandle?: Handle; + private _resolvePromise?: Promise; + + constructor( + private readonly _handleOrContext: Handle, + private readonly _client: AspireClient, + private readonly _typeId: string, + private readonly _getterCapabilityId?: string + ) { + // If no getter capability, the handle is already the dictionary handle + if (!_getterCapabilityId) { + this._resolvedHandle = _handleOrContext; + } + } + + /** + * Ensures we have the actual dictionary handle by calling the getter if needed. + */ + private async _ensureHandle(): Promise { + if (this._resolvedHandle) { + return this._resolvedHandle; + } + if (this._resolvePromise) { + return this._resolvePromise; + } + // Call the getter capability to get the actual dictionary handle + this._resolvePromise = (async () => { + const result = await this._client.invokeCapability(this._getterCapabilityId!, { + context: this._handleOrContext + }); + this._resolvedHandle = result as Handle; + return this._resolvedHandle; + })(); + return this._resolvePromise; + } + + /** + * Gets the number of key-value pairs in the dictionary. + */ + async count(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.count', { + dict: handle + }) as number; + } + + /** + * Gets the value associated with the specified key. + * @throws If the key is not found. + */ + async get(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.get', { + dict: handle, + key + }) as V; + } + + /** + * Sets the value for the specified key. + */ + async set(key: K, value: V): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.set', { + dict: handle, + key, + value + }); + } + + /** + * Determines whether the dictionary contains the specified key. + */ + async containsKey(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.has', { + dict: handle, + key + }) as boolean; + } + + /** + * Removes the value with the specified key. + * @returns True if the element was removed; false if the key was not found. + */ + async remove(key: K): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.remove', { + dict: handle, + key + }) as boolean; + } + + /** + * Clears all key-value pairs from the dictionary. + */ + async clear(): Promise { + const handle = await this._ensureHandle(); + await this._client.invokeCapability('Aspire.Hosting/Dict.clear', { + dict: handle + }); + } + + /** + * Gets all keys in the dictionary. + */ + async keys(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.keys', { + dict: handle + }) as K[]; + } + + /** + * Gets all values in the dictionary. + */ + async values(): Promise { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.values', { + dict: handle + }) as V[]; + } + + /** + * Converts the dictionary to a plain object (creates a copy). + * Only works when K is string. + */ + async toObject(): Promise> { + const handle = await this._ensureHandle(); + return await this._client.invokeCapability('Aspire.Hosting/Dict.toObject', { + dict: handle + }) as Record; + } + + async toJSON(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } +} diff --git a/samples/volume-mount/ts/.modules/transport.ts b/samples/volume-mount/ts/.modules/transport.ts new file mode 100644 index 00000000..7bddd74b --- /dev/null +++ b/samples/volume-mount/ts/.modules/transport.ts @@ -0,0 +1,574 @@ +// transport.ts - ATS transport layer: RPC, Handle, errors, callbacks +import * as net from 'net'; +import * as rpc from 'vscode-jsonrpc/node.js'; + +// ============================================================================ +// Base Types +// ============================================================================ + +/** + * Type for callback functions that can be registered and invoked from .NET. + * Internal: receives args and client for handle wrapping. + */ +export type CallbackFunction = (args: unknown, client: AspireClient) => unknown | Promise; + +/** + * Represents a handle to a .NET object in the ATS system. + * Handles are typed references that can be passed between capabilities. + */ +export interface MarshalledHandle { + /** The handle ID (instance number) */ + $handle: string; + /** The ATS type ID */ + $type: string; +} + +/** + * Error details for ATS errors. + */ +export interface AtsErrorDetails { + /** The parameter that caused the error */ + parameter?: string; + /** The expected type or value */ + expected?: string; + /** The actual type or value */ + actual?: string; +} + +/** + * Structured error from ATS capability invocation. + */ +export interface AtsError { + /** Machine-readable error code */ + code: string; + /** Human-readable error message */ + message: string; + /** The capability that failed (if applicable) */ + capability?: string; + /** Additional error details */ + details?: AtsErrorDetails; +} + +/** + * ATS error codes returned by the server. + */ +export const AtsErrorCodes = { + /** Unknown capability ID */ + CapabilityNotFound: 'CAPABILITY_NOT_FOUND', + /** Handle ID doesn't exist or was disposed */ + HandleNotFound: 'HANDLE_NOT_FOUND', + /** Handle type doesn't satisfy capability's type constraint */ + TypeMismatch: 'TYPE_MISMATCH', + /** Missing required argument or wrong type */ + InvalidArgument: 'INVALID_ARGUMENT', + /** Argument value outside valid range */ + ArgumentOutOfRange: 'ARGUMENT_OUT_OF_RANGE', + /** Error occurred during callback invocation */ + CallbackError: 'CALLBACK_ERROR', + /** Unexpected error in capability execution */ + InternalError: 'INTERNAL_ERROR', +} as const; + +/** + * Type guard to check if a value is an ATS error response. + */ +export function isAtsError(value: unknown): value is { $error: AtsError } { + return ( + value !== null && + typeof value === 'object' && + '$error' in value && + typeof (value as { $error: unknown }).$error === 'object' + ); +} + +/** + * Type guard to check if a value is a marshalled handle. + */ +export function isMarshalledHandle(value: unknown): value is MarshalledHandle { + return ( + value !== null && + typeof value === 'object' && + '$handle' in value && + '$type' in value + ); +} + +// ============================================================================ +// Handle +// ============================================================================ + +/** + * A typed handle to a .NET object in the ATS system. + * Handles are opaque references that can be passed to capabilities. + * + * @typeParam T - The ATS type ID (e.g., "Aspire.Hosting/IDistributedApplicationBuilder") + */ +export class Handle { + private readonly _handleId: string; + private readonly _typeId: T; + + constructor(marshalled: MarshalledHandle) { + this._handleId = marshalled.$handle; + this._typeId = marshalled.$type as T; + } + + /** The handle ID (instance number) */ + get $handle(): string { + return this._handleId; + } + + /** The ATS type ID */ + get $type(): T { + return this._typeId; + } + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { + return { + $handle: this._handleId, + $type: this._typeId + }; + } + + /** String representation for debugging */ + toString(): string { + return `Handle<${this._typeId}>(${this._handleId})`; + } +} + +// ============================================================================ +// Handle Wrapper Registry +// ============================================================================ + +/** + * Factory function for creating typed wrapper instances from handles. + */ +export type HandleWrapperFactory = (handle: Handle, client: AspireClient) => unknown; + +/** + * Registry of handle wrapper factories by type ID. + * Generated code registers wrapper classes here so callback handles can be properly typed. + */ +const handleWrapperRegistry = new Map(); + +/** + * Register a wrapper factory for a type ID. + * Called by generated code to register wrapper classes. + */ +export function registerHandleWrapper(typeId: string, factory: HandleWrapperFactory): void { + handleWrapperRegistry.set(typeId, factory); +} + +/** + * Checks if a value is a marshalled handle and wraps it appropriately. + * Uses the wrapper registry to create typed wrapper instances when available. + * + * @param value - The value to potentially wrap + * @param client - Optional client for creating typed wrapper instances + */ +export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { + if (value && typeof value === 'object') { + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); + } + } + + return handle; + } + } + return value; +} + +// ============================================================================ +// Capability Error +// ============================================================================ + +/** + * Error thrown when an ATS capability invocation fails. + */ +export class CapabilityError extends Error { + constructor( + /** The structured error from the server */ + public readonly error: AtsError + ) { + super(error.message); + this.name = 'CapabilityError'; + } + + /** Machine-readable error code */ + get code(): string { + return this.error.code; + } + + /** The capability that failed (if applicable) */ + get capability(): string | undefined { + return this.error.capability; + } +} + +// ============================================================================ +// Callback Registry +// ============================================================================ + +const callbackRegistry = new Map(); +let callbackIdCounter = 0; + +/** + * Register a callback function that can be invoked from the .NET side. + * Returns a callback ID that should be passed to methods accepting callbacks. + * + * .NET passes arguments as an object with positional keys: `{ p0: value0, p1: value1, ... }` + * This function automatically extracts positional parameters and wraps handles. + * + * @example + * // Single parameter callback + * const id = registerCallback((ctx) => console.log(ctx)); + * // .NET sends: { p0: { $handle: "...", $type: "..." } } + * // Callback receives: Handle instance + * + * @example + * // Multi-parameter callback + * const id = registerCallback((a, b) => console.log(a, b)); + * // .NET sends: { p0: "hello", p1: 42 } + * // Callback receives: "hello", 42 + */ +export function registerCallback( + callback: (...args: any[]) => TResult | Promise +): string { + const callbackId = `callback_${++callbackIdCounter}_${Date.now()}`; + + // Wrap the callback to handle .NET's positional argument format + const wrapper: CallbackFunction = async (args: unknown, client: AspireClient) => { + // .NET sends args as object { p0: value0, p1: value1, ... } + if (args && typeof args === 'object' && !Array.isArray(args)) { + const argObj = args as Record; + const argArray: unknown[] = []; + + // Extract positional parameters (p0, p1, p2, ...) + for (let i = 0; ; i++) { + const key = `p${i}`; + if (key in argObj) { + argArray.push(wrapIfHandle(argObj[key], client)); + } else { + break; + } + } + + if (argArray.length > 0) { + // Spread positional arguments to callback + const result = await callback(...argArray); + // DTO writeback protocol: when a void callback returns undefined, we + // return the original args object so the .NET host can detect property + // mutations made by the callback and apply them back to the original + // C# DTO objects. DTO args are plain JS objects (not Handle wrappers), + // so any property changes the callback made are reflected in args. + // + // Non-void callbacks (result !== undefined) return their actual result. + // The .NET side only activates writeback for void delegates whose + // parameters include [AspireDto] types — all other cases discard the + // returned args object, so the extra wire payload is harmless. + // + // IMPORTANT: callbacks that intentionally return undefined will also + // trigger this path. For non-void delegate types, the C# proxy uses + // a result-unmarshalling path (not writeback), so returning args will + // cause an unmarshal error. Void callbacks should never return a + // meaningful value; non-void callbacks should always return one. + return result !== undefined ? result : args; + } + + // No positional params found — nothing to write back + return await callback(); + } + + // Null/undefined - call with no args + if (args === null || args === undefined) { + return await callback(); + } + + // Primitive value - pass as single arg (shouldn't happen with current protocol) + return await callback(wrapIfHandle(args, client)); + }; + + callbackRegistry.set(callbackId, wrapper); + return callbackId; +} + +/** + * Unregister a callback by its ID. + */ +export function unregisterCallback(callbackId: string): boolean { + return callbackRegistry.delete(callbackId); +} + +/** + * Get the number of registered callbacks. + */ +export function getCallbackCount(): number { + return callbackRegistry.size; +} + +// ============================================================================ +// Cancellation Token Registry +// ============================================================================ + +/** + * Registry for cancellation tokens. + * Maps cancellation IDs to cleanup functions. + */ +const cancellationRegistry = new Map void>(); +let cancellationIdCounter = 0; + +/** + * A reference to the current AspireClient for sending cancel requests. + * Set by AspireClient.connect(). + */ +let currentClient: AspireClient | null = null; + +/** + * Register an AbortSignal for cancellation support. + * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * + * When the AbortSignal is aborted, sends a cancelToken request to the host. + * + * @param signal - The AbortSignal to register (optional) + * @returns The cancellation ID, or undefined if no signal provided + * + * @example + * const controller = new AbortController(); + * const id = registerCancellation(controller.signal); + * // Pass id to capability invocation + * // Later: controller.abort() will cancel the operation + */ +export function registerCancellation(signal?: AbortSignal): string | undefined { + if (!signal) { + return undefined; + } + + // Already aborted? Don't register + if (signal.aborted) { + return undefined; + } + + const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; + + // Set up the abort listener + const onAbort = () => { + // Send cancel request to host + if (currentClient?.connected) { + currentClient.cancelToken(cancellationId).catch(() => { + // Ignore errors - the operation may have already completed + }); + } + // Clean up the listener + cancellationRegistry.delete(cancellationId); + }; + + // Listen for abort + signal.addEventListener('abort', onAbort, { once: true }); + + // Store cleanup function + cancellationRegistry.set(cancellationId, () => { + signal.removeEventListener('abort', onAbort); + }); + + return cancellationId; +} + +/** + * Unregister a cancellation token by its ID. + * Call this when the operation completes to clean up resources. + * + * @param cancellationId - The cancellation ID to unregister + */ +export function unregisterCancellation(cancellationId: string | undefined): void { + if (!cancellationId) { + return; + } + + const cleanup = cancellationRegistry.get(cancellationId); + if (cleanup) { + cleanup(); + cancellationRegistry.delete(cancellationId); + } +} + +// ============================================================================ +// AspireClient (JSON-RPC Connection) +// ============================================================================ + +/** + * Client for connecting to the Aspire AppHost via socket/named pipe. + */ +export class AspireClient { + private connection: rpc.MessageConnection | null = null; + private socket: net.Socket | null = null; + private disconnectCallbacks: (() => void)[] = []; + private _pendingCalls = 0; + + constructor(private socketPath: string) { } + + /** + * Register a callback to be called when the connection is lost + */ + onDisconnect(callback: () => void): void { + this.disconnectCallbacks.push(callback); + } + + private notifyDisconnect(): void { + for (const callback of this.disconnectCallbacks) { + try { + callback(); + } catch { + // Ignore callback errors + } + } + } + + connect(timeoutMs: number = 5000): Promise { + return new Promise((resolve, reject) => { + const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this.socket = net.createConnection(pipePath); + + this.socket.once('error', (error: Error) => { + clearTimeout(timeout); + reject(error); + }); + + this.socket.once('connect', () => { + clearTimeout(timeout); + try { + const reader = new rpc.SocketMessageReader(this.socket!); + const writer = new rpc.SocketMessageWriter(this.socket!); + this.connection = rpc.createMessageConnection(reader, writer); + + this.connection.onClose(() => { + this.connection = null; + this.notifyDisconnect(); + }); + this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); + + // Handle callback invocations from the .NET side + this.connection.onRequest('invokeCallback', async (callbackId: string, args: unknown) => { + const callback = callbackRegistry.get(callbackId); + if (!callback) { + throw new Error(`Callback not found: ${callbackId}`); + } + try { + // The registered wrapper handles arg unpacking and handle wrapping + // Pass this client so handles can be wrapped with typed wrapper classes + return await Promise.resolve(callback(args, this)); + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + throw new Error(`Callback execution failed: ${message}`); + } + }); + + this.connection.listen(); + + // Set the current client for cancellation registry + currentClient = this; + + resolve(); + } catch (e) { + reject(e); + } + }); + + this.socket.on('close', () => { + this.connection?.dispose(); + this.connection = null; + if (currentClient === this) { + currentClient = null; + } + this.notifyDisconnect(); + }); + }); + } + + ping(): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('ping'); + } + + /** + * Cancel a CancellationToken by its ID. + * Called when an AbortSignal is aborted. + * + * @param tokenId - The token ID to cancel + * @returns True if the token was found and cancelled, false otherwise + */ + cancelToken(tokenId: string): Promise { + if (!this.connection) return Promise.reject(new Error('Not connected to AppHost')); + return this.connection.sendRequest('cancelToken', tokenId); + } + + /** + * Invoke an ATS capability by ID. + * + * Capabilities are operations exposed by [AspireExport] attributes. + * Results are automatically wrapped in Handle objects when applicable. + * + * @param capabilityId - The capability ID (e.g., "Aspire.Hosting/createBuilder") + * @param args - Arguments to pass to the capability + * @returns The capability result, wrapped as Handle if it's a handle type + * @throws CapabilityError if the capability fails + */ + async invokeCapability( + capabilityId: string, + args?: Record + ): Promise { + if (!this.connection) { + throw new Error('Not connected to AppHost'); + } + + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); + } + this._pendingCalls++; + + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + args ?? null + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } + } + + disconnect(): void { + try { this.connection?.dispose(); } finally { this.connection = null; } + try { this.socket?.end(); } finally { this.socket = null; } + } + + get connected(): boolean { + return this.connection !== null && this.socket !== null; + } +} diff --git a/samples/volume-mount/ts/package-lock.json b/samples/volume-mount/ts/package-lock.json new file mode 100644 index 00000000..c4d3800c --- /dev/null +++ b/samples/volume-mount/ts/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "ts", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} From 72c9f71f18c115a5d9e5b454958afe7bebcc4075 Mon Sep 17 00:00:00 2001 From: David Pine Date: Mon, 9 Mar 2026 21:52:58 -0500 Subject: [PATCH 13/25] Fix database-containers ts/apphost.ts init.sql path Update the init.sql path to reference the canonical source location at ../DatabaseContainers.ApiService/data/sqlserver/init.sql instead of looking for init.sql next to the apphost.ts file. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- samples/database-containers/ts/apphost.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/database-containers/ts/apphost.ts b/samples/database-containers/ts/apphost.ts index 23daa65d..1749550a 100644 --- a/samples/database-containers/ts/apphost.ts +++ b/samples/database-containers/ts/apphost.ts @@ -40,7 +40,7 @@ const sqlserver = await builder.addSqlServer("sqlserver") // Read the SQL creation script and apply it to the database const __dirname = dirname(fileURLToPath(import.meta.url)); -const initSqlPath = join(__dirname, "init.sql"); +const initSqlPath = join(__dirname, "../DatabaseContainers.ApiService/data/sqlserver/init.sql"); if (!existsSync(initSqlPath)) { throw new Error(`SQL initialization script not found: ${initSqlPath}`); } From 79d171fcb0c9daee7a3a4f9f15f3ca52a462ddcf Mon Sep 17 00:00:00 2001 From: David Pine Date: Mon, 9 Mar 2026 23:42:08 -0500 Subject: [PATCH 14/25] Regenerate TS apphosts using aspire new template Deleted all manually-written ts/ directories and recreated them using 'aspire new aspire-empty --language TypeScript' for proper scaffolding. Then ran 'aspire add {integration}' for each sample to generate the .modules/ SDK with correct APIs. Each apphost.ts is customized to match its C# counterpart with equivalent resource definitions using the TypeScript SDK. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- samples/Metrics/ts/.aspire/settings.json | 4 +- samples/Metrics/ts/.modules/.codegen-hash | 1 - samples/Metrics/ts/apphost.run.json | 11 + samples/Metrics/ts/apphost.ts | 32 +- samples/Metrics/ts/package-lock.json | 960 +- samples/Metrics/ts/package.json | 19 + samples/Metrics/ts/tsconfig.json | 15 + samples/aspire-shop/ts/.aspire/settings.json | 6 +- samples/aspire-shop/ts/.modules/.codegen-hash | 2 +- samples/aspire-shop/ts/.modules/aspire.ts | 23011 ++++++++++++--- samples/aspire-shop/ts/apphost.run.json | 11 + samples/aspire-shop/ts/apphost.ts | 26 +- samples/aspire-shop/ts/package-lock.json | 960 +- samples/aspire-shop/ts/package.json | 19 + samples/aspire-shop/ts/tsconfig.json | 15 + .../ts/.aspire/settings.json | 8 +- .../ts/.modules/.codegen-hash | 2 +- .../ts/.modules/aspire.ts | 19126 +++++++++++- .../ts/apphost.run.json | 11 + .../aspire-with-azure-functions/ts/apphost.ts | 24 +- .../ts/package-lock.json | 960 +- .../ts/package.json | 19 + .../ts/tsconfig.json | 15 + .../ts/.aspire/settings.json | 4 +- .../ts/.modules/.codegen-hash | 2 +- .../ts/.modules/aspire.ts | 6321 +++- .../ts/apphost.run.json | 11 + samples/aspire-with-javascript/ts/apphost.ts | 28 +- .../ts/package-lock.json | 960 +- .../aspire-with-javascript/ts/package.json | 19 + .../aspire-with-javascript/ts/tsconfig.json | 15 + .../aspire-with-node/ts/.aspire/settings.json | 6 +- .../ts/.modules/.codegen-hash | 2 +- .../aspire-with-node/ts/.modules/aspire.ts | 19848 ++++++++++--- samples/aspire-with-node/ts/apphost.run.json | 11 + samples/aspire-with-node/ts/apphost.ts | 18 +- samples/aspire-with-node/ts/package-lock.json | 960 +- samples/aspire-with-node/ts/package.json | 19 + samples/aspire-with-node/ts/tsconfig.json | 15 + .../ts/.aspire/settings.json | 8 +- .../ts/.modules/.codegen-hash | 2 +- .../aspire-with-python/ts/.modules/aspire.ts | 15679 +++++++++- .../aspire-with-python/ts/apphost.run.json | 11 + samples/aspire-with-python/ts/apphost.ts | 10 +- .../aspire-with-python/ts/package-lock.json | 960 +- samples/aspire-with-python/ts/package.json | 19 + samples/aspire-with-python/ts/tsconfig.json | 15 + .../ts/.aspire/settings.json | 4 +- .../ts/.modules/.codegen-hash | 1 - .../ts/apphost.run.json | 11 + samples/client-apps-integration/ts/apphost.ts | 22 +- .../ts/package-lock.json | 960 +- .../client-apps-integration/ts/package.json | 19 + .../client-apps-integration/ts/tsconfig.json | 15 + .../container-build/ts/.aspire/settings.json | 6 +- .../container-build/ts/.modules/.codegen-hash | 1 - samples/container-build/ts/apphost.run.json | 11 + samples/container-build/ts/apphost.ts | 21 +- samples/container-build/ts/package-lock.json | 960 +- samples/container-build/ts/package.json | 19 + samples/container-build/ts/tsconfig.json | 15 + .../custom-resources/ts/.aspire/settings.json | 4 +- .../ts/.modules/.codegen-hash | 1 - samples/custom-resources/ts/apphost.run.json | 11 + samples/custom-resources/ts/apphost.ts | 14 +- samples/custom-resources/ts/package-lock.json | 960 +- samples/custom-resources/ts/package.json | 19 + samples/custom-resources/ts/tsconfig.json | 15 + .../ts/.aspire/settings.json | 8 +- .../ts/.modules/.codegen-hash | 2 +- .../database-containers/ts/.modules/aspire.ts | 20322 +++++++++++-- .../database-containers/ts/apphost.run.json | 11 + samples/database-containers/ts/apphost.ts | 50 +- .../database-containers/ts/package-lock.json | 960 +- samples/database-containers/ts/package.json | 19 + samples/database-containers/ts/tsconfig.json | 15 + .../ts/.aspire/settings.json | 4 +- .../ts/.modules/.codegen-hash | 2 +- .../database-migrations/ts/.modules/aspire.ts | 3071 +- .../database-migrations/ts/apphost.run.json | 11 + samples/database-migrations/ts/apphost.ts | 13 +- .../database-migrations/ts/package-lock.json | 960 +- samples/database-migrations/ts/package.json | 19 + samples/database-migrations/ts/tsconfig.json | 15 + .../health-checks-ui/ts/.aspire/settings.json | 6 +- .../ts/.modules/.codegen-hash | 2 +- .../health-checks-ui/ts/.modules/aspire.ts | 21276 ++++++++++---- samples/health-checks-ui/ts/apphost.run.json | 11 + samples/health-checks-ui/ts/apphost.ts | 35 +- samples/health-checks-ui/ts/package-lock.json | 960 +- samples/health-checks-ui/ts/package.json | 19 + samples/health-checks-ui/ts/tsconfig.json | 15 + .../orleans-voting/ts/.aspire/settings.json | 6 +- .../orleans-voting/ts/.modules/.codegen-hash | 2 +- samples/orleans-voting/ts/.modules/aspire.ts | 7052 ++++- samples/orleans-voting/ts/apphost.run.json | 11 + samples/orleans-voting/ts/apphost.ts | 9 +- samples/orleans-voting/ts/package-lock.json | 960 +- samples/orleans-voting/ts/package.json | 19 + samples/orleans-voting/ts/tsconfig.json | 15 + samples/volume-mount/ts/.aspire/settings.json | 6 +- .../volume-mount/ts/.modules/.codegen-hash | 2 +- samples/volume-mount/ts/.modules/aspire.ts | 24283 ++++++++++++---- samples/volume-mount/ts/apphost.run.json | 11 + samples/volume-mount/ts/apphost.ts | 17 +- samples/volume-mount/ts/package-lock.json | 960 +- samples/volume-mount/ts/package.json | 19 + samples/volume-mount/ts/tsconfig.json | 15 + 108 files changed, 147408 insertions(+), 27074 deletions(-) delete mode 100644 samples/Metrics/ts/.modules/.codegen-hash create mode 100644 samples/Metrics/ts/apphost.run.json create mode 100644 samples/Metrics/ts/package.json create mode 100644 samples/Metrics/ts/tsconfig.json create mode 100644 samples/aspire-shop/ts/apphost.run.json create mode 100644 samples/aspire-shop/ts/package.json create mode 100644 samples/aspire-shop/ts/tsconfig.json create mode 100644 samples/aspire-with-azure-functions/ts/apphost.run.json create mode 100644 samples/aspire-with-azure-functions/ts/package.json create mode 100644 samples/aspire-with-azure-functions/ts/tsconfig.json create mode 100644 samples/aspire-with-javascript/ts/apphost.run.json create mode 100644 samples/aspire-with-javascript/ts/package.json create mode 100644 samples/aspire-with-javascript/ts/tsconfig.json create mode 100644 samples/aspire-with-node/ts/apphost.run.json create mode 100644 samples/aspire-with-node/ts/package.json create mode 100644 samples/aspire-with-node/ts/tsconfig.json create mode 100644 samples/aspire-with-python/ts/apphost.run.json create mode 100644 samples/aspire-with-python/ts/package.json create mode 100644 samples/aspire-with-python/ts/tsconfig.json delete mode 100644 samples/client-apps-integration/ts/.modules/.codegen-hash create mode 100644 samples/client-apps-integration/ts/apphost.run.json create mode 100644 samples/client-apps-integration/ts/package.json create mode 100644 samples/client-apps-integration/ts/tsconfig.json delete mode 100644 samples/container-build/ts/.modules/.codegen-hash create mode 100644 samples/container-build/ts/apphost.run.json create mode 100644 samples/container-build/ts/package.json create mode 100644 samples/container-build/ts/tsconfig.json delete mode 100644 samples/custom-resources/ts/.modules/.codegen-hash create mode 100644 samples/custom-resources/ts/apphost.run.json create mode 100644 samples/custom-resources/ts/package.json create mode 100644 samples/custom-resources/ts/tsconfig.json create mode 100644 samples/database-containers/ts/apphost.run.json create mode 100644 samples/database-containers/ts/package.json create mode 100644 samples/database-containers/ts/tsconfig.json create mode 100644 samples/database-migrations/ts/apphost.run.json create mode 100644 samples/database-migrations/ts/package.json create mode 100644 samples/database-migrations/ts/tsconfig.json create mode 100644 samples/health-checks-ui/ts/apphost.run.json create mode 100644 samples/health-checks-ui/ts/package.json create mode 100644 samples/health-checks-ui/ts/tsconfig.json create mode 100644 samples/orleans-voting/ts/apphost.run.json create mode 100644 samples/orleans-voting/ts/package.json create mode 100644 samples/orleans-voting/ts/tsconfig.json create mode 100644 samples/volume-mount/ts/apphost.run.json create mode 100644 samples/volume-mount/ts/package.json create mode 100644 samples/volume-mount/ts/tsconfig.json diff --git a/samples/Metrics/ts/.aspire/settings.json b/samples/Metrics/ts/.aspire/settings.json index a60c25b1..25c983c9 100644 --- a/samples/Metrics/ts/.aspire/settings.json +++ b/samples/Metrics/ts/.aspire/settings.json @@ -1,3 +1,5 @@ { - "appHostPath": "../apphost.ts" + "language": "typescript/nodejs", + "channel": "staging", + "sdkVersion": "13.2.0-preview.1.26159.1" } \ No newline at end of file diff --git a/samples/Metrics/ts/.modules/.codegen-hash b/samples/Metrics/ts/.modules/.codegen-hash deleted file mode 100644 index 1369f62c..00000000 --- a/samples/Metrics/ts/.modules/.codegen-hash +++ /dev/null @@ -1 +0,0 @@ -385A37965F5742D9B7F75074E7065C879412F46A58CE04016D535C18DA21950E \ No newline at end of file diff --git a/samples/Metrics/ts/apphost.run.json b/samples/Metrics/ts/apphost.run.json new file mode 100644 index 00000000..edfefa15 --- /dev/null +++ b/samples/Metrics/ts/apphost.run.json @@ -0,0 +1,11 @@ +{ + "profiles": { + "https": { + "applicationUrl": "https://localhost:25773;http://localhost:60744", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:56956", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:44377" + } + } + } +} \ No newline at end of file diff --git a/samples/Metrics/ts/apphost.ts b/samples/Metrics/ts/apphost.ts index 905651c8..7f7f25d1 100644 --- a/samples/Metrics/ts/apphost.ts +++ b/samples/Metrics/ts/apphost.ts @@ -1,33 +1,17 @@ -// Setup: No additional packages required (uses core container and project APIs). -// -// AddOpenTelemetryCollector is a custom AppHost extension method defined in the C# project -// (MetricsApp.AppHost.OpenTelemetryCollector) and requires [AspireExport] to be available here. - -import { createBuilder } from "./.modules/aspire.js"; +import { createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); -const prometheus = await builder.addContainer("prometheus", "prom/prometheus", "v3.2.1") - .withBindMount("../prometheus", "/etc/prometheus", true) - .withArgs("--web.enable-otlp-receiver", "--config.file=/etc/prometheus/prometheus.yml") +const prometheus = builder.addContainer("prometheus", "prom/prometheus:v3.2.1") + .withBindMount("../prometheus", "/etc/prometheus", { isReadOnly: true }) + .withArgs(["--web.enable-otlp-receiver", "--config.file=/etc/prometheus/prometheus.yml"]) .withHttpEndpoint({ targetPort: 9090 }); -// POLYGLOT GAP: .WithUrlForEndpoint("http", u => u.DisplayText = "Prometheus Dashboard") — lambda URL customization is not available. - -const prometheusHttpEndpoint = prometheus.getEndpoint("http"); -const grafana = await builder.addContainer("grafana", "grafana/grafana") - .withBindMount("../grafana/config", "/etc/grafana", true) - .withBindMount("../grafana/dashboards", "/var/lib/grafana/dashboards", true) - .withEnvironment("PROMETHEUS_ENDPOINT", prometheusHttpEndpoint) +const grafana = builder.addContainer("grafana", "grafana/grafana") + .withBindMount("../grafana/config", "/etc/grafana", { isReadOnly: true }) + .withBindMount("../grafana/dashboards", "/var/lib/grafana/dashboards", { isReadOnly: true }) .withHttpEndpoint({ targetPort: 3000 }); -// POLYGLOT GAP: .WithUrlForEndpoint("http", u => u.DisplayText = "Grafana Dashboard") — lambda URL customization is not available. - -// POLYGLOT GAP: AddOpenTelemetryCollector("otelcollector", ...) is a custom C# extension -// method from MetricsApp.AppHost.OpenTelemetryCollector. To use it here, it would need -// [AspireExport] annotation and to be distributed as a NuGet package. -const app = builder.addProject("app") - .withEnvironment("GRAFANA_URL", grafana.getEndpoint("http")); -// POLYGLOT GAP: .WithUrlForEndpoint callbacks for display text/location are not available. +builder.addProject("app", "../MetricsApp/MetricsApp.csproj", "https"); await builder.build().run(); diff --git a/samples/Metrics/ts/package-lock.json b/samples/Metrics/ts/package-lock.json index c4d3800c..e9540518 100644 --- a/samples/Metrics/ts/package-lock.json +++ b/samples/Metrics/ts/package-lock.json @@ -1,6 +1,962 @@ { - "name": "ts", + "name": "metricsapp", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, - "packages": {} + "packages": { + "": { + "name": "metricsapp", + "version": "1.0.0", + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz", + "integrity": "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.3.tgz", + "integrity": "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.3.tgz", + "integrity": "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.3.tgz", + "integrity": "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.3.tgz", + "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.3.tgz", + "integrity": "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.3.tgz", + "integrity": "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.3.tgz", + "integrity": "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.3.tgz", + "integrity": "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.3.tgz", + "integrity": "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.3.tgz", + "integrity": "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.3.tgz", + "integrity": "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.3.tgz", + "integrity": "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.3.tgz", + "integrity": "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.3.tgz", + "integrity": "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.3.tgz", + "integrity": "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz", + "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.3.tgz", + "integrity": "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.3.tgz", + "integrity": "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.3.tgz", + "integrity": "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.3.tgz", + "integrity": "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.3.tgz", + "integrity": "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.3.tgz", + "integrity": "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.3.tgz", + "integrity": "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.3.tgz", + "integrity": "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.3.tgz", + "integrity": "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@types/node": { + "version": "20.19.37", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.37.tgz", + "integrity": "sha512-8kzdPJ3FsNsVIurqBs7oodNnCEVbni9yUEkaHbgptDACOPW04jimGagZ51E6+lXUwJjgnBw+hyko/lkFWCldqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.4.tgz", + "integrity": "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/esbuild": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.3.tgz", + "integrity": "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.27.3", + "@esbuild/android-arm": "0.27.3", + "@esbuild/android-arm64": "0.27.3", + "@esbuild/android-x64": "0.27.3", + "@esbuild/darwin-arm64": "0.27.3", + "@esbuild/darwin-x64": "0.27.3", + "@esbuild/freebsd-arm64": "0.27.3", + "@esbuild/freebsd-x64": "0.27.3", + "@esbuild/linux-arm": "0.27.3", + "@esbuild/linux-arm64": "0.27.3", + "@esbuild/linux-ia32": "0.27.3", + "@esbuild/linux-loong64": "0.27.3", + "@esbuild/linux-mips64el": "0.27.3", + "@esbuild/linux-ppc64": "0.27.3", + "@esbuild/linux-riscv64": "0.27.3", + "@esbuild/linux-s390x": "0.27.3", + "@esbuild/linux-x64": "0.27.3", + "@esbuild/netbsd-arm64": "0.27.3", + "@esbuild/netbsd-x64": "0.27.3", + "@esbuild/openbsd-arm64": "0.27.3", + "@esbuild/openbsd-x64": "0.27.3", + "@esbuild/openharmony-arm64": "0.27.3", + "@esbuild/sunos-x64": "0.27.3", + "@esbuild/win32-arm64": "0.27.3", + "@esbuild/win32-ia32": "0.27.3", + "@esbuild/win32-x64": "0.27.3" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-tsconfig": { + "version": "4.13.6", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.6.tgz", + "integrity": "sha512-shZT/QMiSHc/YBLxxOkMtgSid5HFoauqCE3/exfsEcwg1WkeqjG+V40yBbBrsD+jW2HDXcs28xOfcbm2jI8Ddw==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true, + "license": "ISC" + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/minimatch": { + "version": "10.2.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz", + "integrity": "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nodemon": { + "version": "3.1.14", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.14.tgz", + "integrity": "sha512-jakjZi93UtB3jHMWsXL68FXSAosbLfY0In5gtKq3niLSkrWznrVBzXFNOEMJUfc9+Ke7SHWoAZsiMkNP3vq6Jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^10.2.1", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true, + "license": "MIT" + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "license": "ISC", + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/tsx": { + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz", + "integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.27.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true, + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/vscode-jsonrpc": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.1.tgz", + "integrity": "sha512-kdjOSJ2lLIn7r1rtrMbbNCHjyMPfRnowdKjBQ+mGq6NAW5QY2bEZC/khaC5OR8svbbjvLEaIXkOq45e2X9BIbQ==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + } + } } diff --git a/samples/Metrics/ts/package.json b/samples/Metrics/ts/package.json new file mode 100644 index 00000000..0d130a7b --- /dev/null +++ b/samples/Metrics/ts/package.json @@ -0,0 +1,19 @@ +{ + "name": "metricsapp", + "version": "1.0.0", + "type": "module", + "scripts": { + "start": "aspire run", + "build": "tsc", + "dev": "tsc --watch" + }, + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } +} \ No newline at end of file diff --git a/samples/Metrics/ts/tsconfig.json b/samples/Metrics/ts/tsconfig.json new file mode 100644 index 00000000..edf7302c --- /dev/null +++ b/samples/Metrics/ts/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "outDir": "./dist", + "rootDir": "." + }, + "include": ["apphost.ts", ".modules/**/*.ts"], + "exclude": ["node_modules"] +} \ No newline at end of file diff --git a/samples/aspire-shop/ts/.aspire/settings.json b/samples/aspire-shop/ts/.aspire/settings.json index 1c4d3f71..af7e7dff 100644 --- a/samples/aspire-shop/ts/.aspire/settings.json +++ b/samples/aspire-shop/ts/.aspire/settings.json @@ -1,8 +1,10 @@ { "appHostPath": "../apphost.ts", + "language": "typescript/nodejs", + "channel": "staging", "sdkVersion": "13.2.0-preview.1.26159.1", "packages": { - "Aspire.Hosting.Redis": "13.1.2", - "Aspire.Hosting.PostgreSQL": "13.1.2" + "Aspire.Hosting.Redis": "13.2.0-preview.1.26159.1", + "Aspire.Hosting.PostgreSQL": "13.2.0-preview.1.26159.1" } } \ No newline at end of file diff --git a/samples/aspire-shop/ts/.modules/.codegen-hash b/samples/aspire-shop/ts/.modules/.codegen-hash index f80172fe..a7f470fb 100644 --- a/samples/aspire-shop/ts/.modules/.codegen-hash +++ b/samples/aspire-shop/ts/.modules/.codegen-hash @@ -1 +1 @@ -A3D717B4303871C79C85DCB46CECA2EF50362BF3EB47F81CC6B7DCDFAB93E0DA \ No newline at end of file +F147B18FE6EF6F6CE366D1C57BBBD23C865B17C54A3C19C816F30FCDB7EE7930 \ No newline at end of file diff --git a/samples/aspire-shop/ts/.modules/aspire.ts b/samples/aspire-shop/ts/.modules/aspire.ts index 73dc52d2..879641f1 100644 --- a/samples/aspire-shop/ts/.modules/aspire.ts +++ b/samples/aspire-shop/ts/.modules/aspire.ts @@ -26,6 +26,30 @@ import { // Handle Type Aliases (Internal - not exported to users) // ============================================================================ +/** Handle to PostgresDatabaseResource */ +type PostgresDatabaseResourceHandle = Handle<'Aspire.Hosting.PostgreSQL/Aspire.Hosting.ApplicationModel.PostgresDatabaseResource'>; + +/** Handle to PostgresServerResource */ +type PostgresServerResourceHandle = Handle<'Aspire.Hosting.PostgreSQL/Aspire.Hosting.ApplicationModel.PostgresServerResource'>; + +/** Handle to PgAdminContainerResource */ +type PgAdminContainerResourceHandle = Handle<'Aspire.Hosting.PostgreSQL/Aspire.Hosting.Postgres.PgAdminContainerResource'>; + +/** Handle to PgWebContainerResource */ +type PgWebContainerResourceHandle = Handle<'Aspire.Hosting.PostgreSQL/Aspire.Hosting.Postgres.PgWebContainerResource'>; + +/** Handle to PostgresMcpContainerResource */ +type PostgresMcpContainerResourceHandle = Handle<'Aspire.Hosting.PostgreSQL/Aspire.Hosting.Postgres.PostgresMcpContainerResource'>; + +/** Handle to RedisResource */ +type RedisResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting.ApplicationModel.RedisResource'>; + +/** Handle to RedisCommanderResource */ +type RedisCommanderResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisCommanderResource'>; + +/** Handle to RedisInsightResource */ +type RedisInsightResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisInsightResource'>; + /** Handle to CommandLineArgsCallbackContext */ type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; @@ -326,6 +350,10 @@ export interface AddContainerRegistryOptions { repository?: ParameterResource; } +export interface AddDatabaseOptions { + databaseName?: string; +} + export interface AddDockerfileOptions { dockerfilePath?: string; stage?: string; @@ -339,6 +367,21 @@ export interface AddParameterOptions { secret?: boolean; } +export interface AddPostgresOptions { + userName?: ParameterResource; + password?: ParameterResource; + port?: number; +} + +export interface AddRedisOptions { + port?: number; + password?: ParameterResource; +} + +export interface AddRedisWithPortOptions { + port?: number; +} + export interface AppendFormattedOptions { format?: string; } @@ -367,6 +410,15 @@ export interface WithCommandOptions { commandOptions?: CommandOptions; } +export interface WithDataBindMountOptions { + isReadOnly?: boolean; +} + +export interface WithDataVolumeOptions { + name?: string; + isReadOnly?: boolean; +} + export interface WithDescriptionOptions { enableMarkdown?: boolean; } @@ -397,6 +449,10 @@ export interface WithExternalServiceHttpHealthCheckOptions { statusCode?: number; } +export interface WithHostPortOptions { + port?: number; +} + export interface WithHttpEndpointOptions { port?: number; targetPort?: number; @@ -446,6 +502,21 @@ export interface WithMcpServerOptions { endpointName?: string; } +export interface WithPersistenceOptions { + interval?: number; + keysChangedThreshold?: number; +} + +export interface WithPgAdminOptions { + configureContainer?: (obj: PgAdminContainerResource) => Promise; + containerName?: string; +} + +export interface WithPgWebOptions { + configureContainer?: (obj: PgWebContainerResource) => Promise; + containerName?: string; +} + export interface WithPipelineStepFactoryOptions { dependsOn?: string[]; requiredBy?: string[]; @@ -453,6 +524,21 @@ export interface WithPipelineStepFactoryOptions { description?: string; } +export interface WithPostgresMcpOptions { + configureContainer?: (obj: PostgresMcpContainerResource) => Promise; + containerName?: string; +} + +export interface WithRedisCommanderOptions { + configureContainer?: (obj: RedisCommanderResource) => Promise; + containerName?: string; +} + +export interface WithRedisInsightOptions { + configureContainer?: (obj: RedisInsightResource) => Promise; + containerName?: string; +} + export interface WithReferenceOptions { connectionName?: string; optional?: boolean; @@ -1711,6 +1797,63 @@ export class DistributedApplicationBuilder { return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); } + /** Adds a Redis container resource with specific port */ + /** @internal */ + async _addRedisWithPortInternal(name: string, port?: number): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/addRedisWithPort', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { + const port = options?.port; + return new RedisResourcePromise(this._addRedisWithPortInternal(name, port)); + } + + /** Adds a Redis container resource */ + /** @internal */ + async _addRedisInternal(name: string, port?: number, password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (port !== undefined) rpcArgs.port = port; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/addRedis', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { + const port = options?.port; + const password = options?.password; + return new RedisResourcePromise(this._addRedisInternal(name, port, password)); + } + + /** Adds a PostgreSQL server resource */ + /** @internal */ + async _addPostgresInternal(name: string, userName?: ParameterResource, password?: ParameterResource, port?: number): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (userName !== undefined) rpcArgs.userName = userName; + if (password !== undefined) rpcArgs.password = password; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/addPostgres', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + addPostgres(name: string, options?: AddPostgresOptions): PostgresServerResourcePromise { + const userName = options?.userName; + const password = options?.password; + const port = options?.port; + return new PostgresServerResourcePromise(this._addPostgresInternal(name, userName, password, port)); + } + } /** @@ -1801,6 +1944,21 @@ export class DistributedApplicationBuilderPromise implements PromiseLike obj.addCSharpAppWithOptions(name, path, configure))); } + /** Adds a Redis container resource with specific port */ + addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.addRedisWithPort(name, options))); + } + + /** Adds a Redis container resource */ + addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.addRedis(name, options))); + } + + /** Adds a PostgreSQL server resource */ + addPostgres(name: string, options?: AddPostgresOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.addPostgres(name, options))); + } + } // ============================================================================ @@ -3056,6217 +3214,18783 @@ export class ContainerResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + 'Aspire.Hosting/withMcpServer', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageTagInternal(tag)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - const tag = options?.tag; - return new ContainerResourcePromise(this._withImageInternal(image, tag)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', + 'Aspire.Hosting/withEnvironmentExpression', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', + 'Aspire.Hosting/withEnvironmentCallbackAsync', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsContainerInternal()); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNameInternal(name)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + 'Aspire.Hosting/withArgs', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + 'Aspire.Hosting/withArgsCallback', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + 'Aspire.Hosting/withReference', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); } /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', + 'Aspire.Hosting/withServiceReference', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + 'Aspire.Hosting/withServiceReferenceNamed', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + 'Aspire.Hosting/withReferenceUri', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterInternal()); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); return new ContainerResource(result, this._client); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + 'Aspire.Hosting/withEndpoint', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - const helpLink = options?.helpLink; - return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/asHttp2Service', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + 'Aspire.Hosting/withUrl', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + 'Aspire.Hosting/withUrlExpression', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsInternal(args)); - } - - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + 'Aspire.Hosting/waitFor', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + 'Aspire.Hosting/waitForStart', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + 'Aspire.Hosting/withExplicitStart', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + 'Aspire.Hosting/waitForCompletion', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + const exitCode = options?.exitCode; + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + 'Aspire.Hosting/withHealthCheck', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + 'Aspire.Hosting/withCommand', rpcArgs ); return new ContainerResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); + return new ContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + 'Aspire.Hosting/withHttpsDeveloperCertificate', rpcArgs ); return new ContainerResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + const password = options?.password; + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); return new ContainerResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + 'Aspire.Hosting/withParentRelationship', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + 'Aspire.Hosting/withChildRelationship', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + 'Aspire.Hosting/withIconName', rpcArgs ); return new ContainerResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + 'Aspire.Hosting/withHttpProbe', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); return new ContainerResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromManifestInternal()); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); return new ContainerResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForInternal(dependency)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); return new ContainerResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); return new ContainerResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); return new ContainerResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); return new ContainerResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExplicitStartInternal()); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new ContainerResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - const exitCode = options?.exitCode; - return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); - } +} - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ContainerResource(result, this._client); - } +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// CSharpAppResource +// ============================================================================ + +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + const exitCode = options?.exitCode; + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + const commandOptions = options?.commandOptions; + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + const password = options?.password; + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + const iconVariant = options?.iconVariant; + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// DotnetToolResource +// ============================================================================ + +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + } + + /** @internal */ + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + } + + /** @internal */ + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + } + + /** @internal */ + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + } + + /** @internal */ + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + } + + /** @internal */ + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + const exitCode = options?.exitCode; + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + const commandOptions = options?.commandOptions; + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + const password = options?.password; + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + const iconVariant = options?.iconVariant; + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for DotnetToolResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExecutableResource +// ============================================================================ + +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// PgAdminContainerResource +// ============================================================================ + +export class PgAdminContainerResource extends ResourceBuilderBase { + constructor(handle: PgAdminContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PgAdminContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new PgAdminContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PgAdminContainerResourcePromise { + const tag = options?.tag; + return new PgAdminContainerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PgAdminContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new PgAdminContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PgAdminContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new PgAdminContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PgAdminContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new PgAdminContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PgAdminContainerResourcePromise { + const helpLink = options?.helpLink; + return new PgAdminContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PgAdminContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new PgAdminContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PgAdminContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new PgAdminContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PgAdminContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PgAdminContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PgAdminContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PgAdminContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PgAdminContainerResourcePromise { + const displayText = options?.displayText; + return new PgAdminContainerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PgAdminContainerResourcePromise { + const displayText = options?.displayText; + return new PgAdminContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PgAdminContainerResourcePromise { + const exitCode = options?.exitCode; + return new PgAdminContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PgAdminContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new PgAdminContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PgAdminContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new PgAdminContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PgAdminContainerResourcePromise { + const password = options?.password; + return new PgAdminContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PgAdminContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new PgAdminContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PgAdminContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new PgAdminContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PgAdminContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new PgAdminContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PgAdminContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new PgAdminContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPgAdminHostPort', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the host port for pgAdmin */ + withHostPort(options?: WithHostPortOptions): PgAdminContainerResourcePromise { + const port = options?.port; + return new PgAdminContainerResourcePromise(this._withHostPortInternal(port)); + } + +} + +/** + * Thenable wrapper for PgAdminContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class PgAdminContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PgAdminContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Sets the host port for pgAdmin */ + withHostPort(options?: WithHostPortOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + +} + +// ============================================================================ +// PgWebContainerResource +// ============================================================================ + +export class PgWebContainerResource extends ResourceBuilderBase { + constructor(handle: PgWebContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PgWebContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new PgWebContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PgWebContainerResourcePromise { + const tag = options?.tag; + return new PgWebContainerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PgWebContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new PgWebContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PgWebContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new PgWebContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PgWebContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new PgWebContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PgWebContainerResourcePromise { + const helpLink = options?.helpLink; + return new PgWebContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PgWebContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new PgWebContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PgWebContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new PgWebContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PgWebContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PgWebContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PgWebContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PgWebContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PgWebContainerResourcePromise { + const displayText = options?.displayText; + return new PgWebContainerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PgWebContainerResourcePromise { + const displayText = options?.displayText; + return new PgWebContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PgWebContainerResourcePromise { + const exitCode = options?.exitCode; + return new PgWebContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PgWebContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new PgWebContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PgWebContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new PgWebContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PgWebContainerResourcePromise { + const password = options?.password; + return new PgWebContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PgWebContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new PgWebContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PgWebContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new PgWebContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PgWebContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new PgWebContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PgWebContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new PgWebContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPgWebHostPort', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the host port for pgweb */ + withHostPort(options?: WithHostPortOptions): PgWebContainerResourcePromise { + const port = options?.port; + return new PgWebContainerResourcePromise(this._withHostPortInternal(port)); + } + +} + +/** + * Thenable wrapper for PgWebContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class PgWebContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PgWebContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Sets the host port for pgweb */ + withHostPort(options?: WithHostPortOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + +} + +// ============================================================================ +// PostgresDatabaseResource +// ============================================================================ + +export class PostgresDatabaseResource extends ResourceBuilderBase { + constructor(handle: PostgresDatabaseResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Parent property */ + parent = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.parent', + { context: this._handle } + ); + return new PostgresServerResource(handle, this._client); + }, + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the DatabaseName property */ + databaseName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.databaseName', + { context: this._handle } + ); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the JdbcConnectionString property */ + jdbcConnectionString = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.jdbcConnectionString', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresDatabaseResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new PostgresDatabaseResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresDatabaseResourcePromise { + const helpLink = options?.helpLink; + return new PostgresDatabaseResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PostgresDatabaseResourcePromise { + const displayText = options?.displayText; + return new PostgresDatabaseResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresDatabaseResourcePromise { + const displayText = options?.displayText; + return new PostgresDatabaseResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresDatabaseResourcePromise { + const commandOptions = options?.commandOptions; + return new PostgresDatabaseResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PostgresDatabaseResourcePromise { + const iconVariant = options?.iconVariant; + return new PostgresDatabaseResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresDatabaseResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new PostgresDatabaseResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withPostgresMcpInternal(configureContainer?: (obj: PostgresMcpContainerResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PostgresMcpContainerResourceHandle; + const obj = new PostgresMcpContainerResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPostgresMcp', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Adds Postgres MCP server */ + withPostgresMcp(options?: WithPostgresMcpOptions): PostgresDatabaseResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new PostgresDatabaseResourcePromise(this._withPostgresMcpInternal(configureContainer, containerName)); + } + + /** @internal */ + private async _withCreationScriptInternal(script: string): Promise { + const rpcArgs: Record = { builder: this._handle, script }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withCreationScript', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Defines the SQL script for database creation */ + withCreationScript(script: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withCreationScriptInternal(script)); + } + +} + +/** + * Thenable wrapper for PostgresDatabaseResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class PostgresDatabaseResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PostgresDatabaseResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Adds Postgres MCP server */ + withPostgresMcp(options?: WithPostgresMcpOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withPostgresMcp(options))); + } + + /** Defines the SQL script for database creation */ + withCreationScript(script: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withCreationScript(script))); + } + +} + +// ============================================================================ +// PostgresMcpContainerResource +// ============================================================================ + +export class PostgresMcpContainerResource extends ResourceBuilderBase { + constructor(handle: PostgresMcpContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PostgresMcpContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new PostgresMcpContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PostgresMcpContainerResourcePromise { + const tag = options?.tag; + return new PostgresMcpContainerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PostgresMcpContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new PostgresMcpContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresMcpContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new PostgresMcpContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PostgresMcpContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new PostgresMcpContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresMcpContainerResourcePromise { + const helpLink = options?.helpLink; + return new PostgresMcpContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PostgresMcpContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new PostgresMcpContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PostgresMcpContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new PostgresMcpContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PostgresMcpContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PostgresMcpContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PostgresMcpContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PostgresMcpContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PostgresMcpContainerResourcePromise { + const displayText = options?.displayText; + return new PostgresMcpContainerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresMcpContainerResourcePromise { + const displayText = options?.displayText; + return new PostgresMcpContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PostgresMcpContainerResourcePromise { + const exitCode = options?.exitCode; + return new PostgresMcpContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PostgresMcpContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new PostgresMcpContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresMcpContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new PostgresMcpContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PostgresMcpContainerResourcePromise { + const password = options?.password; + return new PostgresMcpContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PostgresMcpContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new PostgresMcpContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PostgresMcpContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new PostgresMcpContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresMcpContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new PostgresMcpContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PostgresMcpContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new PostgresMcpContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for PostgresMcpContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class PostgresMcpContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PostgresMcpContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// PostgresServerResource +// ============================================================================ + +export class PostgresServerResource extends ResourceBuilderBase { + constructor(handle: PostgresServerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the PrimaryEndpoint property */ + primaryEndpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.primaryEndpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the UserNameReference property */ + userNameReference = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.userNameReference', + { context: this._handle } + ); + }, + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the Databases property */ + private _databases?: AspireDict; + get databases(): AspireDict { + if (!this._databases) { + this._databases = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.databases', + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.databases' + ); + } + return this._databases; + } + + /** Gets the Host property */ + host = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.host', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.port', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the JdbcConnectionString property */ + jdbcConnectionString = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.jdbcConnectionString', + { context: this._handle } + ); + }, + }; + + /** Gets the Entrypoint property */ + entrypoint = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.entrypoint', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.setEntrypoint', + { context: this._handle, value } + ); + } + }; + + /** Gets the ShellExecution property */ + shellExecution = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.shellExecution', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.setShellExecution', + { context: this._handle, value } + ); + } + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PostgresServerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new PostgresServerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new ContainerResource(result, this._client); + return new PostgresServerResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Sets the container image tag */ + withImageTag(tag: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new ContainerResource(result, this._client); + return new PostgresServerResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Sets the container image registry */ + withImageRegistry(registry: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', rpcArgs ); - return new ContainerResource(result, this._client); + return new PostgresServerResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PostgresServerResourcePromise { + const tag = options?.tag; + return new PostgresServerResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', rpcArgs ); - return new ContainerResource(result, this._client); + return new PostgresServerResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - const password = options?.password; - return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Configures the resource to be published as a container */ + publishAsContainer(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PostgresServerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new PostgresServerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresServerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new PostgresServerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PostgresServerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new PostgresServerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresServerResourcePromise { + const helpLink = options?.helpLink; + return new PostgresServerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ContainerResource(result, this._client); + return new PostgresServerResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new PostgresServerResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ContainerResource(result, this._client); + return new PostgresServerResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ContainerResource(result, this._client); + return new PostgresServerResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ContainerResource(result, this._client); + return new PostgresServerResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', rpcArgs ); - return new ContainerResource(result, this._client); + return new PostgresServerResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromMcpInternal()); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withConnectionPropertyInternal(name, value)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', rpcArgs ); - return new ContainerResource(result, this._client); + return new PostgresServerResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withConnectionPropertyValueInternal(name, value)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new ContainerResource(result, this._client); + return new PostgresServerResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds arguments */ + withArgs(args: string[]): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ContainerResource(result, this._client); + return new PostgresServerResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new PostgresServerResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new ContainerResource(result, this._client); + return new PostgresServerResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PostgresServerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new PostgresServerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', rpcArgs ); - return new ContainerResource(result, this._client); + return new PostgresServerResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withServiceReferenceInternal(source)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', rpcArgs ); + return new PostgresServerResource(result, this._client); } -} - -/** - * Thenable wrapper for ContainerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ContainerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } - then( - onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withReferenceUriInternal(name, uri)); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PostgresServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new PostgresServerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PostgresServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PostgresServerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PostgresServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PostgresServerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._asHttp2ServiceInternal()); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PostgresServerResourcePromise { + const displayText = options?.displayText; + return new PostgresServerResourcePromise(this._withUrlInternal(url, displayText)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresServerResourcePromise { + const displayText = options?.displayText; + return new PostgresServerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._excludeFromManifestInternal()); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._waitForInternal(dependency)); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._waitForStartInternal(dependency)); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** Prevents resource from starting automatically */ + withExplicitStart(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withExplicitStartInternal()); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PostgresServerResourcePromise { + const exitCode = options?.exitCode; + return new PostgresServerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** Adds a health check by key */ + withHealthCheck(key: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withHealthCheckInternal(key)); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PostgresServerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new PostgresServerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresServerResourcePromise { + const commandOptions = options?.commandOptions; + return new PostgresServerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PostgresServerResourcePromise { + const password = options?.password; + return new PostgresServerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withChildRelationshipInternal(child)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PostgresServerResourcePromise { + const iconVariant = options?.iconVariant; + return new PostgresServerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PostgresServerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new PostgresServerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._excludeFromMcpInternal()); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresServerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new PostgresServerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new PostgresServerResource(result, this._client); } -} - -// ============================================================================ -// CSharpAppResource -// ============================================================================ + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PostgresServerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new PostgresServerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } -export class CSharpAppResource extends ResourceBuilderBase { - constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _addDatabaseInternal(name: string, databaseName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (databaseName !== undefined) rpcArgs.databaseName = databaseName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/addDatabase', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds a PostgreSQL database */ + addDatabase(name: string, options?: AddDatabaseOptions): PostgresDatabaseResourcePromise { + const databaseName = options?.databaseName; + return new PostgresDatabaseResourcePromise(this._addDatabaseInternal(name, databaseName)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withPgAdminInternal(configureContainer?: (obj: PgAdminContainerResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PgAdminContainerResourceHandle; + const obj = new PgAdminContainerResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPgAdmin', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new PostgresServerResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds pgAdmin 4 management UI */ + withPgAdmin(options?: WithPgAdminOptions): PostgresServerResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new PostgresServerResourcePromise(this._withPgAdminInternal(configureContainer, containerName)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _withPgWebInternal(configureContainer?: (obj: PgWebContainerResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PgWebContainerResourceHandle; + const obj = new PgWebContainerResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPgWeb', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new PostgresServerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds pgweb management UI */ + withPgWeb(options?: WithPgWebOptions): PostgresServerResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new PostgresServerResourcePromise(this._withPgWebInternal(configureContainer, containerName)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { + private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withDataVolume', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new PostgresServerResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + /** Adds a data volume for PostgreSQL */ + withDataVolume(options?: WithDataVolumeOptions): PostgresServerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new PostgresServerResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withDataBindMount', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new PostgresServerResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Adds a data bind mount for PostgreSQL */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): PostgresServerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new PostgresServerResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); } /** @internal */ - private async _withReplicasInternal(replicas: number): Promise { - const rpcArgs: Record = { builder: this._handle, replicas }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReplicas', + private async _withInitFilesInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withInitFiles', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new PostgresServerResource(result, this._client); } - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + /** Copies init files to PostgreSQL */ + withInitFiles(source: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withInitFilesInternal(source)); } /** @internal */ - private async _disableForwardedHeadersInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/disableForwardedHeaders', + private async _withPasswordInternal(password: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, password }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPassword', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new PostgresServerResource(result, this._client); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + /** Configures the PostgreSQL password */ + withPassword(password: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withPasswordInternal(password)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withUserNameInternal(userName: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, userName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withUserName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new PostgresServerResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - const helpLink = options?.helpLink; - return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures the PostgreSQL user name */ + withUserName(userName: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withUserNameInternal(userName)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPostgresHostPort', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new PostgresServerResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + /** Sets the host port for PostgreSQL */ + withHostPort(options?: WithHostPortOptions): PostgresServerResourcePromise { + const port = options?.port; + return new PostgresServerResourcePromise(this._withHostPortInternal(port)); } - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new CSharpAppResource(result, this._client); +} + +/** + * Thenable wrapper for PostgresServerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class PostgresServerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PostgresServerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets the container image tag */ + withImageTag(tag: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets the container image registry */ + withImageRegistry(registry: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); } - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Configures the resource to be published as a container */ + publishAsContainer(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); } - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsInternal(args)); + /** Sets the container name */ + withContainerName(name: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); } - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); } - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds arguments */ + withArgs(args: string[]): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); } - /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); - } - - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + withUrl(url: string, options?: WithUrlOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - const exitCode = options?.exitCode; - return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - const commandOptions = options?.commandOptions; - return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds a PostgreSQL database */ + addDatabase(name: string, options?: AddDatabaseOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.addDatabase(name, options))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds pgAdmin 4 management UI */ + withPgAdmin(options?: WithPgAdminOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPgAdmin(options))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Adds pgweb management UI */ + withPgWeb(options?: WithPgWebOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPgWeb(options))); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a data volume for PostgreSQL */ + withDataVolume(options?: WithDataVolumeOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - const password = options?.password; - return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Adds a data bind mount for PostgreSQL */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Copies init files to PostgreSQL */ + withInitFiles(source: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withInitFiles(source))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + /** Configures the PostgreSQL password */ + withPassword(password: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPassword(password))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Configures the PostgreSQL user name */ + withUserName(userName: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUserName(userName))); + } + + /** Sets the host port for PostgreSQL */ + withHostPort(options?: WithHostPortOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - const iconVariant = options?.iconVariant; - return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _withOtlpExporterInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', rpcArgs - ); - } - -} - -/** - * Thenable wrapper for CSharpAppResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class CSharpAppResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); - } - - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); - } - - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); - } - - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); - } - - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); - } - - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + ); + return new ProjectResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ProjectResource(result, this._client); } /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); } -} - -// ============================================================================ -// DotnetToolResource -// ============================================================================ - -export class DotnetToolResource extends ResourceBuilderBase { - constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withToolPackageInternal(packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPackage', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withToolVersionInternal(version: string): Promise { - const rpcArgs: Record = { builder: this._handle, version }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolVersion', + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withToolPrereleaseInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPrerelease', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withToolSourceInternal(source: string): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolSource', + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withToolIgnoreExistingFeedsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreExistingFeeds', + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withToolIgnoreFailedSourcesInternal(): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreFailedSources', + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _publishAsDockerFileInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFile', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; - const obj = new ContainerResource(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFileWithConfigure', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withExecutableCommandInternal(command: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExecutableCommand', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { - const rpcArgs: Record = { builder: this._handle, workingDirectory }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withWorkingDirectory', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - const helpLink = options?.helpLink; - return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new DotnetToolResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); } - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); - } - - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsInternal(args)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } - /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { - const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { - const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// RedisCommanderResource +// ============================================================================ + +export class RedisCommanderResource extends ResourceBuilderBase { + constructor(handle: RedisCommanderResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisCommanderResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisCommanderResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { - const exitCode = options?.exitCode; - return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Sets the container image tag */ + withImageTag(tag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisCommanderResourcePromise { + const tag = options?.tag; + return new RedisCommanderResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { - const commandOptions = options?.commandOptions; - return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withLifetimeInternal(lifetime)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { - const password = options?.password; - return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _publishAsContainerInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisCommanderResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new RedisCommanderResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets the container name */ + withContainerName(name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerNameInternal(name)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { - const iconVariant = options?.iconVariant; - return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withBuildArgInternal(name, value)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisCommanderResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new RedisCommanderResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerNetworkAliasInternal(alias)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisCommanderResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new RedisCommanderResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', rpcArgs ); + return new RedisCommanderResource(result, this._client); } -} - -/** - * Thenable wrapper for DotnetToolResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class DotnetToolResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._publishAsConnectionStringInternal()); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisCommanderResourcePromise { + const helpLink = options?.helpLink; + return new RedisCommanderResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentInternal(name, value)); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentCallbackInternal(callback)); } - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Adds arguments */ + withArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withArgsInternal(args)); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withArgsCallbackInternal(callback)); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } - /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisCommanderResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new RedisCommanderResourcePromise(this._withReferenceInternal(source, connectionName, optional)); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withServiceReferenceInternal(source)); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): RedisCommanderResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new RedisCommanderResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisCommanderResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisCommanderResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisCommanderResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisCommanderResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): RedisCommanderResourcePromise { + const displayText = options?.displayText; + return new RedisCommanderResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisCommanderResourcePromise { + const displayText = options?.displayText; + return new RedisCommanderResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForInternal(dependency)); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForStartInternal(dependency)); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withExplicitStartInternal()); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisCommanderResourcePromise { + const exitCode = options?.exitCode; + return new RedisCommanderResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Adds a health check by key */ + withHealthCheck(key: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withHealthCheckInternal(key)); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisCommanderResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new RedisCommanderResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisCommanderResourcePromise { + const commandOptions = options?.commandOptions; + return new RedisCommanderResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisCommanderResourcePromise { + const password = options?.password; + return new RedisCommanderResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } -} + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withoutHttpsCertificateInternal()); + } -// ============================================================================ -// ExecutableResource -// ============================================================================ + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } -export class ExecutableResource extends ResourceBuilderBase { - constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisCommanderResourcePromise { + const iconVariant = options?.iconVariant; + return new RedisCommanderResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisCommanderResourcePromise { const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + return new RedisCommanderResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - const helpLink = options?.helpLink; - return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisCommanderResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new RedisCommanderResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisCommanderResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisCommanderResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); } - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new ExecutableResource(result, this._client); - } - - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisCommanderHostPort', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Sets the host port for Redis Commander */ + withHostPort(options?: WithHostPortOptions): RedisCommanderResourcePromise { + const port = options?.port; + return new RedisCommanderResourcePromise(this._withHostPortInternal(port)); } - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new ExecutableResource(result, this._client); +} + +/** + * Thenable wrapper for RedisCommanderResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class RedisCommanderResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: RedisCommanderResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsInternal(args)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the container image tag */ + withImageTag(tag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.publishAsContainer())); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Sets the container name */ + withContainerName(name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerName(name))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds arguments */ + withArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); } - /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { - const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { - const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForInternal(dependency)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExplicitStartInternal()); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { - const exitCode = options?.exitCode; - return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { - const commandOptions = options?.commandOptions; - return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { - const password = options?.password; - return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + /** Sets the host port for Redis Commander */ + withHostPort(options?: WithHostPortOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHostPort(options))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } +} - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); +// ============================================================================ +// RedisInsightResource +// ============================================================================ + +export class RedisInsightResource extends ResourceBuilderBase { + constructor(handle: RedisInsightResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { - const iconVariant = options?.iconVariant; - return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisInsightResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisInsightResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + /** Sets the container image tag */ + withImageTag(tag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisInsightResourcePromise { + const tag = options?.tag; + return new RedisInsightResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withLifetimeInternal(lifetime)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); + return new RedisInsightResource(result, this._client); } -} - -/** - * Thenable wrapper for ExecutableResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ExecutableResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._publishAsContainerInternal()); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisInsightResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new RedisInsightResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets the container name */ + withContainerName(name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerNameInternal(name)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withBuildArgInternal(name, value)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withBuildSecretInternal(name, value)); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisInsightResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new RedisInsightResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerNetworkAliasInternal(alias)); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisInsightResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new RedisInsightResourcePromise(this._withMcpServerInternal(path, endpointName)); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withOtlpExporterInternal()); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._publishAsConnectionStringInternal()); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisInsightResourcePromise { + const helpLink = options?.helpLink; + return new RedisInsightResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentInternal(name, value)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentCallbackInternal(callback)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds arguments */ + withArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withArgsInternal(args)); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withArgsCallbackInternal(callback)); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisInsightResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new RedisInsightResourcePromise(this._withReferenceInternal(source, connectionName, optional)); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withServiceReferenceInternal(source)); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withReferenceUriInternal(name, uri)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } -} + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisInsightResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new RedisInsightResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } -// ============================================================================ -// ExternalServiceResource -// ============================================================================ + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } -export class ExternalServiceResource extends ResourceBuilderBase { - constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisInsightResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisInsightResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisInsightResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisInsightResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** @internal */ - private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); - } - - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - const helpLink = options?.helpLink; - return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + withUrl(url: string, options?: WithUrlOptions): RedisInsightResourcePromise { const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + return new RedisInsightResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisInsightResourcePromise { const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new RedisInsightResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisInsightResourcePromise { + const exitCode = options?.exitCode; + return new RedisInsightResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisInsightResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new RedisInsightResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -9274,113 +21998,204 @@ export class ExternalServiceResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisInsightResourcePromise { const commandOptions = options?.commandOptions; - return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new RedisInsightResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisInsightResourcePromise { + const password = options?.password; + return new RedisInsightResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisInsightResourcePromise { + const iconVariant = options?.iconVariant; + return new RedisInsightResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - const iconVariant = options?.iconVariant; - return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisInsightResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new RedisInsightResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -9391,60 +22206,79 @@ export class ExternalServiceResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisInsightResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new RedisInsightResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisInsightResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); } /** Gets the resource name */ @@ -9456,1055 +22290,1253 @@ export class ExternalServiceResource extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsightHostPort', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the host port for Redis Insight */ + withHostPort(options?: WithHostPortOptions): RedisInsightResourcePromise { + const port = options?.port; + return new RedisInsightResourcePromise(this._withHostPortInternal(port)); + } + + /** @internal */ + private async _withDataVolumeInternal(name?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsightDataVolume', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a data volume for Redis Insight */ + withDataVolume(options?: WithDataVolumeOptions): RedisInsightResourcePromise { + const name = options?.name; + return new RedisInsightResourcePromise(this._withDataVolumeInternal(name)); + } + + /** @internal */ + private async _withDataBindMountInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsightDataBindMount', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a data bind mount for Redis Insight */ + withDataBindMount(source: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withDataBindMountInternal(source)); + } + } /** - * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * Thenable wrapper for RedisInsightResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ExternalServiceResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class RedisInsightResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: RedisInsightResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds arguments */ + withArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } -} - -// ============================================================================ -// ParameterResource -// ============================================================================ + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } -export class ParameterResource extends ResourceBuilderBase { - constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** @internal */ - private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, description }; - if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDescription', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - const enableMarkdown = options?.enableMarkdown; - return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - const helpLink = options?.helpLink; - return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromManifestInternal()); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._withExplicitStartInternal()); + /** Sets the host port for Redis Insight */ + withHostPort(options?: WithHostPortOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHostPort(options))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Adds a data volume for Redis Insight */ + withDataVolume(options?: WithDataVolumeOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + /** Adds a data bind mount for Redis Insight */ + withDataBindMount(source: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDataBindMount(source))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ParameterResource(result, this._client); +} + +// ============================================================================ +// RedisResource +// ============================================================================ + +export class RedisResource extends ResourceBuilderBase { + constructor(handle: RedisResourceHandle, client: AspireClientRpc) { + super(handle, client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - const commandOptions = options?.commandOptions; - return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); - } + /** Gets the PrimaryEndpoint property */ + primaryEndpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.primaryEndpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.host', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.port', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the TlsEnabled property */ + tlsEnabled = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.tlsEnabled', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.setTlsEnabled', + { context: this._handle, value } + ); + } + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ParameterResource(result, this._client); - } + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.uriExpression', + { context: this._handle } + ); + }, + }; - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); - } + /** Gets the Entrypoint property */ + entrypoint = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.entrypoint', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.setEntrypoint', + { context: this._handle, value } + ); + } + }; - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ParameterResource(result, this._client); - } + /** Gets the ShellExecution property */ + shellExecution = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.shellExecution', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.setShellExecution', + { context: this._handle, value } + ); + } + }; - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); - } + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.name', + { context: this._handle } + ); + }, + }; /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - const iconVariant = options?.iconVariant; - return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromMcpInternal()); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisResourcePromise { + return new RedisResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Sets the container image tag */ + withImageTag(tag: string): RedisResourcePromise { + return new RedisResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisResourcePromise { + return new RedisResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisResourcePromise { + const tag = options?.tag; + return new RedisResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisResourcePromise { + return new RedisResourcePromise(this._withImageSHA256Internal(sha256)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); + return new RedisResource(result, this._client); } -} - -/** - * Thenable wrapper for ParameterResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ParameterResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); - } - - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); - } - - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); - } - - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerRuntimeArgsInternal(args)); } - /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisResourcePromise { + return new RedisResourcePromise(this._withLifetimeInternal(lifetime)); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisResourcePromise { + return new RedisResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisResourcePromise { + return new RedisResourcePromise(this._publishAsContainerInternal()); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new RedisResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Sets the container name */ + withContainerName(name: string): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerNameInternal(name)); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withBuildArgInternal(name, value)); } -} - -// ============================================================================ -// ProjectResource -// ============================================================================ + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new RedisResource(result, this._client); + } -export class ProjectResource extends ResourceBuilderBase { - constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new RedisResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + withMcpServer(options?: WithMcpServerOptions): RedisResourcePromise { const path = options?.path; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + return new RedisResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { + private async _withOtlpExporterInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterInternal()); + withOtlpExporter(): RedisResourcePromise { + return new RedisResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisResourcePromise { + return new RedisResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisResourcePromise { + return new RedisResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisResourcePromise { const helpLink = options?.helpLink; - return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new RedisResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { + private async _withEnvironmentInternal(name: string, value: string): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + withEnvironment(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentExpression', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; const obj = new EnvironmentCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + return new RedisResourcePromise(this._withReferenceInternal(source, connectionName, optional)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withServiceReference', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + withServiceReference(source: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withServiceReferenceInternal(source)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withServiceReferenceNamed', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisResourcePromise { + return new RedisResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): RedisResourcePromise { + return new RedisResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): RedisResourcePromise { + return new RedisResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -10514,15 +23546,15 @@ export class ProjectResource extends ResourceBuilderBase if (isProxied !== undefined) rpcArgs.isProxied = isProxied; if (isExternal !== undefined) rpcArgs.isExternal = isExternal; if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + withEndpoint(options?: WithEndpointOptions): RedisResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -10531,72 +23563,72 @@ export class ProjectResource extends ResourceBuilderBase const isProxied = options?.isProxied; const isExternal = options?.isExternal; const protocol = options?.protocol; - return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + return new RedisResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new RedisResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new RedisResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): RedisResourcePromise { + return new RedisResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -10609,293 +23641,278 @@ export class ProjectResource extends ResourceBuilderBase } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): RedisResourcePromise { + return new RedisResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + withUrl(url: string, options?: WithUrlOptions): RedisResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + return new RedisResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new RedisResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); - } - - /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): RedisResourcePromise { + return new RedisResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitFor', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): RedisResourcePromise { + return new RedisResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForCompletion', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisResourcePromise { const exitCode = options?.exitCode; - return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new RedisResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): RedisResourcePromise { + return new RedisResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new RedisResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -10903,130 +23920,130 @@ export class ProjectResource extends ResourceBuilderBase }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisResourcePromise { const commandOptions = options?.commandOptions; - return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new RedisResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): RedisResourcePromise { + return new RedisResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsDeveloperCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisResourcePromise { const password = options?.password; - return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new RedisResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): RedisResourcePromise { + return new RedisResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): RedisResourcePromise { const iconVariant = options?.iconVariant; - return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new RedisResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -11035,15 +24052,15 @@ export class ProjectResource extends ResourceBuilderBase if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -11051,56 +24068,56 @@ export class ProjectResource extends ResourceBuilderBase const failureThreshold = options?.failureThreshold; const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new RedisResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): RedisResourcePromise { + return new RedisResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): RedisResourcePromise { + return new RedisResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): RedisResourcePromise { + return new RedisResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -11111,216 +24128,465 @@ export class ProjectResource extends ResourceBuilderBase if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; if (tags !== undefined) rpcArgs.tags = tags; if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new RedisResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withRedisCommanderInternal(configureContainer?: (obj: RedisCommanderResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as RedisCommanderResourceHandle; + const obj = new RedisCommanderResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisCommander', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds Redis Commander management UI */ + withRedisCommander(options?: WithRedisCommanderOptions): RedisResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new RedisResourcePromise(this._withRedisCommanderInternal(configureContainer, containerName)); + } + + /** @internal */ + private async _withRedisInsightInternal(configureContainer?: (obj: RedisInsightResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as RedisInsightResourceHandle; + const obj = new RedisInsightResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsight', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds Redis Insight management UI */ + withRedisInsight(options?: WithRedisInsightOptions): RedisResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new RedisResourcePromise(this._withRedisInsightInternal(configureContainer, containerName)); + } + + /** @internal */ + private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withDataVolume', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a data volume with persistence */ + withDataVolume(options?: WithDataVolumeOptions): RedisResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withDataBindMount', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds a data bind mount with persistence */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): RedisResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withPersistenceInternal(interval?: number, keysChangedThreshold?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (interval !== undefined) rpcArgs.interval = interval; + if (keysChangedThreshold !== undefined) rpcArgs.keysChangedThreshold = keysChangedThreshold; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withPersistence', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Configures Redis persistence */ + withPersistence(options?: WithPersistenceOptions): RedisResourcePromise { + const interval = options?.interval; + const keysChangedThreshold = options?.keysChangedThreshold; + return new RedisResourcePromise(this._withPersistenceInternal(interval, keysChangedThreshold)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withPasswordInternal(password: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, password }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withPassword', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures the password for Redis */ + withPassword(password: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withPasswordInternal(password)); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withHostPort', rpcArgs ); + return new RedisResource(result, this._client); + } + + /** Sets the host port for Redis */ + withHostPort(options?: WithHostPortOptions): RedisResourcePromise { + const port = options?.port; + return new RedisResourcePromise(this._withHostPortInternal(port)); } } /** - * Thenable wrapper for ProjectResource that enables fluent chaining. + * Thenable wrapper for RedisResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ProjectResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class RedisResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: RedisResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + withMcpServer(options?: WithMcpServerOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + withOtlpExporter(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + withEnvironment(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + withServiceReference(source: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); } /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -11329,163 +24595,163 @@ export class ProjectResourcePromise implements PromiseLike { } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } /** Gets the resource name */ @@ -11493,6 +24759,41 @@ export class ProjectResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Adds Redis Commander management UI */ + withRedisCommander(options?: WithRedisCommanderOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRedisCommander(options))); + } + + /** Adds Redis Insight management UI */ + withRedisInsight(options?: WithRedisInsightOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRedisInsight(options))); + } + + /** Adds a data volume with persistence */ + withDataVolume(options?: WithDataVolumeOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + } + + /** Adds a data bind mount with persistence */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); + } + + /** Configures Redis persistence */ + withPersistence(options?: WithPersistenceOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPersistence(options))); + } + + /** Configures the password for Redis */ + withPassword(password: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPassword(password))); + } + + /** Sets the host port for Redis */ + withHostPort(options?: WithHostPortOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + } // ============================================================================ @@ -13293,7 +26594,15 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetTool registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.PostgreSQL/Aspire.Hosting.Postgres.PgAdminContainerResource', (handle, client) => new PgAdminContainerResource(handle as PgAdminContainerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.PostgreSQL/Aspire.Hosting.Postgres.PgWebContainerResource', (handle, client) => new PgWebContainerResource(handle as PgWebContainerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.PostgreSQL/Aspire.Hosting.ApplicationModel.PostgresDatabaseResource', (handle, client) => new PostgresDatabaseResource(handle as PostgresDatabaseResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.PostgreSQL/Aspire.Hosting.Postgres.PostgresMcpContainerResource', (handle, client) => new PostgresMcpContainerResource(handle as PostgresMcpContainerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.PostgreSQL/Aspire.Hosting.ApplicationModel.PostgresServerResource', (handle, client) => new PostgresServerResource(handle as PostgresServerResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisCommanderResource', (handle, client) => new RedisCommanderResource(handle as RedisCommanderResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisInsightResource', (handle, client) => new RedisInsightResource(handle as RedisInsightResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.ApplicationModel.RedisResource', (handle, client) => new RedisResource(handle as RedisResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); diff --git a/samples/aspire-shop/ts/apphost.run.json b/samples/aspire-shop/ts/apphost.run.json new file mode 100644 index 00000000..7560a5ad --- /dev/null +++ b/samples/aspire-shop/ts/apphost.run.json @@ -0,0 +1,11 @@ +{ + "profiles": { + "https": { + "applicationUrl": "https://localhost:37315;http://localhost:43038", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:35116", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:29793" + } + } + } +} \ No newline at end of file diff --git a/samples/aspire-shop/ts/apphost.ts b/samples/aspire-shop/ts/apphost.ts index b33268e0..5647b8a4 100644 --- a/samples/aspire-shop/ts/apphost.ts +++ b/samples/aspire-shop/ts/apphost.ts @@ -1,48 +1,40 @@ -// Setup: Run the following commands to add required integrations: -// aspire add postgres -// aspire add redis - -import { createBuilder, ContainerLifetime } from "./.modules/aspire.js"; +import { createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); -const postgres = await builder.addPostgres("postgres") +const postgres = builder.addPostgres("postgres") .withPgAdmin() - .withLifetime(ContainerLifetime.Persistent); + .withLifetime("persistent"); -const execCtx = await builder.executionContext.get(); -const isRunMode = await execCtx.isRunMode.get(); -if (isRunMode) { +if (builder.executionContext.isRunMode) { await postgres.withDataVolume(); } const catalogDb = postgres.addDatabase("catalogdb"); -const basketCache = await builder.addRedis("basketcache") +const basketCache = builder.addRedis("basketcache") .withDataVolume() .withRedisCommander(); -const catalogDbManager = builder.addProject("catalogdbmanager") +const catalogDbManager = builder.addProject("catalogdbmanager", "../AspireShop.CatalogDbManager/AspireShop.CatalogDbManager.csproj", "https") .withReference(catalogDb) .waitFor(catalogDb) .withHttpHealthCheck("/health"); -// POLYGLOT GAP: .WithHttpCommand("/reset-db", "Reset Database", ...) — custom HTTP commands are not available. -const catalogService = builder.addProject("catalogservice") +const catalogService = builder.addProject("catalogservice", "../AspireShop.CatalogService/AspireShop.CatalogService.csproj", "https") .withReference(catalogDb) .waitFor(catalogDbManager) .withHttpHealthCheck("/health"); -const basketService = builder.addProject("basketservice") +const basketService = builder.addProject("basketservice", "../AspireShop.BasketService/AspireShop.BasketService.csproj", "https") .withReference(basketCache) .waitFor(basketCache); -const frontend = builder.addProject("frontend") +builder.addProject("frontend", "../AspireShop.Frontend/AspireShop.Frontend.csproj", "https") .withExternalHttpEndpoints() .withHttpHealthCheck("/health") .withReference(basketService) .withReference(catalogService) .waitFor(catalogService); -// POLYGLOT GAP: .WithUrlForEndpoint callbacks for display text are not available. await builder.build().run(); diff --git a/samples/aspire-shop/ts/package-lock.json b/samples/aspire-shop/ts/package-lock.json index c4d3800c..6ffe8533 100644 --- a/samples/aspire-shop/ts/package-lock.json +++ b/samples/aspire-shop/ts/package-lock.json @@ -1,6 +1,962 @@ { - "name": "ts", + "name": "aspireshop", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, - "packages": {} + "packages": { + "": { + "name": "aspireshop", + "version": "1.0.0", + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz", + "integrity": "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.3.tgz", + "integrity": "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.3.tgz", + "integrity": "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.3.tgz", + "integrity": "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.3.tgz", + "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.3.tgz", + "integrity": "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.3.tgz", + "integrity": "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.3.tgz", + "integrity": "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.3.tgz", + "integrity": "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.3.tgz", + "integrity": "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.3.tgz", + "integrity": "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.3.tgz", + "integrity": "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.3.tgz", + "integrity": "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.3.tgz", + "integrity": "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.3.tgz", + "integrity": "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.3.tgz", + "integrity": "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz", + "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.3.tgz", + "integrity": "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.3.tgz", + "integrity": "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.3.tgz", + "integrity": "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.3.tgz", + "integrity": "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.3.tgz", + "integrity": "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.3.tgz", + "integrity": "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.3.tgz", + "integrity": "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.3.tgz", + "integrity": "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.3.tgz", + "integrity": "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@types/node": { + "version": "20.19.37", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.37.tgz", + "integrity": "sha512-8kzdPJ3FsNsVIurqBs7oodNnCEVbni9yUEkaHbgptDACOPW04jimGagZ51E6+lXUwJjgnBw+hyko/lkFWCldqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.4.tgz", + "integrity": "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/esbuild": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.3.tgz", + "integrity": "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.27.3", + "@esbuild/android-arm": "0.27.3", + "@esbuild/android-arm64": "0.27.3", + "@esbuild/android-x64": "0.27.3", + "@esbuild/darwin-arm64": "0.27.3", + "@esbuild/darwin-x64": "0.27.3", + "@esbuild/freebsd-arm64": "0.27.3", + "@esbuild/freebsd-x64": "0.27.3", + "@esbuild/linux-arm": "0.27.3", + "@esbuild/linux-arm64": "0.27.3", + "@esbuild/linux-ia32": "0.27.3", + "@esbuild/linux-loong64": "0.27.3", + "@esbuild/linux-mips64el": "0.27.3", + "@esbuild/linux-ppc64": "0.27.3", + "@esbuild/linux-riscv64": "0.27.3", + "@esbuild/linux-s390x": "0.27.3", + "@esbuild/linux-x64": "0.27.3", + "@esbuild/netbsd-arm64": "0.27.3", + "@esbuild/netbsd-x64": "0.27.3", + "@esbuild/openbsd-arm64": "0.27.3", + "@esbuild/openbsd-x64": "0.27.3", + "@esbuild/openharmony-arm64": "0.27.3", + "@esbuild/sunos-x64": "0.27.3", + "@esbuild/win32-arm64": "0.27.3", + "@esbuild/win32-ia32": "0.27.3", + "@esbuild/win32-x64": "0.27.3" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-tsconfig": { + "version": "4.13.6", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.6.tgz", + "integrity": "sha512-shZT/QMiSHc/YBLxxOkMtgSid5HFoauqCE3/exfsEcwg1WkeqjG+V40yBbBrsD+jW2HDXcs28xOfcbm2jI8Ddw==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true, + "license": "ISC" + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/minimatch": { + "version": "10.2.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz", + "integrity": "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nodemon": { + "version": "3.1.14", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.14.tgz", + "integrity": "sha512-jakjZi93UtB3jHMWsXL68FXSAosbLfY0In5gtKq3niLSkrWznrVBzXFNOEMJUfc9+Ke7SHWoAZsiMkNP3vq6Jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^10.2.1", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true, + "license": "MIT" + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "license": "ISC", + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/tsx": { + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz", + "integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.27.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true, + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/vscode-jsonrpc": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.1.tgz", + "integrity": "sha512-kdjOSJ2lLIn7r1rtrMbbNCHjyMPfRnowdKjBQ+mGq6NAW5QY2bEZC/khaC5OR8svbbjvLEaIXkOq45e2X9BIbQ==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + } + } } diff --git a/samples/aspire-shop/ts/package.json b/samples/aspire-shop/ts/package.json new file mode 100644 index 00000000..f7279d01 --- /dev/null +++ b/samples/aspire-shop/ts/package.json @@ -0,0 +1,19 @@ +{ + "name": "aspireshop", + "version": "1.0.0", + "type": "module", + "scripts": { + "start": "aspire run", + "build": "tsc", + "dev": "tsc --watch" + }, + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } +} \ No newline at end of file diff --git a/samples/aspire-shop/ts/tsconfig.json b/samples/aspire-shop/ts/tsconfig.json new file mode 100644 index 00000000..edf7302c --- /dev/null +++ b/samples/aspire-shop/ts/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "outDir": "./dist", + "rootDir": "." + }, + "include": ["apphost.ts", ".modules/**/*.ts"], + "exclude": ["node_modules"] +} \ No newline at end of file diff --git a/samples/aspire-with-azure-functions/ts/.aspire/settings.json b/samples/aspire-with-azure-functions/ts/.aspire/settings.json index cbded5d2..a6bc88b0 100644 --- a/samples/aspire-with-azure-functions/ts/.aspire/settings.json +++ b/samples/aspire-with-azure-functions/ts/.aspire/settings.json @@ -1,9 +1,11 @@ { "appHostPath": "../apphost.ts", + "language": "typescript/nodejs", + "channel": "staging", "sdkVersion": "13.2.0-preview.1.26159.1", "packages": { - "Aspire.Hosting.Azure.AppContainers": "13.1.2", - "Aspire.Hosting.Azure.Storage": "13.1.2", - "Aspire.Hosting.Azure.Functions": "13.1.2" + "Aspire.Hosting.Azure.AppContainers": "13.2.0-preview.1.26159.1", + "Aspire.Hosting.Azure.Storage": "13.2.0-preview.1.26159.1", + "Aspire.Hosting.Azure.Functions": "13.2.0-preview.1.26159.1" } } \ No newline at end of file diff --git a/samples/aspire-with-azure-functions/ts/.modules/.codegen-hash b/samples/aspire-with-azure-functions/ts/.modules/.codegen-hash index 614e1876..896ea9a9 100644 --- a/samples/aspire-with-azure-functions/ts/.modules/.codegen-hash +++ b/samples/aspire-with-azure-functions/ts/.modules/.codegen-hash @@ -1 +1 @@ -EC1A60F277849F10E3FAA5D7EFE05EE83509414FA0AE9B5B529866A62EB7D48E \ No newline at end of file +74DF45CA80E160A211D073E6A077C37D170FF22691C6920AC5C042F48ED9EFF7 \ No newline at end of file diff --git a/samples/aspire-with-azure-functions/ts/.modules/aspire.ts b/samples/aspire-with-azure-functions/ts/.modules/aspire.ts index 73dc52d2..983e0579 100644 --- a/samples/aspire-with-azure-functions/ts/.modules/aspire.ts +++ b/samples/aspire-with-azure-functions/ts/.modules/aspire.ts @@ -26,6 +26,69 @@ import { // Handle Type Aliases (Internal - not exported to users) // ============================================================================ +/** Handle to AzureContainerAppEnvironmentResource */ +type AzureContainerAppEnvironmentResourceHandle = Handle<'Aspire.Hosting.Azure.AppContainers/Aspire.Hosting.Azure.AppContainers.AzureContainerAppEnvironmentResource'>; + +/** Handle to AzureContainerRegistryResource */ +type AzureContainerRegistryResourceHandle = Handle<'Aspire.Hosting.Azure.ContainerRegistry/Aspire.Hosting.Azure.AzureContainerRegistryResource'>; + +/** Handle to AzureFunctionsProjectResource */ +type AzureFunctionsProjectResourceHandle = Handle<'Aspire.Hosting.Azure.Functions/Aspire.Hosting.Azure.AzureFunctionsProjectResource'>; + +/** Handle to AzureLogAnalyticsWorkspaceResource */ +type AzureLogAnalyticsWorkspaceResourceHandle = Handle<'Aspire.Hosting.Azure.OperationalInsights/Aspire.Hosting.Azure.AzureLogAnalyticsWorkspaceResource'>; + +/** Handle to AzureBlobStorageContainerResource */ +type AzureBlobStorageContainerResourceHandle = Handle<'Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureBlobStorageContainerResource'>; + +/** Handle to AzureBlobStorageResource */ +type AzureBlobStorageResourceHandle = Handle<'Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureBlobStorageResource'>; + +/** Handle to AzureDataLakeStorageFileSystemResource */ +type AzureDataLakeStorageFileSystemResourceHandle = Handle<'Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureDataLakeStorageFileSystemResource'>; + +/** Handle to AzureDataLakeStorageResource */ +type AzureDataLakeStorageResourceHandle = Handle<'Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureDataLakeStorageResource'>; + +/** Handle to AzureQueueStorageQueueResource */ +type AzureQueueStorageQueueResourceHandle = Handle<'Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureQueueStorageQueueResource'>; + +/** Handle to AzureQueueStorageResource */ +type AzureQueueStorageResourceHandle = Handle<'Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureQueueStorageResource'>; + +/** Handle to AzureStorageEmulatorResource */ +type AzureStorageEmulatorResourceHandle = Handle<'Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureStorageEmulatorResource'>; + +/** Handle to AzureStorageResource */ +type AzureStorageResourceHandle = Handle<'Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureStorageResource'>; + +/** Handle to AzureTableStorageResource */ +type AzureTableStorageResourceHandle = Handle<'Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureTableStorageResource'>; + +/** Handle to IAzureResource */ +type IAzureResourceHandle = Handle<'Aspire.Hosting.Azure/Aspire.Hosting.ApplicationModel.IAzureResource'>; + +/** Handle to AzureBicepResource */ +type AzureBicepResourceHandle = Handle<'Aspire.Hosting.Azure/Aspire.Hosting.Azure.AzureBicepResource'>; + +/** Handle to AzureEnvironmentResource */ +type AzureEnvironmentResourceHandle = Handle<'Aspire.Hosting.Azure/Aspire.Hosting.Azure.AzureEnvironmentResource'>; + +/** Handle to AzureProvisioningResource */ +type AzureProvisioningResourceHandle = Handle<'Aspire.Hosting.Azure/Aspire.Hosting.Azure.AzureProvisioningResource'>; + +/** Handle to AzureResourceInfrastructure */ +type AzureResourceInfrastructureHandle = Handle<'Aspire.Hosting.Azure/Aspire.Hosting.Azure.AzureResourceInfrastructure'>; + +/** Handle to AzureUserAssignedIdentityResource */ +type AzureUserAssignedIdentityResourceHandle = Handle<'Aspire.Hosting.Azure/Aspire.Hosting.Azure.AzureUserAssignedIdentityResource'>; + +/** Handle to BicepOutputReference */ +type BicepOutputReferenceHandle = Handle<'Aspire.Hosting.Azure/Aspire.Hosting.Azure.BicepOutputReference'>; + +/** Handle to IAzureKeyVaultSecretReference */ +type IAzureKeyVaultSecretReferenceHandle = Handle<'Aspire.Hosting.Azure/Aspire.Hosting.Azure.IAzureKeyVaultSecretReference'>; + /** Handle to CommandLineArgsCallbackContext */ type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; @@ -56,6 +119,9 @@ type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicatio /** Handle to ExecuteCommandContext */ type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; +/** Handle to IComputeResource */ +type IComputeResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource'>; + /** Handle to IContainerFilesDestinationResource */ type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; @@ -143,6 +209,12 @@ type DictstringanyHandle = Handle<'Aspire.Hosting/Dict'>; /** Handle to List */ type ListanyHandle = Handle<'Aspire.Hosting/List'>; +/** Handle to ContainerApp */ +type ContainerAppHandle = Handle<'Azure.Provisioning.AppContainers/Azure.Provisioning.AppContainers.ContainerApp'>; + +/** Handle to ContainerAppJob */ +type ContainerAppJobHandle = Handle<'Azure.Provisioning.AppContainers/Azure.Provisioning.AppContainers.ContainerAppJob'>; + /** Handle to IConfiguration */ type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; @@ -162,6 +234,40 @@ type IServiceProviderHandle = Handle<'System.ComponentModel/System.IServiceProvi // Enum Types // ============================================================================ +/** Enum type for AzureContainerRegistryRole */ +export enum AzureContainerRegistryRole { + AcrDelete = "AcrDelete", + AcrImageSigner = "AcrImageSigner", + AcrPull = "AcrPull", + AcrPush = "AcrPush", + AcrQuarantineReader = "AcrQuarantineReader", + AcrQuarantineWriter = "AcrQuarantineWriter", +} + +/** Enum type for AzureStorageRole */ +export enum AzureStorageRole { + ClassicStorageAccountContributor = "ClassicStorageAccountContributor", + ClassicStorageAccountKeyOperatorServiceRole = "ClassicStorageAccountKeyOperatorServiceRole", + StorageAccountBackupContributor = "StorageAccountBackupContributor", + StorageAccountContributor = "StorageAccountContributor", + StorageAccountKeyOperatorServiceRole = "StorageAccountKeyOperatorServiceRole", + StorageBlobDataContributor = "StorageBlobDataContributor", + StorageBlobDataOwner = "StorageBlobDataOwner", + StorageBlobDataReader = "StorageBlobDataReader", + StorageBlobDelegator = "StorageBlobDelegator", + StorageFileDataPrivilegedContributor = "StorageFileDataPrivilegedContributor", + StorageFileDataPrivilegedReader = "StorageFileDataPrivilegedReader", + StorageFileDataSmbShareContributor = "StorageFileDataSmbShareContributor", + StorageFileDataSmbShareReader = "StorageFileDataSmbShareReader", + StorageFileDataSmbShareElevatedContributor = "StorageFileDataSmbShareElevatedContributor", + StorageQueueDataContributor = "StorageQueueDataContributor", + StorageQueueDataReader = "StorageQueueDataReader", + StorageQueueDataMessageSender = "StorageQueueDataMessageSender", + StorageQueueDataMessageProcessor = "StorageQueueDataMessageProcessor", + StorageTableDataContributor = "StorageTableDataContributor", + StorageTableDataReader = "StorageTableDataReader", +} + /** Enum type for CertificateTrustScope */ export enum CertificateTrustScope { None = "None", @@ -176,6 +282,14 @@ export enum ContainerLifetime { Persistent = "Persistent", } +/** Enum type for DeploymentScope */ +export enum DeploymentScope { + ResourceGroup = "ResourceGroup", + Subscription = "Subscription", + ManagementGroup = "ManagementGroup", + Tenant = "Tenant", +} + /** Enum type for DistributedApplicationOperation */ export enum DistributedApplicationOperation { Run = "Run", @@ -318,6 +432,10 @@ export interface ResourceUrlAnnotation { // Options Interfaces // ============================================================================ +export interface AddBlobContainerOptions { + blobContainerName?: string; +} + export interface AddConnectionStringOptions { environmentVariableName?: string; } @@ -326,6 +444,10 @@ export interface AddContainerRegistryOptions { repository?: ParameterResource; } +export interface AddDataLakeFileSystemOptions { + dataLakeFileSystemName?: string; +} + export interface AddDockerfileOptions { dockerfilePath?: string; stage?: string; @@ -339,6 +461,10 @@ export interface AddParameterOptions { secret?: boolean; } +export interface AddQueueOptions { + queueName?: string; +} + export interface AppendFormattedOptions { format?: string; } @@ -351,6 +477,14 @@ export interface GetValueAsyncOptions { cancellationToken?: AbortSignal; } +export interface PublishAsConfiguredScheduledAzureContainerAppJobOptions { + configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise; +} + +export interface RunAsEmulatorOptions { + configureContainer?: (obj: AzureStorageEmulatorResource) => Promise; +} + export interface RunOptions { cancellationToken?: AbortSignal; } @@ -359,6 +493,10 @@ export interface WaitForCompletionOptions { exitCode?: number; } +export interface WithApiVersionCheckOptions { + enable?: boolean; +} + export interface WithBindMountOptions { isReadOnly?: boolean; } @@ -367,6 +505,20 @@ export interface WithCommandOptions { commandOptions?: CommandOptions; } +export interface WithDashboardOptions { + enable?: boolean; +} + +export interface WithDataBindMountOptions { + path?: string; + isReadOnly?: boolean; +} + +export interface WithDataVolumeOptions { + name?: string; + isReadOnly?: boolean; +} + export interface WithDescriptionOptions { enableMarkdown?: boolean; } @@ -433,6 +585,10 @@ export interface WithHttpsEndpointOptions { isProxied?: boolean; } +export interface WithHttpsUpgradeOptions { + upgrade?: boolean; +} + export interface WithIconNameOptions { iconVariant?: IconVariant; } @@ -453,6 +609,13 @@ export interface WithPipelineStepFactoryOptions { description?: string; } +export interface WithPurgeTaskOptions { + filter?: string; + ago?: number; + keep?: number; + taskName?: string; +} + export interface WithReferenceOptions { connectionName?: string; optional?: boolean; @@ -475,6 +638,92 @@ export interface WithVolumeOptions { isReadOnly?: boolean; } +// ============================================================================ +// AzureResourceInfrastructure +// ============================================================================ + +/** + * Type class for AzureResourceInfrastructure. + */ +export class AzureResourceInfrastructure { + constructor(private _handle: AzureResourceInfrastructureHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the BicepName property */ + bicepName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/AzureResourceInfrastructure.bicepName', + { context: this._handle } + ); + }, + }; + + /** Gets the TargetScope property */ + targetScope = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/AzureResourceInfrastructure.targetScope', + { context: this._handle } + ); + }, + set: async (value: DeploymentScope): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Azure/AzureResourceInfrastructure.setTargetScope', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// BicepOutputReference +// ============================================================================ + +/** + * Type class for BicepOutputReference. + */ +export class BicepOutputReference { + constructor(private _handle: BicepOutputReferenceHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/BicepOutputReference.name', + { context: this._handle } + ); + }, + }; + + /** Gets the Value property */ + value = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/BicepOutputReference.value', + { context: this._handle } + ); + }, + }; + + /** Gets the ValueExpression property */ + valueExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/BicepOutputReference.valueExpression', + { context: this._handle } + ); + }, + }; + +} + // ============================================================================ // CommandLineArgsCallbackContext // ============================================================================ @@ -1711,6 +1960,176 @@ export class DistributedApplicationBuilder { return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); } + /** Adds an Azure Container App Environment resource */ + /** @internal */ + async _addAzureContainerAppEnvironmentInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/addAzureContainerAppEnvironment', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + addAzureContainerAppEnvironment(name: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._addAzureContainerAppEnvironmentInternal(name)); + } + + /** Adds an Azure Storage resource */ + /** @internal */ + async _addAzureStorageInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addAzureStorage', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + addAzureStorage(name: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._addAzureStorageInternal(name)); + } + + /** Adds an Azure Functions project to the distributed application */ + /** @internal */ + async _addAzureFunctionsProjectInternal(name: string, projectPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Functions/addAzureFunctionsProject', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + addAzureFunctionsProject(name: string, projectPath: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._addAzureFunctionsProjectInternal(name, projectPath)); + } + + /** Adds an Azure Bicep template resource from a file */ + /** @internal */ + async _addBicepTemplateInternal(name: string, bicepFile: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepFile }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/addBicepTemplate', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + addBicepTemplate(name: string, bicepFile: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._addBicepTemplateInternal(name, bicepFile)); + } + + /** Adds an Azure Bicep template resource from inline Bicep content */ + /** @internal */ + async _addBicepTemplateStringInternal(name: string, bicepContent: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepContent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/addBicepTemplateString', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + addBicepTemplateString(name: string, bicepContent: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._addBicepTemplateStringInternal(name, bicepContent)); + } + + /** Adds an Azure provisioning resource to the application model */ + /** @internal */ + async _addAzureInfrastructureInternal(name: string, configureInfrastructure: (obj: AzureResourceInfrastructure) => Promise): Promise { + const configureInfrastructureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; + const obj = new AzureResourceInfrastructure(objHandle, this._client); + await configureInfrastructure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, configureInfrastructure: configureInfrastructureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/addAzureInfrastructure', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + addAzureInfrastructure(name: string, configureInfrastructure: (obj: AzureResourceInfrastructure) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._addAzureInfrastructureInternal(name, configureInfrastructure)); + } + + /** Adds Azure provisioning services to the distributed application builder */ + /** @internal */ + async _addAzureProvisioningInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/addAzureProvisioning', + rpcArgs + ); + return new DistributedApplicationBuilder(result, this._client); + } + + addAzureProvisioning(): DistributedApplicationBuilderPromise { + return new DistributedApplicationBuilderPromise(this._addAzureProvisioningInternal()); + } + + /** Adds the shared Azure environment resource to the application model */ + /** @internal */ + async _addAzureEnvironmentInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/addAzureEnvironment', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + addAzureEnvironment(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._addAzureEnvironmentInternal()); + } + + /** Adds an Azure user-assigned identity resource */ + /** @internal */ + async _addAzureUserAssignedIdentityInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/addAzureUserAssignedIdentity', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + addAzureUserAssignedIdentity(name: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._addAzureUserAssignedIdentityInternal(name)); + } + + /** Adds an Azure Container Registry resource to the distributed application model. */ + /** @internal */ + async _addAzureContainerRegistryInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/addAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + addAzureContainerRegistry(name: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._addAzureContainerRegistryInternal(name)); + } + + /** Adds an Azure Log Analytics Workspace resource */ + /** @internal */ + async _addAzureLogAnalyticsWorkspaceInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.OperationalInsights/addAzureLogAnalyticsWorkspace', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + addAzureLogAnalyticsWorkspace(name: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._addAzureLogAnalyticsWorkspaceInternal(name)); + } + } /** @@ -1801,6 +2220,61 @@ export class DistributedApplicationBuilderPromise implements PromiseLike obj.addCSharpAppWithOptions(name, path, configure))); } + /** Adds an Azure Container App Environment resource */ + addAzureContainerAppEnvironment(name: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.addAzureContainerAppEnvironment(name))); + } + + /** Adds an Azure Storage resource */ + addAzureStorage(name: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.addAzureStorage(name))); + } + + /** Adds an Azure Functions project to the distributed application */ + addAzureFunctionsProject(name: string, projectPath: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.addAzureFunctionsProject(name, projectPath))); + } + + /** Adds an Azure Bicep template resource from a file */ + addBicepTemplate(name: string, bicepFile: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.addBicepTemplate(name, bicepFile))); + } + + /** Adds an Azure Bicep template resource from inline Bicep content */ + addBicepTemplateString(name: string, bicepContent: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.addBicepTemplateString(name, bicepContent))); + } + + /** Adds an Azure provisioning resource to the application model */ + addAzureInfrastructure(name: string, configureInfrastructure: (obj: AzureResourceInfrastructure) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.addAzureInfrastructure(name, configureInfrastructure))); + } + + /** Adds Azure provisioning services to the distributed application builder */ + addAzureProvisioning(): DistributedApplicationBuilderPromise { + return new DistributedApplicationBuilderPromise(this._promise.then(obj => obj.addAzureProvisioning())); + } + + /** Adds the shared Azure environment resource to the application model */ + addAzureEnvironment(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.addAzureEnvironment())); + } + + /** Adds an Azure user-assigned identity resource */ + addAzureUserAssignedIdentity(name: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.addAzureUserAssignedIdentity(name))); + } + + /** Adds an Azure Container Registry resource to the distributed application model. */ + addAzureContainerRegistry(name: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.addAzureContainerRegistry(name))); + } + + /** Adds an Azure Log Analytics Workspace resource */ + addAzureLogAnalyticsWorkspace(name: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.addAzureLogAnalyticsWorkspace(name))); + } + } // ============================================================================ @@ -1854,73 +2328,16070 @@ export class DistributedApplicationEventingPromise implements PromiseLike { - constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { +export class AzureBicepResource extends ResourceBuilderBase { + constructor(handle: AzureBicepResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBicepResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new AzureBicepResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBicepResourcePromise { const helpLink = options?.helpLink; - return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new AzureBicepResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureBicepResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureBicepResourcePromise { + const displayText = options?.displayText; + return new AzureBicepResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBicepResourcePromise { + const displayText = options?.displayText; + return new AzureBicepResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBicepResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureBicepResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureBicepResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureBicepResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBicepResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureBicepResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsConnectionString', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + async getBicepIdentifier(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getBicepIdentifier', + rpcArgs + ); + } + + /** @internal */ + private async _clearDefaultRoleAssignmentsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + } + + /** Determines whether a resource is marked as existing */ + async isExisting(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/isExisting', + rpcArgs + ); + } + + /** @internal */ + private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExistingFromParameters', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExisting', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._runAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExistingFromParameters', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExisting', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/asExisting', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureBicepResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureBicepResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureBicepResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + getBicepIdentifier(): Promise { + return this._promise.then(obj => obj.getBicepIdentifier()); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + } + + /** Determines whether a resource is marked as existing */ + isExisting(): Promise { + return this._promise.then(obj => obj.isExisting()); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureBlobStorageContainerResource +// ============================================================================ + +export class AzureBlobStorageContainerResource extends ResourceBuilderBase { + constructor(handle: AzureBlobStorageContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBlobStorageContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureBlobStorageContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBlobStorageContainerResourcePromise { + const helpLink = options?.helpLink; + return new AzureBlobStorageContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureBlobStorageContainerResourcePromise { + const displayText = options?.displayText; + return new AzureBlobStorageContainerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBlobStorageContainerResourcePromise { + const displayText = options?.displayText; + return new AzureBlobStorageContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBlobStorageContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureBlobStorageContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureBlobStorageContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureBlobStorageContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBlobStorageContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureBlobStorageContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureBlobStorageContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureBlobStorageContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureBlobStorageContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureBlobStorageResource +// ============================================================================ + +export class AzureBlobStorageResource extends ResourceBuilderBase { + constructor(handle: AzureBlobStorageResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBlobStorageResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureBlobStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBlobStorageResourcePromise { + const helpLink = options?.helpLink; + return new AzureBlobStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureBlobStorageResourcePromise { + const displayText = options?.displayText; + return new AzureBlobStorageResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBlobStorageResourcePromise { + const displayText = options?.displayText; + return new AzureBlobStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBlobStorageResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureBlobStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureBlobStorageResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureBlobStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBlobStorageResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureBlobStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureBlobStorageResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureBlobStorageResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureBlobStorageResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureContainerAppEnvironmentResource +// ============================================================================ + +export class AzureContainerAppEnvironmentResource extends ResourceBuilderBase { + constructor(handle: AzureContainerAppEnvironmentResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureContainerAppEnvironmentResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureContainerAppEnvironmentResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureContainerAppEnvironmentResourcePromise { + const helpLink = options?.helpLink; + return new AzureContainerAppEnvironmentResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureContainerAppEnvironmentResourcePromise { + const displayText = options?.displayText; + return new AzureContainerAppEnvironmentResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureContainerAppEnvironmentResourcePromise { + const displayText = options?.displayText; + return new AzureContainerAppEnvironmentResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureContainerAppEnvironmentResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureContainerAppEnvironmentResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureContainerAppEnvironmentResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureContainerAppEnvironmentResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureContainerAppEnvironmentResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureContainerAppEnvironmentResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withAzdResourceNamingInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/withAzdResourceNaming', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Configures resources to use azd naming conventions */ + withAzdResourceNaming(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withAzdResourceNamingInternal()); + } + + /** @internal */ + private async _withCompactResourceNamingInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/withCompactResourceNaming', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Configures resources to use compact naming for length-constrained Azure resources */ + withCompactResourceNaming(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withCompactResourceNamingInternal()); + } + + /** @internal */ + private async _withDashboardInternal(enable?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (enable !== undefined) rpcArgs.enable = enable; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/withDashboard', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Configures whether the Aspire dashboard is included in the container app environment */ + withDashboard(options?: WithDashboardOptions): AzureContainerAppEnvironmentResourcePromise { + const enable = options?.enable; + return new AzureContainerAppEnvironmentResourcePromise(this._withDashboardInternal(enable)); + } + + /** @internal */ + private async _withHttpsUpgradeInternal(upgrade?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (upgrade !== undefined) rpcArgs.upgrade = upgrade; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/withHttpsUpgrade', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Configures whether HTTP endpoints are upgraded to HTTPS */ + withHttpsUpgrade(options?: WithHttpsUpgradeOptions): AzureContainerAppEnvironmentResourcePromise { + const upgrade = options?.upgrade; + return new AzureContainerAppEnvironmentResourcePromise(this._withHttpsUpgradeInternal(upgrade)); + } + + /** @internal */ + private async _withAzureLogAnalyticsWorkspaceInternal(workspaceBuilder: AzureLogAnalyticsWorkspaceResource): Promise { + const rpcArgs: Record = { builder: this._handle, workspaceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/withAzureLogAnalyticsWorkspace', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Configures the container app environment to use a specific Log Analytics Workspace */ + withAzureLogAnalyticsWorkspace(workspaceBuilder: AzureLogAnalyticsWorkspaceResource): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withAzureLogAnalyticsWorkspaceInternal(workspaceBuilder)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** Gets an output reference from an Azure Bicep template resource */ + async getOutput(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getOutput', + rpcArgs + ); + } + + /** @internal */ + private async _withParameterInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameter', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withParameterInternal(name)); + } + + /** @internal */ + private async _withParameterStringValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValue', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withParameterStringValueInternal(name, value)); + } + + /** @internal */ + private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValues', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withParameterStringValuesInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromParameter', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withParameterFromParameterInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromConnectionString', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromOutput', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withParameterFromOutputInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromEndpoint', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withParameterFromEndpointInternal(name, value)); + } + + /** @internal */ + private async _configureInfrastructureInternal(configure: (obj: AzureResourceInfrastructure) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; + const obj = new AzureResourceInfrastructure(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/configureInfrastructure', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._configureInfrastructureInternal(configure)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsConnectionString', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + async getBicepIdentifier(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getBicepIdentifier', + rpcArgs + ); + } + + /** @internal */ + private async _clearDefaultRoleAssignmentsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + } + + /** Determines whether a resource is marked as existing */ + async isExisting(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/isExisting', + rpcArgs + ); + } + + /** @internal */ + private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExistingFromParameters', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExisting', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._runAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExistingFromParameters', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExisting', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/asExisting', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureContainerAppEnvironmentResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureContainerAppEnvironmentResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureContainerAppEnvironmentResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Configures resources to use azd naming conventions */ + withAzdResourceNaming(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withAzdResourceNaming())); + } + + /** Configures resources to use compact naming for length-constrained Azure resources */ + withCompactResourceNaming(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withCompactResourceNaming())); + } + + /** Configures whether the Aspire dashboard is included in the container app environment */ + withDashboard(options?: WithDashboardOptions): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withDashboard(options))); + } + + /** Configures whether HTTP endpoints are upgraded to HTTPS */ + withHttpsUpgrade(options?: WithHttpsUpgradeOptions): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withHttpsUpgrade(options))); + } + + /** Configures the container app environment to use a specific Log Analytics Workspace */ + withAzureLogAnalyticsWorkspace(workspaceBuilder: AzureLogAnalyticsWorkspaceResource): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withAzureLogAnalyticsWorkspace(workspaceBuilder))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Gets an output reference from an Azure Bicep template resource */ + getOutput(name: string): Promise { + return this._promise.then(obj => obj.getOutput(name)); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParameter(name))); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); + } + + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.configureInfrastructure(configure))); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + getBicepIdentifier(): Promise { + return this._promise.then(obj => obj.getBicepIdentifier()); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + } + + /** Determines whether a resource is marked as existing */ + isExisting(): Promise { + return this._promise.then(obj => obj.isExisting()); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureContainerRegistryResource +// ============================================================================ + +export class AzureContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: AzureContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new AzureContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new AzureContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new AzureContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** Gets an output reference from an Azure Bicep template resource */ + async getOutput(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getOutput', + rpcArgs + ); + } + + /** @internal */ + private async _withParameterInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameter', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withParameterInternal(name)); + } + + /** @internal */ + private async _withParameterStringValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValue', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withParameterStringValueInternal(name, value)); + } + + /** @internal */ + private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValues', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withParameterStringValuesInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromParameter', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withParameterFromParameterInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromConnectionString', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromOutput', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withParameterFromOutputInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromEndpoint', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withParameterFromEndpointInternal(name, value)); + } + + /** @internal */ + private async _configureInfrastructureInternal(configure: (obj: AzureResourceInfrastructure) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; + const obj = new AzureResourceInfrastructure(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/configureInfrastructure', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._configureInfrastructureInternal(configure)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsConnectionString', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + async getBicepIdentifier(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getBicepIdentifier', + rpcArgs + ); + } + + /** @internal */ + private async _clearDefaultRoleAssignmentsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + } + + /** Determines whether a resource is marked as existing */ + async isExisting(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/isExisting', + rpcArgs + ); + } + + /** @internal */ + private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExistingFromParameters', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExisting', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._runAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExistingFromParameters', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExisting', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/asExisting', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withPurgeTaskInternal(schedule: string, filter?: string, ago?: number, keep?: number, taskName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, schedule }; + if (filter !== undefined) rpcArgs.filter = filter; + if (ago !== undefined) rpcArgs.ago = ago; + if (keep !== undefined) rpcArgs.keep = keep; + if (taskName !== undefined) rpcArgs.taskName = taskName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withPurgeTask', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Configures a purge task for the Azure Container Registry resource. */ + withPurgeTask(schedule: string, options?: WithPurgeTaskOptions): AzureContainerRegistryResourcePromise { + const filter = options?.filter; + const ago = options?.ago; + const keep = options?.keep; + const taskName = options?.taskName; + return new AzureContainerRegistryResourcePromise(this._withPurgeTaskInternal(schedule, filter, ago, keep, taskName)); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Gets an output reference from an Azure Bicep template resource */ + getOutput(name: string): Promise { + return this._promise.then(obj => obj.getOutput(name)); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParameter(name))); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); + } + + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.configureInfrastructure(configure))); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + getBicepIdentifier(): Promise { + return this._promise.then(obj => obj.getBicepIdentifier()); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + } + + /** Determines whether a resource is marked as existing */ + isExisting(): Promise { + return this._promise.then(obj => obj.isExisting()); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Configures a purge task for the Azure Container Registry resource. */ + withPurgeTask(schedule: string, options?: WithPurgeTaskOptions): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withPurgeTask(schedule, options))); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureDataLakeStorageFileSystemResource +// ============================================================================ + +export class AzureDataLakeStorageFileSystemResource extends ResourceBuilderBase { + constructor(handle: AzureDataLakeStorageFileSystemResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureDataLakeStorageFileSystemResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureDataLakeStorageFileSystemResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureDataLakeStorageFileSystemResourcePromise { + const helpLink = options?.helpLink; + return new AzureDataLakeStorageFileSystemResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureDataLakeStorageFileSystemResourcePromise { + const displayText = options?.displayText; + return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureDataLakeStorageFileSystemResourcePromise { + const displayText = options?.displayText; + return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureDataLakeStorageFileSystemResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureDataLakeStorageFileSystemResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureDataLakeStorageFileSystemResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureDataLakeStorageFileSystemResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureDataLakeStorageFileSystemResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureDataLakeStorageFileSystemResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureDataLakeStorageFileSystemResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureDataLakeStorageFileSystemResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureDataLakeStorageFileSystemResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureDataLakeStorageResource +// ============================================================================ + +export class AzureDataLakeStorageResource extends ResourceBuilderBase { + constructor(handle: AzureDataLakeStorageResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureDataLakeStorageResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureDataLakeStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureDataLakeStorageResourcePromise { + const helpLink = options?.helpLink; + return new AzureDataLakeStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureDataLakeStorageResourcePromise { + const displayText = options?.displayText; + return new AzureDataLakeStorageResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureDataLakeStorageResourcePromise { + const displayText = options?.displayText; + return new AzureDataLakeStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureDataLakeStorageResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureDataLakeStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureDataLakeStorageResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureDataLakeStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureDataLakeStorageResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureDataLakeStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureDataLakeStorageResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureDataLakeStorageResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureDataLakeStorageResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureEnvironmentResource +// ============================================================================ + +export class AzureEnvironmentResource extends ResourceBuilderBase { + constructor(handle: AzureEnvironmentResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureEnvironmentResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureEnvironmentResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureEnvironmentResourcePromise { + const helpLink = options?.helpLink; + return new AzureEnvironmentResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureEnvironmentResourcePromise { + const displayText = options?.displayText; + return new AzureEnvironmentResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureEnvironmentResourcePromise { + const displayText = options?.displayText; + return new AzureEnvironmentResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureEnvironmentResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureEnvironmentResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureEnvironmentResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureEnvironmentResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureEnvironmentResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureEnvironmentResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withLocationInternal(location: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, location }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withLocation', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Sets the Azure location for the shared Azure environment resource */ + withLocation(location: ParameterResource): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withLocationInternal(location)); + } + + /** @internal */ + private async _withResourceGroupInternal(resourceGroup: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withResourceGroup', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Sets the Azure resource group for the shared Azure environment resource */ + withResourceGroup(resourceGroup: ParameterResource): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withResourceGroupInternal(resourceGroup)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureEnvironmentResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureEnvironmentResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureEnvironmentResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Sets the Azure location for the shared Azure environment resource */ + withLocation(location: ParameterResource): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withLocation(location))); + } + + /** Sets the Azure resource group for the shared Azure environment resource */ + withResourceGroup(resourceGroup: ParameterResource): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withResourceGroup(resourceGroup))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureFunctionsProjectResource +// ============================================================================ + +export class AzureFunctionsProjectResource extends ResourceBuilderBase { + constructor(handle: AzureFunctionsProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureFunctionsProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureFunctionsProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): AzureFunctionsProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new AzureFunctionsProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureFunctionsProjectResourcePromise { + const helpLink = options?.helpLink; + return new AzureFunctionsProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): AzureFunctionsProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new AzureFunctionsProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): AzureFunctionsProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new AzureFunctionsProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): AzureFunctionsProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new AzureFunctionsProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureFunctionsProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new AzureFunctionsProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureFunctionsProjectResourcePromise { + const displayText = options?.displayText; + return new AzureFunctionsProjectResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureFunctionsProjectResourcePromise { + const displayText = options?.displayText; + return new AzureFunctionsProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): AzureFunctionsProjectResourcePromise { + const exitCode = options?.exitCode; + return new AzureFunctionsProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureFunctionsProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new AzureFunctionsProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureFunctionsProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureFunctionsProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): AzureFunctionsProjectResourcePromise { + const password = options?.password; + return new AzureFunctionsProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureFunctionsProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureFunctionsProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureFunctionsProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new AzureFunctionsProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureFunctionsProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureFunctionsProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _publishAsAzureContainerAppInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): Promise { + const configureId = registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(args.p1) as ContainerAppHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { project: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishProjectAsAzureContainerApp', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Configures the project resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._publishAsAzureContainerAppInternal(configure)); + } + + /** @internal */ + private async _publishAsConfiguredAzureContainerAppJobInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { resource: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredAzureContainerAppJob', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._publishAsConfiguredAzureContainerAppJobInternal(configure)); + } + + /** @internal */ + private async _publishAsAzureContainerAppJobInternal(): Promise { + const rpcArgs: Record = { resource: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsAzureContainerAppJob', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._publishAsAzureContainerAppJobInternal()); + } + + /** @internal */ + private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = configure ? registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; + await configure(arg1, arg2); + }) : undefined; + const rpcArgs: Record = { resource: this._handle, cronExpression }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredScheduledAzureContainerAppJob', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): AzureFunctionsProjectResourcePromise { + const configure = options?.configure; + return new AzureFunctionsProjectResourcePromise(this._publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression, configure)); + } + + /** @internal */ + private async _publishAsScheduledAzureContainerAppJobInternal(cronExpression: string): Promise { + const rpcArgs: Record = { resource: this._handle, cronExpression }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsScheduledAzureContainerAppJob', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._publishAsScheduledAzureContainerAppJobInternal(cronExpression)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withHostStorageInternal(storage: AzureStorageResource): Promise { + const rpcArgs: Record = { builder: this._handle, storage }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Functions/withHostStorage', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Configures the Azure Functions project to use specified Azure Storage as host storage */ + withHostStorage(storage: AzureStorageResource): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withHostStorageInternal(storage)); + } + + /** @internal */ + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + } + + /** @internal */ + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + } + + /** @internal */ + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureFunctionsProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureFunctionsProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureFunctionsProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Configures the project resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerApp(configure))); + } + + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); + } + + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerAppJob())); + } + + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.publishAsConfiguredScheduledAzureContainerAppJob(cronExpression, options))); + } + + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.publishAsScheduledAzureContainerAppJob(cronExpression))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Configures the Azure Functions project to use specified Azure Storage as host storage */ + withHostStorage(storage: AzureStorageResource): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withHostStorage(storage))); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureLogAnalyticsWorkspaceResource +// ============================================================================ + +export class AzureLogAnalyticsWorkspaceResource extends ResourceBuilderBase { + constructor(handle: AzureLogAnalyticsWorkspaceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureLogAnalyticsWorkspaceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureLogAnalyticsWorkspaceResourcePromise { + const helpLink = options?.helpLink; + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureLogAnalyticsWorkspaceResourcePromise { + const displayText = options?.displayText; + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureLogAnalyticsWorkspaceResourcePromise { + const displayText = options?.displayText; + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureLogAnalyticsWorkspaceResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureLogAnalyticsWorkspaceResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureLogAnalyticsWorkspaceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** Gets an output reference from an Azure Bicep template resource */ + async getOutput(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getOutput', + rpcArgs + ); + } + + /** @internal */ + private async _withParameterInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameter', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParameterInternal(name)); + } + + /** @internal */ + private async _withParameterStringValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValue', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParameterStringValueInternal(name, value)); + } + + /** @internal */ + private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValues', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParameterStringValuesInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromParameter', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParameterFromParameterInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromConnectionString', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromOutput', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParameterFromOutputInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromEndpoint', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParameterFromEndpointInternal(name, value)); + } + + /** @internal */ + private async _configureInfrastructureInternal(configure: (obj: AzureResourceInfrastructure) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; + const obj = new AzureResourceInfrastructure(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/configureInfrastructure', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._configureInfrastructureInternal(configure)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsConnectionString', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + async getBicepIdentifier(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getBicepIdentifier', + rpcArgs + ); + } + + /** @internal */ + private async _clearDefaultRoleAssignmentsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + } + + /** Determines whether a resource is marked as existing */ + async isExisting(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/isExisting', + rpcArgs + ); + } + + /** @internal */ + private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExistingFromParameters', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExisting', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._runAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExistingFromParameters', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExisting', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/asExisting', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureLogAnalyticsWorkspaceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureLogAnalyticsWorkspaceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureLogAnalyticsWorkspaceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Gets an output reference from an Azure Bicep template resource */ + getOutput(name: string): Promise { + return this._promise.then(obj => obj.getOutput(name)); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParameter(name))); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); + } + + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.configureInfrastructure(configure))); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + getBicepIdentifier(): Promise { + return this._promise.then(obj => obj.getBicepIdentifier()); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + } + + /** Determines whether a resource is marked as existing */ + isExisting(): Promise { + return this._promise.then(obj => obj.isExisting()); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureProvisioningResource +// ============================================================================ + +export class AzureProvisioningResource extends ResourceBuilderBase { + constructor(handle: AzureProvisioningResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureProvisioningResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureProvisioningResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureProvisioningResourcePromise { + const helpLink = options?.helpLink; + return new AzureProvisioningResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureProvisioningResourcePromise { + const displayText = options?.displayText; + return new AzureProvisioningResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureProvisioningResourcePromise { + const displayText = options?.displayText; + return new AzureProvisioningResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureProvisioningResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureProvisioningResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureProvisioningResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureProvisioningResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureProvisioningResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureProvisioningResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** Gets an output reference from an Azure Bicep template resource */ + async getOutput(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getOutput', + rpcArgs + ); + } + + /** @internal */ + private async _withParameterInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameter', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterInternal(name)); + } + + /** @internal */ + private async _withParameterStringValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValue', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterStringValueInternal(name, value)); + } + + /** @internal */ + private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValues', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterStringValuesInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromParameter', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterFromParameterInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromConnectionString', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromOutput', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterFromOutputInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromEndpoint', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterFromEndpointInternal(name, value)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsConnectionString', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + async getBicepIdentifier(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getBicepIdentifier', + rpcArgs + ); + } + + /** @internal */ + private async _clearDefaultRoleAssignmentsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + } + + /** Determines whether a resource is marked as existing */ + async isExisting(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/isExisting', + rpcArgs + ); + } + + /** @internal */ + private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExistingFromParameters', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExisting', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._runAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExistingFromParameters', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExisting', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/asExisting', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureProvisioningResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureProvisioningResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureProvisioningResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Gets an output reference from an Azure Bicep template resource */ + getOutput(name: string): Promise { + return this._promise.then(obj => obj.getOutput(name)); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameter(name))); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + getBicepIdentifier(): Promise { + return this._promise.then(obj => obj.getBicepIdentifier()); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + } + + /** Determines whether a resource is marked as existing */ + isExisting(): Promise { + return this._promise.then(obj => obj.isExisting()); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureQueueStorageQueueResource +// ============================================================================ + +export class AzureQueueStorageQueueResource extends ResourceBuilderBase { + constructor(handle: AzureQueueStorageQueueResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureQueueStorageQueueResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureQueueStorageQueueResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureQueueStorageQueueResourcePromise { + const helpLink = options?.helpLink; + return new AzureQueueStorageQueueResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureQueueStorageQueueResourcePromise { + const displayText = options?.displayText; + return new AzureQueueStorageQueueResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureQueueStorageQueueResourcePromise { + const displayText = options?.displayText; + return new AzureQueueStorageQueueResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureQueueStorageQueueResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureQueueStorageQueueResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureQueueStorageQueueResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureQueueStorageQueueResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureQueueStorageQueueResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureQueueStorageQueueResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureQueueStorageQueueResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureQueueStorageQueueResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureQueueStorageQueueResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureQueueStorageResource +// ============================================================================ + +export class AzureQueueStorageResource extends ResourceBuilderBase { + constructor(handle: AzureQueueStorageResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureQueueStorageResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureQueueStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureQueueStorageResourcePromise { + const helpLink = options?.helpLink; + return new AzureQueueStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureQueueStorageResourcePromise { + const displayText = options?.displayText; + return new AzureQueueStorageResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureQueueStorageResourcePromise { + const displayText = options?.displayText; + return new AzureQueueStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureQueueStorageResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureQueueStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureQueueStorageResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureQueueStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureQueueStorageResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureQueueStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureQueueStorageResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureQueueStorageResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureQueueStorageResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureStorageEmulatorResource +// ============================================================================ + +export class AzureStorageEmulatorResource extends ResourceBuilderBase { + constructor(handle: AzureStorageEmulatorResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): AzureStorageEmulatorResourcePromise { + const isReadOnly = options?.isReadOnly; + return new AzureStorageEmulatorResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): AzureStorageEmulatorResourcePromise { + const tag = options?.tag; + return new AzureStorageEmulatorResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): AzureStorageEmulatorResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new AzureStorageEmulatorResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureStorageEmulatorResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureStorageEmulatorResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): AzureStorageEmulatorResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new AzureStorageEmulatorResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureStorageEmulatorResourcePromise { + const helpLink = options?.helpLink; + return new AzureStorageEmulatorResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): AzureStorageEmulatorResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new AzureStorageEmulatorResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): AzureStorageEmulatorResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new AzureStorageEmulatorResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): AzureStorageEmulatorResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new AzureStorageEmulatorResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureStorageEmulatorResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new AzureStorageEmulatorResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureStorageEmulatorResourcePromise { + const displayText = options?.displayText; + return new AzureStorageEmulatorResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureStorageEmulatorResourcePromise { + const displayText = options?.displayText; + return new AzureStorageEmulatorResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): AzureStorageEmulatorResourcePromise { + const exitCode = options?.exitCode; + return new AzureStorageEmulatorResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureStorageEmulatorResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new AzureStorageEmulatorResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureStorageEmulatorResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureStorageEmulatorResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): AzureStorageEmulatorResourcePromise { + const password = options?.password; + return new AzureStorageEmulatorResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureStorageEmulatorResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureStorageEmulatorResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureStorageEmulatorResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new AzureStorageEmulatorResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureStorageEmulatorResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureStorageEmulatorResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): AzureStorageEmulatorResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new AzureStorageEmulatorResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _publishAsAzureContainerAppInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): Promise { + const configureId = registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(args.p1) as ContainerAppHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { container: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishContainerAsAzureContainerApp', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures the container resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._publishAsAzureContainerAppInternal(configure)); + } + + /** @internal */ + private async _publishAsConfiguredAzureContainerAppJobInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { resource: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredAzureContainerAppJob', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._publishAsConfiguredAzureContainerAppJobInternal(configure)); + } + + /** @internal */ + private async _publishAsAzureContainerAppJobInternal(): Promise { + const rpcArgs: Record = { resource: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsAzureContainerAppJob', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._publishAsAzureContainerAppJobInternal()); + } + + /** @internal */ + private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = configure ? registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; + await configure(arg1, arg2); + }) : undefined; + const rpcArgs: Record = { resource: this._handle, cronExpression }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredScheduledAzureContainerAppJob', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): AzureStorageEmulatorResourcePromise { + const configure = options?.configure; + return new AzureStorageEmulatorResourcePromise(this._publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression, configure)); + } + + /** @internal */ + private async _publishAsScheduledAzureContainerAppJobInternal(cronExpression: string): Promise { + const rpcArgs: Record = { resource: this._handle, cronExpression }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsScheduledAzureContainerAppJob', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._publishAsScheduledAzureContainerAppJobInternal(cronExpression)); + } + + /** @internal */ + private async _withDataBindMountInternal(path?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withDataBindMount', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a bind mount for the data folder to an Azure Storage emulator resource */ + withDataBindMount(options?: WithDataBindMountOptions): AzureStorageEmulatorResourcePromise { + const path = options?.path; + const isReadOnly = options?.isReadOnly; + return new AzureStorageEmulatorResourcePromise(this._withDataBindMountInternal(path, isReadOnly)); + } + + /** @internal */ + private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withDataVolume', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a named volume for the data folder to an Azure Storage emulator resource */ + withDataVolume(options?: WithDataVolumeOptions): AzureStorageEmulatorResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new AzureStorageEmulatorResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + } + + /** @internal */ + private async _withBlobPortInternal(port: number): Promise { + const rpcArgs: Record = { builder: this._handle, port }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withBlobPort', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the host port for blob requests on the storage emulator */ + withBlobPort(port: number): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withBlobPortInternal(port)); + } + + /** @internal */ + private async _withQueuePortInternal(port: number): Promise { + const rpcArgs: Record = { builder: this._handle, port }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withQueuePort', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the host port for queue requests on the storage emulator */ + withQueuePort(port: number): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withQueuePortInternal(port)); + } + + /** @internal */ + private async _withTablePortInternal(port: number): Promise { + const rpcArgs: Record = { builder: this._handle, port }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withTablePort', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the host port for table requests on the storage emulator */ + withTablePort(port: number): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withTablePortInternal(port)); + } + + /** @internal */ + private async _withApiVersionCheckInternal(enable?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (enable !== undefined) rpcArgs.enable = enable; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withApiVersionCheck', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures whether the emulator checks API version validity */ + withApiVersionCheck(options?: WithApiVersionCheckOptions): AzureStorageEmulatorResourcePromise { + const enable = options?.enable; + return new AzureStorageEmulatorResourcePromise(this._withApiVersionCheckInternal(enable)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + } + + /** @internal */ + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + } + + /** @internal */ + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureStorageEmulatorResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureStorageEmulatorResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureStorageEmulatorResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Configures the container resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerApp(configure))); + } + + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); + } + + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerAppJob())); + } + + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsConfiguredScheduledAzureContainerAppJob(cronExpression, options))); + } + + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsScheduledAzureContainerAppJob(cronExpression))); + } + + /** Adds a bind mount for the data folder to an Azure Storage emulator resource */ + withDataBindMount(options?: WithDataBindMountOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDataBindMount(options))); + } + + /** Adds a named volume for the data folder to an Azure Storage emulator resource */ + withDataVolume(options?: WithDataVolumeOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + } + + /** Sets the host port for blob requests on the storage emulator */ + withBlobPort(port: number): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withBlobPort(port))); + } + + /** Sets the host port for queue requests on the storage emulator */ + withQueuePort(port: number): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withQueuePort(port))); + } + + /** Sets the host port for table requests on the storage emulator */ + withTablePort(port: number): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withTablePort(port))); + } + + /** Configures whether the emulator checks API version validity */ + withApiVersionCheck(options?: WithApiVersionCheckOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withApiVersionCheck(options))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureStorageResource +// ============================================================================ + +export class AzureStorageResource extends ResourceBuilderBase { + constructor(handle: AzureStorageResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureStorageResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): AzureStorageResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new AzureStorageResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureStorageResourcePromise { + const helpLink = options?.helpLink; + return new AzureStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): AzureStorageResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new AzureStorageResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): AzureStorageResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new AzureStorageResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureStorageResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new AzureStorageResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureStorageResourcePromise { + const displayText = options?.displayText; + return new AzureStorageResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureStorageResourcePromise { + const displayText = options?.displayText; + return new AzureStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureStorageResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new AzureStorageResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureStorageResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureStorageResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureStorageResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new AzureStorageResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureStorageResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _runAsEmulatorInternal(configureContainer?: (obj: AzureStorageEmulatorResource) => Promise): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as AzureStorageEmulatorResourceHandle; + const obj = new AzureStorageEmulatorResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/runAsEmulator', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Configures the Azure Storage resource to be emulated using Azurite */ + runAsEmulator(options?: RunAsEmulatorOptions): AzureStorageResourcePromise { + const configureContainer = options?.configureContainer; + return new AzureStorageResourcePromise(this._runAsEmulatorInternal(configureContainer)); + } + + /** @internal */ + private async _addBlobsInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addBlobs', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Adds an Azure Blob Storage resource */ + addBlobs(name: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._addBlobsInternal(name)); + } + + /** @internal */ + private async _addDataLakeInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addDataLake', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Adds an Azure Data Lake Storage resource */ + addDataLake(name: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._addDataLakeInternal(name)); + } + + /** @internal */ + private async _addBlobContainerInternal(name: string, blobContainerName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (blobContainerName !== undefined) rpcArgs.blobContainerName = blobContainerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addBlobContainer', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Adds an Azure Blob Storage container resource */ + addBlobContainer(name: string, options?: AddBlobContainerOptions): AzureBlobStorageContainerResourcePromise { + const blobContainerName = options?.blobContainerName; + return new AzureBlobStorageContainerResourcePromise(this._addBlobContainerInternal(name, blobContainerName)); + } + + /** @internal */ + private async _addDataLakeFileSystemInternal(name: string, dataLakeFileSystemName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (dataLakeFileSystemName !== undefined) rpcArgs.dataLakeFileSystemName = dataLakeFileSystemName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addDataLakeFileSystem', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Adds an Azure Data Lake Storage file system resource */ + addDataLakeFileSystem(name: string, options?: AddDataLakeFileSystemOptions): AzureDataLakeStorageFileSystemResourcePromise { + const dataLakeFileSystemName = options?.dataLakeFileSystemName; + return new AzureDataLakeStorageFileSystemResourcePromise(this._addDataLakeFileSystemInternal(name, dataLakeFileSystemName)); + } + + /** @internal */ + private async _addTablesInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addTables', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Adds an Azure Table Storage resource */ + addTables(name: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._addTablesInternal(name)); + } + + /** @internal */ + private async _addQueuesInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addQueues', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Adds an Azure Queue Storage resource */ + addQueues(name: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._addQueuesInternal(name)); + } + + /** @internal */ + private async _addQueueInternal(name: string, queueName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (queueName !== undefined) rpcArgs.queueName = queueName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addQueue', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Adds an Azure Storage queue resource */ + addQueue(name: string, options?: AddQueueOptions): AzureQueueStorageQueueResourcePromise { + const queueName = options?.queueName; + return new AzureQueueStorageQueueResourcePromise(this._addQueueInternal(name, queueName)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** Gets an output reference from an Azure Bicep template resource */ + async getOutput(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getOutput', + rpcArgs + ); + } + + /** @internal */ + private async _withParameterInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameter', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterInternal(name)); + } + + /** @internal */ + private async _withParameterStringValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValue', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterStringValueInternal(name, value)); + } + + /** @internal */ + private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValues', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterStringValuesInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromParameter', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterFromParameterInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromConnectionString', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromOutput', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterFromOutputInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromEndpoint', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterFromEndpointInternal(name, value)); + } + + /** @internal */ + private async _configureInfrastructureInternal(configure: (obj: AzureResourceInfrastructure) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; + const obj = new AzureResourceInfrastructure(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/configureInfrastructure', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._configureInfrastructureInternal(configure)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsConnectionString', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + async getBicepIdentifier(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getBicepIdentifier', + rpcArgs + ); + } + + /** @internal */ + private async _clearDefaultRoleAssignmentsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + } + + /** Determines whether a resource is marked as existing */ + async isExisting(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/isExisting', + rpcArgs + ); + } + + /** @internal */ + private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExistingFromParameters', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExisting', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._runAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExistingFromParameters', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExisting', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/asExisting', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureStorageResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureStorageResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureStorageResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Configures the Azure Storage resource to be emulated using Azurite */ + runAsEmulator(options?: RunAsEmulatorOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.runAsEmulator(options))); + } + + /** Adds an Azure Blob Storage resource */ + addBlobs(name: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.addBlobs(name))); + } + + /** Adds an Azure Data Lake Storage resource */ + addDataLake(name: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.addDataLake(name))); + } + + /** Adds an Azure Blob Storage container resource */ + addBlobContainer(name: string, options?: AddBlobContainerOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.addBlobContainer(name, options))); + } + + /** Adds an Azure Data Lake Storage file system resource */ + addDataLakeFileSystem(name: string, options?: AddDataLakeFileSystemOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.addDataLakeFileSystem(name, options))); + } + + /** Adds an Azure Table Storage resource */ + addTables(name: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.addTables(name))); + } + + /** Adds an Azure Queue Storage resource */ + addQueues(name: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.addQueues(name))); + } + + /** Adds an Azure Storage queue resource */ + addQueue(name: string, options?: AddQueueOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.addQueue(name, options))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Gets an output reference from an Azure Bicep template resource */ + getOutput(name: string): Promise { + return this._promise.then(obj => obj.getOutput(name)); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameter(name))); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); + } + + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.configureInfrastructure(configure))); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + getBicepIdentifier(): Promise { + return this._promise.then(obj => obj.getBicepIdentifier()); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + } + + /** Determines whether a resource is marked as existing */ + isExisting(): Promise { + return this._promise.then(obj => obj.isExisting()); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureTableStorageResource +// ============================================================================ + +export class AzureTableStorageResource extends ResourceBuilderBase { + constructor(handle: AzureTableStorageResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureTableStorageResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureTableStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureTableStorageResourcePromise { + const helpLink = options?.helpLink; + return new AzureTableStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureTableStorageResourcePromise { + const displayText = options?.displayText; + return new AzureTableStorageResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureTableStorageResourcePromise { + const displayText = options?.displayText; + return new AzureTableStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureTableStorageResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureTableStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureTableStorageResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureTableStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureTableStorageResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureTableStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureTableStorageResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureTableStorageResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureTableStorageResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureUserAssignedIdentityResource +// ============================================================================ + +export class AzureUserAssignedIdentityResource extends ResourceBuilderBase { + constructor(handle: AzureUserAssignedIdentityResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureUserAssignedIdentityResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureUserAssignedIdentityResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureUserAssignedIdentityResourcePromise { + const helpLink = options?.helpLink; + return new AzureUserAssignedIdentityResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureUserAssignedIdentityResourcePromise { + const displayText = options?.displayText; + return new AzureUserAssignedIdentityResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureUserAssignedIdentityResourcePromise { + const displayText = options?.displayText; + return new AzureUserAssignedIdentityResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureUserAssignedIdentityResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureUserAssignedIdentityResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureUserAssignedIdentityResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureUserAssignedIdentityResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureUserAssignedIdentityResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureUserAssignedIdentityResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** Gets an output reference from an Azure Bicep template resource */ + async getOutput(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getOutput', + rpcArgs + ); + } + + /** @internal */ + private async _withParameterInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameter', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterInternal(name)); + } + + /** @internal */ + private async _withParameterStringValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValue', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterStringValueInternal(name, value)); + } + + /** @internal */ + private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValues', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterStringValuesInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromParameter', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromParameterInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromConnectionString', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromOutput', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromOutputInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromEndpoint', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromEndpointInternal(name, value)); + } + + /** @internal */ + private async _configureInfrastructureInternal(configure: (obj: AzureResourceInfrastructure) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; + const obj = new AzureResourceInfrastructure(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/configureInfrastructure', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._configureInfrastructureInternal(configure)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsConnectionString', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + async getBicepIdentifier(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getBicepIdentifier', + rpcArgs + ); + } + + /** @internal */ + private async _clearDefaultRoleAssignmentsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + } + + /** Determines whether a resource is marked as existing */ + async isExisting(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/isExisting', + rpcArgs + ); + } + + /** @internal */ + private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExistingFromParameters', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExisting', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._runAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExistingFromParameters', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExisting', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/asExisting', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureUserAssignedIdentityResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureUserAssignedIdentityResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureUserAssignedIdentityResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Gets an output reference from an Azure Bicep template resource */ + getOutput(name: string): Promise { + return this._promise.then(obj => obj.getOutput(name)); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameter(name))); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); + } + + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.configureInfrastructure(configure))); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + getBicepIdentifier(): Promise { + return this._promise.then(obj => obj.getBicepIdentifier()); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + } + + /** Determines whether a resource is marked as existing */ + isExisting(): Promise { + return this._promise.then(obj => obj.isExisting()); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); } /** Adds a connection property with a reference expression */ @@ -2349,6 +18820,66 @@ export class ConnectionStringResource extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + } /** @@ -2511,6 +19042,26 @@ export class ConnectionStringResourcePromise implements PromiseLike obj.getResourceName()); } + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + } // ============================================================================ @@ -2902,6 +19453,66 @@ export class ContainerRegistryResource extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + } /** @@ -2964,328 +19575,115 @@ export class ContainerRegistryResourcePromise implements PromiseLike obj.excludeFromManifest())); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); - } - - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); - } - -} - -// ============================================================================ -// ContainerResource -// ============================================================================ - -export class ContainerResource extends ResourceBuilderBase { - constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { - super(handle, client); - } - - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); - } - - /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); - } - - /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); - } - - /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageTagInternal(tag)); - } - - /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); - } - - /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - const tag = options?.tag; - return new ContainerResourcePromise(this._withImageInternal(image, tag)); - } - - /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsContainerInternal()); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNameInternal(name)); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); } - /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// ContainerResource +// ============================================================================ + +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ @@ -3307,21 +19705,6 @@ export class ContainerResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); - } - /** @internal */ private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; @@ -3371,21 +19754,6 @@ export class ContainerResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); - } - /** @internal */ private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; @@ -4277,71 +20645,233 @@ export class ContainerResource extends ResourceBuilderBase Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _publishAsConfiguredAzureContainerAppJobInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { resource: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredAzureContainerAppJob', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConfiguredAzureContainerAppJobInternal(configure)); + } + + /** @internal */ + private async _publishAsAzureContainerAppJobInternal(): Promise { + const rpcArgs: Record = { resource: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsAzureContainerAppJob', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsAzureContainerAppJobInternal()); + } + + /** @internal */ + private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = configure ? registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; + await configure(arg1, arg2); + }) : undefined; + const rpcArgs: Record = { resource: this._handle, cronExpression }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredScheduledAzureContainerAppJob', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): ContainerResourcePromise { + const configure = options?.configure; + return new ContainerResourcePromise(this._publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression, configure)); + } + + /** @internal */ + private async _publishAsScheduledAzureContainerAppJobInternal(cronExpression: string): Promise { + const rpcArgs: Record = { resource: this._handle, cronExpression }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsScheduledAzureContainerAppJob', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsScheduledAzureContainerAppJobInternal(cronExpression)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + } + + /** @internal */ + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', rpcArgs ); + return new ContainerResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); } } @@ -4366,91 +20896,11 @@ export class ContainerResourcePromise implements PromiseLike return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); - } - - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); - } - - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); - } - - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); - } - - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); - } - - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); - } - - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); - } - - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); - } - - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); - } - - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); - } - - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); - } - - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); - } - - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); - } - - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); - } - - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); - } - /** Sets the base image for a Dockerfile build */ withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); - } - /** Configures an MCP server endpoint on the resource */ withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); @@ -4466,11 +20916,6 @@ export class ContainerResourcePromise implements PromiseLike return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); - } - /** Adds a required command dependency */ withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); @@ -4736,16 +21181,66 @@ export class ContainerResourcePromise implements PromiseLike return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); - } - /** Gets the resource name */ getResourceName(): Promise { return this._promise.then(obj => obj.getResourceName()); } + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); + } + + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerAppJob())); + } + + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConfiguredScheduledAzureContainerAppJob(cronExpression, options))); + } + + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsScheduledAzureContainerAppJob(cronExpression))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + } // ============================================================================ @@ -5824,6 +22319,209 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): Promise { + const configureId = registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(args.p1) as ContainerAppHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { project: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishProjectAsAzureContainerApp', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the project resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishAsAzureContainerAppInternal(configure)); + } + + /** @internal */ + private async _publishAsConfiguredAzureContainerAppJobInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { resource: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredAzureContainerAppJob', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishAsConfiguredAzureContainerAppJobInternal(configure)); + } + + /** @internal */ + private async _publishAsAzureContainerAppJobInternal(): Promise { + const rpcArgs: Record = { resource: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsAzureContainerAppJob', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishAsAzureContainerAppJobInternal()); + } + + /** @internal */ + private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = configure ? registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; + await configure(arg1, arg2); + }) : undefined; + const rpcArgs: Record = { resource: this._handle, cronExpression }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredScheduledAzureContainerAppJob', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): CSharpAppResourcePromise { + const configure = options?.configure; + return new CSharpAppResourcePromise(this._publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression, configure)); + } + + /** @internal */ + private async _publishAsScheduledAzureContainerAppJobInternal(cronExpression: string): Promise { + const rpcArgs: Record = { resource: this._handle, cronExpression }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsScheduledAzureContainerAppJob', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishAsScheduledAzureContainerAppJobInternal(cronExpression)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + } + + /** @internal */ + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + } + + /** @internal */ + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + } /** @@ -6151,6 +22849,66 @@ export class CSharpAppResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Configures the project resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerApp(configure))); + } + + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); + } + + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerAppJob())); + } + + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsConfiguredScheduledAzureContainerAppJob(cronExpression, options))); + } + + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsScheduledAzureContainerAppJob(cronExpression))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + } // ============================================================================ @@ -7339,6 +24097,209 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): Promise { + const configureId = registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(args.p1) as ContainerAppHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { executable: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishExecutableAsAzureContainerApp', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures the executable resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsAzureContainerAppInternal(configure)); + } + + /** @internal */ + private async _publishAsConfiguredAzureContainerAppJobInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { resource: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredAzureContainerAppJob', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsConfiguredAzureContainerAppJobInternal(configure)); + } + + /** @internal */ + private async _publishAsAzureContainerAppJobInternal(): Promise { + const rpcArgs: Record = { resource: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsAzureContainerAppJob', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsAzureContainerAppJobInternal()); + } + + /** @internal */ + private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = configure ? registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; + await configure(arg1, arg2); + }) : undefined; + const rpcArgs: Record = { resource: this._handle, cronExpression }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredScheduledAzureContainerAppJob', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): DotnetToolResourcePromise { + const configure = options?.configure; + return new DotnetToolResourcePromise(this._publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression, configure)); + } + + /** @internal */ + private async _publishAsScheduledAzureContainerAppJobInternal(cronExpression: string): Promise { + const rpcArgs: Record = { resource: this._handle, cronExpression }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsScheduledAzureContainerAppJob', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsScheduledAzureContainerAppJobInternal(cronExpression)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + } + + /** @internal */ + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + } + + /** @internal */ + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + } /** @@ -7701,6 +24662,66 @@ export class DotnetToolResourcePromise implements PromiseLike obj.getResourceName()); } + /** Configures the executable resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerApp(configure))); + } + + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); + } + + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerAppJob())); + } + + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsConfiguredScheduledAzureContainerAppJob(cronExpression, options))); + } + + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsScheduledAzureContainerAppJob(cronExpression))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + } // ============================================================================ @@ -8670,68 +25691,249 @@ export class ExecutableResource extends ResourceBuilderBase( - 'Aspire.Hosting/withPipelineStepFactory', + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _publishAsConfiguredAzureContainerAppJobInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { resource: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredAzureContainerAppJob', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsConfiguredAzureContainerAppJobInternal(configure)); + } + + /** @internal */ + private async _publishAsAzureContainerAppJobInternal(): Promise { + const rpcArgs: Record = { resource: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsAzureContainerAppJob', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsAzureContainerAppJobInternal()); + } + + /** @internal */ + private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = configure ? registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; + await configure(arg1, arg2); + }) : undefined; + const rpcArgs: Record = { resource: this._handle, cronExpression }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredScheduledAzureContainerAppJob', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): ExecutableResourcePromise { + const configure = options?.configure; + return new ExecutableResourcePromise(this._publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression, configure)); + } + + /** @internal */ + private async _publishAsScheduledAzureContainerAppJobInternal(cronExpression: string): Promise { + const rpcArgs: Record = { resource: this._handle, cronExpression }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsScheduledAzureContainerAppJob', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsScheduledAzureContainerAppJobInternal(cronExpression)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + } + + /** @internal */ + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', rpcArgs ); + return new ExecutableResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); } } @@ -9046,6 +26248,61 @@ export class ExecutableResourcePromise implements PromiseLike obj.getResourceName()); } + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); + } + + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerAppJob())); + } + + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsConfiguredScheduledAzureContainerAppJob(cronExpression, options))); + } + + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsScheduledAzureContainerAppJob(cronExpression))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + } // ============================================================================ @@ -9456,6 +26713,66 @@ export class ExternalServiceResource extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + } /** @@ -9588,6 +26905,26 @@ export class ExternalServiceResourcePromise implements PromiseLike obj.getResourceName()); } + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + } // ============================================================================ @@ -9996,6 +27333,66 @@ export class ParameterResource extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ParameterResourcePromise { + return new ParameterResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ParameterResourcePromise { + return new ParameterResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + } /** @@ -10128,6 +27525,26 @@ export class ParameterResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + } // ============================================================================ @@ -11176,6 +28593,187 @@ export class ProjectResource extends ResourceBuilderBase ); } + /** @internal */ + private async _publishAsConfiguredAzureContainerAppJobInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { resource: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredAzureContainerAppJob', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishAsConfiguredAzureContainerAppJobInternal(configure)); + } + + /** @internal */ + private async _publishAsAzureContainerAppJobInternal(): Promise { + const rpcArgs: Record = { resource: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsAzureContainerAppJob', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishAsAzureContainerAppJobInternal()); + } + + /** @internal */ + private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = configure ? registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; + await configure(arg1, arg2); + }) : undefined; + const rpcArgs: Record = { resource: this._handle, cronExpression }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredScheduledAzureContainerAppJob', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): ProjectResourcePromise { + const configure = options?.configure; + return new ProjectResourcePromise(this._publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression, configure)); + } + + /** @internal */ + private async _publishAsScheduledAzureContainerAppJobInternal(cronExpression: string): Promise { + const rpcArgs: Record = { resource: this._handle, cronExpression }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsScheduledAzureContainerAppJob', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishAsScheduledAzureContainerAppJobInternal(cronExpression)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + } + + /** @internal */ + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + } + + /** @internal */ + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + } /** @@ -11493,6 +29091,401 @@ export class ProjectResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); + } + + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerAppJob())); + } + + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsConfiguredScheduledAzureContainerAppJob(cronExpression, options))); + } + + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsScheduledAzureContainerAppJob(cronExpression))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureResource +// ============================================================================ + +export class AzureResource extends ResourceBuilderBase { + constructor(handle: IAzureResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsConnectionString', + rpcArgs + ); + return new AzureResource(result, this._client); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureResourcePromise { + return new AzureResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + async getBicepIdentifier(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getBicepIdentifier', + rpcArgs + ); + } + + /** @internal */ + private async _clearDefaultRoleAssignmentsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', + rpcArgs + ); + return new AzureResource(result, this._client); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureResourcePromise { + return new AzureResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + } + + /** Determines whether a resource is marked as existing */ + async isExisting(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/isExisting', + rpcArgs + ); + } + + /** @internal */ + private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExistingFromParameters', + rpcArgs + ); + return new AzureResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureResourcePromise { + return new AzureResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExisting', + rpcArgs + ); + return new AzureResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureResourcePromise { + return new AzureResourcePromise(this._runAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExistingFromParameters', + rpcArgs + ); + return new AzureResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureResourcePromise { + return new AzureResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExisting', + rpcArgs + ); + return new AzureResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureResourcePromise { + return new AzureResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/asExisting', + rpcArgs + ); + return new AzureResource(result, this._client); + } + + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureResourcePromise { + return new AzureResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); + } + +} + +/** + * Thenable wrapper for AzureResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureResourcePromise { + return new AzureResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + getBicepIdentifier(): Promise { + return this._promise.then(obj => obj.getBicepIdentifier()); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureResourcePromise { + return new AzureResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + } + + /** Determines whether a resource is marked as existing */ + isExisting(): Promise { + return this._promise.then(obj => obj.isExisting()); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureResourcePromise { + return new AzureResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureResourcePromise { + return new AzureResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureResourcePromise { + return new AzureResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureResourcePromise { + return new AzureResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureResourcePromise { + return new AzureResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + } + +} + +// ============================================================================ +// ComputeResource +// ============================================================================ + +export class ComputeResource extends ResourceBuilderBase { + constructor(handle: IComputeResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _publishAsConfiguredAzureContainerAppJobInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { resource: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredAzureContainerAppJob', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): ComputeResourcePromise { + return new ComputeResourcePromise(this._publishAsConfiguredAzureContainerAppJobInternal(configure)); + } + + /** @internal */ + private async _publishAsAzureContainerAppJobInternal(): Promise { + const rpcArgs: Record = { resource: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsAzureContainerAppJob', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): ComputeResourcePromise { + return new ComputeResourcePromise(this._publishAsAzureContainerAppJobInternal()); + } + + /** @internal */ + private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = configure ? registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; + await configure(arg1, arg2); + }) : undefined; + const rpcArgs: Record = { resource: this._handle, cronExpression }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredScheduledAzureContainerAppJob', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): ComputeResourcePromise { + const configure = options?.configure; + return new ComputeResourcePromise(this._publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression, configure)); + } + + /** @internal */ + private async _publishAsScheduledAzureContainerAppJobInternal(cronExpression: string): Promise { + const rpcArgs: Record = { resource: this._handle, cronExpression }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsScheduledAzureContainerAppJob', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._publishAsScheduledAzureContainerAppJobInternal(cronExpression)); + } + + /** @internal */ + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ComputeResourcePromise { + return new ComputeResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + } + +} + +/** + * Thenable wrapper for ComputeResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ComputeResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ComputeResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); + } + + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerAppJob())); + } + + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.publishAsConfiguredScheduledAzureContainerAppJob(cronExpression, options))); + } + + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.publishAsScheduledAzureContainerAppJob(cronExpression))); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + } + } // ============================================================================ @@ -11932,6 +29925,66 @@ export class Resource extends ResourceBuilderBase { ); } + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ResourcePromise { + return new ResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ResourcePromise { + return new ResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ResourcePromise { + return new ResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + } /** @@ -12059,6 +30112,26 @@ export class ResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + } // ============================================================================ @@ -12892,6 +30965,36 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + } + + /** @internal */ + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + } + } /** @@ -13004,6 +31107,16 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withoutHttpsCertificate())); } + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + } + } // ============================================================================ @@ -13270,6 +31383,8 @@ process.on('uncaughtException', (error: Error) => { // ============================================================================ // Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting.Azure/Aspire.Hosting.Azure.AzureResourceInfrastructure', (handle, client) => new AzureResourceInfrastructure(handle as AzureResourceInfrastructureHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure/Aspire.Hosting.Azure.BicepOutputReference', (handle, client) => new BicepOutputReference(handle as BicepOutputReferenceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); @@ -13285,6 +31400,23 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceE registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure/Aspire.Hosting.Azure.AzureBicepResource', (handle, client) => new AzureBicepResource(handle as AzureBicepResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureBlobStorageContainerResource', (handle, client) => new AzureBlobStorageContainerResource(handle as AzureBlobStorageContainerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureBlobStorageResource', (handle, client) => new AzureBlobStorageResource(handle as AzureBlobStorageResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure.AppContainers/Aspire.Hosting.Azure.AppContainers.AzureContainerAppEnvironmentResource', (handle, client) => new AzureContainerAppEnvironmentResource(handle as AzureContainerAppEnvironmentResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure.ContainerRegistry/Aspire.Hosting.Azure.AzureContainerRegistryResource', (handle, client) => new AzureContainerRegistryResource(handle as AzureContainerRegistryResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureDataLakeStorageFileSystemResource', (handle, client) => new AzureDataLakeStorageFileSystemResource(handle as AzureDataLakeStorageFileSystemResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureDataLakeStorageResource', (handle, client) => new AzureDataLakeStorageResource(handle as AzureDataLakeStorageResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure/Aspire.Hosting.Azure.AzureEnvironmentResource', (handle, client) => new AzureEnvironmentResource(handle as AzureEnvironmentResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure.Functions/Aspire.Hosting.Azure.AzureFunctionsProjectResource', (handle, client) => new AzureFunctionsProjectResource(handle as AzureFunctionsProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure.OperationalInsights/Aspire.Hosting.Azure.AzureLogAnalyticsWorkspaceResource', (handle, client) => new AzureLogAnalyticsWorkspaceResource(handle as AzureLogAnalyticsWorkspaceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure/Aspire.Hosting.Azure.AzureProvisioningResource', (handle, client) => new AzureProvisioningResource(handle as AzureProvisioningResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureQueueStorageQueueResource', (handle, client) => new AzureQueueStorageQueueResource(handle as AzureQueueStorageQueueResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureQueueStorageResource', (handle, client) => new AzureQueueStorageResource(handle as AzureQueueStorageResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureStorageEmulatorResource', (handle, client) => new AzureStorageEmulatorResource(handle as AzureStorageEmulatorResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureStorageResource', (handle, client) => new AzureStorageResource(handle as AzureStorageResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureTableStorageResource', (handle, client) => new AzureTableStorageResource(handle as AzureTableStorageResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure/Aspire.Hosting.Azure.AzureUserAssignedIdentityResource', (handle, client) => new AzureUserAssignedIdentityResource(handle as AzureUserAssignedIdentityResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); @@ -13294,6 +31426,8 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.Executable registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure/Aspire.Hosting.ApplicationModel.IAzureResource', (handle, client) => new AzureResource(handle as IAzureResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource', (handle, client) => new ComputeResource(handle as IComputeResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); diff --git a/samples/aspire-with-azure-functions/ts/apphost.run.json b/samples/aspire-with-azure-functions/ts/apphost.run.json new file mode 100644 index 00000000..cec92c29 --- /dev/null +++ b/samples/aspire-with-azure-functions/ts/apphost.run.json @@ -0,0 +1,11 @@ +{ + "profiles": { + "https": { + "applicationUrl": "https://localhost:11916;http://localhost:45612", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:43241", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:50634" + } + } + } +} \ No newline at end of file diff --git a/samples/aspire-with-azure-functions/ts/apphost.ts b/samples/aspire-with-azure-functions/ts/apphost.ts index 2bdd4049..7d761cb7 100644 --- a/samples/aspire-with-azure-functions/ts/apphost.ts +++ b/samples/aspire-with-azure-functions/ts/apphost.ts @@ -1,13 +1,4 @@ -// Setup: Run the following commands to add required integrations: -// aspire add azure-appcontainers -// aspire add azure-storage -// aspire add azure-functions -// -// Note: StorageBuiltInRole and withRoleAssignments are expected to be available -// after aspire add azure-storage. If StorageBuiltInRole is not exported in the -// generated SDK, the role assignment calls may need to be adjusted. - -import { createBuilder, StorageBuiltInRole } from "./.modules/aspire.js"; +import { createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); @@ -15,29 +6,20 @@ builder.addAzureContainerAppEnvironment("env"); const storage = builder.addAzureStorage("storage") .runAsEmulator(); -// POLYGLOT GAP: .ConfigureInfrastructure(infra => { ... }) — Bicep infrastructure configuration -// with Azure.Provisioning.Storage.StorageAccount is a C# lambda and not directly available. -// The storage account will use default settings. const blobs = storage.addBlobs("blobs"); const queues = storage.addQueues("queues"); -const functions = builder.addAzureFunctionsProject("functions") +const functions = builder.addAzureFunctionsProject("functions", "../ImageGallery.Functions/ImageGallery.Functions.csproj") .withReference(queues) .withReference(blobs) .waitFor(storage) - .withRoleAssignments(storage, - StorageBuiltInRole.StorageAccountContributor, - StorageBuiltInRole.StorageBlobDataOwner, - StorageBuiltInRole.StorageQueueDataContributor) .withHostStorage(storage); -// POLYGLOT GAP: .WithUrlForEndpoint("http", u => u.DisplayText = "Functions App") — lambda URL customization is not available. -const frontend = builder.addProject("frontend") +builder.addProject("frontend", "../ImageGallery.FrontEnd/ImageGallery.FrontEnd.csproj", "https") .withReference(queues) .withReference(blobs) .waitFor(functions) .withExternalHttpEndpoints(); -// POLYGLOT GAP: .WithUrlForEndpoint callbacks for display text are not available. await builder.build().run(); diff --git a/samples/aspire-with-azure-functions/ts/package-lock.json b/samples/aspire-with-azure-functions/ts/package-lock.json index c4d3800c..d553775e 100644 --- a/samples/aspire-with-azure-functions/ts/package-lock.json +++ b/samples/aspire-with-azure-functions/ts/package-lock.json @@ -1,6 +1,962 @@ { - "name": "ts", + "name": "imagegallery", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, - "packages": {} + "packages": { + "": { + "name": "imagegallery", + "version": "1.0.0", + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz", + "integrity": "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.3.tgz", + "integrity": "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.3.tgz", + "integrity": "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.3.tgz", + "integrity": "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.3.tgz", + "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.3.tgz", + "integrity": "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.3.tgz", + "integrity": "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.3.tgz", + "integrity": "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.3.tgz", + "integrity": "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.3.tgz", + "integrity": "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.3.tgz", + "integrity": "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.3.tgz", + "integrity": "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.3.tgz", + "integrity": "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.3.tgz", + "integrity": "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.3.tgz", + "integrity": "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.3.tgz", + "integrity": "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz", + "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.3.tgz", + "integrity": "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.3.tgz", + "integrity": "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.3.tgz", + "integrity": "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.3.tgz", + "integrity": "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.3.tgz", + "integrity": "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.3.tgz", + "integrity": "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.3.tgz", + "integrity": "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.3.tgz", + "integrity": "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.3.tgz", + "integrity": "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@types/node": { + "version": "20.19.37", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.37.tgz", + "integrity": "sha512-8kzdPJ3FsNsVIurqBs7oodNnCEVbni9yUEkaHbgptDACOPW04jimGagZ51E6+lXUwJjgnBw+hyko/lkFWCldqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.4.tgz", + "integrity": "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/esbuild": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.3.tgz", + "integrity": "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.27.3", + "@esbuild/android-arm": "0.27.3", + "@esbuild/android-arm64": "0.27.3", + "@esbuild/android-x64": "0.27.3", + "@esbuild/darwin-arm64": "0.27.3", + "@esbuild/darwin-x64": "0.27.3", + "@esbuild/freebsd-arm64": "0.27.3", + "@esbuild/freebsd-x64": "0.27.3", + "@esbuild/linux-arm": "0.27.3", + "@esbuild/linux-arm64": "0.27.3", + "@esbuild/linux-ia32": "0.27.3", + "@esbuild/linux-loong64": "0.27.3", + "@esbuild/linux-mips64el": "0.27.3", + "@esbuild/linux-ppc64": "0.27.3", + "@esbuild/linux-riscv64": "0.27.3", + "@esbuild/linux-s390x": "0.27.3", + "@esbuild/linux-x64": "0.27.3", + "@esbuild/netbsd-arm64": "0.27.3", + "@esbuild/netbsd-x64": "0.27.3", + "@esbuild/openbsd-arm64": "0.27.3", + "@esbuild/openbsd-x64": "0.27.3", + "@esbuild/openharmony-arm64": "0.27.3", + "@esbuild/sunos-x64": "0.27.3", + "@esbuild/win32-arm64": "0.27.3", + "@esbuild/win32-ia32": "0.27.3", + "@esbuild/win32-x64": "0.27.3" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-tsconfig": { + "version": "4.13.6", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.6.tgz", + "integrity": "sha512-shZT/QMiSHc/YBLxxOkMtgSid5HFoauqCE3/exfsEcwg1WkeqjG+V40yBbBrsD+jW2HDXcs28xOfcbm2jI8Ddw==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true, + "license": "ISC" + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/minimatch": { + "version": "10.2.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz", + "integrity": "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nodemon": { + "version": "3.1.14", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.14.tgz", + "integrity": "sha512-jakjZi93UtB3jHMWsXL68FXSAosbLfY0In5gtKq3niLSkrWznrVBzXFNOEMJUfc9+Ke7SHWoAZsiMkNP3vq6Jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^10.2.1", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true, + "license": "MIT" + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "license": "ISC", + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/tsx": { + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz", + "integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.27.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true, + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/vscode-jsonrpc": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.1.tgz", + "integrity": "sha512-kdjOSJ2lLIn7r1rtrMbbNCHjyMPfRnowdKjBQ+mGq6NAW5QY2bEZC/khaC5OR8svbbjvLEaIXkOq45e2X9BIbQ==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + } + } } diff --git a/samples/aspire-with-azure-functions/ts/package.json b/samples/aspire-with-azure-functions/ts/package.json new file mode 100644 index 00000000..328798c5 --- /dev/null +++ b/samples/aspire-with-azure-functions/ts/package.json @@ -0,0 +1,19 @@ +{ + "name": "imagegallery", + "version": "1.0.0", + "type": "module", + "scripts": { + "start": "aspire run", + "build": "tsc", + "dev": "tsc --watch" + }, + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } +} \ No newline at end of file diff --git a/samples/aspire-with-azure-functions/ts/tsconfig.json b/samples/aspire-with-azure-functions/ts/tsconfig.json new file mode 100644 index 00000000..edf7302c --- /dev/null +++ b/samples/aspire-with-azure-functions/ts/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "outDir": "./dist", + "rootDir": "." + }, + "include": ["apphost.ts", ".modules/**/*.ts"], + "exclude": ["node_modules"] +} \ No newline at end of file diff --git a/samples/aspire-with-javascript/ts/.aspire/settings.json b/samples/aspire-with-javascript/ts/.aspire/settings.json index 14ce40b7..7f9e3027 100644 --- a/samples/aspire-with-javascript/ts/.aspire/settings.json +++ b/samples/aspire-with-javascript/ts/.aspire/settings.json @@ -1,7 +1,9 @@ { "appHostPath": "../apphost.ts", + "language": "typescript/nodejs", + "channel": "staging", "sdkVersion": "13.2.0-preview.1.26159.1", "packages": { - "Aspire.Hosting.JavaScript": "13.1.2" + "Aspire.Hosting.JavaScript": "13.2.0-preview.1.26159.1" } } \ No newline at end of file diff --git a/samples/aspire-with-javascript/ts/.modules/.codegen-hash b/samples/aspire-with-javascript/ts/.modules/.codegen-hash index 3be8a4c4..0eea8b04 100644 --- a/samples/aspire-with-javascript/ts/.modules/.codegen-hash +++ b/samples/aspire-with-javascript/ts/.modules/.codegen-hash @@ -1 +1 @@ -C83A16C77B47A5C68F56361378E1F2F14BC156C402FB624987486277E4429782 \ No newline at end of file +88ADA13426D51D77887AE37D013F598E646AE7698A68086919B880C18973924A \ No newline at end of file diff --git a/samples/aspire-with-javascript/ts/.modules/aspire.ts b/samples/aspire-with-javascript/ts/.modules/aspire.ts index 73dc52d2..9bad32d3 100644 --- a/samples/aspire-with-javascript/ts/.modules/aspire.ts +++ b/samples/aspire-with-javascript/ts/.modules/aspire.ts @@ -26,6 +26,15 @@ import { // Handle Type Aliases (Internal - not exported to users) // ============================================================================ +/** Handle to JavaScriptAppResource */ +type JavaScriptAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource'>; + +/** Handle to NodeAppResource */ +type NodeAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource'>; + +/** Handle to ViteAppResource */ +type ViteAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource'>; + /** Handle to CommandLineArgsCallbackContext */ type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; @@ -331,6 +340,10 @@ export interface AddDockerfileOptions { stage?: string; } +export interface AddJavaScriptAppOptions { + runScriptName?: string; +} + export interface AddParameterFromConfigurationOptions { secret?: boolean; } @@ -339,6 +352,10 @@ export interface AddParameterOptions { secret?: boolean; } +export interface AddViteAppOptions { + runScriptName?: string; +} + export interface AppendFormattedOptions { format?: string; } @@ -363,6 +380,19 @@ export interface WithBindMountOptions { isReadOnly?: boolean; } +export interface WithBrowserDebuggerOptions { + browser?: string; +} + +export interface WithBuildScriptOptions { + args?: string[]; +} + +export interface WithBunOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithCommandOptions { commandOptions?: CommandOptions; } @@ -446,6 +476,12 @@ export interface WithMcpServerOptions { endpointName?: string; } +export interface WithNpmOptions { + install?: boolean; + installCommand?: string; + installArgs?: string[]; +} + export interface WithPipelineStepFactoryOptions { dependsOn?: string[]; requiredBy?: string[]; @@ -453,6 +489,11 @@ export interface WithPipelineStepFactoryOptions { description?: string; } +export interface WithPnpmOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithReferenceOptions { connectionName?: string; optional?: boolean; @@ -462,6 +503,10 @@ export interface WithRequiredCommandOptions { helpLink?: string; } +export interface WithRunScriptOptions { + args?: string[]; +} + export interface WithUrlExpressionOptions { displayText?: string; } @@ -475,6 +520,11 @@ export interface WithVolumeOptions { isReadOnly?: boolean; } +export interface WithYarnOptions { + install?: boolean; + installArgs?: string[]; +} + // ============================================================================ // CommandLineArgsCallbackContext // ============================================================================ @@ -1711,6 +1761,55 @@ export class DistributedApplicationBuilder { return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); } + /** Adds a Node.js application resource */ + /** @internal */ + async _addNodeAppInternal(name: string, appDirectory: string, scriptPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory, scriptPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addNodeApp', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._addNodeAppInternal(name, appDirectory, scriptPath)); + } + + /** Adds a JavaScript application resource */ + /** @internal */ + async _addJavaScriptAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addJavaScriptApp', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + const runScriptName = options?.runScriptName; + return new JavaScriptAppResourcePromise(this._addJavaScriptAppInternal(name, appDirectory, runScriptName)); + } + + /** Adds a Vite application resource */ + /** @internal */ + async _addViteAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addViteApp', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + const runScriptName = options?.runScriptName; + return new ViteAppResourcePromise(this._addViteAppInternal(name, appDirectory, runScriptName)); + } + } /** @@ -1801,6 +1900,21 @@ export class DistributedApplicationBuilderPromise implements PromiseLike obj.addCSharpAppWithOptions(name, path, configure))); } + /** Adds a Node.js application resource */ + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.addNodeApp(name, appDirectory, scriptPath))); + } + + /** Adds a JavaScript application resource */ + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.addJavaScriptApp(name, appDirectory, options))); + } + + /** Adds a Vite application resource */ + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.addViteApp(name, appDirectory, options))); + } + } // ============================================================================ @@ -9591,336 +9705,4710 @@ export class ExternalServiceResourcePromise implements PromiseLike { - constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { +export class JavaScriptAppResource extends ResourceBuilderBase { + constructor(handle: JavaScriptAppResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new JavaScriptAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, description }; - if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDescription', + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - const enableMarkdown = options?.enableMarkdown; - return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - const helpLink = options?.helpLink; - return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromManifestInternal()); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + const helpLink = options?.helpLink; + return new JavaScriptAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._withExplicitStartInternal()); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - const commandOptions = options?.commandOptions; - return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new JavaScriptAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new JavaScriptAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new JavaScriptAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new JavaScriptAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + const displayText = options?.displayText; + return new JavaScriptAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + const displayText = options?.displayText; + return new JavaScriptAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + const exitCode = options?.exitCode; + return new JavaScriptAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + const commandOptions = options?.commandOptions; + return new JavaScriptAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + const password = options?.password; + return new JavaScriptAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + const iconVariant = options?.iconVariant; + return new JavaScriptAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new JavaScriptAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for JavaScriptAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class JavaScriptAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: JavaScriptAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// NodeAppResource +// ============================================================================ + +export class NodeAppResource extends ResourceBuilderBase { + constructor(handle: NodeAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new NodeAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + const helpLink = options?.helpLink; + return new NodeAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new NodeAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new NodeAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + const exitCode = options?.exitCode; + return new NodeAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + const commandOptions = options?.commandOptions; + return new NodeAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + const password = options?.password; + return new NodeAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + const iconVariant = options?.iconVariant; + return new NodeAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new NodeAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withYarnInternal(install, installArgs)); + } + + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withPnpmInternal(install, installArgs)); + } + + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withRunScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withScriptDebuggingInternal(scriptPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, scriptPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withScriptDebugging', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Enables debugging support for a Node.js application with an explicit script path */ + withScriptDebugging(scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withScriptDebuggingInternal(scriptPath)); + } + + /** @internal */ + private async _withDebuggingInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withDebugging', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Enables debugging support for a JavaScript application */ + withDebugging(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withDebuggingInternal()); + } + + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures browser debugging support */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + const browser = options?.browser; + return new NodeAppResourcePromise(this._withBrowserDebuggerInternal(browser)); + } + +} + +/** + * Thenable wrapper for NodeAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class NodeAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: NodeAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Enables debugging support for a Node.js application with an explicit script path */ + withScriptDebugging(scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withScriptDebugging(scriptPath))); + } + + /** Enables debugging support for a JavaScript application */ + withDebugging(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDebugging())); + } + + /** Configures browser debugging support */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { const iconVariant = options?.iconVariant; - return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -9931,60 +14419,60 @@ export class ParameterResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -9999,128 +14487,313 @@ export class ParameterResource extends ResourceBuilderBase { - constructor(private _promise: Promise) {} +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -10131,380 +14804,475 @@ export class ParameterResourcePromise implements PromiseLike } // ============================================================================ -// ProjectResource +// ViteAppResource // ============================================================================ -export class ProjectResource extends ResourceBuilderBase { - constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { +export class ViteAppResource extends ResourceBuilderBase { + constructor(handle: ViteAppResourceHandle, client: AspireClientRpc) { super(handle, client); } + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ViteAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { const path = options?.path; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + return new ViteAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { + private async _withOtlpExporterInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterInternal()); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { const helpLink = options?.helpLink; - return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new ViteAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { + private async _withEnvironmentInternal(name: string, value: string): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + withEnvironment(name: string, value: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentExpression', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + withEnvironmentExpression(name: string, value: ReferenceExpression): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; const obj = new EnvironmentCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + return new ViteAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withServiceReference', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + withServiceReference(source: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withServiceReferenceInternal(source)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withServiceReferenceNamed', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -10514,15 +15282,15 @@ export class ProjectResource extends ResourceBuilderBase if (isProxied !== undefined) rpcArgs.isProxied = isProxied; if (isExternal !== undefined) rpcArgs.isExternal = isExternal; if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -10531,72 +15299,72 @@ export class ProjectResource extends ResourceBuilderBase const isProxied = options?.isProxied; const isExternal = options?.isExternal; const protocol = options?.protocol; - return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + return new ViteAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -10609,293 +15377,308 @@ export class ProjectResource extends ResourceBuilderBase } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _clearContainerFilesSourcesInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitFor', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForCompletion', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { const exitCode = options?.exitCode; - return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ViteAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new ViteAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -10903,130 +15686,130 @@ export class ProjectResource extends ResourceBuilderBase }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { const commandOptions = options?.commandOptions; - return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ViteAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsDeveloperCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { const password = options?.password; - return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new ViteAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { const iconVariant = options?.iconVariant; - return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ViteAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -11035,15 +15818,15 @@ export class ProjectResource extends ResourceBuilderBase if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -11051,56 +15834,56 @@ export class ProjectResource extends ResourceBuilderBase const failureThreshold = options?.failureThreshold; const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new ViteAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -11111,60 +15894,60 @@ export class ProjectResource extends ResourceBuilderBase if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; if (tags !== undefined) rpcArgs.tags = tags; if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ViteAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -11176,151 +15959,330 @@ export class ProjectResource extends ResourceBuilderBase ); } + /** @internal */ + private async _withViteConfigInternal(configPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, configPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withViteConfig', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withViteConfigInternal(configPath)); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withYarnInternal(install, installArgs)); + } + + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withPnpmInternal(install, installArgs)); + } + + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withRunScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withDebuggingInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withDebugging', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Enables debugging support for a JavaScript application */ + withDebugging(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withDebuggingInternal()); + } + + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures browser debugging support */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + const browser = options?.browser; + return new ViteAppResourcePromise(this._withBrowserDebuggerInternal(browser)); + } + } /** - * Thenable wrapper for ProjectResource that enables fluent chaining. + * Thenable wrapper for ViteAppResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ProjectResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ViteAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ViteAppResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + withEnvironment(name: string, value: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + withEnvironmentExpression(name: string, value: ReferenceExpression): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + withServiceReference(source: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); } /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -11329,163 +16291,168 @@ export class ProjectResourcePromise implements PromiseLike { } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -11493,6 +16460,51 @@ export class ProjectResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withViteConfig(configPath))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Enables debugging support for a JavaScript application */ + withDebugging(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDebugging())); + } + + /** Configures browser debugging support */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + } // ============================================================================ @@ -13292,8 +18304,11 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppR registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource', (handle, client) => new JavaScriptAppResource(handle as JavaScriptAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource', (handle, client) => new NodeAppResource(handle as NodeAppResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource', (handle, client) => new ViteAppResource(handle as ViteAppResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); diff --git a/samples/aspire-with-javascript/ts/apphost.run.json b/samples/aspire-with-javascript/ts/apphost.run.json new file mode 100644 index 00000000..ca8c7241 --- /dev/null +++ b/samples/aspire-with-javascript/ts/apphost.run.json @@ -0,0 +1,11 @@ +{ + "profiles": { + "https": { + "applicationUrl": "https://localhost:55218;http://localhost:48020", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:22267", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:39938" + } + } + } +} \ No newline at end of file diff --git a/samples/aspire-with-javascript/ts/apphost.ts b/samples/aspire-with-javascript/ts/apphost.ts index adb0d1fc..608407a3 100644 --- a/samples/aspire-with-javascript/ts/apphost.ts +++ b/samples/aspire-with-javascript/ts/apphost.ts @@ -1,42 +1,38 @@ -// Setup: Run the following commands to add required integrations: -// aspire add javascript - -import { createBuilder } from "./.modules/aspire.js"; +import { createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); -const weatherApi = builder.addProject("weatherapi") +const weatherApi = builder.addProject("weatherapi", "../AspireJavaScript.MinimalApi/AspireJavaScript.MinimalApi.csproj", "https") .withExternalHttpEndpoints(); -const angular = builder.addJavaScriptApp("angular", "../AspireJavaScript.Angular", "start") +builder.addJavaScriptApp("angular", "../AspireJavaScript.Angular", { runScriptName: "start" }) .withReference(weatherApi) .waitFor(weatherApi) .withHttpEndpoint({ env: "PORT" }) - .withExternalHttpEndpoints(); -// POLYGLOT GAP: .PublishAsDockerFile() — publish-time Dockerfile generation may not be available. + .withExternalHttpEndpoints() + .publishAsDockerFile(); -const react = builder.addJavaScriptApp("react", "../AspireJavaScript.React", "start") +builder.addJavaScriptApp("react", "../AspireJavaScript.React", { runScriptName: "start" }) .withReference(weatherApi) .waitFor(weatherApi) .withEnvironment("BROWSER", "none") .withHttpEndpoint({ env: "PORT" }) - .withExternalHttpEndpoints(); -// POLYGLOT GAP: .PublishAsDockerFile() — publish-time Dockerfile generation may not be available. + .withExternalHttpEndpoints() + .publishAsDockerFile(); -const vue = builder.addJavaScriptApp("vue", "../AspireJavaScript.Vue") +builder.addJavaScriptApp("vue", "../AspireJavaScript.Vue") .withRunScript("start") .withNpm({ installCommand: "ci" }) .withReference(weatherApi) .waitFor(weatherApi) .withHttpEndpoint({ env: "PORT" }) - .withExternalHttpEndpoints(); -// POLYGLOT GAP: .PublishAsDockerFile() — publish-time Dockerfile generation may not be available. + .withExternalHttpEndpoints() + .publishAsDockerFile(); const reactVite = builder.addViteApp("reactvite", "../AspireJavaScript.Vite") .withReference(weatherApi) .withEnvironment("BROWSER", "none"); -// POLYGLOT GAP: weatherApi.publishWithContainerFiles(reactVite, "./wwwroot") — bundling Vite -// output into a project's wwwroot may not be available. +weatherApi.publishWithContainerFiles(reactVite, "./wwwroot"); await builder.build().run(); diff --git a/samples/aspire-with-javascript/ts/package-lock.json b/samples/aspire-with-javascript/ts/package-lock.json index c4d3800c..086f1fa3 100644 --- a/samples/aspire-with-javascript/ts/package-lock.json +++ b/samples/aspire-with-javascript/ts/package-lock.json @@ -1,6 +1,962 @@ { - "name": "ts", + "name": "aspirejavascript", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, - "packages": {} + "packages": { + "": { + "name": "aspirejavascript", + "version": "1.0.0", + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz", + "integrity": "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.3.tgz", + "integrity": "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.3.tgz", + "integrity": "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.3.tgz", + "integrity": "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.3.tgz", + "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.3.tgz", + "integrity": "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.3.tgz", + "integrity": "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.3.tgz", + "integrity": "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.3.tgz", + "integrity": "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.3.tgz", + "integrity": "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.3.tgz", + "integrity": "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.3.tgz", + "integrity": "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.3.tgz", + "integrity": "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.3.tgz", + "integrity": "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.3.tgz", + "integrity": "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.3.tgz", + "integrity": "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz", + "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.3.tgz", + "integrity": "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.3.tgz", + "integrity": "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.3.tgz", + "integrity": "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.3.tgz", + "integrity": "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.3.tgz", + "integrity": "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.3.tgz", + "integrity": "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.3.tgz", + "integrity": "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.3.tgz", + "integrity": "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.3.tgz", + "integrity": "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@types/node": { + "version": "20.19.37", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.37.tgz", + "integrity": "sha512-8kzdPJ3FsNsVIurqBs7oodNnCEVbni9yUEkaHbgptDACOPW04jimGagZ51E6+lXUwJjgnBw+hyko/lkFWCldqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.4.tgz", + "integrity": "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/esbuild": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.3.tgz", + "integrity": "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.27.3", + "@esbuild/android-arm": "0.27.3", + "@esbuild/android-arm64": "0.27.3", + "@esbuild/android-x64": "0.27.3", + "@esbuild/darwin-arm64": "0.27.3", + "@esbuild/darwin-x64": "0.27.3", + "@esbuild/freebsd-arm64": "0.27.3", + "@esbuild/freebsd-x64": "0.27.3", + "@esbuild/linux-arm": "0.27.3", + "@esbuild/linux-arm64": "0.27.3", + "@esbuild/linux-ia32": "0.27.3", + "@esbuild/linux-loong64": "0.27.3", + "@esbuild/linux-mips64el": "0.27.3", + "@esbuild/linux-ppc64": "0.27.3", + "@esbuild/linux-riscv64": "0.27.3", + "@esbuild/linux-s390x": "0.27.3", + "@esbuild/linux-x64": "0.27.3", + "@esbuild/netbsd-arm64": "0.27.3", + "@esbuild/netbsd-x64": "0.27.3", + "@esbuild/openbsd-arm64": "0.27.3", + "@esbuild/openbsd-x64": "0.27.3", + "@esbuild/openharmony-arm64": "0.27.3", + "@esbuild/sunos-x64": "0.27.3", + "@esbuild/win32-arm64": "0.27.3", + "@esbuild/win32-ia32": "0.27.3", + "@esbuild/win32-x64": "0.27.3" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-tsconfig": { + "version": "4.13.6", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.6.tgz", + "integrity": "sha512-shZT/QMiSHc/YBLxxOkMtgSid5HFoauqCE3/exfsEcwg1WkeqjG+V40yBbBrsD+jW2HDXcs28xOfcbm2jI8Ddw==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true, + "license": "ISC" + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/minimatch": { + "version": "10.2.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz", + "integrity": "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nodemon": { + "version": "3.1.14", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.14.tgz", + "integrity": "sha512-jakjZi93UtB3jHMWsXL68FXSAosbLfY0In5gtKq3niLSkrWznrVBzXFNOEMJUfc9+Ke7SHWoAZsiMkNP3vq6Jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^10.2.1", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true, + "license": "MIT" + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "license": "ISC", + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/tsx": { + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz", + "integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.27.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true, + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/vscode-jsonrpc": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.1.tgz", + "integrity": "sha512-kdjOSJ2lLIn7r1rtrMbbNCHjyMPfRnowdKjBQ+mGq6NAW5QY2bEZC/khaC5OR8svbbjvLEaIXkOq45e2X9BIbQ==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + } + } } diff --git a/samples/aspire-with-javascript/ts/package.json b/samples/aspire-with-javascript/ts/package.json new file mode 100644 index 00000000..789bedb6 --- /dev/null +++ b/samples/aspire-with-javascript/ts/package.json @@ -0,0 +1,19 @@ +{ + "name": "aspirejavascript", + "version": "1.0.0", + "type": "module", + "scripts": { + "start": "aspire run", + "build": "tsc", + "dev": "tsc --watch" + }, + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } +} \ No newline at end of file diff --git a/samples/aspire-with-javascript/ts/tsconfig.json b/samples/aspire-with-javascript/ts/tsconfig.json new file mode 100644 index 00000000..edf7302c --- /dev/null +++ b/samples/aspire-with-javascript/ts/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "outDir": "./dist", + "rootDir": "." + }, + "include": ["apphost.ts", ".modules/**/*.ts"], + "exclude": ["node_modules"] +} \ No newline at end of file diff --git a/samples/aspire-with-node/ts/.aspire/settings.json b/samples/aspire-with-node/ts/.aspire/settings.json index 37e15bd6..cd047321 100644 --- a/samples/aspire-with-node/ts/.aspire/settings.json +++ b/samples/aspire-with-node/ts/.aspire/settings.json @@ -1,8 +1,10 @@ { "appHostPath": "../apphost.ts", + "language": "typescript/nodejs", + "channel": "staging", "sdkVersion": "13.2.0-preview.1.26159.1", "packages": { - "Aspire.Hosting.JavaScript": "13.1.2", - "Aspire.Hosting.Redis": "13.1.2" + "Aspire.Hosting.JavaScript": "13.2.0-preview.1.26159.1", + "Aspire.Hosting.Redis": "13.2.0-preview.1.26159.1" } } \ No newline at end of file diff --git a/samples/aspire-with-node/ts/.modules/.codegen-hash b/samples/aspire-with-node/ts/.modules/.codegen-hash index 55ba0bec..acfe28db 100644 --- a/samples/aspire-with-node/ts/.modules/.codegen-hash +++ b/samples/aspire-with-node/ts/.modules/.codegen-hash @@ -1 +1 @@ -27FE203695BE4332BD6FD0DE4CA5270B104D44B178E85007FC229E720FBFC238 \ No newline at end of file +EB6192B0943AC285615F9DF1CEC9BADC9FFBB83928261DEA3E1A6C58182C1677 \ No newline at end of file diff --git a/samples/aspire-with-node/ts/.modules/aspire.ts b/samples/aspire-with-node/ts/.modules/aspire.ts index 73dc52d2..1ea516ff 100644 --- a/samples/aspire-with-node/ts/.modules/aspire.ts +++ b/samples/aspire-with-node/ts/.modules/aspire.ts @@ -26,6 +26,24 @@ import { // Handle Type Aliases (Internal - not exported to users) // ============================================================================ +/** Handle to JavaScriptAppResource */ +type JavaScriptAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource'>; + +/** Handle to NodeAppResource */ +type NodeAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource'>; + +/** Handle to ViteAppResource */ +type ViteAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource'>; + +/** Handle to RedisResource */ +type RedisResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting.ApplicationModel.RedisResource'>; + +/** Handle to RedisCommanderResource */ +type RedisCommanderResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisCommanderResource'>; + +/** Handle to RedisInsightResource */ +type RedisInsightResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisInsightResource'>; + /** Handle to CommandLineArgsCallbackContext */ type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; @@ -331,6 +349,10 @@ export interface AddDockerfileOptions { stage?: string; } +export interface AddJavaScriptAppOptions { + runScriptName?: string; +} + export interface AddParameterFromConfigurationOptions { secret?: boolean; } @@ -339,6 +361,19 @@ export interface AddParameterOptions { secret?: boolean; } +export interface AddRedisOptions { + port?: number; + password?: ParameterResource; +} + +export interface AddRedisWithPortOptions { + port?: number; +} + +export interface AddViteAppOptions { + runScriptName?: string; +} + export interface AppendFormattedOptions { format?: string; } @@ -363,10 +398,32 @@ export interface WithBindMountOptions { isReadOnly?: boolean; } +export interface WithBrowserDebuggerOptions { + browser?: string; +} + +export interface WithBuildScriptOptions { + args?: string[]; +} + +export interface WithBunOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithCommandOptions { commandOptions?: CommandOptions; } +export interface WithDataBindMountOptions { + isReadOnly?: boolean; +} + +export interface WithDataVolumeOptions { + name?: string; + isReadOnly?: boolean; +} + export interface WithDescriptionOptions { enableMarkdown?: boolean; } @@ -397,6 +454,10 @@ export interface WithExternalServiceHttpHealthCheckOptions { statusCode?: number; } +export interface WithHostPortOptions { + port?: number; +} + export interface WithHttpEndpointOptions { port?: number; targetPort?: number; @@ -446,6 +507,17 @@ export interface WithMcpServerOptions { endpointName?: string; } +export interface WithNpmOptions { + install?: boolean; + installCommand?: string; + installArgs?: string[]; +} + +export interface WithPersistenceOptions { + interval?: number; + keysChangedThreshold?: number; +} + export interface WithPipelineStepFactoryOptions { dependsOn?: string[]; requiredBy?: string[]; @@ -453,6 +525,21 @@ export interface WithPipelineStepFactoryOptions { description?: string; } +export interface WithPnpmOptions { + install?: boolean; + installArgs?: string[]; +} + +export interface WithRedisCommanderOptions { + configureContainer?: (obj: RedisCommanderResource) => Promise; + containerName?: string; +} + +export interface WithRedisInsightOptions { + configureContainer?: (obj: RedisInsightResource) => Promise; + containerName?: string; +} + export interface WithReferenceOptions { connectionName?: string; optional?: boolean; @@ -462,6 +549,10 @@ export interface WithRequiredCommandOptions { helpLink?: string; } +export interface WithRunScriptOptions { + args?: string[]; +} + export interface WithUrlExpressionOptions { displayText?: string; } @@ -475,6 +566,11 @@ export interface WithVolumeOptions { isReadOnly?: boolean; } +export interface WithYarnOptions { + install?: boolean; + installArgs?: string[]; +} + // ============================================================================ // CommandLineArgsCallbackContext // ============================================================================ @@ -1711,6 +1807,91 @@ export class DistributedApplicationBuilder { return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); } + /** Adds a Node.js application resource */ + /** @internal */ + async _addNodeAppInternal(name: string, appDirectory: string, scriptPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory, scriptPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addNodeApp', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._addNodeAppInternal(name, appDirectory, scriptPath)); + } + + /** Adds a JavaScript application resource */ + /** @internal */ + async _addJavaScriptAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addJavaScriptApp', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + const runScriptName = options?.runScriptName; + return new JavaScriptAppResourcePromise(this._addJavaScriptAppInternal(name, appDirectory, runScriptName)); + } + + /** Adds a Vite application resource */ + /** @internal */ + async _addViteAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addViteApp', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + const runScriptName = options?.runScriptName; + return new ViteAppResourcePromise(this._addViteAppInternal(name, appDirectory, runScriptName)); + } + + /** Adds a Redis container resource with specific port */ + /** @internal */ + async _addRedisWithPortInternal(name: string, port?: number): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/addRedisWithPort', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { + const port = options?.port; + return new RedisResourcePromise(this._addRedisWithPortInternal(name, port)); + } + + /** Adds a Redis container resource */ + /** @internal */ + async _addRedisInternal(name: string, port?: number, password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (port !== undefined) rpcArgs.port = port; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/addRedis', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { + const port = options?.port; + const password = options?.password; + return new RedisResourcePromise(this._addRedisInternal(name, port, password)); + } + } /** @@ -1801,6 +1982,31 @@ export class DistributedApplicationBuilderPromise implements PromiseLike obj.addCSharpAppWithOptions(name, path, configure))); } + /** Adds a Node.js application resource */ + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.addNodeApp(name, appDirectory, scriptPath))); + } + + /** Adds a JavaScript application resource */ + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.addJavaScriptApp(name, appDirectory, options))); + } + + /** Adds a Vite application resource */ + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.addViteApp(name, appDirectory, options))); + } + + /** Adds a Redis container resource with specific port */ + addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.addRedisWithPort(name, options))); + } + + /** Adds a Redis container resource */ + addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.addRedis(name, options))); + } + } // ============================================================================ @@ -3056,7071 +3262,16781 @@ export class ContainerResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + 'Aspire.Hosting/withMcpServer', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageTagInternal(tag)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - const tag = options?.tag; - return new ContainerResourcePromise(this._withImageInternal(image, tag)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', + 'Aspire.Hosting/withEnvironmentExpression', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', + 'Aspire.Hosting/withEnvironmentCallbackAsync', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsContainerInternal()); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNameInternal(name)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + 'Aspire.Hosting/withArgs', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + 'Aspire.Hosting/withArgsCallback', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + 'Aspire.Hosting/withReference', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); } /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', + 'Aspire.Hosting/withServiceReference', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + 'Aspire.Hosting/withServiceReferenceNamed', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + 'Aspire.Hosting/withReferenceUri', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterInternal()); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); return new ContainerResource(result, this._client); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + 'Aspire.Hosting/withEndpoint', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - const helpLink = options?.helpLink; - return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/asHttp2Service', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + 'Aspire.Hosting/withUrl', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + 'Aspire.Hosting/withUrlExpression', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsInternal(args)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + 'Aspire.Hosting/waitFor', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + 'Aspire.Hosting/waitForStart', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + 'Aspire.Hosting/withExplicitStart', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + 'Aspire.Hosting/waitForCompletion', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + const exitCode = options?.exitCode; + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + 'Aspire.Hosting/withHealthCheck', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + 'Aspire.Hosting/withCommand', rpcArgs ); return new ContainerResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); + return new ContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + 'Aspire.Hosting/withHttpsDeveloperCertificate', rpcArgs ); return new ContainerResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + const password = options?.password; + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); return new ContainerResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + 'Aspire.Hosting/withParentRelationship', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + 'Aspire.Hosting/withChildRelationship', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + 'Aspire.Hosting/withIconName', rpcArgs ); return new ContainerResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + 'Aspire.Hosting/withHttpProbe', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); return new ContainerResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromManifestInternal()); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); return new ContainerResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForInternal(dependency)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); return new ContainerResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); return new ContainerResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); return new ContainerResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); return new ContainerResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExplicitStartInternal()); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new ContainerResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - const exitCode = options?.exitCode; - return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); +} + +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - const password = options?.password; - return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromMcpInternal()); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } -} - -/** - * Thenable wrapper for ContainerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ContainerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); - } +} - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } +// ============================================================================ +// CSharpAppResource +// ============================================================================ - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { + super(handle, client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); - } + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } - - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); - } - - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); - } - - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); - } - - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); - } - - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); - } - - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); - } - - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); - } - - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); - } - -} - -// ============================================================================ -// CSharpAppResource -// ============================================================================ - -export class CSharpAppResource extends ResourceBuilderBase { - constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + 'Aspire.Hosting/withArgsCallback', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + 'Aspire.Hosting/withReference', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + 'Aspire.Hosting/withServiceReference', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + 'Aspire.Hosting/withServiceReferenceNamed', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } /** @internal */ - private async _withReplicasInternal(replicas: number): Promise { - const rpcArgs: Record = { builder: this._handle, replicas }; + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReplicas', + 'Aspire.Hosting/withReferenceUri', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _disableForwardedHeadersInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/disableForwardedHeaders', + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - const helpLink = options?.helpLink; - return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + 'Aspire.Hosting/withEndpoint', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); - } + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/asHttp2Service', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + 'Aspire.Hosting/withUrl', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsInternal(args)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + 'Aspire.Hosting/publishWithContainerFiles', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + 'Aspire.Hosting/waitFor', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + 'Aspire.Hosting/waitForStart', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + 'Aspire.Hosting/withExplicitStart', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + 'Aspire.Hosting/waitForCompletion', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + const exitCode = options?.exitCode; + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + 'Aspire.Hosting/withHealthCheck', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + const commandOptions = options?.commandOptions; + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); + return new CSharpAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + 'Aspire.Hosting/withHttpsDeveloperCertificate', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + const password = options?.password; + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + 'Aspire.Hosting/withParentRelationship', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + 'Aspire.Hosting/withChildRelationship', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + const iconVariant = options?.iconVariant; + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// DotnetToolResource +// ============================================================================ + +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + } + + /** @internal */ + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + } + + /** @internal */ + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + } + + /** @internal */ + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + } + + /** @internal */ + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + } + + /** @internal */ + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + const exitCode = options?.exitCode; + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + const commandOptions = options?.commandOptions; + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + const password = options?.password; + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + const iconVariant = options?.iconVariant; + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for DotnetToolResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExecutableResource +// ============================================================================ + +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// JavaScriptAppResource +// ============================================================================ + +export class JavaScriptAppResource extends ResourceBuilderBase { + constructor(handle: JavaScriptAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new JavaScriptAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + const helpLink = options?.helpLink; + return new JavaScriptAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new JavaScriptAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new JavaScriptAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new JavaScriptAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new JavaScriptAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + const displayText = options?.displayText; + return new JavaScriptAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + const displayText = options?.displayText; + return new JavaScriptAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + const exitCode = options?.exitCode; + return new JavaScriptAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + const commandOptions = options?.commandOptions; + return new JavaScriptAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + const password = options?.password; + return new JavaScriptAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + const iconVariant = options?.iconVariant; + return new JavaScriptAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new JavaScriptAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for JavaScriptAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class JavaScriptAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: JavaScriptAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// NodeAppResource +// ============================================================================ + +export class NodeAppResource extends ResourceBuilderBase { + constructor(handle: NodeAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new NodeAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + const helpLink = options?.helpLink; + return new NodeAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new NodeAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new NodeAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + const exitCode = options?.exitCode; + return new NodeAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + const commandOptions = options?.commandOptions; + return new NodeAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + const password = options?.password; + return new NodeAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + const iconVariant = options?.iconVariant; + return new NodeAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new NodeAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withYarnInternal(install, installArgs)); + } + + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withPnpmInternal(install, installArgs)); + } + + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withRunScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withScriptDebuggingInternal(scriptPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, scriptPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withScriptDebugging', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Enables debugging support for a Node.js application with an explicit script path */ + withScriptDebugging(scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withScriptDebuggingInternal(scriptPath)); + } + + /** @internal */ + private async _withDebuggingInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withDebugging', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Enables debugging support for a JavaScript application */ + withDebugging(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withDebuggingInternal()); + } + + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures browser debugging support */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + const browser = options?.browser; + return new NodeAppResourcePromise(this._withBrowserDebuggerInternal(browser)); + } + +} + +/** + * Thenable wrapper for NodeAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class NodeAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: NodeAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Enables debugging support for a Node.js application with an explicit script path */ + withScriptDebugging(scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withScriptDebugging(scriptPath))); + } + + /** Enables debugging support for a JavaScript application */ + withDebugging(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDebugging())); + } + + /** Configures browser debugging support */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - const exitCode = options?.exitCode; - return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - const commandOptions = options?.commandOptions; - return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); +} + +// ============================================================================ +// RedisCommanderResource +// ============================================================================ + +export class RedisCommanderResource extends ResourceBuilderBase { + constructor(handle: RedisCommanderResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - const password = options?.password; - return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisCommanderResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisCommanderResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + /** Sets the container image tag */ + withImageTag(tag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - const iconVariant = options?.iconVariant; - return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisCommanderResourcePromise { + const tag = options?.tag; + return new RedisCommanderResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withLifetimeInternal(lifetime)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisCommanderResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new RedisCommanderResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Sets the container name */ + withContainerName(name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerNameInternal(name)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', rpcArgs ); + return new RedisCommanderResource(result, this._client); } -} - -/** - * Thenable wrapper for CSharpAppResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class CSharpAppResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withBuildArgInternal(name, value)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withBuildSecretInternal(name, value)); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisCommanderResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new RedisCommanderResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerNetworkAliasInternal(alias)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisCommanderResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new RedisCommanderResourcePromise(this._withMcpServerInternal(path, endpointName)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withOtlpExporterInternal()); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._publishAsConnectionStringInternal()); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisCommanderResourcePromise { + const helpLink = options?.helpLink; + return new RedisCommanderResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentInternal(name, value)); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentCallbackInternal(callback)); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds arguments */ + withArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withArgsInternal(args)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withArgsCallbackInternal(callback)); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisCommanderResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new RedisCommanderResourcePromise(this._withReferenceInternal(source, connectionName, optional)); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withServiceReferenceInternal(source)); } - /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } - /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withReferenceUriInternal(name, uri)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisCommanderResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new RedisCommanderResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisCommanderResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisCommanderResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisCommanderResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisCommanderResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._asHttp2ServiceInternal()); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } -} + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlsCallbackInternal(callback)); + } -// ============================================================================ -// DotnetToolResource -// ============================================================================ + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } -export class DotnetToolResource extends ResourceBuilderBase { - constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisCommanderResourcePromise { + const displayText = options?.displayText; + return new RedisCommanderResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisCommanderResourcePromise { + const displayText = options?.displayText; + return new RedisCommanderResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withToolPackageInternal(packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPackage', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withToolVersionInternal(version: string): Promise { - const rpcArgs: Record = { builder: this._handle, version }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolVersion', + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withToolPrereleaseInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPrerelease', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withToolSourceInternal(source: string): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolSource', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withToolIgnoreExistingFeedsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreExistingFeeds', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withToolIgnoreFailedSourcesInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreFailedSources', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _publishAsDockerFileInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFile', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; - const obj = new ContainerResource(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFileWithConfigure', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withExecutableCommandInternal(command: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExecutableCommand', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisCommanderResourcePromise { + const exitCode = options?.exitCode; + return new RedisCommanderResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { - const rpcArgs: Record = { builder: this._handle, workingDirectory }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withWorkingDirectory', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + /** Adds a health check by key */ + withHealthCheck(key: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisCommanderResourcePromise { const path = options?.path; + const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + return new RedisCommanderResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisCommanderResourcePromise { + const commandOptions = options?.commandOptions; + return new RedisCommanderResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - const helpLink = options?.helpLink; - return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisCommanderResourcePromise { + const password = options?.password; + return new RedisCommanderResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisCommanderResourcePromise { + const iconVariant = options?.iconVariant; + return new RedisCommanderResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisCommanderResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new RedisCommanderResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsInternal(args)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisCommanderResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new RedisCommanderResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisCommanderResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisCommanderResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisCommanderHostPort', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Sets the host port for Redis Commander */ + withHostPort(options?: WithHostPortOptions): RedisCommanderResourcePromise { + const port = options?.port; + return new RedisCommanderResourcePromise(this._withHostPortInternal(port)); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new DotnetToolResource(result, this._client); +} + +/** + * Thenable wrapper for RedisCommanderResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class RedisCommanderResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: RedisCommanderResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets the container image tag */ + withImageTag(tag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } - /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Adds arguments */ + withArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { - const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { - const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { - const exitCode = options?.exitCode; - return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { - const commandOptions = options?.commandOptions; - return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); - } - - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + withDeveloperCertificateTrust(trust: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { - const password = options?.password; - return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { - const iconVariant = options?.iconVariant; - return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets the host port for Redis Commander */ + withHostPort(options?: WithHostPortOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHostPort(options))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); +} + +// ============================================================================ +// RedisInsightResource +// ============================================================================ + +export class RedisInsightResource extends ResourceBuilderBase { + constructor(handle: RedisInsightResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisInsightResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisInsightResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisInsightResource(result, this._client); } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Sets the container image tag */ + withImageTag(tag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImageTagInternal(tag)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); + return new RedisInsightResource(result, this._client); } -} - -/** - * Thenable wrapper for DotnetToolResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class DotnetToolResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImageRegistryInternal(registry)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisInsightResourcePromise { + const tag = options?.tag; + return new RedisInsightResourcePromise(this._withImageInternal(image, tag)); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImageSHA256Internal(sha256)); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerRuntimeArgsInternal(args)); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withLifetimeInternal(lifetime)); } - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._publishAsContainerInternal()); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisInsightResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new RedisInsightResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets the container name */ + withContainerName(name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerNameInternal(name)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withBuildArgInternal(name, value)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withBuildSecretInternal(name, value)); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisInsightResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new RedisInsightResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerNetworkAliasInternal(alias)); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisInsightResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new RedisInsightResourcePromise(this._withMcpServerInternal(path, endpointName)); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withOtlpExporterInternal()); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._publishAsConnectionStringInternal()); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisInsightResourcePromise { + const helpLink = options?.helpLink; + return new RedisInsightResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentInternal(name, value)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentCallbackInternal(callback)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds arguments */ + withArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withArgsInternal(args)); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withArgsCallbackInternal(callback)); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisInsightResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new RedisInsightResourcePromise(this._withReferenceInternal(source, connectionName, optional)); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withServiceReferenceInternal(source)); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withReferenceUriInternal(name, uri)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } -} - -// ============================================================================ -// ExecutableResource -// ============================================================================ - -export class ExecutableResource extends ResourceBuilderBase { - constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisInsightResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new RedisInsightResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisInsightResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisInsightResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisInsightResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisInsightResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - const helpLink = options?.helpLink; - return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisInsightResourcePromise { + const displayText = options?.displayText; + return new RedisInsightResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisInsightResourcePromise { + const displayText = options?.displayText; + return new RedisInsightResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsInternal(args)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisInsightResourcePromise { + const exitCode = options?.exitCode; + return new RedisInsightResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + /** Adds a health check by key */ + withHealthCheck(key: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisInsightResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new RedisInsightResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisInsightResourcePromise { + const commandOptions = options?.commandOptions; + return new RedisInsightResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisInsightResourcePromise { + const password = options?.password; + return new RedisInsightResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisInsightResourcePromise { + const iconVariant = options?.iconVariant; + return new RedisInsightResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisInsightResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new RedisInsightResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._excludeFromMcpInternal()); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisInsightResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new RedisInsightResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { - const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { - const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisInsightResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new ExecutableResource(result, this._client); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsightHostPort', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Sets the host port for Redis Insight */ + withHostPort(options?: WithHostPortOptions): RedisInsightResourcePromise { + const port = options?.port; + return new RedisInsightResourcePromise(this._withHostPortInternal(port)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _withDataVolumeInternal(name?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsightDataVolume', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + /** Adds a data volume for Redis Insight */ + withDataVolume(options?: WithDataVolumeOptions): RedisInsightResourcePromise { + const name = options?.name; + return new RedisInsightResourcePromise(this._withDataVolumeInternal(name)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _withDataBindMountInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsightDataBindMount', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForInternal(dependency)); + /** Adds a data bind mount for Redis Insight */ + withDataBindMount(source: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withDataBindMountInternal(source)); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new ExecutableResource(result, this._client); +} + +/** + * Thenable wrapper for RedisInsightResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class RedisInsightResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: RedisInsightResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the container image tag */ + withImageTag(tag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExplicitStartInternal()); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { - const exitCode = options?.exitCode; - return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { - const commandOptions = options?.commandOptions; - return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { - const password = options?.password; - return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + /** Adds a health check by key */ + withHealthCheck(key: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { - const iconVariant = options?.iconVariant; - return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } -} - -/** - * Thenable wrapper for ExecutableResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ExecutableResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Sets the host port for Redis Insight */ + withHostPort(options?: WithHostPortOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHostPort(options))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Adds a data volume for Redis Insight */ + withDataVolume(options?: WithDataVolumeOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds a data bind mount for Redis Insight */ + withDataBindMount(source: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDataBindMount(source))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); - } +} - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); +// ============================================================================ +// RedisResource +// ============================================================================ + +export class RedisResource extends ResourceBuilderBase { + constructor(handle: RedisResourceHandle, client: AspireClientRpc) { + super(handle, client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Gets the PrimaryEndpoint property */ + primaryEndpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.primaryEndpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.host', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.port', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the TlsEnabled property */ + tlsEnabled = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.tlsEnabled', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.setTlsEnabled', + { context: this._handle, value } + ); + } + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the Entrypoint property */ + entrypoint = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.entrypoint', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.setEntrypoint', + { context: this._handle, value } + ); + } + }; + + /** Gets the ShellExecution property */ + shellExecution = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.shellExecution', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.setShellExecution', + { context: this._handle, value } + ); + } + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerRegistryInternal(registry)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisResourcePromise { + return new RedisResourcePromise(this._withEntrypointInternal(entrypoint)); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Sets the container image tag */ + withImageTag(tag: string): RedisResourcePromise { + return new RedisResourcePromise(this._withImageTagInternal(tag)); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisResourcePromise { + return new RedisResourcePromise(this._withImageRegistryInternal(registry)); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisResourcePromise { + const tag = options?.tag; + return new RedisResourcePromise(this._withImageInternal(image, tag)); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisResourcePromise { + return new RedisResourcePromise(this._withImageSHA256Internal(sha256)); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerRuntimeArgsInternal(args)); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisResourcePromise { + return new RedisResourcePromise(this._withLifetimeInternal(lifetime)); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisResourcePromise { + return new RedisResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisResourcePromise { + return new RedisResourcePromise(this._publishAsContainerInternal()); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new RedisResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Sets the container name */ + withContainerName(name: string): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerNameInternal(name)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withBuildArgInternal(name, value)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withBuildSecretInternal(name, value)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new RedisResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerNetworkAliasInternal(alias)); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new RedisResourcePromise(this._withMcpServerInternal(path, endpointName)); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisResourcePromise { + return new RedisResourcePromise(this._withOtlpExporterInternal()); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisResourcePromise { + return new RedisResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisResourcePromise { + return new RedisResourcePromise(this._publishAsConnectionStringInternal()); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisResourcePromise { + const helpLink = options?.helpLink; + return new RedisResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentInternal(name, value)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentCallbackInternal(callback)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new RedisResource(result, this._client); } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); } -} + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } -// ============================================================================ -// ExternalServiceResource -// ============================================================================ + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new RedisResource(result, this._client); + } -export class ExternalServiceResource extends ResourceBuilderBase { - constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._withConnectionPropertyInternal(name, value)); } /** @internal */ - private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisResource(result, this._client); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._withConnectionPropertyValueInternal(name, value)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - const helpLink = options?.helpLink; - return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds arguments */ + withArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new RedisResourcePromise(this._withReferenceInternal(source, connectionName, optional)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withServiceReferenceInternal(source)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisResourcePromise { + return new RedisResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisResourcePromise { + return new RedisResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisResourcePromise { + return new RedisResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new RedisResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - const commandOptions = options?.commandOptions; - return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisResourcePromise { + return new RedisResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisResourcePromise { + return new RedisResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - const iconVariant = options?.iconVariant; - return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisResourcePromise { + const displayText = options?.displayText; + return new RedisResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisResourcePromise { + const displayText = options?.displayText; + return new RedisResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisResourcePromise { + return new RedisResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._waitForInternal(dependency)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); + return new RedisResource(result, this._client); } -} - -/** - * Thenable wrapper for ExternalServiceResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ExternalServiceResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } - then( - onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._waitForStartInternal(dependency)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisResourcePromise { + return new RedisResourcePromise(this._withExplicitStartInternal()); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisResourcePromise { + const exitCode = options?.exitCode; + return new RedisResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Adds a health check by key */ + withHealthCheck(key: string): RedisResourcePromise { + return new RedisResourcePromise(this._withHealthCheckInternal(key)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new RedisResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new RedisResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisResourcePromise { + const commandOptions = options?.commandOptions; + return new RedisResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisResourcePromise { + return new RedisResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisResourcePromise { + const password = options?.password; + return new RedisResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisResourcePromise { + return new RedisResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withParentRelationshipInternal(parent)); } -} + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new RedisResource(result, this._client); + } -// ============================================================================ -// ParameterResource -// ============================================================================ + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withChildRelationshipInternal(child)); + } -export class ParameterResource extends ResourceBuilderBase { - constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisResourcePromise { + const iconVariant = options?.iconVariant; + return new RedisResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new RedisResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisResourcePromise { + return new RedisResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, description }; - if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDescription', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - const enableMarkdown = options?.enableMarkdown; - return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisResourcePromise { + return new RedisResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - const helpLink = options?.helpLink; - return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisResourcePromise { + return new RedisResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new RedisResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new ParameterResource(result, this._client); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _withRedisCommanderInternal(configureContainer?: (obj: RedisCommanderResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as RedisCommanderResourceHandle; + const obj = new RedisCommanderResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisCommander', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Adds Redis Commander management UI */ + withRedisCommander(options?: WithRedisCommanderOptions): RedisResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new RedisResourcePromise(this._withRedisCommanderInternal(configureContainer, containerName)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _withRedisInsightInternal(configureContainer?: (obj: RedisInsightResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as RedisInsightResourceHandle; + const obj = new RedisInsightResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsight', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromManifestInternal()); + /** Adds Redis Insight management UI */ + withRedisInsight(options?: WithRedisInsightOptions): RedisResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new RedisResourcePromise(this._withRedisInsightInternal(configureContainer, containerName)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withDataVolume', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._withExplicitStartInternal()); + /** Adds a data volume with persistence */ + withDataVolume(options?: WithDataVolumeOptions): RedisResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withDataBindMount', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + /** Adds a data bind mount with persistence */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): RedisResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withPersistenceInternal(interval?: number, keysChangedThreshold?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (interval !== undefined) rpcArgs.interval = interval; + if (keysChangedThreshold !== undefined) rpcArgs.keysChangedThreshold = keysChangedThreshold; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withPersistence', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - const commandOptions = options?.commandOptions; - return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Configures Redis persistence */ + withPersistence(options?: WithPersistenceOptions): RedisResourcePromise { + const interval = options?.interval; + const keysChangedThreshold = options?.keysChangedThreshold; + return new RedisResourcePromise(this._withPersistenceInternal(interval, keysChangedThreshold)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withPasswordInternal(password: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, password }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withPassword', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + /** Configures the password for Redis */ + withPassword(password: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withPasswordInternal(password)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withHostPort', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets the host port for Redis */ + withHostPort(options?: WithHostPortOptions): RedisResourcePromise { + const port = options?.port; + return new RedisResourcePromise(this._withHostPortInternal(port)); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ParameterResource(result, this._client); +} + +/** + * Thenable wrapper for RedisResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class RedisResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: RedisResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - const iconVariant = options?.iconVariant; - return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromMcpInternal()); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets the container image tag */ + withImageTag(tag: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); } -} + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } -/** - * Thenable wrapper for ParameterResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ParameterResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } - then( - onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } /** Gets the resource name */ @@ -10128,383 +20044,513 @@ export class ParameterResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Adds Redis Commander management UI */ + withRedisCommander(options?: WithRedisCommanderOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRedisCommander(options))); + } + + /** Adds Redis Insight management UI */ + withRedisInsight(options?: WithRedisInsightOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRedisInsight(options))); + } + + /** Adds a data volume with persistence */ + withDataVolume(options?: WithDataVolumeOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + } + + /** Adds a data bind mount with persistence */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); + } + + /** Configures Redis persistence */ + withPersistence(options?: WithPersistenceOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPersistence(options))); + } + + /** Configures the password for Redis */ + withPassword(password: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPassword(password))); + } + + /** Sets the host port for Redis */ + withHostPort(options?: WithHostPortOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + } // ============================================================================ -// ProjectResource +// ViteAppResource // ============================================================================ -export class ProjectResource extends ResourceBuilderBase { - constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { +export class ViteAppResource extends ResourceBuilderBase { + constructor(handle: ViteAppResourceHandle, client: AspireClientRpc) { super(handle, client); } + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ViteAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { const path = options?.path; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + return new ViteAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { + private async _withOtlpExporterInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterInternal()); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { const helpLink = options?.helpLink; - return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new ViteAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { + private async _withEnvironmentInternal(name: string, value: string): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + withEnvironment(name: string, value: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentExpression', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + withEnvironmentExpression(name: string, value: ReferenceExpression): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; const obj = new EnvironmentCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + return new ViteAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withServiceReference', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + withServiceReference(source: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withServiceReferenceInternal(source)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withServiceReferenceNamed', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -10514,15 +20560,15 @@ export class ProjectResource extends ResourceBuilderBase if (isProxied !== undefined) rpcArgs.isProxied = isProxied; if (isExternal !== undefined) rpcArgs.isExternal = isExternal; if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -10531,72 +20577,72 @@ export class ProjectResource extends ResourceBuilderBase const isProxied = options?.isProxied; const isExternal = options?.isExternal; const protocol = options?.protocol; - return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + return new ViteAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -10609,293 +20655,308 @@ export class ProjectResource extends ResourceBuilderBase } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _clearContainerFilesSourcesInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitFor', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForCompletion', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { const exitCode = options?.exitCode; - return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ViteAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new ViteAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -10903,130 +20964,130 @@ export class ProjectResource extends ResourceBuilderBase }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { const commandOptions = options?.commandOptions; - return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ViteAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsDeveloperCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { const password = options?.password; - return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new ViteAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { const iconVariant = options?.iconVariant; - return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ViteAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -11035,15 +21096,15 @@ export class ProjectResource extends ResourceBuilderBase if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -11051,56 +21112,56 @@ export class ProjectResource extends ResourceBuilderBase const failureThreshold = options?.failureThreshold; const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new ViteAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -11111,60 +21172,60 @@ export class ProjectResource extends ResourceBuilderBase if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; if (tags !== undefined) rpcArgs.tags = tags; if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ViteAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -11176,151 +21237,330 @@ export class ProjectResource extends ResourceBuilderBase ); } + /** @internal */ + private async _withViteConfigInternal(configPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, configPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withViteConfig', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withViteConfigInternal(configPath)); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withYarnInternal(install, installArgs)); + } + + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withPnpmInternal(install, installArgs)); + } + + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withRunScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withDebuggingInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withDebugging', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Enables debugging support for a JavaScript application */ + withDebugging(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withDebuggingInternal()); + } + + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures browser debugging support */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + const browser = options?.browser; + return new ViteAppResourcePromise(this._withBrowserDebuggerInternal(browser)); + } + } /** - * Thenable wrapper for ProjectResource that enables fluent chaining. + * Thenable wrapper for ViteAppResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ProjectResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ViteAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ViteAppResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + withEnvironment(name: string, value: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + withEnvironmentExpression(name: string, value: ReferenceExpression): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + withServiceReference(source: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); } /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -11329,163 +21569,168 @@ export class ProjectResourcePromise implements PromiseLike { } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -11493,6 +21738,51 @@ export class ProjectResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withViteConfig(configPath))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Enables debugging support for a JavaScript application */ + withDebugging(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDebugging())); + } + + /** Configures browser debugging support */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + } // ============================================================================ @@ -13292,8 +23582,14 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppR registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource', (handle, client) => new JavaScriptAppResource(handle as JavaScriptAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource', (handle, client) => new NodeAppResource(handle as NodeAppResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisCommanderResource', (handle, client) => new RedisCommanderResource(handle as RedisCommanderResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisInsightResource', (handle, client) => new RedisInsightResource(handle as RedisInsightResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.ApplicationModel.RedisResource', (handle, client) => new RedisResource(handle as RedisResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource', (handle, client) => new ViteAppResource(handle as ViteAppResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); diff --git a/samples/aspire-with-node/ts/apphost.run.json b/samples/aspire-with-node/ts/apphost.run.json new file mode 100644 index 00000000..0acb796c --- /dev/null +++ b/samples/aspire-with-node/ts/apphost.run.json @@ -0,0 +1,11 @@ +{ + "profiles": { + "https": { + "applicationUrl": "https://localhost:63189;http://localhost:12348", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:59788", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:19248" + } + } + } +} \ No newline at end of file diff --git a/samples/aspire-with-node/ts/apphost.ts b/samples/aspire-with-node/ts/apphost.ts index 65eaa20f..5073fad3 100644 --- a/samples/aspire-with-node/ts/apphost.ts +++ b/samples/aspire-with-node/ts/apphost.ts @@ -1,26 +1,20 @@ -// Setup: Run the following commands to add required integrations: -// aspire add javascript -// aspire add redis - -import { createBuilder } from "./.modules/aspire.js"; +import { createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); -const cache = await builder.addRedis("cache") +const cache = builder.addRedis("cache") .withRedisInsight(); -const weatherapi = builder.addProject("weatherapi") +const weatherapi = builder.addProject("weatherapi", "../AspireWithNode.AspNetCoreApi/AspireWithNode.AspNetCoreApi.csproj", "https") .withHttpHealthCheck("/health"); -const frontend = builder.addNodeApp("frontend", "../NodeFrontend", "./app.js") +builder.addNodeApp("frontend", "../NodeFrontend", "./app.js") .withNpm() .withRunScript("dev") .withHttpEndpoint({ port: 5223, env: "PORT" }) .withExternalHttpEndpoints() .withHttpHealthCheck("/health") - .withReference(weatherapi) - .waitFor(weatherapi) - .withReference(cache) - .waitFor(cache); + .withReference(weatherapi).waitFor(weatherapi) + .withReference(cache).waitFor(cache); await builder.build().run(); diff --git a/samples/aspire-with-node/ts/package-lock.json b/samples/aspire-with-node/ts/package-lock.json index c4d3800c..ddaa2ee1 100644 --- a/samples/aspire-with-node/ts/package-lock.json +++ b/samples/aspire-with-node/ts/package-lock.json @@ -1,6 +1,962 @@ { - "name": "ts", + "name": "aspirewithnode", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, - "packages": {} + "packages": { + "": { + "name": "aspirewithnode", + "version": "1.0.0", + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz", + "integrity": "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.3.tgz", + "integrity": "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.3.tgz", + "integrity": "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.3.tgz", + "integrity": "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.3.tgz", + "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.3.tgz", + "integrity": "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.3.tgz", + "integrity": "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.3.tgz", + "integrity": "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.3.tgz", + "integrity": "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.3.tgz", + "integrity": "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.3.tgz", + "integrity": "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.3.tgz", + "integrity": "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.3.tgz", + "integrity": "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.3.tgz", + "integrity": "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.3.tgz", + "integrity": "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.3.tgz", + "integrity": "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz", + "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.3.tgz", + "integrity": "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.3.tgz", + "integrity": "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.3.tgz", + "integrity": "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.3.tgz", + "integrity": "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.3.tgz", + "integrity": "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.3.tgz", + "integrity": "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.3.tgz", + "integrity": "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.3.tgz", + "integrity": "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.3.tgz", + "integrity": "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@types/node": { + "version": "20.19.37", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.37.tgz", + "integrity": "sha512-8kzdPJ3FsNsVIurqBs7oodNnCEVbni9yUEkaHbgptDACOPW04jimGagZ51E6+lXUwJjgnBw+hyko/lkFWCldqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.4.tgz", + "integrity": "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/esbuild": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.3.tgz", + "integrity": "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.27.3", + "@esbuild/android-arm": "0.27.3", + "@esbuild/android-arm64": "0.27.3", + "@esbuild/android-x64": "0.27.3", + "@esbuild/darwin-arm64": "0.27.3", + "@esbuild/darwin-x64": "0.27.3", + "@esbuild/freebsd-arm64": "0.27.3", + "@esbuild/freebsd-x64": "0.27.3", + "@esbuild/linux-arm": "0.27.3", + "@esbuild/linux-arm64": "0.27.3", + "@esbuild/linux-ia32": "0.27.3", + "@esbuild/linux-loong64": "0.27.3", + "@esbuild/linux-mips64el": "0.27.3", + "@esbuild/linux-ppc64": "0.27.3", + "@esbuild/linux-riscv64": "0.27.3", + "@esbuild/linux-s390x": "0.27.3", + "@esbuild/linux-x64": "0.27.3", + "@esbuild/netbsd-arm64": "0.27.3", + "@esbuild/netbsd-x64": "0.27.3", + "@esbuild/openbsd-arm64": "0.27.3", + "@esbuild/openbsd-x64": "0.27.3", + "@esbuild/openharmony-arm64": "0.27.3", + "@esbuild/sunos-x64": "0.27.3", + "@esbuild/win32-arm64": "0.27.3", + "@esbuild/win32-ia32": "0.27.3", + "@esbuild/win32-x64": "0.27.3" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-tsconfig": { + "version": "4.13.6", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.6.tgz", + "integrity": "sha512-shZT/QMiSHc/YBLxxOkMtgSid5HFoauqCE3/exfsEcwg1WkeqjG+V40yBbBrsD+jW2HDXcs28xOfcbm2jI8Ddw==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true, + "license": "ISC" + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/minimatch": { + "version": "10.2.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz", + "integrity": "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nodemon": { + "version": "3.1.14", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.14.tgz", + "integrity": "sha512-jakjZi93UtB3jHMWsXL68FXSAosbLfY0In5gtKq3niLSkrWznrVBzXFNOEMJUfc9+Ke7SHWoAZsiMkNP3vq6Jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^10.2.1", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true, + "license": "MIT" + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "license": "ISC", + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/tsx": { + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz", + "integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.27.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true, + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/vscode-jsonrpc": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.1.tgz", + "integrity": "sha512-kdjOSJ2lLIn7r1rtrMbbNCHjyMPfRnowdKjBQ+mGq6NAW5QY2bEZC/khaC5OR8svbbjvLEaIXkOq45e2X9BIbQ==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + } + } } diff --git a/samples/aspire-with-node/ts/package.json b/samples/aspire-with-node/ts/package.json new file mode 100644 index 00000000..55bae494 --- /dev/null +++ b/samples/aspire-with-node/ts/package.json @@ -0,0 +1,19 @@ +{ + "name": "aspirewithnode", + "version": "1.0.0", + "type": "module", + "scripts": { + "start": "aspire run", + "build": "tsc", + "dev": "tsc --watch" + }, + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } +} \ No newline at end of file diff --git a/samples/aspire-with-node/ts/tsconfig.json b/samples/aspire-with-node/ts/tsconfig.json new file mode 100644 index 00000000..edf7302c --- /dev/null +++ b/samples/aspire-with-node/ts/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "outDir": "./dist", + "rootDir": "." + }, + "include": ["apphost.ts", ".modules/**/*.ts"], + "exclude": ["node_modules"] +} \ No newline at end of file diff --git a/samples/aspire-with-python/ts/.aspire/settings.json b/samples/aspire-with-python/ts/.aspire/settings.json index d1f66f1c..740f2867 100644 --- a/samples/aspire-with-python/ts/.aspire/settings.json +++ b/samples/aspire-with-python/ts/.aspire/settings.json @@ -1,9 +1,11 @@ { "appHostPath": "../apphost.ts", + "language": "typescript/nodejs", + "channel": "staging", "sdkVersion": "13.2.0-preview.1.26159.1", "packages": { - "Aspire.Hosting.JavaScript": "13.1.2", - "Aspire.Hosting.Python": "13.1.2", - "Aspire.Hosting.Redis": "13.1.2" + "Aspire.Hosting.JavaScript": "13.2.0-preview.1.26159.1", + "Aspire.Hosting.Python": "13.2.0-preview.1.26159.1", + "Aspire.Hosting.Redis": "13.2.0-preview.1.26159.1" } } \ No newline at end of file diff --git a/samples/aspire-with-python/ts/.modules/.codegen-hash b/samples/aspire-with-python/ts/.modules/.codegen-hash index 9096ba67..ed9b5088 100644 --- a/samples/aspire-with-python/ts/.modules/.codegen-hash +++ b/samples/aspire-with-python/ts/.modules/.codegen-hash @@ -1 +1 @@ -D66AA668A0AD635945E71F6603AA313690E7E1F03850A50E65F7552A3CCC96A8 \ No newline at end of file +88B06DEE25ADD164A343C2F31075632DBD4CAB744AC0C87242FF6092F9CF600A \ No newline at end of file diff --git a/samples/aspire-with-python/ts/.modules/aspire.ts b/samples/aspire-with-python/ts/.modules/aspire.ts index 73dc52d2..d858410b 100644 --- a/samples/aspire-with-python/ts/.modules/aspire.ts +++ b/samples/aspire-with-python/ts/.modules/aspire.ts @@ -26,6 +26,30 @@ import { // Handle Type Aliases (Internal - not exported to users) // ============================================================================ +/** Handle to JavaScriptAppResource */ +type JavaScriptAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource'>; + +/** Handle to NodeAppResource */ +type NodeAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource'>; + +/** Handle to ViteAppResource */ +type ViteAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource'>; + +/** Handle to PythonAppResource */ +type PythonAppResourceHandle = Handle<'Aspire.Hosting.Python/Aspire.Hosting.Python.PythonAppResource'>; + +/** Handle to UvicornAppResource */ +type UvicornAppResourceHandle = Handle<'Aspire.Hosting.Python/Aspire.Hosting.Python.UvicornAppResource'>; + +/** Handle to RedisResource */ +type RedisResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting.ApplicationModel.RedisResource'>; + +/** Handle to RedisCommanderResource */ +type RedisCommanderResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisCommanderResource'>; + +/** Handle to RedisInsightResource */ +type RedisInsightResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisInsightResource'>; + /** Handle to CommandLineArgsCallbackContext */ type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; @@ -193,6 +217,13 @@ export enum EndpointProperty { HostAndPort = "HostAndPort", } +/** Enum type for EntrypointType */ +export enum EntrypointType { + Executable = "Executable", + Script = "Script", + Module = "Module", +} + /** Enum type for IconVariant */ export enum IconVariant { Regular = "Regular", @@ -331,6 +362,10 @@ export interface AddDockerfileOptions { stage?: string; } +export interface AddJavaScriptAppOptions { + runScriptName?: string; +} + export interface AddParameterFromConfigurationOptions { secret?: boolean; } @@ -339,6 +374,19 @@ export interface AddParameterOptions { secret?: boolean; } +export interface AddRedisOptions { + port?: number; + password?: ParameterResource; +} + +export interface AddRedisWithPortOptions { + port?: number; +} + +export interface AddViteAppOptions { + runScriptName?: string; +} + export interface AppendFormattedOptions { format?: string; } @@ -363,10 +411,32 @@ export interface WithBindMountOptions { isReadOnly?: boolean; } +export interface WithBrowserDebuggerOptions { + browser?: string; +} + +export interface WithBuildScriptOptions { + args?: string[]; +} + +export interface WithBunOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithCommandOptions { commandOptions?: CommandOptions; } +export interface WithDataBindMountOptions { + isReadOnly?: boolean; +} + +export interface WithDataVolumeOptions { + name?: string; + isReadOnly?: boolean; +} + export interface WithDescriptionOptions { enableMarkdown?: boolean; } @@ -397,6 +467,10 @@ export interface WithExternalServiceHttpHealthCheckOptions { statusCode?: number; } +export interface WithHostPortOptions { + port?: number; +} + export interface WithHttpEndpointOptions { port?: number; targetPort?: number; @@ -446,6 +520,17 @@ export interface WithMcpServerOptions { endpointName?: string; } +export interface WithNpmOptions { + install?: boolean; + installCommand?: string; + installArgs?: string[]; +} + +export interface WithPersistenceOptions { + interval?: number; + keysChangedThreshold?: number; +} + export interface WithPipelineStepFactoryOptions { dependsOn?: string[]; requiredBy?: string[]; @@ -453,6 +538,26 @@ export interface WithPipelineStepFactoryOptions { description?: string; } +export interface WithPipOptions { + install?: boolean; + installArgs?: string[]; +} + +export interface WithPnpmOptions { + install?: boolean; + installArgs?: string[]; +} + +export interface WithRedisCommanderOptions { + configureContainer?: (obj: RedisCommanderResource) => Promise; + containerName?: string; +} + +export interface WithRedisInsightOptions { + configureContainer?: (obj: RedisInsightResource) => Promise; + containerName?: string; +} + export interface WithReferenceOptions { connectionName?: string; optional?: boolean; @@ -462,6 +567,10 @@ export interface WithRequiredCommandOptions { helpLink?: string; } +export interface WithRunScriptOptions { + args?: string[]; +} + export interface WithUrlExpressionOptions { displayText?: string; } @@ -470,11 +579,25 @@ export interface WithUrlOptions { displayText?: string; } +export interface WithUvOptions { + install?: boolean; + args?: string[]; +} + +export interface WithVirtualEnvironmentOptions { + createIfNotExists?: boolean; +} + export interface WithVolumeOptions { name?: string; isReadOnly?: boolean; } +export interface WithYarnOptions { + install?: boolean; + installArgs?: string[]; +} + // ============================================================================ // CommandLineArgsCallbackContext // ============================================================================ @@ -1711,6 +1834,151 @@ export class DistributedApplicationBuilder { return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); } + /** Adds a Node.js application resource */ + /** @internal */ + async _addNodeAppInternal(name: string, appDirectory: string, scriptPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory, scriptPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addNodeApp', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._addNodeAppInternal(name, appDirectory, scriptPath)); + } + + /** Adds a JavaScript application resource */ + /** @internal */ + async _addJavaScriptAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addJavaScriptApp', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + const runScriptName = options?.runScriptName; + return new JavaScriptAppResourcePromise(this._addJavaScriptAppInternal(name, appDirectory, runScriptName)); + } + + /** Adds a Vite application resource */ + /** @internal */ + async _addViteAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addViteApp', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + const runScriptName = options?.runScriptName; + return new ViteAppResourcePromise(this._addViteAppInternal(name, appDirectory, runScriptName)); + } + + /** Adds a Python script application resource */ + /** @internal */ + async _addPythonAppInternal(name: string, appDirectory: string, scriptPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory, scriptPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Python/addPythonApp', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + addPythonApp(name: string, appDirectory: string, scriptPath: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._addPythonAppInternal(name, appDirectory, scriptPath)); + } + + /** Adds a Python module application resource */ + /** @internal */ + async _addPythonModuleInternal(name: string, appDirectory: string, moduleName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory, moduleName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Python/addPythonModule', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + addPythonModule(name: string, appDirectory: string, moduleName: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._addPythonModuleInternal(name, appDirectory, moduleName)); + } + + /** Adds a Python executable application resource */ + /** @internal */ + async _addPythonExecutableInternal(name: string, appDirectory: string, executableName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory, executableName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Python/addPythonExecutable', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + addPythonExecutable(name: string, appDirectory: string, executableName: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._addPythonExecutableInternal(name, appDirectory, executableName)); + } + + /** Adds a Uvicorn-based Python application resource */ + /** @internal */ + async _addUvicornAppInternal(name: string, appDirectory: string, app: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory, app }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Python/addUvicornApp', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + addUvicornApp(name: string, appDirectory: string, app: string): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._addUvicornAppInternal(name, appDirectory, app)); + } + + /** Adds a Redis container resource with specific port */ + /** @internal */ + async _addRedisWithPortInternal(name: string, port?: number): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/addRedisWithPort', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { + const port = options?.port; + return new RedisResourcePromise(this._addRedisWithPortInternal(name, port)); + } + + /** Adds a Redis container resource */ + /** @internal */ + async _addRedisInternal(name: string, port?: number, password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (port !== undefined) rpcArgs.port = port; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/addRedis', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { + const port = options?.port; + const password = options?.password; + return new RedisResourcePromise(this._addRedisInternal(name, port, password)); + } + } /** @@ -1801,6 +2069,51 @@ export class DistributedApplicationBuilderPromise implements PromiseLike obj.addCSharpAppWithOptions(name, path, configure))); } + /** Adds a Node.js application resource */ + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.addNodeApp(name, appDirectory, scriptPath))); + } + + /** Adds a JavaScript application resource */ + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.addJavaScriptApp(name, appDirectory, options))); + } + + /** Adds a Vite application resource */ + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.addViteApp(name, appDirectory, options))); + } + + /** Adds a Python script application resource */ + addPythonApp(name: string, appDirectory: string, scriptPath: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.addPythonApp(name, appDirectory, scriptPath))); + } + + /** Adds a Python module application resource */ + addPythonModule(name: string, appDirectory: string, moduleName: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.addPythonModule(name, appDirectory, moduleName))); + } + + /** Adds a Python executable application resource */ + addPythonExecutable(name: string, appDirectory: string, executableName: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.addPythonExecutable(name, appDirectory, executableName))); + } + + /** Adds a Uvicorn-based Python application resource */ + addUvicornApp(name: string, appDirectory: string, app: string): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.addUvicornApp(name, appDirectory, app))); + } + + /** Adds a Redis container resource with specific port */ + addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.addRedisWithPort(name, options))); + } + + /** Adds a Redis container resource */ + addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.addRedis(name, options))); + } + } // ============================================================================ @@ -3056,421 +3369,158 @@ export class ContainerResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + 'Aspire.Hosting/withMcpServer', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageTagInternal(tag)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - const tag = options?.tag; - return new ContainerResourcePromise(this._withImageInternal(image, tag)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', + 'Aspire.Hosting/withEnvironmentExpression', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', + 'Aspire.Hosting/withEnvironmentCallbackAsync', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); - } - - /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsContainerInternal()); - } - - /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); - } - - /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNameInternal(name)); - } - - /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); - } - - /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); - } - - /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); - } - - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); - } - - /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); - } - - /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); - } - - /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterInternal()); - } - - /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); - } - - /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); - } - - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - const helpLink = options?.helpLink; - return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } - - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); - } - - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } /** @internal */ @@ -4316,25 +4366,6 @@ export class ContainerResource extends ResourceBuilderBase { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); - } - /** Gets the resource name */ async getResourceName(): Promise { const rpcArgs: Record = { resource: this._handle }; @@ -4366,91 +4397,11 @@ export class ContainerResourcePromise implements PromiseLike return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); - } - - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); - } - - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); - } - - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); - } - - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); - } - - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); - } - - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); - } - - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); - } - - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); - } - - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); - } - - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); - } - - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); - } - - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); - } - - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); - } - - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); - } - /** Sets the base image for a Dockerfile build */ withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); - } - /** Configures an MCP server endpoint on the resource */ withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); @@ -4466,11 +4417,6 @@ export class ContainerResourcePromise implements PromiseLike return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); - } - /** Adds a required command dependency */ withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); @@ -4736,11 +4682,6 @@ export class ContainerResourcePromise implements PromiseLike return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); - } - /** Gets the resource name */ getResourceName(): Promise { return this._promise.then(obj => obj.getResourceName()); @@ -9591,336 +9532,13148 @@ export class ExternalServiceResourcePromise implements PromiseLike { - constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { +export class JavaScriptAppResource extends ResourceBuilderBase { + constructor(handle: JavaScriptAppResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new JavaScriptAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, description }; - if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDescription', + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - const enableMarkdown = options?.enableMarkdown; - return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - const helpLink = options?.helpLink; - return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromManifestInternal()); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + const helpLink = options?.helpLink; + return new JavaScriptAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._withExplicitStartInternal()); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - const commandOptions = options?.commandOptions; - return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', rpcArgs ); - return new ParameterResource(result, this._client); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new JavaScriptAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new JavaScriptAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new JavaScriptAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new JavaScriptAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + const displayText = options?.displayText; + return new JavaScriptAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + const displayText = options?.displayText; + return new JavaScriptAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + const exitCode = options?.exitCode; + return new JavaScriptAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + const commandOptions = options?.commandOptions; + return new JavaScriptAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + const password = options?.password; + return new JavaScriptAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + const iconVariant = options?.iconVariant; + return new JavaScriptAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new JavaScriptAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for JavaScriptAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class JavaScriptAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: JavaScriptAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// NodeAppResource +// ============================================================================ + +export class NodeAppResource extends ResourceBuilderBase { + constructor(handle: NodeAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new NodeAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + const helpLink = options?.helpLink; + return new NodeAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new NodeAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new NodeAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + const exitCode = options?.exitCode; + return new NodeAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + const commandOptions = options?.commandOptions; + return new NodeAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + const password = options?.password; + return new NodeAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + const iconVariant = options?.iconVariant; + return new NodeAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new NodeAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withYarnInternal(install, installArgs)); + } + + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withPnpmInternal(install, installArgs)); + } + + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withRunScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withScriptDebuggingInternal(scriptPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, scriptPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withScriptDebugging', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Enables debugging support for a Node.js application with an explicit script path */ + withScriptDebugging(scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withScriptDebuggingInternal(scriptPath)); + } + + /** @internal */ + private async _withDebuggingInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withDebugging', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Enables debugging support for a JavaScript application */ + withDebugging(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withDebuggingInternal()); + } + + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures browser debugging support */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + const browser = options?.browser; + return new NodeAppResourcePromise(this._withBrowserDebuggerInternal(browser)); + } + +} + +/** + * Thenable wrapper for NodeAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class NodeAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: NodeAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Enables debugging support for a Node.js application with an explicit script path */ + withScriptDebugging(scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withScriptDebugging(scriptPath))); + } + + /** Enables debugging support for a JavaScript application */ + withDebugging(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDebugging())); + } + + /** Configures browser debugging support */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// PythonAppResource +// ============================================================================ + +export class PythonAppResource extends ResourceBuilderBase { + constructor(handle: PythonAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PythonAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new PythonAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PythonAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new PythonAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PythonAppResourcePromise { + const helpLink = options?.helpLink; + return new PythonAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PythonAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new PythonAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PythonAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new PythonAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PythonAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PythonAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PythonAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PythonAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PythonAppResourcePromise { + const displayText = options?.displayText; + return new PythonAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PythonAppResourcePromise { + const displayText = options?.displayText; + return new PythonAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PythonAppResourcePromise { + const exitCode = options?.exitCode; + return new PythonAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PythonAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new PythonAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PythonAppResourcePromise { + const commandOptions = options?.commandOptions; + return new PythonAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PythonAppResourcePromise { + const password = options?.password; + return new PythonAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PythonAppResourcePromise { + const iconVariant = options?.iconVariant; + return new PythonAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PythonAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new PythonAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PythonAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new PythonAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for PythonAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class PythonAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PythonAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// RedisCommanderResource +// ============================================================================ + +export class RedisCommanderResource extends ResourceBuilderBase { + constructor(handle: RedisCommanderResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisCommanderResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisCommanderResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisCommanderResourcePromise { + const tag = options?.tag; + return new RedisCommanderResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisCommanderResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new RedisCommanderResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisCommanderResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new RedisCommanderResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisCommanderResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new RedisCommanderResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisCommanderResourcePromise { + const helpLink = options?.helpLink; + return new RedisCommanderResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisCommanderResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new RedisCommanderResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisCommanderResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new RedisCommanderResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisCommanderResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisCommanderResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisCommanderResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisCommanderResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisCommanderResourcePromise { + const displayText = options?.displayText; + return new RedisCommanderResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisCommanderResourcePromise { + const displayText = options?.displayText; + return new RedisCommanderResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisCommanderResourcePromise { + const exitCode = options?.exitCode; + return new RedisCommanderResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisCommanderResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new RedisCommanderResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisCommanderResourcePromise { + const commandOptions = options?.commandOptions; + return new RedisCommanderResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisCommanderResourcePromise { + const password = options?.password; + return new RedisCommanderResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisCommanderResourcePromise { + const iconVariant = options?.iconVariant; + return new RedisCommanderResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisCommanderResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new RedisCommanderResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisCommanderResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new RedisCommanderResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisCommanderResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisCommanderResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisCommanderHostPort', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the host port for Redis Commander */ + withHostPort(options?: WithHostPortOptions): RedisCommanderResourcePromise { + const port = options?.port; + return new RedisCommanderResourcePromise(this._withHostPortInternal(port)); + } + +} + +/** + * Thenable wrapper for RedisCommanderResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class RedisCommanderResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: RedisCommanderResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Sets the host port for Redis Commander */ + withHostPort(options?: WithHostPortOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + +} + +// ============================================================================ +// RedisInsightResource +// ============================================================================ + +export class RedisInsightResource extends ResourceBuilderBase { + constructor(handle: RedisInsightResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisInsightResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisInsightResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisInsightResourcePromise { + const tag = options?.tag; + return new RedisInsightResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisInsightResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new RedisInsightResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisInsightResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new RedisInsightResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisInsightResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new RedisInsightResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisInsightResourcePromise { + const helpLink = options?.helpLink; + return new RedisInsightResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisInsightResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new RedisInsightResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisInsightResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new RedisInsightResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisInsightResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisInsightResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisInsightResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisInsightResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisInsightResourcePromise { + const displayText = options?.displayText; + return new RedisInsightResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisInsightResourcePromise { + const displayText = options?.displayText; + return new RedisInsightResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisInsightResourcePromise { + const exitCode = options?.exitCode; + return new RedisInsightResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisInsightResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new RedisInsightResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisInsightResourcePromise { + const commandOptions = options?.commandOptions; + return new RedisInsightResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisInsightResourcePromise { + const password = options?.password; + return new RedisInsightResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisInsightResourcePromise { + const iconVariant = options?.iconVariant; + return new RedisInsightResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisInsightResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new RedisInsightResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisInsightResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new RedisInsightResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisInsightResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsightHostPort', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the host port for Redis Insight */ + withHostPort(options?: WithHostPortOptions): RedisInsightResourcePromise { + const port = options?.port; + return new RedisInsightResourcePromise(this._withHostPortInternal(port)); + } + + /** @internal */ + private async _withDataVolumeInternal(name?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsightDataVolume', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a data volume for Redis Insight */ + withDataVolume(options?: WithDataVolumeOptions): RedisInsightResourcePromise { + const name = options?.name; + return new RedisInsightResourcePromise(this._withDataVolumeInternal(name)); + } + + /** @internal */ + private async _withDataBindMountInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsightDataBindMount', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a data bind mount for Redis Insight */ + withDataBindMount(source: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withDataBindMountInternal(source)); + } + +} + +/** + * Thenable wrapper for RedisInsightResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class RedisInsightResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: RedisInsightResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Sets the host port for Redis Insight */ + withHostPort(options?: WithHostPortOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + + /** Adds a data volume for Redis Insight */ + withDataVolume(options?: WithDataVolumeOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + } + + /** Adds a data bind mount for Redis Insight */ + withDataBindMount(source: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDataBindMount(source))); + } + +} + +// ============================================================================ +// RedisResource +// ============================================================================ + +export class RedisResource extends ResourceBuilderBase { + constructor(handle: RedisResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the PrimaryEndpoint property */ + primaryEndpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.primaryEndpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.host', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.port', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the TlsEnabled property */ + tlsEnabled = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.tlsEnabled', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.setTlsEnabled', + { context: this._handle, value } + ); + } + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the Entrypoint property */ + entrypoint = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.entrypoint', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.setEntrypoint', + { context: this._handle, value } + ); + } + }; + + /** Gets the ShellExecution property */ + shellExecution = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.shellExecution', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.setShellExecution', + { context: this._handle, value } + ); + } + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisResourcePromise { + return new RedisResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisResourcePromise { + return new RedisResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisResourcePromise { + return new RedisResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisResourcePromise { + const tag = options?.tag; + return new RedisResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisResourcePromise { + return new RedisResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisResourcePromise { + return new RedisResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisResourcePromise { + return new RedisResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisResourcePromise { + return new RedisResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new RedisResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new RedisResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new RedisResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisResourcePromise { + return new RedisResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisResourcePromise { + return new RedisResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisResourcePromise { + return new RedisResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisResourcePromise { + const helpLink = options?.helpLink; + return new RedisResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new RedisResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisResourcePromise { + return new RedisResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisResourcePromise { + return new RedisResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisResourcePromise { + return new RedisResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new RedisResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisResourcePromise { + return new RedisResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisResourcePromise { + return new RedisResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisResourcePromise { + const displayText = options?.displayText; + return new RedisResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisResourcePromise { + const displayText = options?.displayText; + return new RedisResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisResourcePromise { + return new RedisResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisResourcePromise { + return new RedisResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisResourcePromise { + const exitCode = options?.exitCode; + return new RedisResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisResourcePromise { + return new RedisResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new RedisResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisResourcePromise { + const commandOptions = options?.commandOptions; + return new RedisResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisResourcePromise { + return new RedisResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisResourcePromise { + const password = options?.password; + return new RedisResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisResourcePromise { + return new RedisResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisResourcePromise { + const iconVariant = options?.iconVariant; + return new RedisResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new RedisResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisResourcePromise { + return new RedisResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisResourcePromise { + return new RedisResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisResourcePromise { + return new RedisResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new RedisResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withRedisCommanderInternal(configureContainer?: (obj: RedisCommanderResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as RedisCommanderResourceHandle; + const obj = new RedisCommanderResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisCommander', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds Redis Commander management UI */ + withRedisCommander(options?: WithRedisCommanderOptions): RedisResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new RedisResourcePromise(this._withRedisCommanderInternal(configureContainer, containerName)); + } + + /** @internal */ + private async _withRedisInsightInternal(configureContainer?: (obj: RedisInsightResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as RedisInsightResourceHandle; + const obj = new RedisInsightResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsight', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds Redis Insight management UI */ + withRedisInsight(options?: WithRedisInsightOptions): RedisResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new RedisResourcePromise(this._withRedisInsightInternal(configureContainer, containerName)); + } + + /** @internal */ + private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withDataVolume', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a data volume with persistence */ + withDataVolume(options?: WithDataVolumeOptions): RedisResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + } + + /** @internal */ + private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withDataBindMount', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a data bind mount with persistence */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): RedisResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); + } + + /** @internal */ + private async _withPersistenceInternal(interval?: number, keysChangedThreshold?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (interval !== undefined) rpcArgs.interval = interval; + if (keysChangedThreshold !== undefined) rpcArgs.keysChangedThreshold = keysChangedThreshold; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withPersistence', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures Redis persistence */ + withPersistence(options?: WithPersistenceOptions): RedisResourcePromise { + const interval = options?.interval; + const keysChangedThreshold = options?.keysChangedThreshold; + return new RedisResourcePromise(this._withPersistenceInternal(interval, keysChangedThreshold)); + } + + /** @internal */ + private async _withPasswordInternal(password: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, password }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withPassword', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures the password for Redis */ + withPassword(password: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withPasswordInternal(password)); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withHostPort', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the host port for Redis */ + withHostPort(options?: WithHostPortOptions): RedisResourcePromise { + const port = options?.port; + return new RedisResourcePromise(this._withHostPortInternal(port)); + } + +} + +/** + * Thenable wrapper for RedisResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class RedisResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: RedisResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Adds Redis Commander management UI */ + withRedisCommander(options?: WithRedisCommanderOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRedisCommander(options))); + } + + /** Adds Redis Insight management UI */ + withRedisInsight(options?: WithRedisInsightOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRedisInsight(options))); + } + + /** Adds a data volume with persistence */ + withDataVolume(options?: WithDataVolumeOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + } + + /** Adds a data bind mount with persistence */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); + } + + /** Configures Redis persistence */ + withPersistence(options?: WithPersistenceOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPersistence(options))); + } + + /** Configures the password for Redis */ + withPassword(password: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPassword(password))); + } + + /** Sets the host port for Redis */ + withHostPort(options?: WithHostPortOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + +} + +// ============================================================================ +// UvicornAppResource +// ============================================================================ + +export class UvicornAppResource extends ResourceBuilderBase { + constructor(handle: UvicornAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): UvicornAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new UvicornAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): UvicornAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new UvicornAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): UvicornAppResourcePromise { + const helpLink = options?.helpLink; + return new UvicornAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): UvicornAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new UvicornAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): UvicornAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new UvicornAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): UvicornAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new UvicornAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): UvicornAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new UvicornAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): UvicornAppResourcePromise { + const displayText = options?.displayText; + return new UvicornAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): UvicornAppResourcePromise { + const displayText = options?.displayText; + return new UvicornAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): UvicornAppResourcePromise { + const exitCode = options?.exitCode; + return new UvicornAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): UvicornAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new UvicornAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): UvicornAppResourcePromise { + const commandOptions = options?.commandOptions; + return new UvicornAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): UvicornAppResourcePromise { + const password = options?.password; + return new UvicornAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new UvicornAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ParameterResource(result, this._client); + return new UvicornAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ParameterResource(result, this._client); + return new UvicornAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): UvicornAppResourcePromise { const iconVariant = options?.iconVariant; - return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new UvicornAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): UvicornAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new UvicornAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ParameterResource(result, this._client); + return new UvicornAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ParameterResource(result, this._client); + return new UvicornAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ParameterResource(result, this._client); + return new UvicornAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -9931,196 +22684,486 @@ export class ParameterResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ParameterResource(result, this._client); + return new UvicornAppResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): UvicornAppResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new UvicornAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withVirtualEnvironmentInternal(virtualEnvironmentPath: string, createIfNotExists?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, virtualEnvironmentPath }; + if (createIfNotExists !== undefined) rpcArgs.createIfNotExists = createIfNotExists; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Python/withVirtualEnvironment', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Configures the virtual environment for a Python application */ + withVirtualEnvironment(virtualEnvironmentPath: string, options?: WithVirtualEnvironmentOptions): UvicornAppResourcePromise { + const createIfNotExists = options?.createIfNotExists; + return new UvicornAppResourcePromise(this._withVirtualEnvironmentInternal(virtualEnvironmentPath, createIfNotExists)); + } + + /** @internal */ + private async _withDebuggingInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Python/withDebugging', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Enables debugging support for a Python application */ + withDebugging(): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withDebuggingInternal()); + } + + /** @internal */ + private async _withEntrypointInternal(entrypointType: EntrypointType, entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypointType, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Python/withEntrypoint', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Configures the entrypoint for a Python application */ + withEntrypoint(entrypointType: EntrypointType, entrypoint: string): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withEntrypointInternal(entrypointType, entrypoint)); + } + + /** @internal */ + private async _withPipInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Python/withPip', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Configures pip package installation for a Python application */ + withPip(options?: WithPipOptions): UvicornAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new UvicornAppResourcePromise(this._withPipInternal(install, installArgs)); + } + + /** @internal */ + private async _withUvInternal(install?: boolean, args?: string[]): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Python/withUv', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Configures uv package management for a Python application */ + withUv(options?: WithUvOptions): UvicornAppResourcePromise { + const install = options?.install; + const args = options?.args; + return new UvicornAppResourcePromise(this._withUvInternal(install, args)); + } + +} + +/** + * Thenable wrapper for UvicornAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class UvicornAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: UvicornAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } -} - -/** - * Thenable wrapper for ParameterResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ParameterResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } - then( - onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -10128,383 +23171,503 @@ export class ParameterResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Configures the virtual environment for a Python application */ + withVirtualEnvironment(virtualEnvironmentPath: string, options?: WithVirtualEnvironmentOptions): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withVirtualEnvironment(virtualEnvironmentPath, options))); + } + + /** Enables debugging support for a Python application */ + withDebugging(): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withDebugging())); + } + + /** Configures the entrypoint for a Python application */ + withEntrypoint(entrypointType: EntrypointType, entrypoint: string): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypointType, entrypoint))); + } + + /** Configures pip package installation for a Python application */ + withPip(options?: WithPipOptions): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withPip(options))); + } + + /** Configures uv package management for a Python application */ + withUv(options?: WithUvOptions): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withUv(options))); + } + } // ============================================================================ -// ProjectResource +// ViteAppResource // ============================================================================ -export class ProjectResource extends ResourceBuilderBase { - constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { +export class ViteAppResource extends ResourceBuilderBase { + constructor(handle: ViteAppResourceHandle, client: AspireClientRpc) { super(handle, client); } + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ViteAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { const path = options?.path; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + return new ViteAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { + private async _withOtlpExporterInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterInternal()); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { const helpLink = options?.helpLink; - return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new ViteAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { + private async _withEnvironmentInternal(name: string, value: string): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + withEnvironment(name: string, value: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentExpression', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + withEnvironmentExpression(name: string, value: ReferenceExpression): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; const obj = new EnvironmentCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + return new ViteAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withServiceReference', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + withServiceReference(source: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withServiceReferenceInternal(source)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withServiceReferenceNamed', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -10514,15 +23677,15 @@ export class ProjectResource extends ResourceBuilderBase if (isProxied !== undefined) rpcArgs.isProxied = isProxied; if (isExternal !== undefined) rpcArgs.isExternal = isExternal; if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -10531,72 +23694,72 @@ export class ProjectResource extends ResourceBuilderBase const isProxied = options?.isProxied; const isExternal = options?.isExternal; const protocol = options?.protocol; - return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + return new ViteAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -10609,293 +23772,308 @@ export class ProjectResource extends ResourceBuilderBase } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _clearContainerFilesSourcesInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitFor', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForCompletion', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { const exitCode = options?.exitCode; - return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ViteAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new ViteAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -10903,130 +24081,130 @@ export class ProjectResource extends ResourceBuilderBase }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { const commandOptions = options?.commandOptions; - return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ViteAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsDeveloperCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { const password = options?.password; - return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new ViteAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { const iconVariant = options?.iconVariant; - return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ViteAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -11035,15 +24213,15 @@ export class ProjectResource extends ResourceBuilderBase if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -11051,56 +24229,56 @@ export class ProjectResource extends ResourceBuilderBase const failureThreshold = options?.failureThreshold; const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new ViteAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -11111,60 +24289,60 @@ export class ProjectResource extends ResourceBuilderBase if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; if (tags !== undefined) rpcArgs.tags = tags; if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ViteAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -11176,151 +24354,330 @@ export class ProjectResource extends ResourceBuilderBase ); } + /** @internal */ + private async _withViteConfigInternal(configPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, configPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withViteConfig', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withViteConfigInternal(configPath)); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withYarnInternal(install, installArgs)); + } + + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withPnpmInternal(install, installArgs)); + } + + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withRunScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withDebuggingInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withDebugging', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Enables debugging support for a JavaScript application */ + withDebugging(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withDebuggingInternal()); + } + + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures browser debugging support */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + const browser = options?.browser; + return new ViteAppResourcePromise(this._withBrowserDebuggerInternal(browser)); + } + } /** - * Thenable wrapper for ProjectResource that enables fluent chaining. + * Thenable wrapper for ViteAppResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ProjectResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ViteAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ViteAppResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + withEnvironment(name: string, value: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + withEnvironmentExpression(name: string, value: ReferenceExpression): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + withServiceReference(source: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); } /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -11329,163 +24686,168 @@ export class ProjectResourcePromise implements PromiseLike { } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -11493,6 +24855,51 @@ export class ProjectResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withViteConfig(configPath))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Enables debugging support for a JavaScript application */ + withDebugging(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDebugging())); + } + + /** Configures browser debugging support */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + } // ============================================================================ @@ -13292,8 +26699,16 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppR registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource', (handle, client) => new JavaScriptAppResource(handle as JavaScriptAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource', (handle, client) => new NodeAppResource(handle as NodeAppResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Python/Aspire.Hosting.Python.PythonAppResource', (handle, client) => new PythonAppResource(handle as PythonAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisCommanderResource', (handle, client) => new RedisCommanderResource(handle as RedisCommanderResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisInsightResource', (handle, client) => new RedisInsightResource(handle as RedisInsightResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.ApplicationModel.RedisResource', (handle, client) => new RedisResource(handle as RedisResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Python/Aspire.Hosting.Python.UvicornAppResource', (handle, client) => new UvicornAppResource(handle as UvicornAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource', (handle, client) => new ViteAppResource(handle as ViteAppResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); diff --git a/samples/aspire-with-python/ts/apphost.run.json b/samples/aspire-with-python/ts/apphost.run.json new file mode 100644 index 00000000..b9409187 --- /dev/null +++ b/samples/aspire-with-python/ts/apphost.run.json @@ -0,0 +1,11 @@ +{ + "profiles": { + "https": { + "applicationUrl": "https://localhost:29413;http://localhost:62834", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:30143", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:44526" + } + } + } +} \ No newline at end of file diff --git a/samples/aspire-with-python/ts/apphost.ts b/samples/aspire-with-python/ts/apphost.ts index 9b1b83d2..be361490 100644 --- a/samples/aspire-with-python/ts/apphost.ts +++ b/samples/aspire-with-python/ts/apphost.ts @@ -1,9 +1,4 @@ -// Setup: Run the following commands to add required integrations: -// aspire add javascript -// aspire add python -// aspire add redis - -import { createBuilder } from "./.modules/aspire.js"; +import { createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); @@ -20,7 +15,6 @@ const frontend = builder.addViteApp("frontend", "../frontend") .withReference(app) .waitFor(app); -// POLYGLOT GAP: app.publishWithContainerFiles(frontend, "./static") — bundling Vite output -// into the Python app's static directory may not be available. +app.publishWithContainerFiles(frontend, "./static"); await builder.build().run(); diff --git a/samples/aspire-with-python/ts/package-lock.json b/samples/aspire-with-python/ts/package-lock.json index c4d3800c..66852d12 100644 --- a/samples/aspire-with-python/ts/package-lock.json +++ b/samples/aspire-with-python/ts/package-lock.json @@ -1,6 +1,962 @@ { - "name": "ts", + "name": "aspirewithpython", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, - "packages": {} + "packages": { + "": { + "name": "aspirewithpython", + "version": "1.0.0", + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz", + "integrity": "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.3.tgz", + "integrity": "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.3.tgz", + "integrity": "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.3.tgz", + "integrity": "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.3.tgz", + "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.3.tgz", + "integrity": "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.3.tgz", + "integrity": "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.3.tgz", + "integrity": "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.3.tgz", + "integrity": "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.3.tgz", + "integrity": "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.3.tgz", + "integrity": "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.3.tgz", + "integrity": "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.3.tgz", + "integrity": "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.3.tgz", + "integrity": "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.3.tgz", + "integrity": "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.3.tgz", + "integrity": "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz", + "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.3.tgz", + "integrity": "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.3.tgz", + "integrity": "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.3.tgz", + "integrity": "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.3.tgz", + "integrity": "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.3.tgz", + "integrity": "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.3.tgz", + "integrity": "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.3.tgz", + "integrity": "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.3.tgz", + "integrity": "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.3.tgz", + "integrity": "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@types/node": { + "version": "20.19.37", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.37.tgz", + "integrity": "sha512-8kzdPJ3FsNsVIurqBs7oodNnCEVbni9yUEkaHbgptDACOPW04jimGagZ51E6+lXUwJjgnBw+hyko/lkFWCldqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.4.tgz", + "integrity": "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/esbuild": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.3.tgz", + "integrity": "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.27.3", + "@esbuild/android-arm": "0.27.3", + "@esbuild/android-arm64": "0.27.3", + "@esbuild/android-x64": "0.27.3", + "@esbuild/darwin-arm64": "0.27.3", + "@esbuild/darwin-x64": "0.27.3", + "@esbuild/freebsd-arm64": "0.27.3", + "@esbuild/freebsd-x64": "0.27.3", + "@esbuild/linux-arm": "0.27.3", + "@esbuild/linux-arm64": "0.27.3", + "@esbuild/linux-ia32": "0.27.3", + "@esbuild/linux-loong64": "0.27.3", + "@esbuild/linux-mips64el": "0.27.3", + "@esbuild/linux-ppc64": "0.27.3", + "@esbuild/linux-riscv64": "0.27.3", + "@esbuild/linux-s390x": "0.27.3", + "@esbuild/linux-x64": "0.27.3", + "@esbuild/netbsd-arm64": "0.27.3", + "@esbuild/netbsd-x64": "0.27.3", + "@esbuild/openbsd-arm64": "0.27.3", + "@esbuild/openbsd-x64": "0.27.3", + "@esbuild/openharmony-arm64": "0.27.3", + "@esbuild/sunos-x64": "0.27.3", + "@esbuild/win32-arm64": "0.27.3", + "@esbuild/win32-ia32": "0.27.3", + "@esbuild/win32-x64": "0.27.3" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-tsconfig": { + "version": "4.13.6", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.6.tgz", + "integrity": "sha512-shZT/QMiSHc/YBLxxOkMtgSid5HFoauqCE3/exfsEcwg1WkeqjG+V40yBbBrsD+jW2HDXcs28xOfcbm2jI8Ddw==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true, + "license": "ISC" + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/minimatch": { + "version": "10.2.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz", + "integrity": "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nodemon": { + "version": "3.1.14", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.14.tgz", + "integrity": "sha512-jakjZi93UtB3jHMWsXL68FXSAosbLfY0In5gtKq3niLSkrWznrVBzXFNOEMJUfc9+Ke7SHWoAZsiMkNP3vq6Jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^10.2.1", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true, + "license": "MIT" + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "license": "ISC", + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/tsx": { + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz", + "integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.27.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true, + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/vscode-jsonrpc": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.1.tgz", + "integrity": "sha512-kdjOSJ2lLIn7r1rtrMbbNCHjyMPfRnowdKjBQ+mGq6NAW5QY2bEZC/khaC5OR8svbbjvLEaIXkOq45e2X9BIbQ==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + } + } } diff --git a/samples/aspire-with-python/ts/package.json b/samples/aspire-with-python/ts/package.json new file mode 100644 index 00000000..7bbca253 --- /dev/null +++ b/samples/aspire-with-python/ts/package.json @@ -0,0 +1,19 @@ +{ + "name": "aspirewithpython", + "version": "1.0.0", + "type": "module", + "scripts": { + "start": "aspire run", + "build": "tsc", + "dev": "tsc --watch" + }, + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } +} \ No newline at end of file diff --git a/samples/aspire-with-python/ts/tsconfig.json b/samples/aspire-with-python/ts/tsconfig.json new file mode 100644 index 00000000..edf7302c --- /dev/null +++ b/samples/aspire-with-python/ts/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "outDir": "./dist", + "rootDir": "." + }, + "include": ["apphost.ts", ".modules/**/*.ts"], + "exclude": ["node_modules"] +} \ No newline at end of file diff --git a/samples/client-apps-integration/ts/.aspire/settings.json b/samples/client-apps-integration/ts/.aspire/settings.json index a60c25b1..25c983c9 100644 --- a/samples/client-apps-integration/ts/.aspire/settings.json +++ b/samples/client-apps-integration/ts/.aspire/settings.json @@ -1,3 +1,5 @@ { - "appHostPath": "../apphost.ts" + "language": "typescript/nodejs", + "channel": "staging", + "sdkVersion": "13.2.0-preview.1.26159.1" } \ No newline at end of file diff --git a/samples/client-apps-integration/ts/.modules/.codegen-hash b/samples/client-apps-integration/ts/.modules/.codegen-hash deleted file mode 100644 index 1369f62c..00000000 --- a/samples/client-apps-integration/ts/.modules/.codegen-hash +++ /dev/null @@ -1 +0,0 @@ -385A37965F5742D9B7F75074E7065C879412F46A58CE04016D535C18DA21950E \ No newline at end of file diff --git a/samples/client-apps-integration/ts/apphost.run.json b/samples/client-apps-integration/ts/apphost.run.json new file mode 100644 index 00000000..b857ff66 --- /dev/null +++ b/samples/client-apps-integration/ts/apphost.run.json @@ -0,0 +1,11 @@ +{ + "profiles": { + "https": { + "applicationUrl": "https://localhost:27048;http://localhost:46197", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:52661", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:54131" + } + } + } +} \ No newline at end of file diff --git a/samples/client-apps-integration/ts/apphost.ts b/samples/client-apps-integration/ts/apphost.ts index baa54451..ebcb9574 100644 --- a/samples/client-apps-integration/ts/apphost.ts +++ b/samples/client-apps-integration/ts/apphost.ts @@ -1,25 +1,7 @@ -// Setup: No additional packages required (uses core project APIs). - -import { createBuilder } from "./.modules/aspire.js"; +import { createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); -const apiService = builder.addProject("apiservice"); - -// The C# version conditionally adds WinForms/WPF projects on Windows using OperatingSystem.IsWindows(). -// In TypeScript, we can use process.platform for the equivalent check. -if (process.platform === "win32") { - builder.addProject("winformsclient") - .withReference(apiService) - .waitFor(apiService) - .withExplicitStart() - .excludeFromManifest(); - - builder.addProject("wpfclient") - .withReference(apiService) - .waitFor(apiService) - .withExplicitStart() - .excludeFromManifest(); -} +const apiService = builder.addProject("apiservice", "../ClientAppsIntegration.ApiService/ClientAppsIntegration.ApiService.csproj", "https"); await builder.build().run(); diff --git a/samples/client-apps-integration/ts/package-lock.json b/samples/client-apps-integration/ts/package-lock.json index c4d3800c..9581492d 100644 --- a/samples/client-apps-integration/ts/package-lock.json +++ b/samples/client-apps-integration/ts/package-lock.json @@ -1,6 +1,962 @@ { - "name": "ts", + "name": "clientappsintegration", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, - "packages": {} + "packages": { + "": { + "name": "clientappsintegration", + "version": "1.0.0", + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz", + "integrity": "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.3.tgz", + "integrity": "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.3.tgz", + "integrity": "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.3.tgz", + "integrity": "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.3.tgz", + "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.3.tgz", + "integrity": "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.3.tgz", + "integrity": "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.3.tgz", + "integrity": "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.3.tgz", + "integrity": "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.3.tgz", + "integrity": "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.3.tgz", + "integrity": "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.3.tgz", + "integrity": "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.3.tgz", + "integrity": "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.3.tgz", + "integrity": "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.3.tgz", + "integrity": "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.3.tgz", + "integrity": "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz", + "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.3.tgz", + "integrity": "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.3.tgz", + "integrity": "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.3.tgz", + "integrity": "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.3.tgz", + "integrity": "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.3.tgz", + "integrity": "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.3.tgz", + "integrity": "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.3.tgz", + "integrity": "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.3.tgz", + "integrity": "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.3.tgz", + "integrity": "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@types/node": { + "version": "20.19.37", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.37.tgz", + "integrity": "sha512-8kzdPJ3FsNsVIurqBs7oodNnCEVbni9yUEkaHbgptDACOPW04jimGagZ51E6+lXUwJjgnBw+hyko/lkFWCldqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.4.tgz", + "integrity": "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/esbuild": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.3.tgz", + "integrity": "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.27.3", + "@esbuild/android-arm": "0.27.3", + "@esbuild/android-arm64": "0.27.3", + "@esbuild/android-x64": "0.27.3", + "@esbuild/darwin-arm64": "0.27.3", + "@esbuild/darwin-x64": "0.27.3", + "@esbuild/freebsd-arm64": "0.27.3", + "@esbuild/freebsd-x64": "0.27.3", + "@esbuild/linux-arm": "0.27.3", + "@esbuild/linux-arm64": "0.27.3", + "@esbuild/linux-ia32": "0.27.3", + "@esbuild/linux-loong64": "0.27.3", + "@esbuild/linux-mips64el": "0.27.3", + "@esbuild/linux-ppc64": "0.27.3", + "@esbuild/linux-riscv64": "0.27.3", + "@esbuild/linux-s390x": "0.27.3", + "@esbuild/linux-x64": "0.27.3", + "@esbuild/netbsd-arm64": "0.27.3", + "@esbuild/netbsd-x64": "0.27.3", + "@esbuild/openbsd-arm64": "0.27.3", + "@esbuild/openbsd-x64": "0.27.3", + "@esbuild/openharmony-arm64": "0.27.3", + "@esbuild/sunos-x64": "0.27.3", + "@esbuild/win32-arm64": "0.27.3", + "@esbuild/win32-ia32": "0.27.3", + "@esbuild/win32-x64": "0.27.3" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-tsconfig": { + "version": "4.13.6", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.6.tgz", + "integrity": "sha512-shZT/QMiSHc/YBLxxOkMtgSid5HFoauqCE3/exfsEcwg1WkeqjG+V40yBbBrsD+jW2HDXcs28xOfcbm2jI8Ddw==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true, + "license": "ISC" + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/minimatch": { + "version": "10.2.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz", + "integrity": "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nodemon": { + "version": "3.1.14", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.14.tgz", + "integrity": "sha512-jakjZi93UtB3jHMWsXL68FXSAosbLfY0In5gtKq3niLSkrWznrVBzXFNOEMJUfc9+Ke7SHWoAZsiMkNP3vq6Jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^10.2.1", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true, + "license": "MIT" + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "license": "ISC", + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/tsx": { + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz", + "integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.27.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true, + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/vscode-jsonrpc": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.1.tgz", + "integrity": "sha512-kdjOSJ2lLIn7r1rtrMbbNCHjyMPfRnowdKjBQ+mGq6NAW5QY2bEZC/khaC5OR8svbbjvLEaIXkOq45e2X9BIbQ==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + } + } } diff --git a/samples/client-apps-integration/ts/package.json b/samples/client-apps-integration/ts/package.json new file mode 100644 index 00000000..3ca79073 --- /dev/null +++ b/samples/client-apps-integration/ts/package.json @@ -0,0 +1,19 @@ +{ + "name": "clientappsintegration", + "version": "1.0.0", + "type": "module", + "scripts": { + "start": "aspire run", + "build": "tsc", + "dev": "tsc --watch" + }, + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } +} \ No newline at end of file diff --git a/samples/client-apps-integration/ts/tsconfig.json b/samples/client-apps-integration/ts/tsconfig.json new file mode 100644 index 00000000..edf7302c --- /dev/null +++ b/samples/client-apps-integration/ts/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "outDir": "./dist", + "rootDir": "." + }, + "include": ["apphost.ts", ".modules/**/*.ts"], + "exclude": ["node_modules"] +} \ No newline at end of file diff --git a/samples/container-build/ts/.aspire/settings.json b/samples/container-build/ts/.aspire/settings.json index 7d5a1905..25c983c9 100644 --- a/samples/container-build/ts/.aspire/settings.json +++ b/samples/container-build/ts/.aspire/settings.json @@ -1 +1,5 @@ -{"appHostPath":"../apphost.ts"} \ No newline at end of file +{ + "language": "typescript/nodejs", + "channel": "staging", + "sdkVersion": "13.2.0-preview.1.26159.1" +} \ No newline at end of file diff --git a/samples/container-build/ts/.modules/.codegen-hash b/samples/container-build/ts/.modules/.codegen-hash deleted file mode 100644 index 1369f62c..00000000 --- a/samples/container-build/ts/.modules/.codegen-hash +++ /dev/null @@ -1 +0,0 @@ -385A37965F5742D9B7F75074E7065C879412F46A58CE04016D535C18DA21950E \ No newline at end of file diff --git a/samples/container-build/ts/apphost.run.json b/samples/container-build/ts/apphost.run.json new file mode 100644 index 00000000..f917e9c6 --- /dev/null +++ b/samples/container-build/ts/apphost.run.json @@ -0,0 +1,11 @@ +{ + "profiles": { + "https": { + "applicationUrl": "https://localhost:48638;http://localhost:10429", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:51082", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:62825" + } + } + } +} \ No newline at end of file diff --git a/samples/container-build/ts/apphost.ts b/samples/container-build/ts/apphost.ts index c7a37f14..8efa7898 100644 --- a/samples/container-build/ts/apphost.ts +++ b/samples/container-build/ts/apphost.ts @@ -1,21 +1,16 @@ -// Setup: No additional packages required (uses core container and Dockerfile APIs). - -import { createBuilder } from "./.modules/aspire.js"; +import { createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); const goVersion = builder.addParameter("goversion", { default: "1.25.4" }); -const execCtx = await builder.executionContext.get(); -const isRunMode = await execCtx.isRunMode.get(); -const isPublishMode = !isRunMode; - let ginapp; -if (isPublishMode) { + +if (builder.executionContext.isPublishMode) { ginapp = builder.addDockerfile("ginapp", "../ginapp") .withBuildArg("GO_VERSION", goVersion); } else { - ginapp = builder.addDockerfile("ginapp", "../ginapp", "Dockerfile.dev") + ginapp = builder.addDockerfile("ginapp", "../ginapp", { dockerfilePath: "Dockerfile.dev" }) .withBuildArg("GO_VERSION", goVersion) .withBindMount("../ginapp", "/app"); } @@ -24,11 +19,11 @@ ginapp .withHttpEndpoint({ targetPort: 5555, env: "PORT" }) .withHttpHealthCheck("/") .withExternalHttpEndpoints() - .withOtlpExporter(); -// POLYGLOT GAP: .withDeveloperCertificateTrust(true) — developer certificate trust may not be available. + .withOtlpExporter() + .withDeveloperCertificateTrust(); -if (isPublishMode) { - ginapp +if (builder.executionContext.isPublishMode) { + await ginapp .withEnvironment("GIN_MODE", "release") .withEnvironment("TRUSTED_PROXIES", "all"); } diff --git a/samples/container-build/ts/package-lock.json b/samples/container-build/ts/package-lock.json index c4d3800c..915d6ab3 100644 --- a/samples/container-build/ts/package-lock.json +++ b/samples/container-build/ts/package-lock.json @@ -1,6 +1,962 @@ { - "name": "ts", + "name": "containerbuild", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, - "packages": {} + "packages": { + "": { + "name": "containerbuild", + "version": "1.0.0", + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz", + "integrity": "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.3.tgz", + "integrity": "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.3.tgz", + "integrity": "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.3.tgz", + "integrity": "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.3.tgz", + "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.3.tgz", + "integrity": "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.3.tgz", + "integrity": "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.3.tgz", + "integrity": "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.3.tgz", + "integrity": "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.3.tgz", + "integrity": "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.3.tgz", + "integrity": "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.3.tgz", + "integrity": "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.3.tgz", + "integrity": "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.3.tgz", + "integrity": "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.3.tgz", + "integrity": "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.3.tgz", + "integrity": "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz", + "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.3.tgz", + "integrity": "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.3.tgz", + "integrity": "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.3.tgz", + "integrity": "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.3.tgz", + "integrity": "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.3.tgz", + "integrity": "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.3.tgz", + "integrity": "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.3.tgz", + "integrity": "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.3.tgz", + "integrity": "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.3.tgz", + "integrity": "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@types/node": { + "version": "20.19.37", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.37.tgz", + "integrity": "sha512-8kzdPJ3FsNsVIurqBs7oodNnCEVbni9yUEkaHbgptDACOPW04jimGagZ51E6+lXUwJjgnBw+hyko/lkFWCldqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.4.tgz", + "integrity": "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/esbuild": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.3.tgz", + "integrity": "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.27.3", + "@esbuild/android-arm": "0.27.3", + "@esbuild/android-arm64": "0.27.3", + "@esbuild/android-x64": "0.27.3", + "@esbuild/darwin-arm64": "0.27.3", + "@esbuild/darwin-x64": "0.27.3", + "@esbuild/freebsd-arm64": "0.27.3", + "@esbuild/freebsd-x64": "0.27.3", + "@esbuild/linux-arm": "0.27.3", + "@esbuild/linux-arm64": "0.27.3", + "@esbuild/linux-ia32": "0.27.3", + "@esbuild/linux-loong64": "0.27.3", + "@esbuild/linux-mips64el": "0.27.3", + "@esbuild/linux-ppc64": "0.27.3", + "@esbuild/linux-riscv64": "0.27.3", + "@esbuild/linux-s390x": "0.27.3", + "@esbuild/linux-x64": "0.27.3", + "@esbuild/netbsd-arm64": "0.27.3", + "@esbuild/netbsd-x64": "0.27.3", + "@esbuild/openbsd-arm64": "0.27.3", + "@esbuild/openbsd-x64": "0.27.3", + "@esbuild/openharmony-arm64": "0.27.3", + "@esbuild/sunos-x64": "0.27.3", + "@esbuild/win32-arm64": "0.27.3", + "@esbuild/win32-ia32": "0.27.3", + "@esbuild/win32-x64": "0.27.3" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-tsconfig": { + "version": "4.13.6", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.6.tgz", + "integrity": "sha512-shZT/QMiSHc/YBLxxOkMtgSid5HFoauqCE3/exfsEcwg1WkeqjG+V40yBbBrsD+jW2HDXcs28xOfcbm2jI8Ddw==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true, + "license": "ISC" + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/minimatch": { + "version": "10.2.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz", + "integrity": "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nodemon": { + "version": "3.1.14", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.14.tgz", + "integrity": "sha512-jakjZi93UtB3jHMWsXL68FXSAosbLfY0In5gtKq3niLSkrWznrVBzXFNOEMJUfc9+Ke7SHWoAZsiMkNP3vq6Jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^10.2.1", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true, + "license": "MIT" + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "license": "ISC", + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/tsx": { + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz", + "integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.27.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true, + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/vscode-jsonrpc": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.1.tgz", + "integrity": "sha512-kdjOSJ2lLIn7r1rtrMbbNCHjyMPfRnowdKjBQ+mGq6NAW5QY2bEZC/khaC5OR8svbbjvLEaIXkOq45e2X9BIbQ==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + } + } } diff --git a/samples/container-build/ts/package.json b/samples/container-build/ts/package.json new file mode 100644 index 00000000..a3223fa3 --- /dev/null +++ b/samples/container-build/ts/package.json @@ -0,0 +1,19 @@ +{ + "name": "containerbuild", + "version": "1.0.0", + "type": "module", + "scripts": { + "start": "aspire run", + "build": "tsc", + "dev": "tsc --watch" + }, + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } +} \ No newline at end of file diff --git a/samples/container-build/ts/tsconfig.json b/samples/container-build/ts/tsconfig.json new file mode 100644 index 00000000..edf7302c --- /dev/null +++ b/samples/container-build/ts/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "outDir": "./dist", + "rootDir": "." + }, + "include": ["apphost.ts", ".modules/**/*.ts"], + "exclude": ["node_modules"] +} \ No newline at end of file diff --git a/samples/custom-resources/ts/.aspire/settings.json b/samples/custom-resources/ts/.aspire/settings.json index a60c25b1..25c983c9 100644 --- a/samples/custom-resources/ts/.aspire/settings.json +++ b/samples/custom-resources/ts/.aspire/settings.json @@ -1,3 +1,5 @@ { - "appHostPath": "../apphost.ts" + "language": "typescript/nodejs", + "channel": "staging", + "sdkVersion": "13.2.0-preview.1.26159.1" } \ No newline at end of file diff --git a/samples/custom-resources/ts/.modules/.codegen-hash b/samples/custom-resources/ts/.modules/.codegen-hash deleted file mode 100644 index 1369f62c..00000000 --- a/samples/custom-resources/ts/.modules/.codegen-hash +++ /dev/null @@ -1 +0,0 @@ -385A37965F5742D9B7F75074E7065C879412F46A58CE04016D535C18DA21950E \ No newline at end of file diff --git a/samples/custom-resources/ts/apphost.run.json b/samples/custom-resources/ts/apphost.run.json new file mode 100644 index 00000000..6bc233ec --- /dev/null +++ b/samples/custom-resources/ts/apphost.run.json @@ -0,0 +1,11 @@ +{ + "profiles": { + "https": { + "applicationUrl": "https://localhost:14749;http://localhost:19147", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10741", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:36753" + } + } + } +} \ No newline at end of file diff --git a/samples/custom-resources/ts/apphost.ts b/samples/custom-resources/ts/apphost.ts index ba5f749a..4d0be1c2 100644 --- a/samples/custom-resources/ts/apphost.ts +++ b/samples/custom-resources/ts/apphost.ts @@ -1,15 +1,9 @@ -// Setup: No standard packages — this sample uses custom C# resource extensions. -// -// POLYGLOT GAP: AddTalkingClock and AddTestResource are custom C# resource extensions -// defined in CustomResources.AppHost. To use them from TypeScript, they would need -// [AspireExport] attributes and distribution as a NuGet package, then added via: -// aspire add - -import { createBuilder } from "./.modules/aspire.js"; +import { createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); -// builder.addTalkingClock("talking-clock"); -// builder.addTestResource("test"); +// Custom resources are defined in C# extensions and are not available in the TypeScript SDK. +// This sample demonstrates the C# custom resource extensibility model. +// See the cs/ directory for the full implementation. await builder.build().run(); diff --git a/samples/custom-resources/ts/package-lock.json b/samples/custom-resources/ts/package-lock.json index c4d3800c..a9f5fcd6 100644 --- a/samples/custom-resources/ts/package-lock.json +++ b/samples/custom-resources/ts/package-lock.json @@ -1,6 +1,962 @@ { - "name": "ts", + "name": "customresources", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, - "packages": {} + "packages": { + "": { + "name": "customresources", + "version": "1.0.0", + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz", + "integrity": "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.3.tgz", + "integrity": "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.3.tgz", + "integrity": "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.3.tgz", + "integrity": "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.3.tgz", + "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.3.tgz", + "integrity": "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.3.tgz", + "integrity": "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.3.tgz", + "integrity": "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.3.tgz", + "integrity": "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.3.tgz", + "integrity": "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.3.tgz", + "integrity": "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.3.tgz", + "integrity": "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.3.tgz", + "integrity": "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.3.tgz", + "integrity": "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.3.tgz", + "integrity": "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.3.tgz", + "integrity": "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz", + "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.3.tgz", + "integrity": "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.3.tgz", + "integrity": "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.3.tgz", + "integrity": "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.3.tgz", + "integrity": "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.3.tgz", + "integrity": "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.3.tgz", + "integrity": "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.3.tgz", + "integrity": "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.3.tgz", + "integrity": "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.3.tgz", + "integrity": "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@types/node": { + "version": "20.19.37", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.37.tgz", + "integrity": "sha512-8kzdPJ3FsNsVIurqBs7oodNnCEVbni9yUEkaHbgptDACOPW04jimGagZ51E6+lXUwJjgnBw+hyko/lkFWCldqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.4.tgz", + "integrity": "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/esbuild": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.3.tgz", + "integrity": "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.27.3", + "@esbuild/android-arm": "0.27.3", + "@esbuild/android-arm64": "0.27.3", + "@esbuild/android-x64": "0.27.3", + "@esbuild/darwin-arm64": "0.27.3", + "@esbuild/darwin-x64": "0.27.3", + "@esbuild/freebsd-arm64": "0.27.3", + "@esbuild/freebsd-x64": "0.27.3", + "@esbuild/linux-arm": "0.27.3", + "@esbuild/linux-arm64": "0.27.3", + "@esbuild/linux-ia32": "0.27.3", + "@esbuild/linux-loong64": "0.27.3", + "@esbuild/linux-mips64el": "0.27.3", + "@esbuild/linux-ppc64": "0.27.3", + "@esbuild/linux-riscv64": "0.27.3", + "@esbuild/linux-s390x": "0.27.3", + "@esbuild/linux-x64": "0.27.3", + "@esbuild/netbsd-arm64": "0.27.3", + "@esbuild/netbsd-x64": "0.27.3", + "@esbuild/openbsd-arm64": "0.27.3", + "@esbuild/openbsd-x64": "0.27.3", + "@esbuild/openharmony-arm64": "0.27.3", + "@esbuild/sunos-x64": "0.27.3", + "@esbuild/win32-arm64": "0.27.3", + "@esbuild/win32-ia32": "0.27.3", + "@esbuild/win32-x64": "0.27.3" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-tsconfig": { + "version": "4.13.6", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.6.tgz", + "integrity": "sha512-shZT/QMiSHc/YBLxxOkMtgSid5HFoauqCE3/exfsEcwg1WkeqjG+V40yBbBrsD+jW2HDXcs28xOfcbm2jI8Ddw==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true, + "license": "ISC" + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/minimatch": { + "version": "10.2.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz", + "integrity": "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nodemon": { + "version": "3.1.14", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.14.tgz", + "integrity": "sha512-jakjZi93UtB3jHMWsXL68FXSAosbLfY0In5gtKq3niLSkrWznrVBzXFNOEMJUfc9+Ke7SHWoAZsiMkNP3vq6Jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^10.2.1", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true, + "license": "MIT" + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "license": "ISC", + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/tsx": { + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz", + "integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.27.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true, + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/vscode-jsonrpc": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.1.tgz", + "integrity": "sha512-kdjOSJ2lLIn7r1rtrMbbNCHjyMPfRnowdKjBQ+mGq6NAW5QY2bEZC/khaC5OR8svbbjvLEaIXkOq45e2X9BIbQ==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + } + } } diff --git a/samples/custom-resources/ts/package.json b/samples/custom-resources/ts/package.json new file mode 100644 index 00000000..59f4eb6d --- /dev/null +++ b/samples/custom-resources/ts/package.json @@ -0,0 +1,19 @@ +{ + "name": "customresources", + "version": "1.0.0", + "type": "module", + "scripts": { + "start": "aspire run", + "build": "tsc", + "dev": "tsc --watch" + }, + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } +} \ No newline at end of file diff --git a/samples/custom-resources/ts/tsconfig.json b/samples/custom-resources/ts/tsconfig.json new file mode 100644 index 00000000..edf7302c --- /dev/null +++ b/samples/custom-resources/ts/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "outDir": "./dist", + "rootDir": "." + }, + "include": ["apphost.ts", ".modules/**/*.ts"], + "exclude": ["node_modules"] +} \ No newline at end of file diff --git a/samples/database-containers/ts/.aspire/settings.json b/samples/database-containers/ts/.aspire/settings.json index 3d90acd9..847e6309 100644 --- a/samples/database-containers/ts/.aspire/settings.json +++ b/samples/database-containers/ts/.aspire/settings.json @@ -1,9 +1,11 @@ { "appHostPath": "../apphost.ts", + "language": "typescript/nodejs", + "channel": "staging", "sdkVersion": "13.2.0-preview.1.26159.1", "packages": { - "Aspire.Hosting.MySql": "13.1.2", - "Aspire.Hosting.SqlServer": "13.1.2", - "Aspire.Hosting.PostgreSQL": "13.1.2" + "Aspire.Hosting.MySql": "13.2.0-preview.1.26159.1", + "Aspire.Hosting.SqlServer": "13.2.0-preview.1.26159.1", + "Aspire.Hosting.PostgreSQL": "13.2.0-preview.1.26159.1" } } \ No newline at end of file diff --git a/samples/database-containers/ts/.modules/.codegen-hash b/samples/database-containers/ts/.modules/.codegen-hash index 9fb31b57..2d458169 100644 --- a/samples/database-containers/ts/.modules/.codegen-hash +++ b/samples/database-containers/ts/.modules/.codegen-hash @@ -1 +1 @@ -439EC44FA3F8231EA4FBF2309D5FFA8169BD7BD369E27A4E5BCCA77D54BBAF23 \ No newline at end of file +FAB8AD59B56D9F8877DFAFD7060D80050FD8C598324727D81CD00E2A094EF5FD \ No newline at end of file diff --git a/samples/database-containers/ts/.modules/aspire.ts b/samples/database-containers/ts/.modules/aspire.ts index 73dc52d2..5b8421d8 100644 --- a/samples/database-containers/ts/.modules/aspire.ts +++ b/samples/database-containers/ts/.modules/aspire.ts @@ -26,6 +26,36 @@ import { // Handle Type Aliases (Internal - not exported to users) // ============================================================================ +/** Handle to MySqlDatabaseResource */ +type MySqlDatabaseResourceHandle = Handle<'Aspire.Hosting.MySql/Aspire.Hosting.ApplicationModel.MySqlDatabaseResource'>; + +/** Handle to MySqlServerResource */ +type MySqlServerResourceHandle = Handle<'Aspire.Hosting.MySql/Aspire.Hosting.ApplicationModel.MySqlServerResource'>; + +/** Handle to PhpMyAdminContainerResource */ +type PhpMyAdminContainerResourceHandle = Handle<'Aspire.Hosting.MySql/Aspire.Hosting.MySql.PhpMyAdminContainerResource'>; + +/** Handle to PostgresDatabaseResource */ +type PostgresDatabaseResourceHandle = Handle<'Aspire.Hosting.PostgreSQL/Aspire.Hosting.ApplicationModel.PostgresDatabaseResource'>; + +/** Handle to PostgresServerResource */ +type PostgresServerResourceHandle = Handle<'Aspire.Hosting.PostgreSQL/Aspire.Hosting.ApplicationModel.PostgresServerResource'>; + +/** Handle to PgAdminContainerResource */ +type PgAdminContainerResourceHandle = Handle<'Aspire.Hosting.PostgreSQL/Aspire.Hosting.Postgres.PgAdminContainerResource'>; + +/** Handle to PgWebContainerResource */ +type PgWebContainerResourceHandle = Handle<'Aspire.Hosting.PostgreSQL/Aspire.Hosting.Postgres.PgWebContainerResource'>; + +/** Handle to PostgresMcpContainerResource */ +type PostgresMcpContainerResourceHandle = Handle<'Aspire.Hosting.PostgreSQL/Aspire.Hosting.Postgres.PostgresMcpContainerResource'>; + +/** Handle to SqlServerDatabaseResource */ +type SqlServerDatabaseResourceHandle = Handle<'Aspire.Hosting.SqlServer/Aspire.Hosting.ApplicationModel.SqlServerDatabaseResource'>; + +/** Handle to SqlServerServerResource */ +type SqlServerServerResourceHandle = Handle<'Aspire.Hosting.SqlServer/Aspire.Hosting.ApplicationModel.SqlServerServerResource'>; + /** Handle to CommandLineArgsCallbackContext */ type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; @@ -326,11 +356,20 @@ export interface AddContainerRegistryOptions { repository?: ParameterResource; } +export interface AddDatabaseOptions { + databaseName?: string; +} + export interface AddDockerfileOptions { dockerfilePath?: string; stage?: string; } +export interface AddMySqlOptions { + password?: ParameterResource; + port?: number; +} + export interface AddParameterFromConfigurationOptions { secret?: boolean; } @@ -339,6 +378,17 @@ export interface AddParameterOptions { secret?: boolean; } +export interface AddPostgresOptions { + userName?: ParameterResource; + password?: ParameterResource; + port?: number; +} + +export interface AddSqlServerOptions { + password?: ParameterResource; + port?: number; +} + export interface AppendFormattedOptions { format?: string; } @@ -367,6 +417,15 @@ export interface WithCommandOptions { commandOptions?: CommandOptions; } +export interface WithDataBindMountOptions { + isReadOnly?: boolean; +} + +export interface WithDataVolumeOptions { + name?: string; + isReadOnly?: boolean; +} + export interface WithDescriptionOptions { enableMarkdown?: boolean; } @@ -397,6 +456,10 @@ export interface WithExternalServiceHttpHealthCheckOptions { statusCode?: number; } +export interface WithHostPortOptions { + port?: number; +} + export interface WithHttpEndpointOptions { port?: number; targetPort?: number; @@ -446,6 +509,21 @@ export interface WithMcpServerOptions { endpointName?: string; } +export interface WithPgAdminOptions { + configureContainer?: (obj: PgAdminContainerResource) => Promise; + containerName?: string; +} + +export interface WithPgWebOptions { + configureContainer?: (obj: PgWebContainerResource) => Promise; + containerName?: string; +} + +export interface WithPhpMyAdminOptions { + configureContainer?: (obj: PhpMyAdminContainerResource) => Promise; + containerName?: string; +} + export interface WithPipelineStepFactoryOptions { dependsOn?: string[]; requiredBy?: string[]; @@ -453,6 +531,11 @@ export interface WithPipelineStepFactoryOptions { description?: string; } +export interface WithPostgresMcpOptions { + configureContainer?: (obj: PostgresMcpContainerResource) => Promise; + containerName?: string; +} + export interface WithReferenceOptions { connectionName?: string; optional?: boolean; @@ -1711,6 +1794,65 @@ export class DistributedApplicationBuilder { return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); } + /** Adds a MySQL server resource */ + /** @internal */ + async _addMySqlInternal(name: string, password?: ParameterResource, port?: number): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (password !== undefined) rpcArgs.password = password; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.MySql/addMySql', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + addMySql(name: string, options?: AddMySqlOptions): MySqlServerResourcePromise { + const password = options?.password; + const port = options?.port; + return new MySqlServerResourcePromise(this._addMySqlInternal(name, password, port)); + } + + /** Adds a SQL Server container resource */ + /** @internal */ + async _addSqlServerInternal(name: string, password?: ParameterResource, port?: number): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (password !== undefined) rpcArgs.password = password; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/addSqlServer', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + addSqlServer(name: string, options?: AddSqlServerOptions): SqlServerServerResourcePromise { + const password = options?.password; + const port = options?.port; + return new SqlServerServerResourcePromise(this._addSqlServerInternal(name, password, port)); + } + + /** Adds a PostgreSQL server resource */ + /** @internal */ + async _addPostgresInternal(name: string, userName?: ParameterResource, password?: ParameterResource, port?: number): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (userName !== undefined) rpcArgs.userName = userName; + if (password !== undefined) rpcArgs.password = password; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/addPostgres', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + addPostgres(name: string, options?: AddPostgresOptions): PostgresServerResourcePromise { + const userName = options?.userName; + const password = options?.password; + const port = options?.port; + return new PostgresServerResourcePromise(this._addPostgresInternal(name, userName, password, port)); + } + } /** @@ -1801,6 +1943,21 @@ export class DistributedApplicationBuilderPromise implements PromiseLike obj.addCSharpAppWithOptions(name, path, configure))); } + /** Adds a MySQL server resource */ + addMySql(name: string, options?: AddMySqlOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.addMySql(name, options))); + } + + /** Adds a SQL Server container resource */ + addSqlServer(name: string, options?: AddSqlServerOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.addSqlServer(name, options))); + } + + /** Adds a PostgreSQL server resource */ + addPostgres(name: string, options?: AddPostgresOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.addPostgres(name, options))); + } + } // ============================================================================ @@ -3056,2989 +3213,2617 @@ export class ContainerResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + 'Aspire.Hosting/withMcpServer', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageTagInternal(tag)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - const tag = options?.tag; - return new ContainerResourcePromise(this._withImageInternal(image, tag)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', + 'Aspire.Hosting/withEnvironmentExpression', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', + 'Aspire.Hosting/withEnvironmentCallbackAsync', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsContainerInternal()); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNameInternal(name)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + 'Aspire.Hosting/withArgs', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + 'Aspire.Hosting/withArgsCallback', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); - } - + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + 'Aspire.Hosting/withReference', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); } /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', + 'Aspire.Hosting/withServiceReference', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + 'Aspire.Hosting/withServiceReferenceNamed', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + 'Aspire.Hosting/withReferenceUri', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterInternal()); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); return new ContainerResource(result, this._client); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + 'Aspire.Hosting/withEndpoint', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - const helpLink = options?.helpLink; - return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/asHttp2Service', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + 'Aspire.Hosting/withUrl', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + 'Aspire.Hosting/withUrlExpression', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsInternal(args)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + 'Aspire.Hosting/waitFor', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + 'Aspire.Hosting/waitForStart', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + 'Aspire.Hosting/withExplicitStart', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + 'Aspire.Hosting/waitForCompletion', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + const exitCode = options?.exitCode; + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + 'Aspire.Hosting/withHealthCheck', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + 'Aspire.Hosting/withCommand', rpcArgs ); return new ContainerResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); + return new ContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + 'Aspire.Hosting/withHttpsDeveloperCertificate', rpcArgs ); return new ContainerResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); - } + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + const password = options?.password; + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); return new ContainerResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + 'Aspire.Hosting/withParentRelationship', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + 'Aspire.Hosting/withChildRelationship', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + 'Aspire.Hosting/withIconName', rpcArgs ); return new ContainerResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + 'Aspire.Hosting/withHttpProbe', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); return new ContainerResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromManifestInternal()); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); return new ContainerResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForInternal(dependency)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); return new ContainerResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); return new ContainerResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); return new ContainerResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); return new ContainerResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExplicitStartInternal()); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new ContainerResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - const exitCode = options?.exitCode; - return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); +} + +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - const password = options?.password; - return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromMcpInternal()); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); - } - - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } -} - -/** - * Thenable wrapper for ContainerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ContainerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } +} - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } +// ============================================================================ +// CSharpAppResource +// ============================================================================ - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { + super(handle, client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); - } - - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); - } - - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); - } - - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); - } - - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); - } - - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); - } - - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); - } - - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); - } - - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); - } - -} - -// ============================================================================ -// CSharpAppResource -// ============================================================================ - -export class CSharpAppResource extends ResourceBuilderBase { - constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + 'Aspire.Hosting/withArgsCallback', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + 'Aspire.Hosting/withReference', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + 'Aspire.Hosting/withServiceReference', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + 'Aspire.Hosting/withServiceReferenceNamed', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } /** @internal */ - private async _withReplicasInternal(replicas: number): Promise { - const rpcArgs: Record = { builder: this._handle, replicas }; + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReplicas', + 'Aspire.Hosting/withReferenceUri', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _disableForwardedHeadersInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/disableForwardedHeaders', + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - const helpLink = options?.helpLink; - return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + 'Aspire.Hosting/withEndpoint', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/asHttp2Service', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + 'Aspire.Hosting/withUrl', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsInternal(args)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + 'Aspire.Hosting/publishWithContainerFiles', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + 'Aspire.Hosting/waitFor', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + 'Aspire.Hosting/waitForStart', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + 'Aspire.Hosting/withExplicitStart', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + 'Aspire.Hosting/waitForCompletion', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + const exitCode = options?.exitCode; + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + 'Aspire.Hosting/withHealthCheck', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + const commandOptions = options?.commandOptions; + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + 'Aspire.Hosting/withHttpsDeveloperCertificate', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + const password = options?.password; + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + 'Aspire.Hosting/withParentRelationship', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + 'Aspire.Hosting/withChildRelationship', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + 'Aspire.Hosting/withIconName', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + const iconVariant = options?.iconVariant; + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/withHttpProbe', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new CSharpAppResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - const exitCode = options?.exitCode; - return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - const commandOptions = options?.commandOptions; - return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - const password = options?.password; - return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - const iconVariant = options?.iconVariant; - return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); } - /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } -} - -/** - * Thenable wrapper for CSharpAppResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class CSharpAppResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } - then( - onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); - } - - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); - } - - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); - } - - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); - } - - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); - } - - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); - } - - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); - } - - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); - } - - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); - } - - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); - } - - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); - } - - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); - } - - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); - } - - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); - } - - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); - } - - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); - } - - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); - } - - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); - } - - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); - } - - /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); - } - - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); - } - - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); - } - - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } - - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } - - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); - } - - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ @@ -8961,426 +8746,14494 @@ export class ExecutableResourcePromise implements PromiseLike obj.withHealthCheck(key))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// MySqlDatabaseResource +// ============================================================================ + +export class MySqlDatabaseResource extends ResourceBuilderBase { + constructor(handle: MySqlDatabaseResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Parent property */ + parent = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlDatabaseResource.parent', + { context: this._handle } + ); + return new MySqlServerResource(handle, this._client); + }, + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlDatabaseResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlDatabaseResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the JdbcConnectionString property */ + jdbcConnectionString = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlDatabaseResource.jdbcConnectionString', + { context: this._handle } + ); + }, + }; + + /** Gets the DatabaseName property */ + databaseName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlDatabaseResource.databaseName', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlDatabaseResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new MySqlDatabaseResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new MySqlDatabaseResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): MySqlDatabaseResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new MySqlDatabaseResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new MySqlDatabaseResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): MySqlDatabaseResourcePromise { + const helpLink = options?.helpLink; + return new MySqlDatabaseResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new MySqlDatabaseResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new MySqlDatabaseResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new MySqlDatabaseResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new MySqlDatabaseResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new MySqlDatabaseResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): MySqlDatabaseResourcePromise { + const displayText = options?.displayText; + return new MySqlDatabaseResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new MySqlDatabaseResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): MySqlDatabaseResourcePromise { + const displayText = options?.displayText; + return new MySqlDatabaseResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new MySqlDatabaseResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new MySqlDatabaseResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new MySqlDatabaseResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new MySqlDatabaseResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new MySqlDatabaseResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): MySqlDatabaseResourcePromise { + const commandOptions = options?.commandOptions; + return new MySqlDatabaseResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new MySqlDatabaseResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new MySqlDatabaseResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new MySqlDatabaseResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): MySqlDatabaseResourcePromise { + const iconVariant = options?.iconVariant; + return new MySqlDatabaseResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new MySqlDatabaseResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new MySqlDatabaseResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new MySqlDatabaseResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new MySqlDatabaseResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): MySqlDatabaseResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new MySqlDatabaseResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new MySqlDatabaseResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new MySqlDatabaseResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withCreationScriptInternal(script: string): Promise { + const rpcArgs: Record = { builder: this._handle, script }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.MySql/withCreationScript', + rpcArgs + ); + return new MySqlDatabaseResource(result, this._client); + } + + /** Defines the SQL script for database creation */ + withCreationScript(script: string): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withCreationScriptInternal(script)); + } + +} + +/** + * Thenable wrapper for MySqlDatabaseResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class MySqlDatabaseResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: MySqlDatabaseResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Defines the SQL script for database creation */ + withCreationScript(script: string): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withCreationScript(script))); + } + +} + +// ============================================================================ +// MySqlServerResource +// ============================================================================ + +export class MySqlServerResource extends ResourceBuilderBase { + constructor(handle: MySqlServerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the PrimaryEndpoint property */ + primaryEndpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.primaryEndpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.host', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.port', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the JdbcConnectionString property */ + jdbcConnectionString = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.jdbcConnectionString', + { context: this._handle } + ); + }, + }; + + /** Gets the Databases property */ + private _databases?: AspireDict; + get databases(): AspireDict { + if (!this._databases) { + this._databases = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.databases', + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.databases' + ); + } + return this._databases; + } + + /** Gets the Entrypoint property */ + entrypoint = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.entrypoint', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.setEntrypoint', + { context: this._handle, value } + ); + } + }; + + /** Gets the ShellExecution property */ + shellExecution = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.shellExecution', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.setShellExecution', + { context: this._handle, value } + ); + } + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): MySqlServerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new MySqlServerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): MySqlServerResourcePromise { + const tag = options?.tag; + return new MySqlServerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): MySqlServerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new MySqlServerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): MySqlServerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new MySqlServerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): MySqlServerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new MySqlServerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): MySqlServerResourcePromise { + const helpLink = options?.helpLink; + return new MySqlServerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): MySqlServerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new MySqlServerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): MySqlServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new MySqlServerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): MySqlServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new MySqlServerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): MySqlServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new MySqlServerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): MySqlServerResourcePromise { + const displayText = options?.displayText; + return new MySqlServerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): MySqlServerResourcePromise { + const displayText = options?.displayText; + return new MySqlServerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): MySqlServerResourcePromise { + const exitCode = options?.exitCode; + return new MySqlServerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): MySqlServerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new MySqlServerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): MySqlServerResourcePromise { + const commandOptions = options?.commandOptions; + return new MySqlServerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): MySqlServerResourcePromise { + const password = options?.password; + return new MySqlServerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): MySqlServerResourcePromise { + const iconVariant = options?.iconVariant; + return new MySqlServerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): MySqlServerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new MySqlServerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): MySqlServerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new MySqlServerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): MySqlServerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new MySqlServerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _addDatabaseInternal(name: string, databaseName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (databaseName !== undefined) rpcArgs.databaseName = databaseName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.MySql/addDatabase', + rpcArgs + ); + return new MySqlDatabaseResource(result, this._client); + } + + /** Adds a MySQL database */ + addDatabase(name: string, options?: AddDatabaseOptions): MySqlDatabaseResourcePromise { + const databaseName = options?.databaseName; + return new MySqlDatabaseResourcePromise(this._addDatabaseInternal(name, databaseName)); + } + + /** @internal */ + private async _withPasswordInternal(password: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, password }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.MySql/withPassword', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Configures the MySQL password */ + withPassword(password: ParameterResource): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withPasswordInternal(password)); + } + + /** @internal */ + private async _withPhpMyAdminInternal(configureContainer?: (obj: PhpMyAdminContainerResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PhpMyAdminContainerResourceHandle; + const obj = new PhpMyAdminContainerResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.MySql/withPhpMyAdmin', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds phpMyAdmin management UI */ + withPhpMyAdmin(options?: WithPhpMyAdminOptions): MySqlServerResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new MySqlServerResourcePromise(this._withPhpMyAdminInternal(configureContainer, containerName)); + } + + /** @internal */ + private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.MySql/withDataVolume', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds a data volume for MySQL */ + withDataVolume(options?: WithDataVolumeOptions): MySqlServerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new MySqlServerResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + } + + /** @internal */ + private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.MySql/withDataBindMount', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Adds a data bind mount for MySQL */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): MySqlServerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new MySqlServerResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); + } + + /** @internal */ + private async _withInitFilesInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.MySql/withInitFiles', + rpcArgs + ); + return new MySqlServerResource(result, this._client); + } + + /** Copies init files to MySQL */ + withInitFiles(source: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withInitFilesInternal(source)); + } + +} + +/** + * Thenable wrapper for MySqlServerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class MySqlServerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: MySqlServerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Adds arguments */ + withArgs(args: string[]): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Adds a MySQL database */ + addDatabase(name: string, options?: AddDatabaseOptions): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.addDatabase(name, options))); + } + + /** Configures the MySQL password */ + withPassword(password: ParameterResource): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withPassword(password))); + } + + /** Adds phpMyAdmin management UI */ + withPhpMyAdmin(options?: WithPhpMyAdminOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withPhpMyAdmin(options))); + } + + /** Adds a data volume for MySQL */ + withDataVolume(options?: WithDataVolumeOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + } + + /** Adds a data bind mount for MySQL */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); + } + + /** Copies init files to MySQL */ + withInitFiles(source: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withInitFiles(source))); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// PgAdminContainerResource +// ============================================================================ + +export class PgAdminContainerResource extends ResourceBuilderBase { + constructor(handle: PgAdminContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PgAdminContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new PgAdminContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PgAdminContainerResourcePromise { + const tag = options?.tag; + return new PgAdminContainerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PgAdminContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new PgAdminContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PgAdminContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new PgAdminContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PgAdminContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new PgAdminContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PgAdminContainerResourcePromise { + const helpLink = options?.helpLink; + return new PgAdminContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PgAdminContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new PgAdminContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PgAdminContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new PgAdminContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PgAdminContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PgAdminContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PgAdminContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PgAdminContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PgAdminContainerResourcePromise { + const displayText = options?.displayText; + return new PgAdminContainerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PgAdminContainerResourcePromise { + const displayText = options?.displayText; + return new PgAdminContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PgAdminContainerResourcePromise { + const exitCode = options?.exitCode; + return new PgAdminContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PgAdminContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new PgAdminContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PgAdminContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new PgAdminContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PgAdminContainerResourcePromise { + const password = options?.password; + return new PgAdminContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PgAdminContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new PgAdminContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PgAdminContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new PgAdminContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PgAdminContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new PgAdminContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PgAdminContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new PgAdminContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPgAdminHostPort', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the host port for pgAdmin */ + withHostPort(options?: WithHostPortOptions): PgAdminContainerResourcePromise { + const port = options?.port; + return new PgAdminContainerResourcePromise(this._withHostPortInternal(port)); + } + +} + +/** + * Thenable wrapper for PgAdminContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class PgAdminContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PgAdminContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Sets the host port for pgAdmin */ + withHostPort(options?: WithHostPortOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + +} + +// ============================================================================ +// PgWebContainerResource +// ============================================================================ + +export class PgWebContainerResource extends ResourceBuilderBase { + constructor(handle: PgWebContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PgWebContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new PgWebContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PgWebContainerResourcePromise { + const tag = options?.tag; + return new PgWebContainerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PgWebContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new PgWebContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PgWebContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new PgWebContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PgWebContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new PgWebContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PgWebContainerResourcePromise { + const helpLink = options?.helpLink; + return new PgWebContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PgWebContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new PgWebContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PgWebContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new PgWebContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PgWebContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PgWebContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PgWebContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PgWebContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PgWebContainerResourcePromise { + const displayText = options?.displayText; + return new PgWebContainerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PgWebContainerResourcePromise { + const displayText = options?.displayText; + return new PgWebContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PgWebContainerResourcePromise { + const exitCode = options?.exitCode; + return new PgWebContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PgWebContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new PgWebContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PgWebContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new PgWebContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PgWebContainerResourcePromise { + const password = options?.password; + return new PgWebContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PgWebContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new PgWebContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PgWebContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new PgWebContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PgWebContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new PgWebContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PgWebContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new PgWebContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPgWebHostPort', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the host port for pgweb */ + withHostPort(options?: WithHostPortOptions): PgWebContainerResourcePromise { + const port = options?.port; + return new PgWebContainerResourcePromise(this._withHostPortInternal(port)); + } + +} + +/** + * Thenable wrapper for PgWebContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class PgWebContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PgWebContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Sets the host port for pgweb */ + withHostPort(options?: WithHostPortOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + +} + +// ============================================================================ +// PhpMyAdminContainerResource +// ============================================================================ + +export class PhpMyAdminContainerResource extends ResourceBuilderBase { + constructor(handle: PhpMyAdminContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PhpMyAdminContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new PhpMyAdminContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PhpMyAdminContainerResourcePromise { + const tag = options?.tag; + return new PhpMyAdminContainerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PhpMyAdminContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new PhpMyAdminContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PhpMyAdminContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new PhpMyAdminContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PhpMyAdminContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new PhpMyAdminContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PhpMyAdminContainerResourcePromise { + const helpLink = options?.helpLink; + return new PhpMyAdminContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PhpMyAdminContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new PhpMyAdminContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PhpMyAdminContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new PhpMyAdminContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PhpMyAdminContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PhpMyAdminContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PhpMyAdminContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PhpMyAdminContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PhpMyAdminContainerResourcePromise { + const displayText = options?.displayText; + return new PhpMyAdminContainerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PhpMyAdminContainerResourcePromise { + const displayText = options?.displayText; + return new PhpMyAdminContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PhpMyAdminContainerResourcePromise { + const exitCode = options?.exitCode; + return new PhpMyAdminContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PhpMyAdminContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new PhpMyAdminContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PhpMyAdminContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new PhpMyAdminContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PhpMyAdminContainerResourcePromise { + const password = options?.password; + return new PhpMyAdminContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PhpMyAdminContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new PhpMyAdminContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PhpMyAdminContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new PhpMyAdminContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PhpMyAdminContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new PhpMyAdminContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PhpMyAdminContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new PhpMyAdminContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.MySql/withHostPort', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } + + /** Sets the host port for phpMyAdmin */ + withHostPort(options?: WithHostPortOptions): PhpMyAdminContainerResourcePromise { + const port = options?.port; + return new PhpMyAdminContainerResourcePromise(this._withHostPortInternal(port)); + } + +} + +/** + * Thenable wrapper for PhpMyAdminContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class PhpMyAdminContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PhpMyAdminContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Sets the host port for phpMyAdmin */ + withHostPort(options?: WithHostPortOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + +} + +// ============================================================================ +// PostgresDatabaseResource +// ============================================================================ + +export class PostgresDatabaseResource extends ResourceBuilderBase { + constructor(handle: PostgresDatabaseResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Parent property */ + parent = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.parent', + { context: this._handle } + ); + return new PostgresServerResource(handle, this._client); + }, + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the DatabaseName property */ + databaseName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.databaseName', + { context: this._handle } + ); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the JdbcConnectionString property */ + jdbcConnectionString = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.jdbcConnectionString', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresDatabaseResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new PostgresDatabaseResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresDatabaseResourcePromise { + const helpLink = options?.helpLink; + return new PostgresDatabaseResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PostgresDatabaseResourcePromise { + const displayText = options?.displayText; + return new PostgresDatabaseResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresDatabaseResourcePromise { + const displayText = options?.displayText; + return new PostgresDatabaseResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresDatabaseResourcePromise { + const commandOptions = options?.commandOptions; + return new PostgresDatabaseResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PostgresDatabaseResourcePromise { + const iconVariant = options?.iconVariant; + return new PostgresDatabaseResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresDatabaseResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new PostgresDatabaseResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withPostgresMcpInternal(configureContainer?: (obj: PostgresMcpContainerResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PostgresMcpContainerResourceHandle; + const obj = new PostgresMcpContainerResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPostgresMcp', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Adds Postgres MCP server */ + withPostgresMcp(options?: WithPostgresMcpOptions): PostgresDatabaseResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new PostgresDatabaseResourcePromise(this._withPostgresMcpInternal(configureContainer, containerName)); + } + + /** @internal */ + private async _withCreationScriptInternal(script: string): Promise { + const rpcArgs: Record = { builder: this._handle, script }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withCreationScript', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Defines the SQL script for database creation */ + withCreationScript(script: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withCreationScriptInternal(script)); + } + +} + +/** + * Thenable wrapper for PostgresDatabaseResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class PostgresDatabaseResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PostgresDatabaseResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Adds Postgres MCP server */ + withPostgresMcp(options?: WithPostgresMcpOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withPostgresMcp(options))); + } + + /** Defines the SQL script for database creation */ + withCreationScript(script: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withCreationScript(script))); + } + +} + +// ============================================================================ +// PostgresMcpContainerResource +// ============================================================================ + +export class PostgresMcpContainerResource extends ResourceBuilderBase { + constructor(handle: PostgresMcpContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PostgresMcpContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new PostgresMcpContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PostgresMcpContainerResourcePromise { + const tag = options?.tag; + return new PostgresMcpContainerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PostgresMcpContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new PostgresMcpContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresMcpContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new PostgresMcpContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PostgresMcpContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new PostgresMcpContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresMcpContainerResourcePromise { + const helpLink = options?.helpLink; + return new PostgresMcpContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PostgresMcpContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new PostgresMcpContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PostgresMcpContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new PostgresMcpContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PostgresMcpContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PostgresMcpContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PostgresMcpContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PostgresMcpContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PostgresMcpContainerResourcePromise { + const displayText = options?.displayText; + return new PostgresMcpContainerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresMcpContainerResourcePromise { + const displayText = options?.displayText; + return new PostgresMcpContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PostgresMcpContainerResourcePromise { + const exitCode = options?.exitCode; + return new PostgresMcpContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PostgresMcpContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new PostgresMcpContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresMcpContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new PostgresMcpContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PostgresMcpContainerResourcePromise { + const password = options?.password; + return new PostgresMcpContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PostgresMcpContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new PostgresMcpContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PostgresMcpContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new PostgresMcpContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresMcpContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new PostgresMcpContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PostgresMcpContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new PostgresMcpContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for PostgresMcpContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class PostgresMcpContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PostgresMcpContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// PostgresServerResource +// ============================================================================ + +export class PostgresServerResource extends ResourceBuilderBase { + constructor(handle: PostgresServerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the PrimaryEndpoint property */ + primaryEndpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.primaryEndpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the UserNameReference property */ + userNameReference = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.userNameReference', + { context: this._handle } + ); + }, + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the Databases property */ + private _databases?: AspireDict; + get databases(): AspireDict { + if (!this._databases) { + this._databases = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.databases', + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.databases' + ); + } + return this._databases; + } + + /** Gets the Host property */ + host = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.host', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.port', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the JdbcConnectionString property */ + jdbcConnectionString = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.jdbcConnectionString', + { context: this._handle } + ); + }, + }; + + /** Gets the Entrypoint property */ + entrypoint = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.entrypoint', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.setEntrypoint', + { context: this._handle, value } + ); + } + }; + + /** Gets the ShellExecution property */ + shellExecution = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.shellExecution', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.setShellExecution', + { context: this._handle, value } + ); + } + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PostgresServerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new PostgresServerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PostgresServerResourcePromise { + const tag = options?.tag; + return new PostgresServerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PostgresServerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new PostgresServerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresServerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new PostgresServerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PostgresServerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new PostgresServerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresServerResourcePromise { + const helpLink = options?.helpLink; + return new PostgresServerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PostgresServerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new PostgresServerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PostgresServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new PostgresServerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PostgresServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PostgresServerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PostgresServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PostgresServerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PostgresServerResourcePromise { + const displayText = options?.displayText; + return new PostgresServerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresServerResourcePromise { + const displayText = options?.displayText; + return new PostgresServerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PostgresServerResourcePromise { + const exitCode = options?.exitCode; + return new PostgresServerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PostgresServerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new PostgresServerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresServerResourcePromise { + const commandOptions = options?.commandOptions; + return new PostgresServerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PostgresServerResourcePromise { + const password = options?.password; + return new PostgresServerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PostgresServerResourcePromise { + const iconVariant = options?.iconVariant; + return new PostgresServerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PostgresServerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new PostgresServerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresServerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new PostgresServerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PostgresServerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new PostgresServerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _addDatabaseInternal(name: string, databaseName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (databaseName !== undefined) rpcArgs.databaseName = databaseName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/addDatabase', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Adds a PostgreSQL database */ + addDatabase(name: string, options?: AddDatabaseOptions): PostgresDatabaseResourcePromise { + const databaseName = options?.databaseName; + return new PostgresDatabaseResourcePromise(this._addDatabaseInternal(name, databaseName)); + } + + /** @internal */ + private async _withPgAdminInternal(configureContainer?: (obj: PgAdminContainerResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PgAdminContainerResourceHandle; + const obj = new PgAdminContainerResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPgAdmin', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds pgAdmin 4 management UI */ + withPgAdmin(options?: WithPgAdminOptions): PostgresServerResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new PostgresServerResourcePromise(this._withPgAdminInternal(configureContainer, containerName)); + } + + /** @internal */ + private async _withPgWebInternal(configureContainer?: (obj: PgWebContainerResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PgWebContainerResourceHandle; + const obj = new PgWebContainerResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPgWeb', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds pgweb management UI */ + withPgWeb(options?: WithPgWebOptions): PostgresServerResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new PostgresServerResourcePromise(this._withPgWebInternal(configureContainer, containerName)); + } + + /** @internal */ + private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withDataVolume', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a data volume for PostgreSQL */ + withDataVolume(options?: WithDataVolumeOptions): PostgresServerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new PostgresServerResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + } + + /** @internal */ + private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withDataBindMount', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a data bind mount for PostgreSQL */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): PostgresServerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new PostgresServerResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); + } + + /** @internal */ + private async _withInitFilesInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withInitFiles', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Copies init files to PostgreSQL */ + withInitFiles(source: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withInitFilesInternal(source)); + } + + /** @internal */ + private async _withPasswordInternal(password: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, password }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPassword', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures the PostgreSQL password */ + withPassword(password: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withPasswordInternal(password)); + } + + /** @internal */ + private async _withUserNameInternal(userName: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, userName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withUserName', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures the PostgreSQL user name */ + withUserName(userName: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withUserNameInternal(userName)); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPostgresHostPort', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the host port for PostgreSQL */ + withHostPort(options?: WithHostPortOptions): PostgresServerResourcePromise { + const port = options?.port; + return new PostgresServerResourcePromise(this._withHostPortInternal(port)); + } + +} + +/** + * Thenable wrapper for PostgresServerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class PostgresServerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PostgresServerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Adds arguments */ + withArgs(args: string[]): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Adds a PostgreSQL database */ + addDatabase(name: string, options?: AddDatabaseOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.addDatabase(name, options))); + } + + /** Adds pgAdmin 4 management UI */ + withPgAdmin(options?: WithPgAdminOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPgAdmin(options))); + } + + /** Adds pgweb management UI */ + withPgWeb(options?: WithPgWebOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPgWeb(options))); + } + + /** Adds a data volume for PostgreSQL */ + withDataVolume(options?: WithDataVolumeOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + } + + /** Adds a data bind mount for PostgreSQL */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); + } + + /** Copies init files to PostgreSQL */ + withInitFiles(source: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withInitFiles(source))); + } + + /** Configures the PostgreSQL password */ + withPassword(password: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPassword(password))); + } + + /** Configures the PostgreSQL user name */ + withUserName(userName: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUserName(userName))); + } + + /** Sets the host port for PostgreSQL */ + withHostPort(options?: WithHostPortOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); } -} - -// ============================================================================ -// ExternalServiceResource -// ============================================================================ - -export class ExternalServiceResource extends ResourceBuilderBase { - constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - const helpLink = options?.helpLink; - return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - const commandOptions = options?.commandOptions; - return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { const iconVariant = options?.iconVariant; - return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -9391,60 +23244,60 @@ export class ExternalServiceResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -9459,128 +23312,313 @@ export class ExternalServiceResource extends ResourceBuilderBase { - constructor(private _promise: Promise) {} +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -9591,222 +23629,296 @@ export class ExternalServiceResourcePromise implements PromiseLike { - constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { +export class SqlServerDatabaseResource extends ResourceBuilderBase { + constructor(handle: SqlServerDatabaseResourceHandle, client: AspireClientRpc) { super(handle, client); } + /** Gets the Parent property */ + parent = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.parent', + { context: this._handle } + ); + return new SqlServerServerResource(handle, this._client); + }, + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the JdbcConnectionString property */ + jdbcConnectionString = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.jdbcConnectionString', + { context: this._handle } + ); + }, + }; + + /** Gets the DatabaseName property */ + databaseName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.databaseName', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ParameterResource(result, this._client); + return new SqlServerDatabaseResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ParameterResource(result, this._client); + return new SqlServerDatabaseResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerDatabaseResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new SqlServerDatabaseResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, description }; - if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDescription', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ParameterResource(result, this._client); + return new SqlServerDatabaseResource(result, this._client); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - const enableMarkdown = options?.enableMarkdown; - return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerDatabaseResourcePromise { + const helpLink = options?.helpLink; + return new SqlServerDatabaseResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', rpcArgs ); - return new ParameterResource(result, this._client); + return new SqlServerDatabaseResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - const helpLink = options?.helpLink; - return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withConnectionPropertyInternal(name, value)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ParameterResource(result, this._client); + return new SqlServerDatabaseResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ParameterResource(result, this._client); + return new SqlServerDatabaseResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ParameterResource(result, this._client); + return new SqlServerDatabaseResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + withUrl(url: string, options?: WithUrlOptions): SqlServerDatabaseResourcePromise { const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + return new SqlServerDatabaseResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ParameterResource(result, this._client); + return new SqlServerDatabaseResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerDatabaseResourcePromise { const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new SqlServerDatabaseResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ParameterResource(result, this._client); + return new SqlServerDatabaseResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ParameterResource(result, this._client); + return new SqlServerDatabaseResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ParameterResource(result, this._client); + return new SqlServerDatabaseResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ParameterResource(result, this._client); + return new SqlServerDatabaseResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -9814,113 +23926,113 @@ export class ParameterResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ParameterResource(result, this._client); + return new SqlServerDatabaseResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerDatabaseResourcePromise { const commandOptions = options?.commandOptions; - return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new SqlServerDatabaseResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ParameterResource(result, this._client); + return new SqlServerDatabaseResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ParameterResource(result, this._client); + return new SqlServerDatabaseResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ParameterResource(result, this._client); + return new SqlServerDatabaseResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): SqlServerDatabaseResourcePromise { const iconVariant = options?.iconVariant; - return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new SqlServerDatabaseResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ParameterResource(result, this._client); + return new SqlServerDatabaseResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ParameterResource(result, this._client); + return new SqlServerDatabaseResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ParameterResource(result, this._client); + return new SqlServerDatabaseResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -9931,60 +24043,60 @@ export class ParameterResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ParameterResource(result, this._client); + return new SqlServerDatabaseResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerDatabaseResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new SqlServerDatabaseResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ParameterResource(result, this._client); + return new SqlServerDatabaseResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ParameterResource(result, this._client); + return new SqlServerDatabaseResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -9996,515 +24108,962 @@ export class ParameterResource extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle, script }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withCreationScript', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Defines the SQL script used to create the database */ + withCreationScript(script: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withCreationScriptInternal(script)); + } + } /** - * Thenable wrapper for ParameterResource that enables fluent chaining. + * Thenable wrapper for SqlServerDatabaseResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ParameterResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class SqlServerDatabaseResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: SqlServerDatabaseResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Defines the SQL script used to create the database */ + withCreationScript(script: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withCreationScript(script))); + } + +} + +// ============================================================================ +// SqlServerServerResource +// ============================================================================ + +export class SqlServerServerResource extends ResourceBuilderBase { + constructor(handle: SqlServerServerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the PrimaryEndpoint property */ + primaryEndpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.primaryEndpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.host', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.port', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the UserNameReference property */ + userNameReference = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.userNameReference', + { context: this._handle } + ); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the JdbcConnectionString property */ + jdbcConnectionString = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.jdbcConnectionString', + { context: this._handle } + ); + }, + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the Databases property */ + private _databases?: AspireDict; + get databases(): AspireDict { + if (!this._databases) { + this._databases = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.databases', + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.databases' + ); + } + return this._databases; + } + + /** Gets the Entrypoint property */ + entrypoint = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.entrypoint', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.setEntrypoint', + { context: this._handle, value } + ); + } + }; + + /** Gets the ShellExecution property */ + shellExecution = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.shellExecution', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.setShellExecution', + { context: this._handle, value } + ); + } + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): SqlServerServerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new SqlServerServerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): SqlServerServerResourcePromise { + const tag = options?.tag; + return new SqlServerServerResourcePromise(this._withImageInternal(image, tag)); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withImageSHA256Internal(sha256)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withContainerRuntimeArgsInternal(args)); } - /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withLifetimeInternal(lifetime)); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Configures the resource to be published as a container */ + publishAsContainer(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._publishAsContainerInternal()); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): SqlServerServerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new SqlServerServerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Sets the container name */ + withContainerName(name: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withContainerNameInternal(name)); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withBuildArgInternal(name, value)); } -} - -// ============================================================================ -// ProjectResource -// ============================================================================ + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } -export class ProjectResource extends ResourceBuilderBase { - constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerServerResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new SqlServerServerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + withMcpServer(options?: WithMcpServerOptions): SqlServerServerResourcePromise { const path = options?.path; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + return new SqlServerServerResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { + private async _withOtlpExporterInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterInternal()); + withOtlpExporter(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + withOtlpExporterProtocol(protocol: OtlpProtocol): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerServerResourcePromise { const helpLink = options?.helpLink; - return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new SqlServerServerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { + private async _withEnvironmentInternal(name: string, value: string): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + withEnvironment(name: string, value: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentExpression', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + withEnvironmentExpression(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; const obj = new EnvironmentCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): SqlServerServerResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + return new SqlServerServerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withServiceReference', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + withServiceReference(source: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withServiceReferenceInternal(source)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withServiceReferenceNamed', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -10514,15 +25073,15 @@ export class ProjectResource extends ResourceBuilderBase if (isProxied !== undefined) rpcArgs.isProxied = isProxied; if (isExternal !== undefined) rpcArgs.isExternal = isExternal; if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + withEndpoint(options?: WithEndpointOptions): SqlServerServerResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -10531,72 +25090,72 @@ export class ProjectResource extends ResourceBuilderBase const isProxied = options?.isProxied; const isExternal = options?.isExternal; const protocol = options?.protocol; - return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + return new SqlServerServerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): SqlServerServerResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new SqlServerServerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): SqlServerServerResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new SqlServerServerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -10609,293 +25168,278 @@ export class ProjectResource extends ResourceBuilderBase } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + withUrl(url: string, options?: WithUrlOptions): SqlServerServerResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + return new SqlServerServerResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerServerResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new SqlServerServerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); - } - - /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitFor', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForCompletion', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): SqlServerServerResourcePromise { const exitCode = options?.exitCode; - return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new SqlServerServerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): SqlServerServerResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new SqlServerServerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -10903,130 +25447,130 @@ export class ProjectResource extends ResourceBuilderBase }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerServerResourcePromise { const commandOptions = options?.commandOptions; - return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new SqlServerServerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsDeveloperCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): SqlServerServerResourcePromise { const password = options?.password; - return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new SqlServerServerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): SqlServerServerResourcePromise { const iconVariant = options?.iconVariant; - return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new SqlServerServerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -11035,15 +25579,15 @@ export class ProjectResource extends ResourceBuilderBase if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): SqlServerServerResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -11051,56 +25595,56 @@ export class ProjectResource extends ResourceBuilderBase const failureThreshold = options?.failureThreshold; const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new SqlServerServerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -11111,216 +25655,415 @@ export class ProjectResource extends ResourceBuilderBase if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; if (tags !== undefined) rpcArgs.tags = tags; if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerServerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new SqlServerServerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): SqlServerServerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new SqlServerServerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _addDatabaseInternal(name: string, databaseName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (databaseName !== undefined) rpcArgs.databaseName = databaseName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/addDatabase', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a SQL Server database resource */ + addDatabase(name: string, options?: AddDatabaseOptions): SqlServerDatabaseResourcePromise { + const databaseName = options?.databaseName; + return new SqlServerDatabaseResourcePromise(this._addDatabaseInternal(name, databaseName)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withDataVolume', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds a named volume for the SQL Server data folder */ + withDataVolume(options?: WithDataVolumeOptions): SqlServerServerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new SqlServerServerResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withDataBindMount', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds a bind mount for the SQL Server data folder */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): SqlServerServerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new SqlServerServerResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withPasswordInternal(password: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, password }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withPassword', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures the password for the SQL Server resource */ + withPassword(password: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withPasswordInternal(password)); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withHostPort', rpcArgs ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the host port for the SQL Server resource */ + withHostPort(options?: WithHostPortOptions): SqlServerServerResourcePromise { + const port = options?.port; + return new SqlServerServerResourcePromise(this._withHostPortInternal(port)); } } /** - * Thenable wrapper for ProjectResource that enables fluent chaining. + * Thenable wrapper for SqlServerServerResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ProjectResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class SqlServerServerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: SqlServerServerResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + withMcpServer(options?: WithMcpServerOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + withOtlpExporter(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + withOtlpExporterProtocol(protocol: OtlpProtocol): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + withEnvironment(name: string, value: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + withEnvironmentExpression(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + withServiceReference(source: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); } /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -11329,163 +26072,163 @@ export class ProjectResourcePromise implements PromiseLike { } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } /** Gets the resource name */ @@ -11493,6 +26236,31 @@ export class ProjectResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Adds a SQL Server database resource */ + addDatabase(name: string, options?: AddDatabaseOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.addDatabase(name, options))); + } + + /** Adds a named volume for the SQL Server data folder */ + withDataVolume(options?: WithDataVolumeOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + } + + /** Adds a bind mount for the SQL Server data folder */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); + } + + /** Configures the password for the SQL Server resource */ + withPassword(password: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPassword(password))); + } + + /** Sets the host port for the SQL Server resource */ + withHostPort(options?: WithHostPortOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + } // ============================================================================ @@ -13292,8 +28060,18 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppR registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.MySql/Aspire.Hosting.ApplicationModel.MySqlDatabaseResource', (handle, client) => new MySqlDatabaseResource(handle as MySqlDatabaseResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.MySql/Aspire.Hosting.ApplicationModel.MySqlServerResource', (handle, client) => new MySqlServerResource(handle as MySqlServerResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.PostgreSQL/Aspire.Hosting.Postgres.PgAdminContainerResource', (handle, client) => new PgAdminContainerResource(handle as PgAdminContainerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.PostgreSQL/Aspire.Hosting.Postgres.PgWebContainerResource', (handle, client) => new PgWebContainerResource(handle as PgWebContainerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.MySql/Aspire.Hosting.MySql.PhpMyAdminContainerResource', (handle, client) => new PhpMyAdminContainerResource(handle as PhpMyAdminContainerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.PostgreSQL/Aspire.Hosting.ApplicationModel.PostgresDatabaseResource', (handle, client) => new PostgresDatabaseResource(handle as PostgresDatabaseResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.PostgreSQL/Aspire.Hosting.Postgres.PostgresMcpContainerResource', (handle, client) => new PostgresMcpContainerResource(handle as PostgresMcpContainerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.PostgreSQL/Aspire.Hosting.ApplicationModel.PostgresServerResource', (handle, client) => new PostgresServerResource(handle as PostgresServerResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.SqlServer/Aspire.Hosting.ApplicationModel.SqlServerDatabaseResource', (handle, client) => new SqlServerDatabaseResource(handle as SqlServerDatabaseResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.SqlServer/Aspire.Hosting.ApplicationModel.SqlServerServerResource', (handle, client) => new SqlServerServerResource(handle as SqlServerServerResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); diff --git a/samples/database-containers/ts/apphost.run.json b/samples/database-containers/ts/apphost.run.json new file mode 100644 index 00000000..49a84323 --- /dev/null +++ b/samples/database-containers/ts/apphost.run.json @@ -0,0 +1,11 @@ +{ + "profiles": { + "https": { + "applicationUrl": "https://localhost:11848;http://localhost:15340", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:62043", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:44379" + } + } + } +} \ No newline at end of file diff --git a/samples/database-containers/ts/apphost.ts b/samples/database-containers/ts/apphost.ts index 1749550a..4b7602c8 100644 --- a/samples/database-containers/ts/apphost.ts +++ b/samples/database-containers/ts/apphost.ts @@ -1,61 +1,51 @@ -// Setup: Run the following commands to add required integrations: -// aspire add postgres -// aspire add mysql -// aspire add sqlserver -// -// Note: This sample reads init.sql using Node.js fs APIs (the TypeScript -// equivalent of C#'s File.ReadAllText) and passes it to withCreationScript(). - -import { createBuilder, ContainerLifetime } from "./.modules/aspire.js"; -import { readFileSync, existsSync } from "node:fs"; -import { join, dirname } from "node:path"; -import { fileURLToPath } from "node:url"; +import { createBuilder } from './.modules/aspire.js'; +import { readFileSync } from 'fs'; +import { join, dirname } from 'path'; +import { fileURLToPath } from 'url'; const builder = await createBuilder(); +// PostgreSQL const todosDbName = "Todos"; -const postgres = await builder.addPostgres("postgres") +const postgres = builder.addPostgres("postgres") .withEnvironment("POSTGRES_DB", todosDbName) .withBindMount("../DatabaseContainers.ApiService/data/postgres", "/docker-entrypoint-initdb.d") .withDataVolume() .withPgWeb() - .withLifetime(ContainerLifetime.Persistent); + .withLifetime("persistent"); const todosDb = postgres.addDatabase(todosDbName); +// MySQL const catalogDbName = "catalog"; -const mysql = await builder.addMySql("mysql") +const mysql = builder.addMySql("mysql") .withEnvironment("MYSQL_DATABASE", catalogDbName) .withBindMount("../DatabaseContainers.ApiService/data/mysql", "/docker-entrypoint-initdb.d") .withDataVolume() - .withLifetime(ContainerLifetime.Persistent); + .withLifetime("persistent"); const catalogDb = mysql.addDatabase(catalogDbName); -const sqlserver = await builder.addSqlServer("sqlserver") +// SQL Server +const sqlserver = builder.addSqlServer("sqlserver") .withDataVolume() - .withLifetime(ContainerLifetime.Persistent); - -// Read the SQL creation script and apply it to the database -const __dirname = dirname(fileURLToPath(import.meta.url)); -const initSqlPath = join(__dirname, "../DatabaseContainers.ApiService/data/sqlserver/init.sql"); -if (!existsSync(initSqlPath)) { - throw new Error(`SQL initialization script not found: ${initSqlPath}`); -} -const initSql = readFileSync(initSqlPath, "utf-8"); + .withLifetime("persistent"); + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); +const initScriptPath = join(__dirname, "../DatabaseContainers.ApiService/data/sqlserver/init.sql"); const addressBookDb = sqlserver.addDatabase("AddressBook") - .withCreationScript(initSql); + .withCreationScript(readFileSync(initScriptPath, "utf-8")); -const apiservice = builder.addProject("apiservice") +builder.addProject("apiservice", "../DatabaseContainers.ApiService/DatabaseContainers.ApiService.csproj", "https") .withReference(todosDb) .waitFor(todosDb) .withReference(catalogDb) .waitFor(catalogDb) .withReference(addressBookDb) .waitFor(addressBookDb) - .withHttpHealthCheck("/alive") - .withHttpHealthCheck("/health"); + .withHttpHealthCheck("/alive"); await builder.build().run(); diff --git a/samples/database-containers/ts/package-lock.json b/samples/database-containers/ts/package-lock.json index c4d3800c..dfc78de1 100644 --- a/samples/database-containers/ts/package-lock.json +++ b/samples/database-containers/ts/package-lock.json @@ -1,6 +1,962 @@ { - "name": "ts", + "name": "databasecontainers", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, - "packages": {} + "packages": { + "": { + "name": "databasecontainers", + "version": "1.0.0", + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz", + "integrity": "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.3.tgz", + "integrity": "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.3.tgz", + "integrity": "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.3.tgz", + "integrity": "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.3.tgz", + "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.3.tgz", + "integrity": "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.3.tgz", + "integrity": "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.3.tgz", + "integrity": "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.3.tgz", + "integrity": "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.3.tgz", + "integrity": "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.3.tgz", + "integrity": "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.3.tgz", + "integrity": "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.3.tgz", + "integrity": "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.3.tgz", + "integrity": "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.3.tgz", + "integrity": "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.3.tgz", + "integrity": "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz", + "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.3.tgz", + "integrity": "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.3.tgz", + "integrity": "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.3.tgz", + "integrity": "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.3.tgz", + "integrity": "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.3.tgz", + "integrity": "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.3.tgz", + "integrity": "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.3.tgz", + "integrity": "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.3.tgz", + "integrity": "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.3.tgz", + "integrity": "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@types/node": { + "version": "20.19.37", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.37.tgz", + "integrity": "sha512-8kzdPJ3FsNsVIurqBs7oodNnCEVbni9yUEkaHbgptDACOPW04jimGagZ51E6+lXUwJjgnBw+hyko/lkFWCldqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.4.tgz", + "integrity": "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/esbuild": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.3.tgz", + "integrity": "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.27.3", + "@esbuild/android-arm": "0.27.3", + "@esbuild/android-arm64": "0.27.3", + "@esbuild/android-x64": "0.27.3", + "@esbuild/darwin-arm64": "0.27.3", + "@esbuild/darwin-x64": "0.27.3", + "@esbuild/freebsd-arm64": "0.27.3", + "@esbuild/freebsd-x64": "0.27.3", + "@esbuild/linux-arm": "0.27.3", + "@esbuild/linux-arm64": "0.27.3", + "@esbuild/linux-ia32": "0.27.3", + "@esbuild/linux-loong64": "0.27.3", + "@esbuild/linux-mips64el": "0.27.3", + "@esbuild/linux-ppc64": "0.27.3", + "@esbuild/linux-riscv64": "0.27.3", + "@esbuild/linux-s390x": "0.27.3", + "@esbuild/linux-x64": "0.27.3", + "@esbuild/netbsd-arm64": "0.27.3", + "@esbuild/netbsd-x64": "0.27.3", + "@esbuild/openbsd-arm64": "0.27.3", + "@esbuild/openbsd-x64": "0.27.3", + "@esbuild/openharmony-arm64": "0.27.3", + "@esbuild/sunos-x64": "0.27.3", + "@esbuild/win32-arm64": "0.27.3", + "@esbuild/win32-ia32": "0.27.3", + "@esbuild/win32-x64": "0.27.3" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-tsconfig": { + "version": "4.13.6", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.6.tgz", + "integrity": "sha512-shZT/QMiSHc/YBLxxOkMtgSid5HFoauqCE3/exfsEcwg1WkeqjG+V40yBbBrsD+jW2HDXcs28xOfcbm2jI8Ddw==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true, + "license": "ISC" + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/minimatch": { + "version": "10.2.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz", + "integrity": "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nodemon": { + "version": "3.1.14", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.14.tgz", + "integrity": "sha512-jakjZi93UtB3jHMWsXL68FXSAosbLfY0In5gtKq3niLSkrWznrVBzXFNOEMJUfc9+Ke7SHWoAZsiMkNP3vq6Jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^10.2.1", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true, + "license": "MIT" + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "license": "ISC", + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/tsx": { + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz", + "integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.27.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true, + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/vscode-jsonrpc": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.1.tgz", + "integrity": "sha512-kdjOSJ2lLIn7r1rtrMbbNCHjyMPfRnowdKjBQ+mGq6NAW5QY2bEZC/khaC5OR8svbbjvLEaIXkOq45e2X9BIbQ==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + } + } } diff --git a/samples/database-containers/ts/package.json b/samples/database-containers/ts/package.json new file mode 100644 index 00000000..91409a87 --- /dev/null +++ b/samples/database-containers/ts/package.json @@ -0,0 +1,19 @@ +{ + "name": "databasecontainers", + "version": "1.0.0", + "type": "module", + "scripts": { + "start": "aspire run", + "build": "tsc", + "dev": "tsc --watch" + }, + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } +} \ No newline at end of file diff --git a/samples/database-containers/ts/tsconfig.json b/samples/database-containers/ts/tsconfig.json new file mode 100644 index 00000000..edf7302c --- /dev/null +++ b/samples/database-containers/ts/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "outDir": "./dist", + "rootDir": "." + }, + "include": ["apphost.ts", ".modules/**/*.ts"], + "exclude": ["node_modules"] +} \ No newline at end of file diff --git a/samples/database-migrations/ts/.aspire/settings.json b/samples/database-migrations/ts/.aspire/settings.json index a0a8820b..c7715292 100644 --- a/samples/database-migrations/ts/.aspire/settings.json +++ b/samples/database-migrations/ts/.aspire/settings.json @@ -1,7 +1,9 @@ { "appHostPath": "../apphost.ts", + "language": "typescript/nodejs", + "channel": "staging", "sdkVersion": "13.2.0-preview.1.26159.1", "packages": { - "Aspire.Hosting.SqlServer": "13.1.2" + "Aspire.Hosting.SqlServer": "13.2.0-preview.1.26159.1" } } \ No newline at end of file diff --git a/samples/database-migrations/ts/.modules/.codegen-hash b/samples/database-migrations/ts/.modules/.codegen-hash index 57778ed0..4339e3e4 100644 --- a/samples/database-migrations/ts/.modules/.codegen-hash +++ b/samples/database-migrations/ts/.modules/.codegen-hash @@ -1 +1 @@ -23D2045F98131678EA8334C41B1A65173035209D6EC7F218631F84915E06E6EE \ No newline at end of file +F1454E21BA68FADAFF01DF5D95185FCD3DE865741AA895F1B5F9669DB7368188 \ No newline at end of file diff --git a/samples/database-migrations/ts/.modules/aspire.ts b/samples/database-migrations/ts/.modules/aspire.ts index 73dc52d2..07e659d2 100644 --- a/samples/database-migrations/ts/.modules/aspire.ts +++ b/samples/database-migrations/ts/.modules/aspire.ts @@ -26,6 +26,12 @@ import { // Handle Type Aliases (Internal - not exported to users) // ============================================================================ +/** Handle to SqlServerDatabaseResource */ +type SqlServerDatabaseResourceHandle = Handle<'Aspire.Hosting.SqlServer/Aspire.Hosting.ApplicationModel.SqlServerDatabaseResource'>; + +/** Handle to SqlServerServerResource */ +type SqlServerServerResourceHandle = Handle<'Aspire.Hosting.SqlServer/Aspire.Hosting.ApplicationModel.SqlServerServerResource'>; + /** Handle to CommandLineArgsCallbackContext */ type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; @@ -326,6 +332,10 @@ export interface AddContainerRegistryOptions { repository?: ParameterResource; } +export interface AddDatabaseOptions { + databaseName?: string; +} + export interface AddDockerfileOptions { dockerfilePath?: string; stage?: string; @@ -339,6 +349,11 @@ export interface AddParameterOptions { secret?: boolean; } +export interface AddSqlServerOptions { + password?: ParameterResource; + port?: number; +} + export interface AppendFormattedOptions { format?: string; } @@ -367,6 +382,15 @@ export interface WithCommandOptions { commandOptions?: CommandOptions; } +export interface WithDataBindMountOptions { + isReadOnly?: boolean; +} + +export interface WithDataVolumeOptions { + name?: string; + isReadOnly?: boolean; +} + export interface WithDescriptionOptions { enableMarkdown?: boolean; } @@ -397,6 +421,10 @@ export interface WithExternalServiceHttpHealthCheckOptions { statusCode?: number; } +export interface WithHostPortOptions { + port?: number; +} + export interface WithHttpEndpointOptions { port?: number; targetPort?: number; @@ -1711,6 +1739,25 @@ export class DistributedApplicationBuilder { return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); } + /** Adds a SQL Server container resource */ + /** @internal */ + async _addSqlServerInternal(name: string, password?: ParameterResource, port?: number): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (password !== undefined) rpcArgs.password = password; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/addSqlServer', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + addSqlServer(name: string, options?: AddSqlServerOptions): SqlServerServerResourcePromise { + const password = options?.password; + const port = options?.port; + return new SqlServerServerResourcePromise(this._addSqlServerInternal(name, password, port)); + } + } /** @@ -1801,6 +1848,11 @@ export class DistributedApplicationBuilderPromise implements PromiseLike obj.addCSharpAppWithOptions(name, path, configure))); } + /** Adds a SQL Server container resource */ + addSqlServer(name: string, options?: AddSqlServerOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.addSqlServer(name, options))); + } + } // ============================================================================ @@ -3055,239 +3107,6 @@ export class ContainerResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); - } - - /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); - } - - /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageTagInternal(tag)); - } - - /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); - } - - /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - const tag = options?.tag; - return new ContainerResourcePromise(this._withImageInternal(image, tag)); - } - - /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); - } - - /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); - } - - /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); - } - - /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); - } - - /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsContainerInternal()); - } - - /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); - } - - /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNameInternal(name)); - } - - /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); - } - - /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); - } - - /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); - } - /** @internal */ private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; @@ -3307,21 +3126,6 @@ export class ContainerResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); - } - /** @internal */ private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; @@ -3371,21 +3175,6 @@ export class ContainerResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); - } - /** @internal */ private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; @@ -4316,30 +4105,11 @@ export class ContainerResource extends ResourceBuilderBase { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); - } - - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); } @@ -4366,91 +4136,11 @@ export class ContainerResourcePromise implements PromiseLike return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); - } - - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); - } - - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); - } - - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); - } - - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); - } - - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); - } - - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); - } - - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); - } - - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); - } - - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); - } - - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); - } - - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); - } - - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); - } - - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); - } - - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); - } - /** Sets the base image for a Dockerfile build */ withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); - } - /** Configures an MCP server endpoint on the resource */ withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); @@ -4466,11 +4156,6 @@ export class ContainerResourcePromise implements PromiseLike return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); - } - /** Adds a required command dependency */ withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); @@ -4736,11 +4421,6 @@ export class ContainerResourcePromise implements PromiseLike return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); - } - /** Gets the resource name */ getResourceName(): Promise { return this._promise.then(obj => obj.getResourceName()); @@ -11495,6 +11175,2641 @@ export class ProjectResourcePromise implements PromiseLike { } +// ============================================================================ +// SqlServerDatabaseResource +// ============================================================================ + +export class SqlServerDatabaseResource extends ResourceBuilderBase { + constructor(handle: SqlServerDatabaseResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Parent property */ + parent = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.parent', + { context: this._handle } + ); + return new SqlServerServerResource(handle, this._client); + }, + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the JdbcConnectionString property */ + jdbcConnectionString = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.jdbcConnectionString', + { context: this._handle } + ); + }, + }; + + /** Gets the DatabaseName property */ + databaseName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.databaseName', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerDatabaseResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new SqlServerDatabaseResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerDatabaseResourcePromise { + const helpLink = options?.helpLink; + return new SqlServerDatabaseResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): SqlServerDatabaseResourcePromise { + const displayText = options?.displayText; + return new SqlServerDatabaseResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerDatabaseResourcePromise { + const displayText = options?.displayText; + return new SqlServerDatabaseResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerDatabaseResourcePromise { + const commandOptions = options?.commandOptions; + return new SqlServerDatabaseResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): SqlServerDatabaseResourcePromise { + const iconVariant = options?.iconVariant; + return new SqlServerDatabaseResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerDatabaseResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new SqlServerDatabaseResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withCreationScriptInternal(script: string): Promise { + const rpcArgs: Record = { builder: this._handle, script }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withCreationScript', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Defines the SQL script used to create the database */ + withCreationScript(script: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withCreationScriptInternal(script)); + } + +} + +/** + * Thenable wrapper for SqlServerDatabaseResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class SqlServerDatabaseResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: SqlServerDatabaseResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Defines the SQL script used to create the database */ + withCreationScript(script: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withCreationScript(script))); + } + +} + +// ============================================================================ +// SqlServerServerResource +// ============================================================================ + +export class SqlServerServerResource extends ResourceBuilderBase { + constructor(handle: SqlServerServerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the PrimaryEndpoint property */ + primaryEndpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.primaryEndpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.host', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.port', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the UserNameReference property */ + userNameReference = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.userNameReference', + { context: this._handle } + ); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the JdbcConnectionString property */ + jdbcConnectionString = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.jdbcConnectionString', + { context: this._handle } + ); + }, + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the Databases property */ + private _databases?: AspireDict; + get databases(): AspireDict { + if (!this._databases) { + this._databases = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.databases', + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.databases' + ); + } + return this._databases; + } + + /** Gets the Entrypoint property */ + entrypoint = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.entrypoint', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.setEntrypoint', + { context: this._handle, value } + ); + } + }; + + /** Gets the ShellExecution property */ + shellExecution = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.shellExecution', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.setShellExecution', + { context: this._handle, value } + ); + } + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): SqlServerServerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new SqlServerServerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): SqlServerServerResourcePromise { + const tag = options?.tag; + return new SqlServerServerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): SqlServerServerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new SqlServerServerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerServerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new SqlServerServerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): SqlServerServerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new SqlServerServerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerServerResourcePromise { + const helpLink = options?.helpLink; + return new SqlServerServerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): SqlServerServerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new SqlServerServerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): SqlServerServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new SqlServerServerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): SqlServerServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new SqlServerServerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): SqlServerServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new SqlServerServerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): SqlServerServerResourcePromise { + const displayText = options?.displayText; + return new SqlServerServerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerServerResourcePromise { + const displayText = options?.displayText; + return new SqlServerServerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): SqlServerServerResourcePromise { + const exitCode = options?.exitCode; + return new SqlServerServerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): SqlServerServerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new SqlServerServerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerServerResourcePromise { + const commandOptions = options?.commandOptions; + return new SqlServerServerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): SqlServerServerResourcePromise { + const password = options?.password; + return new SqlServerServerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): SqlServerServerResourcePromise { + const iconVariant = options?.iconVariant; + return new SqlServerServerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): SqlServerServerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new SqlServerServerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerServerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new SqlServerServerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): SqlServerServerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new SqlServerServerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _addDatabaseInternal(name: string, databaseName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (databaseName !== undefined) rpcArgs.databaseName = databaseName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/addDatabase', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a SQL Server database resource */ + addDatabase(name: string, options?: AddDatabaseOptions): SqlServerDatabaseResourcePromise { + const databaseName = options?.databaseName; + return new SqlServerDatabaseResourcePromise(this._addDatabaseInternal(name, databaseName)); + } + + /** @internal */ + private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withDataVolume', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a named volume for the SQL Server data folder */ + withDataVolume(options?: WithDataVolumeOptions): SqlServerServerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new SqlServerServerResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + } + + /** @internal */ + private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withDataBindMount', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a bind mount for the SQL Server data folder */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): SqlServerServerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new SqlServerServerResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); + } + + /** @internal */ + private async _withPasswordInternal(password: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, password }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withPassword', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures the password for the SQL Server resource */ + withPassword(password: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withPasswordInternal(password)); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withHostPort', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the host port for the SQL Server resource */ + withHostPort(options?: WithHostPortOptions): SqlServerServerResourcePromise { + const port = options?.port; + return new SqlServerServerResourcePromise(this._withHostPortInternal(port)); + } + +} + +/** + * Thenable wrapper for SqlServerServerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class SqlServerServerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: SqlServerServerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Adds arguments */ + withArgs(args: string[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Adds a SQL Server database resource */ + addDatabase(name: string, options?: AddDatabaseOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.addDatabase(name, options))); + } + + /** Adds a named volume for the SQL Server data folder */ + withDataVolume(options?: WithDataVolumeOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + } + + /** Adds a bind mount for the SQL Server data folder */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); + } + + /** Configures the password for the SQL Server resource */ + withPassword(password: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPassword(password))); + } + + /** Sets the host port for the SQL Server resource */ + withHostPort(options?: WithHostPortOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + +} + // ============================================================================ // ContainerFilesDestinationResource // ============================================================================ @@ -13294,6 +15609,8 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.Executable registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.SqlServer/Aspire.Hosting.ApplicationModel.SqlServerDatabaseResource', (handle, client) => new SqlServerDatabaseResource(handle as SqlServerDatabaseResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.SqlServer/Aspire.Hosting.ApplicationModel.SqlServerServerResource', (handle, client) => new SqlServerServerResource(handle as SqlServerServerResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); diff --git a/samples/database-migrations/ts/apphost.run.json b/samples/database-migrations/ts/apphost.run.json new file mode 100644 index 00000000..fdb86060 --- /dev/null +++ b/samples/database-migrations/ts/apphost.run.json @@ -0,0 +1,11 @@ +{ + "profiles": { + "https": { + "applicationUrl": "https://localhost:17120;http://localhost:39492", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:38758", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:62185" + } + } + } +} \ No newline at end of file diff --git a/samples/database-migrations/ts/apphost.ts b/samples/database-migrations/ts/apphost.ts index d04f54aa..e13e1da6 100644 --- a/samples/database-migrations/ts/apphost.ts +++ b/samples/database-migrations/ts/apphost.ts @@ -1,21 +1,18 @@ -// Setup: Run the following commands to add required integrations: -// aspire add sqlserver - -import { createBuilder, ContainerLifetime } from "./.modules/aspire.js"; +import { createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); -const sqlserver = await builder.addSqlServer("sqlserver") +const sqlserver = builder.addSqlServer("sqlserver") .withDataVolume() - .withLifetime(ContainerLifetime.Persistent); + .withLifetime("persistent"); const db1 = sqlserver.addDatabase("db1"); -const migrationService = builder.addProject("migration") +const migrationService = builder.addProject("migration", "../DatabaseMigrations.MigrationService/DatabaseMigrations.MigrationService.csproj", "https") .withReference(db1) .waitFor(db1); -const api = builder.addProject("api") +builder.addProject("api", "../DatabaseMigrations.ApiService/DatabaseMigrations.ApiService.csproj", "https") .withReference(db1) .waitForCompletion(migrationService); diff --git a/samples/database-migrations/ts/package-lock.json b/samples/database-migrations/ts/package-lock.json index c4d3800c..59222c16 100644 --- a/samples/database-migrations/ts/package-lock.json +++ b/samples/database-migrations/ts/package-lock.json @@ -1,6 +1,962 @@ { - "name": "ts", + "name": "databasemigrations", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, - "packages": {} + "packages": { + "": { + "name": "databasemigrations", + "version": "1.0.0", + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz", + "integrity": "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.3.tgz", + "integrity": "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.3.tgz", + "integrity": "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.3.tgz", + "integrity": "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.3.tgz", + "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.3.tgz", + "integrity": "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.3.tgz", + "integrity": "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.3.tgz", + "integrity": "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.3.tgz", + "integrity": "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.3.tgz", + "integrity": "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.3.tgz", + "integrity": "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.3.tgz", + "integrity": "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.3.tgz", + "integrity": "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.3.tgz", + "integrity": "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.3.tgz", + "integrity": "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.3.tgz", + "integrity": "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz", + "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.3.tgz", + "integrity": "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.3.tgz", + "integrity": "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.3.tgz", + "integrity": "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.3.tgz", + "integrity": "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.3.tgz", + "integrity": "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.3.tgz", + "integrity": "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.3.tgz", + "integrity": "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.3.tgz", + "integrity": "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.3.tgz", + "integrity": "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@types/node": { + "version": "20.19.37", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.37.tgz", + "integrity": "sha512-8kzdPJ3FsNsVIurqBs7oodNnCEVbni9yUEkaHbgptDACOPW04jimGagZ51E6+lXUwJjgnBw+hyko/lkFWCldqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.4.tgz", + "integrity": "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/esbuild": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.3.tgz", + "integrity": "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.27.3", + "@esbuild/android-arm": "0.27.3", + "@esbuild/android-arm64": "0.27.3", + "@esbuild/android-x64": "0.27.3", + "@esbuild/darwin-arm64": "0.27.3", + "@esbuild/darwin-x64": "0.27.3", + "@esbuild/freebsd-arm64": "0.27.3", + "@esbuild/freebsd-x64": "0.27.3", + "@esbuild/linux-arm": "0.27.3", + "@esbuild/linux-arm64": "0.27.3", + "@esbuild/linux-ia32": "0.27.3", + "@esbuild/linux-loong64": "0.27.3", + "@esbuild/linux-mips64el": "0.27.3", + "@esbuild/linux-ppc64": "0.27.3", + "@esbuild/linux-riscv64": "0.27.3", + "@esbuild/linux-s390x": "0.27.3", + "@esbuild/linux-x64": "0.27.3", + "@esbuild/netbsd-arm64": "0.27.3", + "@esbuild/netbsd-x64": "0.27.3", + "@esbuild/openbsd-arm64": "0.27.3", + "@esbuild/openbsd-x64": "0.27.3", + "@esbuild/openharmony-arm64": "0.27.3", + "@esbuild/sunos-x64": "0.27.3", + "@esbuild/win32-arm64": "0.27.3", + "@esbuild/win32-ia32": "0.27.3", + "@esbuild/win32-x64": "0.27.3" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-tsconfig": { + "version": "4.13.6", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.6.tgz", + "integrity": "sha512-shZT/QMiSHc/YBLxxOkMtgSid5HFoauqCE3/exfsEcwg1WkeqjG+V40yBbBrsD+jW2HDXcs28xOfcbm2jI8Ddw==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true, + "license": "ISC" + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/minimatch": { + "version": "10.2.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz", + "integrity": "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nodemon": { + "version": "3.1.14", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.14.tgz", + "integrity": "sha512-jakjZi93UtB3jHMWsXL68FXSAosbLfY0In5gtKq3niLSkrWznrVBzXFNOEMJUfc9+Ke7SHWoAZsiMkNP3vq6Jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^10.2.1", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true, + "license": "MIT" + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "license": "ISC", + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/tsx": { + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz", + "integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.27.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true, + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/vscode-jsonrpc": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.1.tgz", + "integrity": "sha512-kdjOSJ2lLIn7r1rtrMbbNCHjyMPfRnowdKjBQ+mGq6NAW5QY2bEZC/khaC5OR8svbbjvLEaIXkOq45e2X9BIbQ==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + } + } } diff --git a/samples/database-migrations/ts/package.json b/samples/database-migrations/ts/package.json new file mode 100644 index 00000000..c62488a3 --- /dev/null +++ b/samples/database-migrations/ts/package.json @@ -0,0 +1,19 @@ +{ + "name": "databasemigrations", + "version": "1.0.0", + "type": "module", + "scripts": { + "start": "aspire run", + "build": "tsc", + "dev": "tsc --watch" + }, + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } +} \ No newline at end of file diff --git a/samples/database-migrations/ts/tsconfig.json b/samples/database-migrations/ts/tsconfig.json new file mode 100644 index 00000000..edf7302c --- /dev/null +++ b/samples/database-migrations/ts/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "outDir": "./dist", + "rootDir": "." + }, + "include": ["apphost.ts", ".modules/**/*.ts"], + "exclude": ["node_modules"] +} \ No newline at end of file diff --git a/samples/health-checks-ui/ts/.aspire/settings.json b/samples/health-checks-ui/ts/.aspire/settings.json index 9dfecf35..0785bef5 100644 --- a/samples/health-checks-ui/ts/.aspire/settings.json +++ b/samples/health-checks-ui/ts/.aspire/settings.json @@ -1,8 +1,10 @@ { "appHostPath": "../apphost.ts", + "language": "typescript/nodejs", + "channel": "staging", "sdkVersion": "13.2.0-preview.1.26159.1", "packages": { - "Aspire.Hosting.Redis": "13.1.2", - "Aspire.Hosting.Docker": "13.1.2-preview.1.26125.13" + "Aspire.Hosting.Redis": "13.2.0-preview.1.26159.1", + "Aspire.Hosting.Docker": "13.2.0-preview.1.26159.1" } } \ No newline at end of file diff --git a/samples/health-checks-ui/ts/.modules/.codegen-hash b/samples/health-checks-ui/ts/.modules/.codegen-hash index 97328095..b983a78d 100644 --- a/samples/health-checks-ui/ts/.modules/.codegen-hash +++ b/samples/health-checks-ui/ts/.modules/.codegen-hash @@ -1 +1 @@ -77D2D99D9A6D8891BA4E3557755A508847E488D10B955BB8D1A887611E28AFB8 \ No newline at end of file +515A3230DD89FC07B770D55FBBBFBC9A78A2CD226301458C2AE764DB5B64389A \ No newline at end of file diff --git a/samples/health-checks-ui/ts/.modules/aspire.ts b/samples/health-checks-ui/ts/.modules/aspire.ts index 73dc52d2..a5902685 100644 --- a/samples/health-checks-ui/ts/.modules/aspire.ts +++ b/samples/health-checks-ui/ts/.modules/aspire.ts @@ -26,6 +26,27 @@ import { // Handle Type Aliases (Internal - not exported to users) // ============================================================================ +/** Handle to DockerComposeAspireDashboardResource */ +type DockerComposeAspireDashboardResourceHandle = Handle<'Aspire.Hosting.Docker/Aspire.Hosting.Docker.DockerComposeAspireDashboardResource'>; + +/** Handle to DockerComposeEnvironmentResource */ +type DockerComposeEnvironmentResourceHandle = Handle<'Aspire.Hosting.Docker/Aspire.Hosting.Docker.DockerComposeEnvironmentResource'>; + +/** Handle to DockerComposeServiceResource */ +type DockerComposeServiceResourceHandle = Handle<'Aspire.Hosting.Docker/Aspire.Hosting.Docker.DockerComposeServiceResource'>; + +/** Handle to Service */ +type ServiceHandle = Handle<'Aspire.Hosting.Docker/Aspire.Hosting.Docker.Resources.ComposeNodes.Service'>; + +/** Handle to RedisResource */ +type RedisResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting.ApplicationModel.RedisResource'>; + +/** Handle to RedisCommanderResource */ +type RedisCommanderResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisCommanderResource'>; + +/** Handle to RedisInsightResource */ +type RedisInsightResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisInsightResource'>; + /** Handle to CommandLineArgsCallbackContext */ type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; @@ -56,6 +77,9 @@ type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicatio /** Handle to ExecuteCommandContext */ type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; +/** Handle to IComputeResource */ +type IComputeResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource'>; + /** Handle to IContainerFilesDestinationResource */ type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; @@ -339,6 +363,15 @@ export interface AddParameterOptions { secret?: boolean; } +export interface AddRedisOptions { + port?: number; + password?: ParameterResource; +} + +export interface AddRedisWithPortOptions { + port?: number; +} + export interface AppendFormattedOptions { format?: string; } @@ -367,6 +400,19 @@ export interface WithCommandOptions { commandOptions?: CommandOptions; } +export interface WithDashboardOptions { + enabled?: boolean; +} + +export interface WithDataBindMountOptions { + isReadOnly?: boolean; +} + +export interface WithDataVolumeOptions { + name?: string; + isReadOnly?: boolean; +} + export interface WithDescriptionOptions { enableMarkdown?: boolean; } @@ -397,6 +443,14 @@ export interface WithExternalServiceHttpHealthCheckOptions { statusCode?: number; } +export interface WithForwardedHeadersOptions { + enabled?: boolean; +} + +export interface WithHostPortOptions { + port?: number; +} + export interface WithHttpEndpointOptions { port?: number; targetPort?: number; @@ -446,6 +500,11 @@ export interface WithMcpServerOptions { endpointName?: string; } +export interface WithPersistenceOptions { + interval?: number; + keysChangedThreshold?: number; +} + export interface WithPipelineStepFactoryOptions { dependsOn?: string[]; requiredBy?: string[]; @@ -453,6 +512,16 @@ export interface WithPipelineStepFactoryOptions { description?: string; } +export interface WithRedisCommanderOptions { + configureContainer?: (obj: RedisCommanderResource) => Promise; + containerName?: string; +} + +export interface WithRedisInsightOptions { + configureContainer?: (obj: RedisInsightResource) => Promise; + containerName?: string; +} + export interface WithReferenceOptions { connectionName?: string; optional?: boolean; @@ -1415,751 +1484,9069 @@ export class ResourceUrlsCallbackContext { } // ============================================================================ -// DistributedApplicationBuilder +// Service // ============================================================================ /** - * Type class for DistributedApplicationBuilder. + * Type class for Service. */ -export class DistributedApplicationBuilder { - constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} +export class Service { + constructor(private _handle: ServiceHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the AppHostDirectory property */ - appHostDirectory = { + /** Gets the Image property */ + image = { get: async (): Promise => { return await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.image', { context: this._handle } ); }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.setImage', + { context: this._handle, value } + ); + } }; - /** Gets the Eventing property */ - eventing = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + /** Gets the PullPolicy property */ + pullPolicy = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.pullPolicy', { context: this._handle } ); - return new DistributedApplicationEventing(handle, this._client); }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.setPullPolicy', + { context: this._handle, value } + ); + } }; - /** Gets the ExecutionContext property */ - executionContext = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + /** Gets the ContainerName property */ + containerName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.containerName', { context: this._handle } ); - return new DistributedApplicationExecutionContext(handle, this._client); }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.setContainerName', + { context: this._handle, value } + ); + } }; - /** Builds the distributed application */ - /** @internal */ - async _buildInternal(): Promise { - const rpcArgs: Record = { context: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/build', - rpcArgs - ); - return new DistributedApplication(result, this._client); - } - - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._buildInternal()); + /** Gets the Command property */ + private _command?: AspireList; + get command(): AspireList { + if (!this._command) { + this._command = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.command', + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.command' + ); + } + return this._command; } - /** Adds a connection string with a builder callback */ - /** @internal */ - async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { - const connectionStringBuilderId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; - const obj = new ReferenceExpressionBuilder(objHandle, this._client); - await connectionStringBuilder(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionStringBuilder', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); + /** Gets the Entrypoint property */ + private _entrypoint?: AspireList; + get entrypoint(): AspireList { + if (!this._entrypoint) { + this._entrypoint = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.entrypoint', + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.entrypoint' + ); + } + return this._entrypoint; } - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + /** Gets the Environment property */ + private _environment?: AspireDict; + get environment(): AspireDict { + if (!this._environment) { + this._environment = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.environment', + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.environment' + ); + } + return this._environment; } - /** Adds a container registry resource */ - /** @internal */ - async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpoint }; - if (repository !== undefined) rpcArgs.repository = repository; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainerRegistry', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Gets the EnvFile property */ + private _envFile?: AspireList; + get envFile(): AspireList { + if (!this._envFile) { + this._envFile = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.envFile', + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.envFile' + ); + } + return this._envFile; } - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - const repository = options?.repository; - return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); - } + /** Gets the WorkingDir property */ + workingDir = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.workingDir', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.setWorkingDir', + { context: this._handle, value } + ); + } + }; - /** Adds a container resource */ - /** @internal */ - async _addContainerInternal(name: string, image: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, image }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainer', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets the Ports property */ + private _ports?: AspireList; + get ports(): AspireList { + if (!this._ports) { + this._ports = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.ports', + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.ports' + ); + } + return this._ports; } - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._addContainerInternal(name, image)); + /** Gets the Expose property */ + private _expose?: AspireList; + get expose(): AspireList { + if (!this._expose) { + this._expose = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.expose', + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.expose' + ); + } + return this._expose; } - /** Adds a container resource built from a Dockerfile */ - /** @internal */ - async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDockerfile', - rpcArgs - ); - return new ContainerResource(result, this._client); - } + /** Gets the User property */ + user = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.user', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.setUser', + { context: this._handle, value } + ); + } + }; - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); + /** Gets the Networks property */ + private _networks?: AspireList; + get networks(): AspireList { + if (!this._networks) { + this._networks = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.networks', + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.networks' + ); + } + return this._networks; } - /** Adds a .NET tool resource */ - /** @internal */ - async _addDotnetToolInternal(name: string, packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDotnetTool', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } + /** Gets the Restart property */ + restart = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.restart', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.setRestart', + { context: this._handle, value } + ); + } + }; - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + /** Gets the Labels property */ + private _labels?: AspireDict; + get labels(): AspireDict { + if (!this._labels) { + this._labels = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.labels', + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.labels' + ); + } + return this._labels; } - /** Adds an executable resource */ - /** @internal */ - async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExecutable', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } + /** Gets the DomainName property */ + domainName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.domainName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.setDomainName', + { context: this._handle, value } + ); + } + }; - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); - } + /** Gets the Hostname property */ + hostname = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.hostname', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.setHostname', + { context: this._handle, value } + ); + } + }; + + /** Gets the Isolation property */ + isolation = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.isolation', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.setIsolation', + { context: this._handle, value } + ); + } + }; + + /** Gets the Ipc property */ + ipc = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.ipc', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.setIpc', + { context: this._handle, value } + ); + } + }; + + /** Gets the MacAddress property */ + macAddress = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.macAddress', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.setMacAddress', + { context: this._handle, value } + ); + } + }; + + /** Gets the Pid property */ + pid = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.pid', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.setPid', + { context: this._handle, value } + ); + } + }; + + /** Gets the CapAdd property */ + private _capAdd?: AspireList; + get capAdd(): AspireList { + if (!this._capAdd) { + this._capAdd = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.capAdd', + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.capAdd' + ); + } + return this._capAdd; + } + + /** Gets the CapDrop property */ + private _capDrop?: AspireList; + get capDrop(): AspireList { + if (!this._capDrop) { + this._capDrop = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.capDrop', + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.capDrop' + ); + } + return this._capDrop; + } + + /** Gets the CgroupParent property */ + cgroupParent = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.cgroupParent', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.setCgroupParent', + { context: this._handle, value } + ); + } + }; + + /** Gets the Devices property */ + private _devices?: AspireList; + get devices(): AspireList { + if (!this._devices) { + this._devices = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.devices', + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.devices' + ); + } + return this._devices; + } + + /** Gets the Dns property */ + private _dns?: AspireList; + get dns(): AspireList { + if (!this._dns) { + this._dns = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.dns', + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.dns' + ); + } + return this._dns; + } + + /** Gets the DnsSearch property */ + private _dnsSearch?: AspireList; + get dnsSearch(): AspireList { + if (!this._dnsSearch) { + this._dnsSearch = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.dnsSearch', + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.dnsSearch' + ); + } + return this._dnsSearch; + } + + /** Gets the ExtraHosts property */ + private _extraHosts?: AspireDict; + get extraHosts(): AspireDict { + if (!this._extraHosts) { + this._extraHosts = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.extraHosts', + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.extraHosts' + ); + } + return this._extraHosts; + } + + /** Gets the GroupAdd property */ + private _groupAdd?: AspireList; + get groupAdd(): AspireList { + if (!this._groupAdd) { + this._groupAdd = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.groupAdd', + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.groupAdd' + ); + } + return this._groupAdd; + } + + /** Gets the Init property */ + init = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.init', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.setInit', + { context: this._handle, value } + ); + } + }; + + /** Gets the Links property */ + private _links?: AspireList; + get links(): AspireList { + if (!this._links) { + this._links = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.links', + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.links' + ); + } + return this._links; + } + + /** Gets the ExternalLinks property */ + private _externalLinks?: AspireList; + get externalLinks(): AspireList { + if (!this._externalLinks) { + this._externalLinks = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.externalLinks', + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.externalLinks' + ); + } + return this._externalLinks; + } + + /** Gets the NetworkMode property */ + networkMode = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.networkMode', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.setNetworkMode', + { context: this._handle, value } + ); + } + }; + + /** Gets the Profiles property */ + private _profiles?: AspireList; + get profiles(): AspireList { + if (!this._profiles) { + this._profiles = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.profiles', + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.profiles' + ); + } + return this._profiles; + } + + /** Gets the ReadOnly property */ + readOnly = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.readOnly', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.setReadOnly', + { context: this._handle, value } + ); + } + }; + + /** Gets the SecurityOpt property */ + private _securityOpt?: AspireList; + get securityOpt(): AspireList { + if (!this._securityOpt) { + this._securityOpt = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.securityOpt', + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.securityOpt' + ); + } + return this._securityOpt; + } + + /** Gets the StopGracePeriod property */ + stopGracePeriod = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.stopGracePeriod', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.setStopGracePeriod', + { context: this._handle, value } + ); + } + }; + + /** Gets the StopSignal property */ + stopSignal = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.stopSignal', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.setStopSignal', + { context: this._handle, value } + ); + } + }; + + /** Gets the Sysctls property */ + private _sysctls?: AspireDict; + get sysctls(): AspireDict { + if (!this._sysctls) { + this._sysctls = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.sysctls', + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.sysctls' + ); + } + return this._sysctls; + } + + /** Gets the Tmpfs property */ + private _tmpfs?: AspireList; + get tmpfs(): AspireList { + if (!this._tmpfs) { + this._tmpfs = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.tmpfs', + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.tmpfs' + ); + } + return this._tmpfs; + } + + /** Gets the StdinOpen property */ + stdinOpen = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.stdinOpen', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.setStdinOpen', + { context: this._handle, value } + ); + } + }; + + /** Gets the Tty property */ + tty = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.tty', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.setTty', + { context: this._handle, value } + ); + } + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.name', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.setName', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Builds the distributed application */ + /** @internal */ + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', + rpcArgs + ); + return new DistributedApplication(result, this._client); + } + + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); + } + + /** Adds a connection string with a builder callback */ + /** @internal */ + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionStringBuilder', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + } + + /** Adds a container registry resource */ + /** @internal */ + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + } + + /** Adds a container resource */ + /** @internal */ + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); + } + + /** Adds a container resource built from a Dockerfile */ + /** @internal */ + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); + } + + /** Adds a .NET tool resource */ + /** @internal */ + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + } + + /** Adds an executable resource */ + /** @internal */ + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + } + + /** Adds an external service resource */ + /** @internal */ + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); + } + + /** Adds a parameter resource */ + /** @internal */ + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); + } + + /** Adds a parameter sourced from configuration */ + /** @internal */ + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + } + + /** Adds a connection string resource */ + /** @internal */ + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + } + + /** Adds a .NET project resource */ + /** @internal */ + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + } + + /** Adds a project resource with configuration options */ + /** @internal */ + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + } + + /** Adds a C# application resource */ + /** @internal */ + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + } + + /** Adds a C# application resource with configuration options */ + /** @internal */ + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + } + + /** Adds a Redis container resource with specific port */ + /** @internal */ + async _addRedisWithPortInternal(name: string, port?: number): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/addRedisWithPort', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { + const port = options?.port; + return new RedisResourcePromise(this._addRedisWithPortInternal(name, port)); + } + + /** Adds a Redis container resource */ + /** @internal */ + async _addRedisInternal(name: string, port?: number, password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (port !== undefined) rpcArgs.port = port; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/addRedis', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { + const port = options?.port; + const password = options?.password; + return new RedisResourcePromise(this._addRedisInternal(name, port, password)); + } + + /** Adds a Docker Compose publishing environment */ + /** @internal */ + async _addDockerComposeEnvironmentInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/addDockerComposeEnvironment', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + addDockerComposeEnvironment(name: string): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._addDockerComposeEnvironmentInternal(name)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + */ +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); + } + + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + } + + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + } + + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + } + + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + } + + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + } + + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); + } + + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + } + + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); + } + + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + } + + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); + } + + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); + } + + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); + } + + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); + } + + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); + } + + /** Adds a Redis container resource with specific port */ + addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.addRedisWithPort(name, options))); + } + + /** Adds a Redis container resource */ + addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.addRedis(name, options))); + } + + /** Adds a Docker Compose publishing environment */ + addDockerComposeEnvironment(name: string): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.addDockerComposeEnvironment(name))); + } + +} + +// ============================================================================ +// DistributedApplicationEventing +// ============================================================================ + +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Unsubscribe method */ + /** @internal */ + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + rpcArgs + ); + return this; + } + + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ + +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// ContainerResource +// ============================================================================ + +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + const exitCode = options?.exitCode; + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + const password = options?.password; + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { + const configureId = registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as DockerComposeServiceResourceHandle; + const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); + const arg2Handle = wrapIfHandle(args.p1) as ServiceHandle; + const arg2 = new Service(arg2Handle, this._client); + await configure(arg1, arg2); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/publishAsDockerComposeService', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); + } + +} + +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); + } + +} + +// ============================================================================ +// CSharpAppResource +// ============================================================================ + +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + const exitCode = options?.exitCode; + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + const commandOptions = options?.commandOptions; + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + const password = options?.password; + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + const iconVariant = options?.iconVariant; + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { + const configureId = registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as DockerComposeServiceResourceHandle; + const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); + const arg2Handle = wrapIfHandle(args.p1) as ServiceHandle; + const arg2 = new Service(arg2Handle, this._client); + await configure(arg1, arg2); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/publishAsDockerComposeService', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); + } + +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); + } + +} + +// ============================================================================ +// DockerComposeAspireDashboardResource +// ============================================================================ + +export class DockerComposeAspireDashboardResource extends ResourceBuilderBase { + constructor(handle: DockerComposeAspireDashboardResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the PrimaryEndpoint property */ + primaryEndpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeAspireDashboardResource.primaryEndpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the OtlpGrpcEndpoint property */ + otlpGrpcEndpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeAspireDashboardResource.otlpGrpcEndpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Entrypoint property */ + entrypoint = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeAspireDashboardResource.entrypoint', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeAspireDashboardResource.setEntrypoint', + { context: this._handle, value } + ); + } + }; + + /** Gets the ShellExecution property */ + shellExecution = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeAspireDashboardResource.shellExecution', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeAspireDashboardResource.setShellExecution', + { context: this._handle, value } + ); + } + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeAspireDashboardResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): DockerComposeAspireDashboardResourcePromise { + const isReadOnly = options?.isReadOnly; + return new DockerComposeAspireDashboardResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): DockerComposeAspireDashboardResourcePromise { + const tag = options?.tag; + return new DockerComposeAspireDashboardResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): DockerComposeAspireDashboardResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new DockerComposeAspireDashboardResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DockerComposeAspireDashboardResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new DockerComposeAspireDashboardResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DockerComposeAspireDashboardResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DockerComposeAspireDashboardResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DockerComposeAspireDashboardResourcePromise { + const helpLink = options?.helpLink; + return new DockerComposeAspireDashboardResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DockerComposeAspireDashboardResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new DockerComposeAspireDashboardResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DockerComposeAspireDashboardResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new DockerComposeAspireDashboardResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DockerComposeAspireDashboardResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DockerComposeAspireDashboardResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DockerComposeAspireDashboardResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DockerComposeAspireDashboardResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DockerComposeAspireDashboardResourcePromise { + const displayText = options?.displayText; + return new DockerComposeAspireDashboardResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DockerComposeAspireDashboardResourcePromise { + const displayText = options?.displayText; + return new DockerComposeAspireDashboardResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DockerComposeAspireDashboardResourcePromise { + const exitCode = options?.exitCode; + return new DockerComposeAspireDashboardResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DockerComposeAspireDashboardResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new DockerComposeAspireDashboardResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DockerComposeAspireDashboardResourcePromise { + const commandOptions = options?.commandOptions; + return new DockerComposeAspireDashboardResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DockerComposeAspireDashboardResourcePromise { + const password = options?.password; + return new DockerComposeAspireDashboardResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DockerComposeAspireDashboardResourcePromise { + const iconVariant = options?.iconVariant; + return new DockerComposeAspireDashboardResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DockerComposeAspireDashboardResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new DockerComposeAspireDashboardResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DockerComposeAspireDashboardResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new DockerComposeAspireDashboardResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): DockerComposeAspireDashboardResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new DockerComposeAspireDashboardResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/withHostPort', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Sets the host port for the Aspire dashboard */ + withHostPort(options?: WithHostPortOptions): DockerComposeAspireDashboardResourcePromise { + const port = options?.port; + return new DockerComposeAspireDashboardResourcePromise(this._withHostPortInternal(port)); + } + + /** @internal */ + private async _withForwardedHeadersInternal(enabled?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (enabled !== undefined) rpcArgs.enabled = enabled; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/withForwardedHeaders', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Enables or disables forwarded headers support for the Aspire dashboard */ + withForwardedHeaders(options?: WithForwardedHeadersOptions): DockerComposeAspireDashboardResourcePromise { + const enabled = options?.enabled; + return new DockerComposeAspireDashboardResourcePromise(this._withForwardedHeadersInternal(enabled)); + } + + /** @internal */ + private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { + const configureId = registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as DockerComposeServiceResourceHandle; + const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); + const arg2Handle = wrapIfHandle(args.p1) as ServiceHandle; + const arg2 = new Service(arg2Handle, this._client); + await configure(arg1, arg2); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/publishAsDockerComposeService', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); + } + + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); + } + +} + +/** + * Thenable wrapper for DockerComposeAspireDashboardResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DockerComposeAspireDashboardResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DockerComposeAspireDashboardResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Sets the host port for the Aspire dashboard */ + withHostPort(options?: WithHostPortOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + + /** Enables or disables forwarded headers support for the Aspire dashboard */ + withForwardedHeaders(options?: WithForwardedHeadersOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withForwardedHeaders(options))); + } + + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); + } + +} + +// ============================================================================ +// DockerComposeEnvironmentResource +// ============================================================================ + +export class DockerComposeEnvironmentResource extends ResourceBuilderBase { + constructor(handle: DockerComposeEnvironmentResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the DefaultNetworkName property */ + defaultNetworkName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeEnvironmentResource.defaultNetworkName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeEnvironmentResource.setDefaultNetworkName', + { context: this._handle, value } + ); + } + }; + + /** Gets the DashboardEnabled property */ + dashboardEnabled = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeEnvironmentResource.dashboardEnabled', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeEnvironmentResource.setDashboardEnabled', + { context: this._handle, value } + ); + } + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeEnvironmentResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DockerComposeEnvironmentResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new DockerComposeEnvironmentResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DockerComposeEnvironmentResourcePromise { + const helpLink = options?.helpLink; + return new DockerComposeEnvironmentResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DockerComposeEnvironmentResourcePromise { + const displayText = options?.displayText; + return new DockerComposeEnvironmentResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DockerComposeEnvironmentResourcePromise { + const displayText = options?.displayText; + return new DockerComposeEnvironmentResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DockerComposeEnvironmentResourcePromise { + const commandOptions = options?.commandOptions; + return new DockerComposeEnvironmentResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DockerComposeEnvironmentResourcePromise { + const iconVariant = options?.iconVariant; + return new DockerComposeEnvironmentResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DockerComposeEnvironmentResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new DockerComposeEnvironmentResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withPropertiesInternal(configure: (obj: DockerComposeEnvironmentResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as DockerComposeEnvironmentResourceHandle; + const obj = new DockerComposeEnvironmentResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/withProperties', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Configures properties of the Docker Compose environment */ + withProperties(configure: (obj: DockerComposeEnvironmentResource) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._withPropertiesInternal(configure)); + } + + /** @internal */ + private async _withDashboardInternal(enabled?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (enabled !== undefined) rpcArgs.enabled = enabled; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/withDashboard', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Enables or disables the Aspire dashboard for the Docker Compose environment */ + withDashboard(options?: WithDashboardOptions): DockerComposeEnvironmentResourcePromise { + const enabled = options?.enabled; + return new DockerComposeEnvironmentResourcePromise(this._withDashboardInternal(enabled)); + } + + /** @internal */ + private async _configureDashboardInternal(configure: (obj: DockerComposeAspireDashboardResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as DockerComposeAspireDashboardResourceHandle; + const obj = new DockerComposeAspireDashboardResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/configureDashboard', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Configures the Aspire dashboard resource for the Docker Compose environment */ + configureDashboard(configure: (obj: DockerComposeAspireDashboardResource) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._configureDashboardInternal(configure)); + } + +} + +/** + * Thenable wrapper for DockerComposeEnvironmentResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DockerComposeEnvironmentResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DockerComposeEnvironmentResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Configures properties of the Docker Compose environment */ + withProperties(configure: (obj: DockerComposeEnvironmentResource) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withProperties(configure))); + } + + /** Enables or disables the Aspire dashboard for the Docker Compose environment */ + withDashboard(options?: WithDashboardOptions): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withDashboard(options))); + } + + /** Configures the Aspire dashboard resource for the Docker Compose environment */ + configureDashboard(configure: (obj: DockerComposeAspireDashboardResource) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.configureDashboard(configure))); + } + +} + +// ============================================================================ +// DockerComposeServiceResource +// ============================================================================ + +export class DockerComposeServiceResource extends ResourceBuilderBase { + constructor(handle: DockerComposeServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Parent property */ + parent = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeServiceResource.parent', + { context: this._handle } + ); + return new DockerComposeEnvironmentResource(handle, this._client); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeServiceResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new DockerComposeServiceResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new DockerComposeServiceResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DockerComposeServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new DockerComposeServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DockerComposeServiceResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DockerComposeServiceResourcePromise { + const helpLink = options?.helpLink; + return new DockerComposeServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new DockerComposeServiceResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new DockerComposeServiceResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new DockerComposeServiceResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DockerComposeServiceResourcePromise { + const displayText = options?.displayText; + return new DockerComposeServiceResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new DockerComposeServiceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DockerComposeServiceResourcePromise { + const displayText = options?.displayText; + return new DockerComposeServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new DockerComposeServiceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new DockerComposeServiceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new DockerComposeServiceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new DockerComposeServiceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new DockerComposeServiceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DockerComposeServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new DockerComposeServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new DockerComposeServiceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new DockerComposeServiceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new DockerComposeServiceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DockerComposeServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new DockerComposeServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new DockerComposeServiceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new DockerComposeServiceResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new DockerComposeServiceResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new DockerComposeServiceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DockerComposeServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new DockerComposeServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new DockerComposeServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new DockerComposeServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for DockerComposeServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DockerComposeServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DockerComposeServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + +} + +// ============================================================================ +// DotnetToolResource +// ============================================================================ + +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { + super(handle, client); + } - /** Adds an external service resource */ /** @internal */ - async _addExternalServiceInternal(name: string, url: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, url }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExternalService', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + } + + /** @internal */ + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + } + + /** @internal */ + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + } + + /** @internal */ + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + } + + /** @internal */ + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + } + + /** @internal */ + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); } - /** Adds a parameter resource */ /** @internal */ - async _addParameterInternal(name: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameter', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterInternal(name, secret)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } - /** Adds a parameter sourced from configuration */ /** @internal */ - async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name, configurationKey }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameterFromConfiguration', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** Adds a connection string resource */ /** @internal */ - async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionString', + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new ResourceWithConnectionString(result, this._client); + return new DotnetToolResource(result, this._client); } - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - const environmentVariableName = options?.environmentVariableName; - return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); } - /** Adds a .NET project resource */ /** @internal */ - async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProject', + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', rpcArgs ); - return new ProjectResource(result, this._client); + return new DotnetToolResource(result, this._client); } - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } - /** Adds a project resource with configuration options */ /** @internal */ - async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProjectWithOptions', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new DotnetToolResource(result, this._client); } - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); } - /** Adds a C# application resource */ /** @internal */ - async _addCSharpAppInternal(name: string, path: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, path }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpApp', + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new DotnetToolResource(result, this._client); } - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } - /** Adds a C# application resource with configuration options */ /** @internal */ - async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpAppWithOptions', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new DotnetToolResource(result, this._client); } - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } -} - -/** - * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. - */ -export class DistributedApplicationBuilderPromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Builds the distributed application */ - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } - /** Adds a connection string with a builder callback */ - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a container registry resource */ - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } - /** Adds a container resource */ - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a container resource built from a Dockerfile */ - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); } - /** Adds a .NET tool resource */ - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds an executable resource */ - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); } - /** Adds an external service resource */ - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a parameter resource */ - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } - /** Adds a parameter sourced from configuration */ - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a connection string resource */ - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); } - /** Adds a .NET project resource */ - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a project resource with configuration options */ - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); } - /** Adds a C# application resource */ - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a C# application resource with configuration options */ - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } -} - -// ============================================================================ -// DistributedApplicationEventing -// ============================================================================ - -/** - * Type class for DistributedApplicationEventing. - */ -export class DistributedApplicationEventing { - constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} - - /** Serialize for JSON-RPC transport */ - toJSON(): MarshalledHandle { return this._handle.toJSON(); } - - /** Invokes the Unsubscribe method */ /** @internal */ - async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { - const rpcArgs: Record = { context: this._handle, subscription }; - await this._client.invokeCapability( - 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return this; + return new DotnetToolResource(result, this._client); } - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); } -} - -/** - * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. - */ -export class DistributedApplicationEventingPromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Invokes the Unsubscribe method */ - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } -} - -// ============================================================================ -// ConnectionStringResource -// ============================================================================ + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } -export class ConnectionStringResource extends ResourceBuilderBase { - constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { - const helpLink = options?.helpLink; - return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitFor', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStart', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForCompletion', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { const exitCode = options?.exitCode; - return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -2167,113 +10554,204 @@ export class ConnectionStringResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { const commandOptions = options?.commandOptions; - return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + const password = options?.password; + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { const iconVariant = options?.iconVariant; - return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -2284,744 +10762,449 @@ export class ConnectionStringResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); - } - - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); - } - -} - -/** - * Thenable wrapper for ConnectionStringResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ConnectionStringResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); - } - - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); - } - - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); - } - - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); - } - - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } - - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); - } - - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); - } - - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); - } - - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } - - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); - } - - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** @internal */ + private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { + const configureId = registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as DockerComposeServiceResourceHandle; + const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); + const arg2Handle = wrapIfHandle(args.p1) as ServiceHandle; + const arg2 = new Service(arg2Handle, this._client); + await configure(arg1, arg2); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/publishAsDockerComposeService', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); } } -// ============================================================================ -// ContainerRegistryResource -// ============================================================================ - -export class ContainerRegistryResource extends ResourceBuilderBase { - constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { - super(handle, client); - } +/** + * Thenable wrapper for DotnetToolResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { - const helpLink = options?.helpLink; - return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { - const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { - const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } -} + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } -/** - * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ContainerRegistryResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } - then( - onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -3029,1716 +11212,1919 @@ export class ContainerRegistryResourcePromise implements PromiseLike obj.getResourceName()); } + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); + } + } // ============================================================================ -// ContainerResource +// ExecutableResource // ============================================================================ -export class ContainerResource extends ResourceBuilderBase { - constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { - super(handle, client); +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageTagInternal(tag)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - const tag = options?.tag; - return new ContainerResourcePromise(this._withImageInternal(image, tag)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); } /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); } /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsContainerInternal()); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNameInternal(name)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterInternal()); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - const helpLink = options?.helpLink; - return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsInternal(args)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + return new ExecutableResource(result, this._client); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); + private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { + const configureId = registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as DockerComposeServiceResourceHandle; + const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); + const arg2Handle = wrapIfHandle(args.p1) as ServiceHandle; + const arg2 = new Service(arg2Handle, this._client); + await configure(arg1, arg2); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/publishAsDockerComposeService', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); } - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new ContainerResource(result, this._client); +} + +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromManifestInternal()); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForInternal(dependency)); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExplicitStartInternal()); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - const exitCode = options?.exitCode; - return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - const password = options?.password; - return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromMcpInternal()); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } -} - -/** - * Thenable wrapper for ContainerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ContainerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } - then( - onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); } - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** @internal */ + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } +} - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); - } - - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -4749,4524 +13135,4719 @@ export class ContainerResourcePromise implements PromiseLike } // ============================================================================ -// CSharpAppResource +// ParameterResource // ============================================================================ -export class CSharpAppResource extends ResourceBuilderBase { - constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ParameterResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ParameterResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withReplicasInternal(replicas: number): Promise { - const rpcArgs: Record = { builder: this._handle, replicas }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReplicas', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _disableForwardedHeadersInternal(): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/disableForwardedHeaders', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - const helpLink = options?.helpLink; - return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsInternal(args)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new CSharpAppResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - const exitCode = options?.exitCode; - return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - const commandOptions = options?.commandOptions; - return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - const password = options?.password; - return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - const iconVariant = options?.iconVariant; - return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); + return new ProjectResource(result, this._client); } -} - -/** - * Thenable wrapper for CSharpAppResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class CSharpAppResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); - } - - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); - } - - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); - } - - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); - } - - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); - } - - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); - } - - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); - } - - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); - } - - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); - } - - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ProjectResource(result, this._client); } -} + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } -// ============================================================================ -// DotnetToolResource -// ============================================================================ + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } -export class DotnetToolResource extends ResourceBuilderBase { - constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } /** @internal */ - private async _withToolPackageInternal(packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPackage', + private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { + const configureId = registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as DockerComposeServiceResourceHandle; + const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); + const arg2Handle = wrapIfHandle(args.p1) as ServiceHandle; + const arg2 = new Service(arg2Handle, this._client); + await configure(arg1, arg2); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/publishAsDockerComposeService', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); } - /** @internal */ - private async _withToolVersionInternal(version: string): Promise { - const rpcArgs: Record = { builder: this._handle, version }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolVersion', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } +} - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** @internal */ - private async _withToolPrereleaseInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPrerelease', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** @internal */ - private async _withToolSourceInternal(source: string): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolSource', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** @internal */ - private async _withToolIgnoreExistingFeedsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreExistingFeeds', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withToolIgnoreFailedSourcesInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreFailedSources', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } - /** @internal */ - private async _publishAsDockerFileInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFile', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); } - /** @internal */ - private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; - const obj = new ContainerResource(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFileWithConfigure', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** @internal */ - private async _withExecutableCommandInternal(command: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExecutableCommand', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** @internal */ - private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { - const rpcArgs: Record = { builder: this._handle, workingDirectory }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withWorkingDirectory', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); } - /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - const helpLink = options?.helpLink; - return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsInternal(args)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); +} + +// ============================================================================ +// RedisCommanderResource +// ============================================================================ + +export class RedisCommanderResource extends ResourceBuilderBase { + constructor(handle: RedisCommanderResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new DotnetToolResource(result, this._client); - } - - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + return new RedisCommanderResource(result, this._client); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisCommanderResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisCommanderResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets the container image tag */ + withImageTag(tag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { - const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { - const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisCommanderResourcePromise { + const tag = options?.tag; + return new RedisCommanderResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + return new RedisCommanderResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withLifetimeInternal(lifetime)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisCommanderResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new RedisCommanderResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Sets the container name */ + withContainerName(name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerNameInternal(name)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withBuildArgInternal(name, value)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { - const exitCode = options?.exitCode; - return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisCommanderResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new RedisCommanderResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { - const commandOptions = options?.commandOptions; - return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerNetworkAliasInternal(alias)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisCommanderResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new RedisCommanderResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { - const password = options?.password; - return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _publishAsConnectionStringInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._publishAsConnectionStringInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisCommanderResourcePromise { + const helpLink = options?.helpLink; + return new RedisCommanderResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { - const iconVariant = options?.iconVariant; - return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds arguments */ + withArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withArgsCallbackInternal(callback)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); + return new RedisCommanderResource(result, this._client); } -} - -/** - * Thenable wrapper for DotnetToolResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class DotnetToolResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } - then( - onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisCommanderResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new RedisCommanderResourcePromise(this._withReferenceInternal(source, connectionName, optional)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withServiceReferenceInternal(source)); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withReferenceUriInternal(name, uri)); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisCommanderResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new RedisCommanderResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisCommanderResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisCommanderResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisCommanderResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisCommanderResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._asHttp2ServiceInternal()); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisCommanderResourcePromise { + const displayText = options?.displayText; + return new RedisCommanderResourcePromise(this._withUrlInternal(url, displayText)); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisCommanderResourcePromise { + const displayText = options?.displayText; + return new RedisCommanderResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._excludeFromManifestInternal()); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForInternal(dependency)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForStartInternal(dependency)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withExplicitStartInternal()); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisCommanderResourcePromise { + const exitCode = options?.exitCode; + return new RedisCommanderResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Adds a health check by key */ + withHealthCheck(key: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withHealthCheckInternal(key)); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisCommanderResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new RedisCommanderResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisCommanderResourcePromise { + const commandOptions = options?.commandOptions; + return new RedisCommanderResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisCommanderResourcePromise { + const password = options?.password; + return new RedisCommanderResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withChildRelationshipInternal(child)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisCommanderResourcePromise { + const iconVariant = options?.iconVariant; + return new RedisCommanderResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); } -} - -// ============================================================================ -// ExecutableResource -// ============================================================================ - -export class ExecutableResource extends ResourceBuilderBase { - constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisCommanderResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new RedisCommanderResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisCommanderResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new RedisCommanderResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - const helpLink = options?.helpLink; - return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisCommanderResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisCommanderResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); } - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisCommanderHostPort', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Sets the host port for Redis Commander */ + withHostPort(options?: WithHostPortOptions): RedisCommanderResourcePromise { + const port = options?.port; + return new RedisCommanderResourcePromise(this._withHostPortInternal(port)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { + const configureId = registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as DockerComposeServiceResourceHandle; + const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); + const arg2Handle = wrapIfHandle(args.p1) as ServiceHandle; + const arg2 = new Service(arg2Handle, this._client); + await configure(arg1, arg2); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/publishAsDockerComposeService', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisCommanderResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); } - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new ExecutableResource(result, this._client); +} + +/** + * Thenable wrapper for RedisCommanderResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class RedisCommanderResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: RedisCommanderResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the container image tag */ + withImageTag(tag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } - /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsInternal(args)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.publishAsContainer())); } - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Sets the container name */ + withContainerName(name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerName(name))); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds arguments */ + withArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { - const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { - const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForInternal(dependency)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + /** Adds a health check by key */ + withHealthCheck(key: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExplicitStartInternal()); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { - const exitCode = options?.exitCode; - return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { - const commandOptions = options?.commandOptions; - return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { - const password = options?.password; - return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Sets the host port for Redis Commander */ + withHostPort(options?: WithHostPortOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHostPort(options))); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); +} + +// ============================================================================ +// RedisInsightResource +// ============================================================================ + +export class RedisInsightResource extends ResourceBuilderBase { + constructor(handle: RedisInsightResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisInsightResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisInsightResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { - const iconVariant = options?.iconVariant; - return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Sets the container image tag */ + withImageTag(tag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisInsightResourcePromise { + const tag = options?.tag; + return new RedisInsightResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withLifetimeInternal(lifetime)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); - return new ExecutableResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', rpcArgs ); + return new RedisInsightResource(result, this._client); } -} - -/** - * Thenable wrapper for ExecutableResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ExecutableResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._publishAsContainerInternal()); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisInsightResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new RedisInsightResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Sets the container name */ + withContainerName(name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerNameInternal(name)); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withBuildArgInternal(name, value)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withBuildSecretInternal(name, value)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisInsightResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new RedisInsightResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerNetworkAliasInternal(alias)); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisInsightResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new RedisInsightResourcePromise(this._withMcpServerInternal(path, endpointName)); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withOtlpExporterInternal()); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._publishAsConnectionStringInternal()); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisInsightResourcePromise { + const helpLink = options?.helpLink; + return new RedisInsightResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentInternal(name, value)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentCallbackInternal(callback)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Adds arguments */ + withArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withArgsInternal(args)); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withArgsCallbackInternal(callback)); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisInsightResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new RedisInsightResourcePromise(this._withReferenceInternal(source, connectionName, optional)); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withServiceReferenceInternal(source)); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withReferenceUriInternal(name, uri)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisInsightResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new RedisInsightResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); } -} - -// ============================================================================ -// ExternalServiceResource -// ============================================================================ - -export class ExternalServiceResource extends ResourceBuilderBase { - constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisInsightResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisInsightResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisInsightResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisInsightResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** @internal */ - private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); - } - - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - const helpLink = options?.helpLink; - return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + withUrl(url: string, options?: WithUrlOptions): RedisInsightResourcePromise { const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + return new RedisInsightResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisInsightResourcePromise { const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new RedisInsightResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisInsightResourcePromise { + const exitCode = options?.exitCode; + return new RedisInsightResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisInsightResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new RedisInsightResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -9274,113 +17855,204 @@ export class ExternalServiceResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisInsightResourcePromise { const commandOptions = options?.commandOptions; - return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new RedisInsightResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisInsightResourcePromise { + const password = options?.password; + return new RedisInsightResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): RedisInsightResourcePromise { const iconVariant = options?.iconVariant; - return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new RedisInsightResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisInsightResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new RedisInsightResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -9391,60 +18063,79 @@ export class ExternalServiceResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisInsightResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new RedisInsightResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new RedisInsightResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisInsightResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); } /** Gets the resource name */ @@ -9456,1055 +18147,1281 @@ export class ExternalServiceResource extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsightHostPort', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the host port for Redis Insight */ + withHostPort(options?: WithHostPortOptions): RedisInsightResourcePromise { + const port = options?.port; + return new RedisInsightResourcePromise(this._withHostPortInternal(port)); + } + + /** @internal */ + private async _withDataVolumeInternal(name?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsightDataVolume', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a data volume for Redis Insight */ + withDataVolume(options?: WithDataVolumeOptions): RedisInsightResourcePromise { + const name = options?.name; + return new RedisInsightResourcePromise(this._withDataVolumeInternal(name)); + } + + /** @internal */ + private async _withDataBindMountInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsightDataBindMount', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a data bind mount for Redis Insight */ + withDataBindMount(source: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withDataBindMountInternal(source)); + } + + /** @internal */ + private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { + const configureId = registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as DockerComposeServiceResourceHandle; + const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); + const arg2Handle = wrapIfHandle(args.p1) as ServiceHandle; + const arg2 = new Service(arg2Handle, this._client); + await configure(arg1, arg2); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/publishAsDockerComposeService', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); + } + } /** - * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * Thenable wrapper for RedisInsightResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ExternalServiceResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class RedisInsightResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: RedisInsightResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds arguments */ + withArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } -} + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } -// ============================================================================ -// ParameterResource -// ============================================================================ + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } -export class ParameterResource extends ResourceBuilderBase { - constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds a health check by key */ + withHealthCheck(key: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** @internal */ - private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, description }; - if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDescription', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - const enableMarkdown = options?.enableMarkdown; - return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - const helpLink = options?.helpLink; - return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromManifestInternal()); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets the host port for Redis Insight */ + withHostPort(options?: WithHostPortOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHostPort(options))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._withExplicitStartInternal()); + /** Adds a data volume for Redis Insight */ + withDataVolume(options?: WithDataVolumeOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Adds a data bind mount for Redis Insight */ + withDataBindMount(source: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDataBindMount(source))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ParameterResource(result, this._client); +} + +// ============================================================================ +// RedisResource +// ============================================================================ + +export class RedisResource extends ResourceBuilderBase { + constructor(handle: RedisResourceHandle, client: AspireClientRpc) { + super(handle, client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - const commandOptions = options?.commandOptions; - return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); - } + /** Gets the PrimaryEndpoint property */ + primaryEndpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.primaryEndpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.host', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.port', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the TlsEnabled property */ + tlsEnabled = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.tlsEnabled', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.setTlsEnabled', + { context: this._handle, value } + ); + } + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ParameterResource(result, this._client); - } + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.uriExpression', + { context: this._handle } + ); + }, + }; - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); - } + /** Gets the Entrypoint property */ + entrypoint = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.entrypoint', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.setEntrypoint', + { context: this._handle, value } + ); + } + }; - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ParameterResource(result, this._client); - } + /** Gets the ShellExecution property */ + shellExecution = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.shellExecution', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.setShellExecution', + { context: this._handle, value } + ); + } + }; - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); - } + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.name', + { context: this._handle } + ); + }, + }; /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - const iconVariant = options?.iconVariant; - return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromMcpInternal()); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisResourcePromise { + return new RedisResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Sets the container image tag */ + withImageTag(tag: string): RedisResourcePromise { + return new RedisResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisResourcePromise { + return new RedisResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisResourcePromise { + const tag = options?.tag; + return new RedisResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new ParameterResource(result, this._client); + return new RedisResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisResourcePromise { + return new RedisResourcePromise(this._withImageSHA256Internal(sha256)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs - ); - } - -} - -/** - * Thenable wrapper for ParameterResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ParameterResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); - } - - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); - } - - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); - } - - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + ); + return new RedisResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerRuntimeArgsInternal(args)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisResourcePromise { + return new RedisResourcePromise(this._withLifetimeInternal(lifetime)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisResourcePromise { + return new RedisResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisResourcePromise { + return new RedisResourcePromise(this._publishAsContainerInternal()); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new RedisResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Sets the container name */ + withContainerName(name: string): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerNameInternal(name)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new RedisResource(result, this._client); } -} + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withBuildArgInternal(name, value)); + } -// ============================================================================ -// ProjectResource -// ============================================================================ + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new RedisResource(result, this._client); + } -export class ProjectResource extends ResourceBuilderBase { - constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new RedisResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + withMcpServer(options?: WithMcpServerOptions): RedisResourcePromise { const path = options?.path; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + return new RedisResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { + private async _withOtlpExporterInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterInternal()); + withOtlpExporter(): RedisResourcePromise { + return new RedisResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisResourcePromise { + return new RedisResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisResourcePromise { + return new RedisResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisResourcePromise { const helpLink = options?.helpLink; - return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new RedisResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { + private async _withEnvironmentInternal(name: string, value: string): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + withEnvironment(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentExpression', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; const obj = new EnvironmentCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + return new RedisResourcePromise(this._withReferenceInternal(source, connectionName, optional)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withServiceReference', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + withServiceReference(source: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withServiceReferenceInternal(source)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withServiceReferenceNamed', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisResourcePromise { + return new RedisResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): RedisResourcePromise { + return new RedisResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): RedisResourcePromise { + return new RedisResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -10514,15 +19431,15 @@ export class ProjectResource extends ResourceBuilderBase if (isProxied !== undefined) rpcArgs.isProxied = isProxied; if (isExternal !== undefined) rpcArgs.isExternal = isExternal; if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + withEndpoint(options?: WithEndpointOptions): RedisResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -10531,72 +19448,72 @@ export class ProjectResource extends ResourceBuilderBase const isProxied = options?.isProxied; const isExternal = options?.isExternal; const protocol = options?.protocol; - return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + return new RedisResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new RedisResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new RedisResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): RedisResourcePromise { + return new RedisResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -10609,293 +19526,278 @@ export class ProjectResource extends ResourceBuilderBase } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): RedisResourcePromise { + return new RedisResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + withUrl(url: string, options?: WithUrlOptions): RedisResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + return new RedisResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new RedisResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); - } - - /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): RedisResourcePromise { + return new RedisResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitFor', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): RedisResourcePromise { + return new RedisResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForCompletion', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisResourcePromise { const exitCode = options?.exitCode; - return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new RedisResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): RedisResourcePromise { + return new RedisResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new RedisResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -10903,130 +19805,130 @@ export class ProjectResource extends ResourceBuilderBase }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisResourcePromise { const commandOptions = options?.commandOptions; - return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new RedisResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): RedisResourcePromise { + return new RedisResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsDeveloperCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisResourcePromise { const password = options?.password; - return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new RedisResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): RedisResourcePromise { + return new RedisResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): RedisResourcePromise { const iconVariant = options?.iconVariant; - return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new RedisResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -11035,15 +19937,15 @@ export class ProjectResource extends ResourceBuilderBase if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -11051,56 +19953,56 @@ export class ProjectResource extends ResourceBuilderBase const failureThreshold = options?.failureThreshold; const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new RedisResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): RedisResourcePromise { + return new RedisResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): RedisResourcePromise { + return new RedisResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): RedisResourcePromise { + return new RedisResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -11111,216 +20013,488 @@ export class ProjectResource extends ResourceBuilderBase if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; if (tags !== undefined) rpcArgs.tags = tags; if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new RedisResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withRedisCommanderInternal(configureContainer?: (obj: RedisCommanderResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as RedisCommanderResourceHandle; + const obj = new RedisCommanderResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisCommander', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds Redis Commander management UI */ + withRedisCommander(options?: WithRedisCommanderOptions): RedisResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new RedisResourcePromise(this._withRedisCommanderInternal(configureContainer, containerName)); + } + + /** @internal */ + private async _withRedisInsightInternal(configureContainer?: (obj: RedisInsightResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as RedisInsightResourceHandle; + const obj = new RedisInsightResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsight', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds Redis Insight management UI */ + withRedisInsight(options?: WithRedisInsightOptions): RedisResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new RedisResourcePromise(this._withRedisInsightInternal(configureContainer, containerName)); + } + + /** @internal */ + private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withDataVolume', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a data volume with persistence */ + withDataVolume(options?: WithDataVolumeOptions): RedisResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + } + + /** @internal */ + private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withDataBindMount', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a data bind mount with persistence */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): RedisResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); + } + + /** @internal */ + private async _withPersistenceInternal(interval?: number, keysChangedThreshold?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (interval !== undefined) rpcArgs.interval = interval; + if (keysChangedThreshold !== undefined) rpcArgs.keysChangedThreshold = keysChangedThreshold; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withPersistence', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures Redis persistence */ + withPersistence(options?: WithPersistenceOptions): RedisResourcePromise { + const interval = options?.interval; + const keysChangedThreshold = options?.keysChangedThreshold; + return new RedisResourcePromise(this._withPersistenceInternal(interval, keysChangedThreshold)); + } + + /** @internal */ + private async _withPasswordInternal(password: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, password }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withPassword', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Configures the password for Redis */ + withPassword(password: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withPasswordInternal(password)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withHostPort', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the host port for Redis */ + withHostPort(options?: WithHostPortOptions): RedisResourcePromise { + const port = options?.port; + return new RedisResourcePromise(this._withHostPortInternal(port)); + } + + /** @internal */ + private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { + const configureId = registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as DockerComposeServiceResourceHandle; + const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); + const arg2Handle = wrapIfHandle(args.p1) as ServiceHandle; + const arg2 = new Service(arg2Handle, this._client); + await configure(arg1, arg2); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/publishAsDockerComposeService', rpcArgs ); + return new RedisResource(result, this._client); + } + + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); } } /** - * Thenable wrapper for ProjectResource that enables fluent chaining. + * Thenable wrapper for RedisResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ProjectResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class RedisResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: RedisResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + withMcpServer(options?: WithMcpServerOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + withOtlpExporter(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + withEnvironment(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + withServiceReference(source: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); } /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -11329,163 +20503,163 @@ export class ProjectResourcePromise implements PromiseLike { } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } /** Gets the resource name */ @@ -11493,6 +20667,102 @@ export class ProjectResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Adds Redis Commander management UI */ + withRedisCommander(options?: WithRedisCommanderOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRedisCommander(options))); + } + + /** Adds Redis Insight management UI */ + withRedisInsight(options?: WithRedisInsightOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRedisInsight(options))); + } + + /** Adds a data volume with persistence */ + withDataVolume(options?: WithDataVolumeOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + } + + /** Adds a data bind mount with persistence */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); + } + + /** Configures Redis persistence */ + withPersistence(options?: WithPersistenceOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPersistence(options))); + } + + /** Configures the password for Redis */ + withPassword(password: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPassword(password))); + } + + /** Sets the host port for Redis */ + withHostPort(options?: WithHostPortOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); + } + +} + +// ============================================================================ +// ComputeResource +// ============================================================================ + +export class ComputeResource extends ResourceBuilderBase { + constructor(handle: IComputeResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { + const configureId = registerCallback(async (argsData: unknown) => { + const args = argsData as { p0: unknown, p1: unknown }; + const arg1Handle = wrapIfHandle(args.p0) as DockerComposeServiceResourceHandle; + const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); + const arg2Handle = wrapIfHandle(args.p1) as ServiceHandle; + const arg2 = new Service(arg2Handle, this._client); + await configure(arg1, arg2); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/publishAsDockerComposeService', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): ComputeResourcePromise { + return new ComputeResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); + } + +} + +/** + * Thenable wrapper for ComputeResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ComputeResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ComputeResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); + } + } // ============================================================================ @@ -13283,17 +22553,25 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepConte registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting.Docker/Aspire.Hosting.Docker.Resources.ComposeNodes.Service', (handle, client) => new Service(handle as ServiceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource', (handle, client) => new CSharpAppResource(handle as CSharpAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Docker/Aspire.Hosting.Docker.DockerComposeAspireDashboardResource', (handle, client) => new DockerComposeAspireDashboardResource(handle as DockerComposeAspireDashboardResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Docker/Aspire.Hosting.Docker.DockerComposeEnvironmentResource', (handle, client) => new DockerComposeEnvironmentResource(handle as DockerComposeEnvironmentResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Docker/Aspire.Hosting.Docker.DockerComposeServiceResource', (handle, client) => new DockerComposeServiceResource(handle as DockerComposeServiceResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisCommanderResource', (handle, client) => new RedisCommanderResource(handle as RedisCommanderResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisInsightResource', (handle, client) => new RedisInsightResource(handle as RedisInsightResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.ApplicationModel.RedisResource', (handle, client) => new RedisResource(handle as RedisResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource', (handle, client) => new ComputeResource(handle as IComputeResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); diff --git a/samples/health-checks-ui/ts/apphost.run.json b/samples/health-checks-ui/ts/apphost.run.json new file mode 100644 index 00000000..d2a34576 --- /dev/null +++ b/samples/health-checks-ui/ts/apphost.run.json @@ -0,0 +1,11 @@ +{ + "profiles": { + "https": { + "applicationUrl": "https://localhost:55469;http://localhost:44473", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:62071", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:51097" + } + } + } +} \ No newline at end of file diff --git a/samples/health-checks-ui/ts/apphost.ts b/samples/health-checks-ui/ts/apphost.ts index 13c120d0..7f4a0bb7 100644 --- a/samples/health-checks-ui/ts/apphost.ts +++ b/samples/health-checks-ui/ts/apphost.ts @@ -1,12 +1,4 @@ -// Setup: Run the following commands to add required integrations: -// aspire add redis -// aspire add docker -// -// Note: ProbeType, addDockerComposeEnvironment, addHealthChecksUI, and withHttpProbe -// are expected to be available after aspire add docker. If ProbeType is not exported -// in the generated SDK, the withHttpProbe calls may need to be removed. - -import { createBuilder, ProbeType } from "./.modules/aspire.js"; +import { createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); @@ -14,33 +6,18 @@ builder.addDockerComposeEnvironment("compose"); const cache = builder.addRedis("cache"); -const apiService = builder.addProject("apiservice") - .withHttpHealthCheck("/health") - .withHttpProbe(ProbeType.Liveness, "/alive"); -// POLYGLOT GAP: .WithFriendlyUrls(displayText: "API") — WithFriendlyUrls is a custom C# extension -// method defined in the AppHost project. It needs [AspireExport] to be available here. +const apiService = builder.addProject("apiservice", "../HealthChecksUI.ApiService/HealthChecksUI.ApiService.csproj", "https") + .withHttpHealthCheck("/health"); -const webFrontend = builder.addProject("webfrontend") +const webFrontend = builder.addProject("webfrontend", "../HealthChecksUI.Web/HealthChecksUI.Web.csproj", "https") .withReference(cache) .waitFor(cache) .withReference(apiService) .waitFor(apiService) - .withHttpProbe(ProbeType.Liveness, "/alive") .withHttpHealthCheck("/health") .withExternalHttpEndpoints(); -// POLYGLOT GAP: .WithFriendlyUrls("Web Frontend") — custom C# extension method. - -const healthChecksUI = builder.addHealthChecksUI("healthchecksui") - .withReference(apiService) - .withReference(webFrontend) - .withHttpProbe(ProbeType.Liveness, "/") - .withExternalHttpEndpoints(); -// POLYGLOT GAP: .WithFriendlyUrls("HealthChecksUI Dashboard", "http") — custom C# extension method. -const execCtx = await builder.executionContext.get(); -const isRunMode = await execCtx.isRunMode.get(); -if (isRunMode) { - healthChecksUI.withHostPort(7230); -} +// Note: AddHealthChecksUI is not yet available in the TypeScript SDK. +// See the cs/ directory for the full implementation with HealthChecksUI dashboard. await builder.build().run(); diff --git a/samples/health-checks-ui/ts/package-lock.json b/samples/health-checks-ui/ts/package-lock.json index c4d3800c..58af53f3 100644 --- a/samples/health-checks-ui/ts/package-lock.json +++ b/samples/health-checks-ui/ts/package-lock.json @@ -1,6 +1,962 @@ { - "name": "ts", + "name": "healthchecksui", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, - "packages": {} + "packages": { + "": { + "name": "healthchecksui", + "version": "1.0.0", + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz", + "integrity": "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.3.tgz", + "integrity": "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.3.tgz", + "integrity": "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.3.tgz", + "integrity": "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.3.tgz", + "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.3.tgz", + "integrity": "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.3.tgz", + "integrity": "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.3.tgz", + "integrity": "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.3.tgz", + "integrity": "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.3.tgz", + "integrity": "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.3.tgz", + "integrity": "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.3.tgz", + "integrity": "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.3.tgz", + "integrity": "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.3.tgz", + "integrity": "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.3.tgz", + "integrity": "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.3.tgz", + "integrity": "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz", + "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.3.tgz", + "integrity": "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.3.tgz", + "integrity": "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.3.tgz", + "integrity": "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.3.tgz", + "integrity": "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.3.tgz", + "integrity": "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.3.tgz", + "integrity": "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.3.tgz", + "integrity": "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.3.tgz", + "integrity": "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.3.tgz", + "integrity": "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@types/node": { + "version": "20.19.37", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.37.tgz", + "integrity": "sha512-8kzdPJ3FsNsVIurqBs7oodNnCEVbni9yUEkaHbgptDACOPW04jimGagZ51E6+lXUwJjgnBw+hyko/lkFWCldqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.4.tgz", + "integrity": "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/esbuild": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.3.tgz", + "integrity": "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.27.3", + "@esbuild/android-arm": "0.27.3", + "@esbuild/android-arm64": "0.27.3", + "@esbuild/android-x64": "0.27.3", + "@esbuild/darwin-arm64": "0.27.3", + "@esbuild/darwin-x64": "0.27.3", + "@esbuild/freebsd-arm64": "0.27.3", + "@esbuild/freebsd-x64": "0.27.3", + "@esbuild/linux-arm": "0.27.3", + "@esbuild/linux-arm64": "0.27.3", + "@esbuild/linux-ia32": "0.27.3", + "@esbuild/linux-loong64": "0.27.3", + "@esbuild/linux-mips64el": "0.27.3", + "@esbuild/linux-ppc64": "0.27.3", + "@esbuild/linux-riscv64": "0.27.3", + "@esbuild/linux-s390x": "0.27.3", + "@esbuild/linux-x64": "0.27.3", + "@esbuild/netbsd-arm64": "0.27.3", + "@esbuild/netbsd-x64": "0.27.3", + "@esbuild/openbsd-arm64": "0.27.3", + "@esbuild/openbsd-x64": "0.27.3", + "@esbuild/openharmony-arm64": "0.27.3", + "@esbuild/sunos-x64": "0.27.3", + "@esbuild/win32-arm64": "0.27.3", + "@esbuild/win32-ia32": "0.27.3", + "@esbuild/win32-x64": "0.27.3" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-tsconfig": { + "version": "4.13.6", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.6.tgz", + "integrity": "sha512-shZT/QMiSHc/YBLxxOkMtgSid5HFoauqCE3/exfsEcwg1WkeqjG+V40yBbBrsD+jW2HDXcs28xOfcbm2jI8Ddw==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true, + "license": "ISC" + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/minimatch": { + "version": "10.2.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz", + "integrity": "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nodemon": { + "version": "3.1.14", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.14.tgz", + "integrity": "sha512-jakjZi93UtB3jHMWsXL68FXSAosbLfY0In5gtKq3niLSkrWznrVBzXFNOEMJUfc9+Ke7SHWoAZsiMkNP3vq6Jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^10.2.1", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true, + "license": "MIT" + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "license": "ISC", + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/tsx": { + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz", + "integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.27.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true, + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/vscode-jsonrpc": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.1.tgz", + "integrity": "sha512-kdjOSJ2lLIn7r1rtrMbbNCHjyMPfRnowdKjBQ+mGq6NAW5QY2bEZC/khaC5OR8svbbjvLEaIXkOq45e2X9BIbQ==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + } + } } diff --git a/samples/health-checks-ui/ts/package.json b/samples/health-checks-ui/ts/package.json new file mode 100644 index 00000000..4d912235 --- /dev/null +++ b/samples/health-checks-ui/ts/package.json @@ -0,0 +1,19 @@ +{ + "name": "healthchecksui", + "version": "1.0.0", + "type": "module", + "scripts": { + "start": "aspire run", + "build": "tsc", + "dev": "tsc --watch" + }, + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } +} \ No newline at end of file diff --git a/samples/health-checks-ui/ts/tsconfig.json b/samples/health-checks-ui/ts/tsconfig.json new file mode 100644 index 00000000..edf7302c --- /dev/null +++ b/samples/health-checks-ui/ts/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "outDir": "./dist", + "rootDir": "." + }, + "include": ["apphost.ts", ".modules/**/*.ts"], + "exclude": ["node_modules"] +} \ No newline at end of file diff --git a/samples/orleans-voting/ts/.aspire/settings.json b/samples/orleans-voting/ts/.aspire/settings.json index 3a9d225e..8beb9163 100644 --- a/samples/orleans-voting/ts/.aspire/settings.json +++ b/samples/orleans-voting/ts/.aspire/settings.json @@ -1,8 +1,10 @@ { "appHostPath": "../apphost.ts", + "language": "typescript/nodejs", + "channel": "staging", "sdkVersion": "13.2.0-preview.1.26159.1", "packages": { - "Aspire.Hosting.Redis": "13.1.2", - "Aspire.Hosting.Orleans": "13.1.2" + "Aspire.Hosting.Redis": "13.2.0-preview.1.26159.1", + "Aspire.Hosting.Orleans": "13.2.0-preview.1.26159.1" } } \ No newline at end of file diff --git a/samples/orleans-voting/ts/.modules/.codegen-hash b/samples/orleans-voting/ts/.modules/.codegen-hash index dd6c8838..c648850f 100644 --- a/samples/orleans-voting/ts/.modules/.codegen-hash +++ b/samples/orleans-voting/ts/.modules/.codegen-hash @@ -1 +1 @@ -CE101936110C8B56C4297D7C7545E8984957FCEB4E670953C016D56A8BF4FFF5 \ No newline at end of file +3DF283E73348B290509CE99152467BCE5C6DBDF051EE2E9CBE17F62C050D3512 \ No newline at end of file diff --git a/samples/orleans-voting/ts/.modules/aspire.ts b/samples/orleans-voting/ts/.modules/aspire.ts index 73dc52d2..366a28dd 100644 --- a/samples/orleans-voting/ts/.modules/aspire.ts +++ b/samples/orleans-voting/ts/.modules/aspire.ts @@ -26,6 +26,21 @@ import { // Handle Type Aliases (Internal - not exported to users) // ============================================================================ +/** Handle to OrleansService */ +type OrleansServiceHandle = Handle<'Aspire.Hosting.Orleans/Aspire.Hosting.Orleans.OrleansService'>; + +/** Handle to OrleansServiceClient */ +type OrleansServiceClientHandle = Handle<'Aspire.Hosting.Orleans/Aspire.Hosting.Orleans.OrleansServiceClient'>; + +/** Handle to RedisResource */ +type RedisResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting.ApplicationModel.RedisResource'>; + +/** Handle to RedisCommanderResource */ +type RedisCommanderResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisCommanderResource'>; + +/** Handle to RedisInsightResource */ +type RedisInsightResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisInsightResource'>; + /** Handle to CommandLineArgsCallbackContext */ type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; @@ -339,6 +354,15 @@ export interface AddParameterOptions { secret?: boolean; } +export interface AddRedisOptions { + port?: number; + password?: ParameterResource; +} + +export interface AddRedisWithPortOptions { + port?: number; +} + export interface AppendFormattedOptions { format?: string; } @@ -367,6 +391,15 @@ export interface WithCommandOptions { commandOptions?: CommandOptions; } +export interface WithDataBindMountOptions { + isReadOnly?: boolean; +} + +export interface WithDataVolumeOptions { + name?: string; + isReadOnly?: boolean; +} + export interface WithDescriptionOptions { enableMarkdown?: boolean; } @@ -397,6 +430,10 @@ export interface WithExternalServiceHttpHealthCheckOptions { statusCode?: number; } +export interface WithHostPortOptions { + port?: number; +} + export interface WithHttpEndpointOptions { port?: number; targetPort?: number; @@ -446,6 +483,11 @@ export interface WithMcpServerOptions { endpointName?: string; } +export interface WithPersistenceOptions { + interval?: number; + keysChangedThreshold?: number; +} + export interface WithPipelineStepFactoryOptions { dependsOn?: string[]; requiredBy?: string[]; @@ -453,6 +495,16 @@ export interface WithPipelineStepFactoryOptions { description?: string; } +export interface WithRedisCommanderOptions { + configureContainer?: (obj: RedisCommanderResource) => Promise; + containerName?: string; +} + +export interface WithRedisInsightOptions { + configureContainer?: (obj: RedisInsightResource) => Promise; + containerName?: string; +} + export interface WithReferenceOptions { connectionName?: string; optional?: boolean; @@ -943,6 +995,290 @@ export class ExecuteCommandContext { } +// ============================================================================ +// OrleansService +// ============================================================================ + +/** + * Type class for OrleansService. + */ +export class OrleansService { + constructor(private _handle: OrleansServiceHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Sets the Orleans cluster ID */ + /** @internal */ + async _withClusterIdInternal(clusterId: string): Promise { + const rpcArgs: Record = { orleansServiceBuilder: this._handle, clusterId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withClusterId', + rpcArgs + ); + return new OrleansService(result, this._client); + } + + withClusterId(clusterId: string): OrleansServicePromise { + return new OrleansServicePromise(this._withClusterIdInternal(clusterId)); + } + + /** Sets the Orleans service ID */ + /** @internal */ + async _withServiceIdInternal(serviceId: string): Promise { + const rpcArgs: Record = { orleansServiceBuilder: this._handle, serviceId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withServiceId', + rpcArgs + ); + return new OrleansService(result, this._client); + } + + withServiceId(serviceId: string): OrleansServicePromise { + return new OrleansServicePromise(this._withServiceIdInternal(serviceId)); + } + + /** Configures Orleans clustering using a resource connection */ + /** @internal */ + async _withClusteringInternal(provider: ResourceBuilderBase): Promise { + const rpcArgs: Record = { orleansServiceBuilder: this._handle, provider }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withClustering', + rpcArgs + ); + return new OrleansService(result, this._client); + } + + withClustering(provider: ResourceBuilderBase): OrleansServicePromise { + return new OrleansServicePromise(this._withClusteringInternal(provider)); + } + + /** Configures Orleans development clustering */ + /** @internal */ + async _withDevelopmentClusteringInternal(): Promise { + const rpcArgs: Record = { orleansServiceBuilder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withDevelopmentClustering', + rpcArgs + ); + return new OrleansService(result, this._client); + } + + withDevelopmentClustering(): OrleansServicePromise { + return new OrleansServicePromise(this._withDevelopmentClusteringInternal()); + } + + /** Adds an Orleans grain storage provider */ + /** @internal */ + async _withGrainStorageInternal(name: string, provider: ResourceBuilderBase): Promise { + const rpcArgs: Record = { orleansServiceBuilder: this._handle, name, provider }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withGrainStorage', + rpcArgs + ); + return new OrleansService(result, this._client); + } + + withGrainStorage(name: string, provider: ResourceBuilderBase): OrleansServicePromise { + return new OrleansServicePromise(this._withGrainStorageInternal(name, provider)); + } + + /** Adds in-memory Orleans grain storage */ + /** @internal */ + async _withMemoryGrainStorageInternal(name: string): Promise { + const rpcArgs: Record = { orleansServiceBuilder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withMemoryGrainStorage', + rpcArgs + ); + return new OrleansService(result, this._client); + } + + withMemoryGrainStorage(name: string): OrleansServicePromise { + return new OrleansServicePromise(this._withMemoryGrainStorageInternal(name)); + } + + /** Adds an Orleans stream provider */ + /** @internal */ + async _withStreamingInternal(name: string, provider: ResourceBuilderBase): Promise { + const rpcArgs: Record = { orleansServiceBuilder: this._handle, name, provider }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withStreaming', + rpcArgs + ); + return new OrleansService(result, this._client); + } + + withStreaming(name: string, provider: ResourceBuilderBase): OrleansServicePromise { + return new OrleansServicePromise(this._withStreamingInternal(name, provider)); + } + + /** Adds in-memory Orleans streaming */ + /** @internal */ + async _withMemoryStreamingInternal(name: string): Promise { + const rpcArgs: Record = { orleansServiceBuilder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withMemoryStreaming', + rpcArgs + ); + return new OrleansService(result, this._client); + } + + withMemoryStreaming(name: string): OrleansServicePromise { + return new OrleansServicePromise(this._withMemoryStreamingInternal(name)); + } + + /** Adds an Orleans broadcast channel provider */ + /** @internal */ + async _withBroadcastChannelInternal(name: string): Promise { + const rpcArgs: Record = { orleansServiceBuilder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withBroadcastChannel', + rpcArgs + ); + return new OrleansService(result, this._client); + } + + withBroadcastChannel(name: string): OrleansServicePromise { + return new OrleansServicePromise(this._withBroadcastChannelInternal(name)); + } + + /** Configures Orleans reminder storage */ + /** @internal */ + async _withRemindersInternal(provider: ResourceBuilderBase): Promise { + const rpcArgs: Record = { orleansServiceBuilder: this._handle, provider }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withReminders', + rpcArgs + ); + return new OrleansService(result, this._client); + } + + withReminders(provider: ResourceBuilderBase): OrleansServicePromise { + return new OrleansServicePromise(this._withRemindersInternal(provider)); + } + + /** Configures in-memory Orleans reminders */ + /** @internal */ + async _withMemoryRemindersInternal(): Promise { + const rpcArgs: Record = { orleansServiceBuilder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withMemoryReminders', + rpcArgs + ); + return new OrleansService(result, this._client); + } + + withMemoryReminders(): OrleansServicePromise { + return new OrleansServicePromise(this._withMemoryRemindersInternal()); + } + + /** Adds an Orleans grain directory provider */ + /** @internal */ + async _withGrainDirectoryInternal(name: string, provider: ResourceBuilderBase): Promise { + const rpcArgs: Record = { orleansServiceBuilder: this._handle, name, provider }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withGrainDirectory', + rpcArgs + ); + return new OrleansService(result, this._client); + } + + withGrainDirectory(name: string, provider: ResourceBuilderBase): OrleansServicePromise { + return new OrleansServicePromise(this._withGrainDirectoryInternal(name, provider)); + } + + /** Creates an Orleans client view for the service */ + async asClient(): Promise { + const rpcArgs: Record = { orleansService: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/asClient', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for OrleansService that enables fluent chaining. + */ +export class OrleansServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: OrleansService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Sets the Orleans cluster ID */ + withClusterId(clusterId: string): OrleansServicePromise { + return new OrleansServicePromise(this._promise.then(obj => obj.withClusterId(clusterId))); + } + + /** Sets the Orleans service ID */ + withServiceId(serviceId: string): OrleansServicePromise { + return new OrleansServicePromise(this._promise.then(obj => obj.withServiceId(serviceId))); + } + + /** Configures Orleans clustering using a resource connection */ + withClustering(provider: ResourceBuilderBase): OrleansServicePromise { + return new OrleansServicePromise(this._promise.then(obj => obj.withClustering(provider))); + } + + /** Configures Orleans development clustering */ + withDevelopmentClustering(): OrleansServicePromise { + return new OrleansServicePromise(this._promise.then(obj => obj.withDevelopmentClustering())); + } + + /** Adds an Orleans grain storage provider */ + withGrainStorage(name: string, provider: ResourceBuilderBase): OrleansServicePromise { + return new OrleansServicePromise(this._promise.then(obj => obj.withGrainStorage(name, provider))); + } + + /** Adds in-memory Orleans grain storage */ + withMemoryGrainStorage(name: string): OrleansServicePromise { + return new OrleansServicePromise(this._promise.then(obj => obj.withMemoryGrainStorage(name))); + } + + /** Adds an Orleans stream provider */ + withStreaming(name: string, provider: ResourceBuilderBase): OrleansServicePromise { + return new OrleansServicePromise(this._promise.then(obj => obj.withStreaming(name, provider))); + } + + /** Adds in-memory Orleans streaming */ + withMemoryStreaming(name: string): OrleansServicePromise { + return new OrleansServicePromise(this._promise.then(obj => obj.withMemoryStreaming(name))); + } + + /** Adds an Orleans broadcast channel provider */ + withBroadcastChannel(name: string): OrleansServicePromise { + return new OrleansServicePromise(this._promise.then(obj => obj.withBroadcastChannel(name))); + } + + /** Configures Orleans reminder storage */ + withReminders(provider: ResourceBuilderBase): OrleansServicePromise { + return new OrleansServicePromise(this._promise.then(obj => obj.withReminders(provider))); + } + + /** Configures in-memory Orleans reminders */ + withMemoryReminders(): OrleansServicePromise { + return new OrleansServicePromise(this._promise.then(obj => obj.withMemoryReminders())); + } + + /** Adds an Orleans grain directory provider */ + withGrainDirectory(name: string, provider: ResourceBuilderBase): OrleansServicePromise { + return new OrleansServicePromise(this._promise.then(obj => obj.withGrainDirectory(name, provider))); + } + + /** Creates an Orleans client view for the service */ + asClient(): Promise { + return this._promise.then(obj => obj.asClient()); + } + +} + // ============================================================================ // PipelineConfigurationContext // ============================================================================ @@ -1711,6 +2047,57 @@ export class DistributedApplicationBuilder { return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); } + /** Adds a Redis container resource with specific port */ + /** @internal */ + async _addRedisWithPortInternal(name: string, port?: number): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/addRedisWithPort', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { + const port = options?.port; + return new RedisResourcePromise(this._addRedisWithPortInternal(name, port)); + } + + /** Adds a Redis container resource */ + /** @internal */ + async _addRedisInternal(name: string, port?: number, password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (port !== undefined) rpcArgs.port = port; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/addRedis', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { + const port = options?.port; + const password = options?.password; + return new RedisResourcePromise(this._addRedisInternal(name, port, password)); + } + + /** Adds an Orleans service configuration */ + /** @internal */ + async _addOrleansInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/addOrleans', + rpcArgs + ); + return new OrleansService(result, this._client); + } + + addOrleans(name: string): OrleansServicePromise { + return new OrleansServicePromise(this._addOrleansInternal(name)); + } + } /** @@ -1801,6 +2188,21 @@ export class DistributedApplicationBuilderPromise implements PromiseLike obj.addCSharpAppWithOptions(name, path, configure))); } + /** Adds a Redis container resource with specific port */ + addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.addRedisWithPort(name, options))); + } + + /** Adds a Redis container resource */ + addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.addRedis(name, options))); + } + + /** Adds an Orleans service configuration */ + addOrleans(name: string): OrleansServicePromise { + return new OrleansServicePromise(this._promise.then(obj => obj.addOrleans(name))); + } + } // ============================================================================ @@ -3056,342 +3458,79 @@ export class ContainerResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + 'Aspire.Hosting/withMcpServer', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageTagInternal(tag)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - const tag = options?.tag; - return new ContainerResourcePromise(this._withImageInternal(image, tag)); - } - - /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); - } - - /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); - } - - /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); - } - - /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); - } - - /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsContainerInternal()); - } - - /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); - } - - /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNameInternal(name)); - } - - /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); - } - - /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); - } - - /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); - } - - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); - } - - /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); - } - - /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); - } - - /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterInternal()); - } - - /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); - } - - /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); - } - - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); return new ContainerResource(result, this._client); @@ -4316,32 +4455,43 @@ export class ContainerResource extends ResourceBuilderBase { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + private async _withOrleansClientReferenceInternal(orleansServiceClient: OrleansServiceClientHandle): Promise { + const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', + 'Aspire.Hosting.Orleans/withOrleansClientReference', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { + const rpcArgs: Record = { builder: this._handle, orleansService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansReference', rpcArgs ); + return new ContainerResource(result, this._client); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOrleansReferenceInternal(orleansService)); } } @@ -4366,91 +4516,11 @@ export class ContainerResourcePromise implements PromiseLike return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); - } - - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); - } - - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); - } - - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); - } - - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); - } - - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); - } - - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); - } - - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); - } - - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); - } - - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); - } - - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); - } - - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); - } - - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); - } - - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); - } - - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); - } - /** Sets the base image for a Dockerfile build */ withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); - } - /** Configures an MCP server endpoint on the resource */ withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); @@ -4466,11 +4536,6 @@ export class ContainerResourcePromise implements PromiseLike return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); - } - /** Adds a required command dependency */ withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); @@ -4736,16 +4801,21 @@ export class ContainerResourcePromise implements PromiseLike return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); - } - /** Gets the resource name */ getResourceName(): Promise { return this._promise.then(obj => obj.getResourceName()); } + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); + } + } // ============================================================================ @@ -5824,6 +5894,36 @@ export class CSharpAppResource extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansClientReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); + } + + /** @internal */ + private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { + const rpcArgs: Record = { builder: this._handle, orleansService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOrleansReferenceInternal(orleansService)); + } + } /** @@ -6151,6 +6251,16 @@ export class CSharpAppResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); + } + } // ============================================================================ @@ -7339,6 +7449,36 @@ export class DotnetToolResource extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansClientReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); + } + + /** @internal */ + private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { + const rpcArgs: Record = { builder: this._handle, orleansService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOrleansReferenceInternal(orleansService)); + } + } /** @@ -7701,6 +7841,16 @@ export class DotnetToolResourcePromise implements PromiseLike obj.getResourceName()); } + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); + } + } // ============================================================================ @@ -8734,6 +8884,36 @@ export class ExecutableResource extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansClientReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); + } + + /** @internal */ + private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { + const rpcArgs: Record = { builder: this._handle, orleansService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOrleansReferenceInternal(orleansService)); + } + } /** @@ -9046,6 +9226,16 @@ export class ExecutableResourcePromise implements PromiseLike obj.getResourceName()); } + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); + } + } // ============================================================================ @@ -11139,188 +11329,5861 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withOrleansClientReferenceInternal(orleansServiceClient: OrleansServiceClientHandle): Promise { + const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansClientReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); + } + + /** @internal */ + private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { + const rpcArgs: Record = { builder: this._handle, orleansService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOrleansReferenceInternal(orleansService)); + } + +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); + } + +} + +// ============================================================================ +// RedisCommanderResource +// ============================================================================ + +export class RedisCommanderResource extends ResourceBuilderBase { + constructor(handle: RedisCommanderResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisCommanderResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisCommanderResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisCommanderResourcePromise { + const tag = options?.tag; + return new RedisCommanderResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisCommanderResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new RedisCommanderResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisCommanderResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new RedisCommanderResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisCommanderResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new RedisCommanderResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisCommanderResourcePromise { + const helpLink = options?.helpLink; + return new RedisCommanderResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisCommanderResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new RedisCommanderResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisCommanderResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new RedisCommanderResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisCommanderResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisCommanderResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisCommanderResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisCommanderResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisCommanderResourcePromise { + const displayText = options?.displayText; + return new RedisCommanderResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisCommanderResourcePromise { + const displayText = options?.displayText; + return new RedisCommanderResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisCommanderResourcePromise { + const exitCode = options?.exitCode; + return new RedisCommanderResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisCommanderResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new RedisCommanderResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisCommanderResourcePromise { + const commandOptions = options?.commandOptions; + return new RedisCommanderResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisCommanderResourcePromise { + const password = options?.password; + return new RedisCommanderResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisCommanderResourcePromise { + const iconVariant = options?.iconVariant; + return new RedisCommanderResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisCommanderResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new RedisCommanderResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisCommanderResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new RedisCommanderResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisCommanderResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisCommanderResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisCommanderHostPort', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the host port for Redis Commander */ + withHostPort(options?: WithHostPortOptions): RedisCommanderResourcePromise { + const port = options?.port; + return new RedisCommanderResourcePromise(this._withHostPortInternal(port)); + } + + /** @internal */ + private async _withOrleansClientReferenceInternal(orleansServiceClient: OrleansServiceClientHandle): Promise { + const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansClientReference', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); + } + + /** @internal */ + private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { + const rpcArgs: Record = { builder: this._handle, orleansService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansReference', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withOrleansReferenceInternal(orleansService)); + } + +} + +/** + * Thenable wrapper for RedisCommanderResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class RedisCommanderResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: RedisCommanderResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Sets the host port for Redis Commander */ + withHostPort(options?: WithHostPortOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); + } + +} + +// ============================================================================ +// RedisInsightResource +// ============================================================================ + +export class RedisInsightResource extends ResourceBuilderBase { + constructor(handle: RedisInsightResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisInsightResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisInsightResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisInsightResourcePromise { + const tag = options?.tag; + return new RedisInsightResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisInsightResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new RedisInsightResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisInsightResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new RedisInsightResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisInsightResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new RedisInsightResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisInsightResourcePromise { + const helpLink = options?.helpLink; + return new RedisInsightResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisInsightResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new RedisInsightResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisInsightResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new RedisInsightResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisInsightResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisInsightResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisInsightResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisInsightResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisInsightResourcePromise { + const displayText = options?.displayText; + return new RedisInsightResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisInsightResourcePromise { + const displayText = options?.displayText; + return new RedisInsightResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisInsightResourcePromise { + const exitCode = options?.exitCode; + return new RedisInsightResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisInsightResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new RedisInsightResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisInsightResourcePromise { + const commandOptions = options?.commandOptions; + return new RedisInsightResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisInsightResourcePromise { + const password = options?.password; + return new RedisInsightResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisInsightResourcePromise { + const iconVariant = options?.iconVariant; + return new RedisInsightResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisInsightResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new RedisInsightResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisInsightResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new RedisInsightResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisInsightResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsightHostPort', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the host port for Redis Insight */ + withHostPort(options?: WithHostPortOptions): RedisInsightResourcePromise { + const port = options?.port; + return new RedisInsightResourcePromise(this._withHostPortInternal(port)); + } + + /** @internal */ + private async _withDataVolumeInternal(name?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsightDataVolume', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a data volume for Redis Insight */ + withDataVolume(options?: WithDataVolumeOptions): RedisInsightResourcePromise { + const name = options?.name; + return new RedisInsightResourcePromise(this._withDataVolumeInternal(name)); + } + + /** @internal */ + private async _withDataBindMountInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsightDataBindMount', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a data bind mount for Redis Insight */ + withDataBindMount(source: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withDataBindMountInternal(source)); + } + + /** @internal */ + private async _withOrleansClientReferenceInternal(orleansServiceClient: OrleansServiceClientHandle): Promise { + const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansClientReference', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); + } + + /** @internal */ + private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { + const rpcArgs: Record = { builder: this._handle, orleansService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansReference', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withOrleansReferenceInternal(orleansService)); + } + +} + +/** + * Thenable wrapper for RedisInsightResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class RedisInsightResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: RedisInsightResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Sets the host port for Redis Insight */ + withHostPort(options?: WithHostPortOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + + /** Adds a data volume for Redis Insight */ + withDataVolume(options?: WithDataVolumeOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + } + + /** Adds a data bind mount for Redis Insight */ + withDataBindMount(source: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDataBindMount(source))); + } + + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); + } + +} + +// ============================================================================ +// RedisResource +// ============================================================================ + +export class RedisResource extends ResourceBuilderBase { + constructor(handle: RedisResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the PrimaryEndpoint property */ + primaryEndpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.primaryEndpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.host', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.port', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the TlsEnabled property */ + tlsEnabled = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.tlsEnabled', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.setTlsEnabled', + { context: this._handle, value } + ); + } + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the Entrypoint property */ + entrypoint = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.entrypoint', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.setEntrypoint', + { context: this._handle, value } + ); + } + }; + + /** Gets the ShellExecution property */ + shellExecution = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.shellExecution', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.setShellExecution', + { context: this._handle, value } + ); + } + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisResourcePromise { + return new RedisResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisResourcePromise { + return new RedisResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisResourcePromise { + return new RedisResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisResourcePromise { + const tag = options?.tag; + return new RedisResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisResourcePromise { + return new RedisResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisResourcePromise { + return new RedisResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisResourcePromise { + return new RedisResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisResourcePromise { + return new RedisResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new RedisResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new RedisResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new RedisResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisResourcePromise { + return new RedisResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisResourcePromise { + return new RedisResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisResourcePromise { + return new RedisResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisResourcePromise { + const helpLink = options?.helpLink; + return new RedisResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new RedisResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisResourcePromise { + return new RedisResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisResourcePromise { + return new RedisResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisResourcePromise { + return new RedisResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new RedisResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisResourcePromise { + return new RedisResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisResourcePromise { + return new RedisResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisResourcePromise { + const displayText = options?.displayText; + return new RedisResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisResourcePromise { + const displayText = options?.displayText; + return new RedisResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisResourcePromise { + return new RedisResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisResourcePromise { + return new RedisResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisResourcePromise { + const exitCode = options?.exitCode; + return new RedisResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisResourcePromise { + return new RedisResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new RedisResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisResourcePromise { + const commandOptions = options?.commandOptions; + return new RedisResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisResourcePromise { + return new RedisResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisResourcePromise { + const password = options?.password; + return new RedisResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisResourcePromise { + return new RedisResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisResourcePromise { + const iconVariant = options?.iconVariant; + return new RedisResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new RedisResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisResourcePromise { + return new RedisResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisResourcePromise { + return new RedisResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisResourcePromise { + return new RedisResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new RedisResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withRedisCommanderInternal(configureContainer?: (obj: RedisCommanderResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as RedisCommanderResourceHandle; + const obj = new RedisCommanderResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisCommander', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds Redis Commander management UI */ + withRedisCommander(options?: WithRedisCommanderOptions): RedisResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new RedisResourcePromise(this._withRedisCommanderInternal(configureContainer, containerName)); + } + + /** @internal */ + private async _withRedisInsightInternal(configureContainer?: (obj: RedisInsightResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as RedisInsightResourceHandle; + const obj = new RedisInsightResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsight', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds Redis Insight management UI */ + withRedisInsight(options?: WithRedisInsightOptions): RedisResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new RedisResourcePromise(this._withRedisInsightInternal(configureContainer, containerName)); + } + + /** @internal */ + private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withDataVolume', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a data volume with persistence */ + withDataVolume(options?: WithDataVolumeOptions): RedisResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + } + + /** @internal */ + private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withDataBindMount', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a data bind mount with persistence */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): RedisResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); + } + + /** @internal */ + private async _withPersistenceInternal(interval?: number, keysChangedThreshold?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (interval !== undefined) rpcArgs.interval = interval; + if (keysChangedThreshold !== undefined) rpcArgs.keysChangedThreshold = keysChangedThreshold; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withPersistence', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures Redis persistence */ + withPersistence(options?: WithPersistenceOptions): RedisResourcePromise { + const interval = options?.interval; + const keysChangedThreshold = options?.keysChangedThreshold; + return new RedisResourcePromise(this._withPersistenceInternal(interval, keysChangedThreshold)); + } + + /** @internal */ + private async _withPasswordInternal(password: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, password }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withPassword', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures the password for Redis */ + withPassword(password: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withPasswordInternal(password)); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withHostPort', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Sets the host port for Redis */ + withHostPort(options?: WithHostPortOptions): RedisResourcePromise { + const port = options?.port; + return new RedisResourcePromise(this._withHostPortInternal(port)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withOrleansClientReferenceInternal(orleansServiceClient: OrleansServiceClientHandle): Promise { + const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansClientReference', rpcArgs ); - return new ProjectResource(result, this._client); + return new RedisResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): RedisResourcePromise { + return new RedisResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { + const rpcArgs: Record = { builder: this._handle, orleansService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansReference', rpcArgs ); + return new RedisResource(result, this._client); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): RedisResourcePromise { + return new RedisResourcePromise(this._withOrleansReferenceInternal(orleansService)); } } /** - * Thenable wrapper for ProjectResource that enables fluent chaining. + * Thenable wrapper for RedisResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ProjectResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class RedisResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: RedisResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + withMcpServer(options?: WithMcpServerOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + withOtlpExporter(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + withEnvironment(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + withEnvironmentExpression(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + withServiceReference(source: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); } /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -11329,163 +17192,163 @@ export class ProjectResourcePromise implements PromiseLike { } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } /** Gets the resource name */ @@ -11493,6 +17356,51 @@ export class ProjectResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Adds Redis Commander management UI */ + withRedisCommander(options?: WithRedisCommanderOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRedisCommander(options))); + } + + /** Adds Redis Insight management UI */ + withRedisInsight(options?: WithRedisInsightOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRedisInsight(options))); + } + + /** Adds a data volume with persistence */ + withDataVolume(options?: WithDataVolumeOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + } + + /** Adds a data bind mount with persistence */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); + } + + /** Configures Redis persistence */ + withPersistence(options?: WithPersistenceOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPersistence(options))); + } + + /** Configures the password for Redis */ + withPassword(password: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPassword(password))); + } + + /** Sets the host port for Redis */ + withHostPort(options?: WithHostPortOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); + } + } // ============================================================================ @@ -12892,6 +18800,36 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansClientReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); + } + + /** @internal */ + private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { + const rpcArgs: Record = { builder: this._handle, orleansService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansReference', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withOrleansReferenceInternal(orleansService)); + } + } /** @@ -13004,6 +18942,16 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withoutHttpsCertificate())); } + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); + } + } // ============================================================================ @@ -13277,6 +19225,7 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointRe registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting.Orleans/Aspire.Hosting.Orleans.OrleansService', (handle, client) => new OrleansService(handle as OrleansServiceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); @@ -13294,6 +19243,9 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.Executable registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisCommanderResource', (handle, client) => new RedisCommanderResource(handle as RedisCommanderResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisInsightResource', (handle, client) => new RedisInsightResource(handle as RedisInsightResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.ApplicationModel.RedisResource', (handle, client) => new RedisResource(handle as RedisResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); diff --git a/samples/orleans-voting/ts/apphost.run.json b/samples/orleans-voting/ts/apphost.run.json new file mode 100644 index 00000000..a66b5698 --- /dev/null +++ b/samples/orleans-voting/ts/apphost.run.json @@ -0,0 +1,11 @@ +{ + "profiles": { + "https": { + "applicationUrl": "https://localhost:31520;http://localhost:54968", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:19475", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:40651" + } + } + } +} \ No newline at end of file diff --git a/samples/orleans-voting/ts/apphost.ts b/samples/orleans-voting/ts/apphost.ts index 5f0fbe18..ce117b28 100644 --- a/samples/orleans-voting/ts/apphost.ts +++ b/samples/orleans-voting/ts/apphost.ts @@ -1,8 +1,4 @@ -// Setup: Run the following commands to add required integrations: -// aspire add redis -// aspire add orleans - -import { createBuilder } from "./.modules/aspire.js"; +import { createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); @@ -12,11 +8,10 @@ const orleans = builder.addOrleans("voting-cluster") .withClustering(redis) .withGrainStorage("votes", redis); -const votingFe = builder.addProject("voting-fe") +builder.addProject("voting-fe", "../OrleansVoting.Service/OrleansVoting.Service.csproj", "https") .withReference(orleans) .waitFor(redis) .withReplicas(3) .withExternalHttpEndpoints(); -// POLYGLOT GAP: .WithUrlForEndpoint callbacks for display text/location are not available. await builder.build().run(); diff --git a/samples/orleans-voting/ts/package-lock.json b/samples/orleans-voting/ts/package-lock.json index c4d3800c..6d69083c 100644 --- a/samples/orleans-voting/ts/package-lock.json +++ b/samples/orleans-voting/ts/package-lock.json @@ -1,6 +1,962 @@ { - "name": "ts", + "name": "orleansvoting", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, - "packages": {} + "packages": { + "": { + "name": "orleansvoting", + "version": "1.0.0", + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz", + "integrity": "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.3.tgz", + "integrity": "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.3.tgz", + "integrity": "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.3.tgz", + "integrity": "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.3.tgz", + "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.3.tgz", + "integrity": "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.3.tgz", + "integrity": "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.3.tgz", + "integrity": "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.3.tgz", + "integrity": "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.3.tgz", + "integrity": "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.3.tgz", + "integrity": "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.3.tgz", + "integrity": "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.3.tgz", + "integrity": "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.3.tgz", + "integrity": "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.3.tgz", + "integrity": "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.3.tgz", + "integrity": "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz", + "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.3.tgz", + "integrity": "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.3.tgz", + "integrity": "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.3.tgz", + "integrity": "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.3.tgz", + "integrity": "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.3.tgz", + "integrity": "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.3.tgz", + "integrity": "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.3.tgz", + "integrity": "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.3.tgz", + "integrity": "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.3.tgz", + "integrity": "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@types/node": { + "version": "20.19.37", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.37.tgz", + "integrity": "sha512-8kzdPJ3FsNsVIurqBs7oodNnCEVbni9yUEkaHbgptDACOPW04jimGagZ51E6+lXUwJjgnBw+hyko/lkFWCldqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.4.tgz", + "integrity": "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/esbuild": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.3.tgz", + "integrity": "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.27.3", + "@esbuild/android-arm": "0.27.3", + "@esbuild/android-arm64": "0.27.3", + "@esbuild/android-x64": "0.27.3", + "@esbuild/darwin-arm64": "0.27.3", + "@esbuild/darwin-x64": "0.27.3", + "@esbuild/freebsd-arm64": "0.27.3", + "@esbuild/freebsd-x64": "0.27.3", + "@esbuild/linux-arm": "0.27.3", + "@esbuild/linux-arm64": "0.27.3", + "@esbuild/linux-ia32": "0.27.3", + "@esbuild/linux-loong64": "0.27.3", + "@esbuild/linux-mips64el": "0.27.3", + "@esbuild/linux-ppc64": "0.27.3", + "@esbuild/linux-riscv64": "0.27.3", + "@esbuild/linux-s390x": "0.27.3", + "@esbuild/linux-x64": "0.27.3", + "@esbuild/netbsd-arm64": "0.27.3", + "@esbuild/netbsd-x64": "0.27.3", + "@esbuild/openbsd-arm64": "0.27.3", + "@esbuild/openbsd-x64": "0.27.3", + "@esbuild/openharmony-arm64": "0.27.3", + "@esbuild/sunos-x64": "0.27.3", + "@esbuild/win32-arm64": "0.27.3", + "@esbuild/win32-ia32": "0.27.3", + "@esbuild/win32-x64": "0.27.3" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-tsconfig": { + "version": "4.13.6", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.6.tgz", + "integrity": "sha512-shZT/QMiSHc/YBLxxOkMtgSid5HFoauqCE3/exfsEcwg1WkeqjG+V40yBbBrsD+jW2HDXcs28xOfcbm2jI8Ddw==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true, + "license": "ISC" + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/minimatch": { + "version": "10.2.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz", + "integrity": "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nodemon": { + "version": "3.1.14", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.14.tgz", + "integrity": "sha512-jakjZi93UtB3jHMWsXL68FXSAosbLfY0In5gtKq3niLSkrWznrVBzXFNOEMJUfc9+Ke7SHWoAZsiMkNP3vq6Jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^10.2.1", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true, + "license": "MIT" + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "license": "ISC", + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/tsx": { + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz", + "integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.27.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true, + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/vscode-jsonrpc": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.1.tgz", + "integrity": "sha512-kdjOSJ2lLIn7r1rtrMbbNCHjyMPfRnowdKjBQ+mGq6NAW5QY2bEZC/khaC5OR8svbbjvLEaIXkOq45e2X9BIbQ==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + } + } } diff --git a/samples/orleans-voting/ts/package.json b/samples/orleans-voting/ts/package.json new file mode 100644 index 00000000..e903d851 --- /dev/null +++ b/samples/orleans-voting/ts/package.json @@ -0,0 +1,19 @@ +{ + "name": "orleansvoting", + "version": "1.0.0", + "type": "module", + "scripts": { + "start": "aspire run", + "build": "tsc", + "dev": "tsc --watch" + }, + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } +} \ No newline at end of file diff --git a/samples/orleans-voting/ts/tsconfig.json b/samples/orleans-voting/ts/tsconfig.json new file mode 100644 index 00000000..edf7302c --- /dev/null +++ b/samples/orleans-voting/ts/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "outDir": "./dist", + "rootDir": "." + }, + "include": ["apphost.ts", ".modules/**/*.ts"], + "exclude": ["node_modules"] +} \ No newline at end of file diff --git a/samples/volume-mount/ts/.aspire/settings.json b/samples/volume-mount/ts/.aspire/settings.json index ef8ae858..f9d36596 100644 --- a/samples/volume-mount/ts/.aspire/settings.json +++ b/samples/volume-mount/ts/.aspire/settings.json @@ -1,8 +1,10 @@ { "appHostPath": "../apphost.ts", + "language": "typescript/nodejs", + "channel": "staging", "sdkVersion": "13.2.0-preview.1.26159.1", "packages": { - "Aspire.Hosting.SqlServer": "13.1.2", - "Aspire.Hosting.Azure.Storage": "13.1.2" + "Aspire.Hosting.SqlServer": "13.2.0-preview.1.26159.1", + "Aspire.Hosting.Azure.Storage": "13.2.0-preview.1.26159.1" } } \ No newline at end of file diff --git a/samples/volume-mount/ts/.modules/.codegen-hash b/samples/volume-mount/ts/.modules/.codegen-hash index 2a5d6507..5628150b 100644 --- a/samples/volume-mount/ts/.modules/.codegen-hash +++ b/samples/volume-mount/ts/.modules/.codegen-hash @@ -1 +1 @@ -0CA325CC136F8BB0FC38B839BD64C8D81521D5299613710FDEF9138B8AD90EF8 \ No newline at end of file +56A47AF31545CDE490D3B599CDB4136C17486DF59752D95D4B7E85432CC03DF1 \ No newline at end of file diff --git a/samples/volume-mount/ts/.modules/aspire.ts b/samples/volume-mount/ts/.modules/aspire.ts index 73dc52d2..3682e0f0 100644 --- a/samples/volume-mount/ts/.modules/aspire.ts +++ b/samples/volume-mount/ts/.modules/aspire.ts @@ -26,6 +26,63 @@ import { // Handle Type Aliases (Internal - not exported to users) // ============================================================================ +/** Handle to AzureBlobStorageContainerResource */ +type AzureBlobStorageContainerResourceHandle = Handle<'Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureBlobStorageContainerResource'>; + +/** Handle to AzureBlobStorageResource */ +type AzureBlobStorageResourceHandle = Handle<'Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureBlobStorageResource'>; + +/** Handle to AzureDataLakeStorageFileSystemResource */ +type AzureDataLakeStorageFileSystemResourceHandle = Handle<'Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureDataLakeStorageFileSystemResource'>; + +/** Handle to AzureDataLakeStorageResource */ +type AzureDataLakeStorageResourceHandle = Handle<'Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureDataLakeStorageResource'>; + +/** Handle to AzureQueueStorageQueueResource */ +type AzureQueueStorageQueueResourceHandle = Handle<'Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureQueueStorageQueueResource'>; + +/** Handle to AzureQueueStorageResource */ +type AzureQueueStorageResourceHandle = Handle<'Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureQueueStorageResource'>; + +/** Handle to AzureStorageEmulatorResource */ +type AzureStorageEmulatorResourceHandle = Handle<'Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureStorageEmulatorResource'>; + +/** Handle to AzureStorageResource */ +type AzureStorageResourceHandle = Handle<'Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureStorageResource'>; + +/** Handle to AzureTableStorageResource */ +type AzureTableStorageResourceHandle = Handle<'Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureTableStorageResource'>; + +/** Handle to IAzureResource */ +type IAzureResourceHandle = Handle<'Aspire.Hosting.Azure/Aspire.Hosting.ApplicationModel.IAzureResource'>; + +/** Handle to AzureBicepResource */ +type AzureBicepResourceHandle = Handle<'Aspire.Hosting.Azure/Aspire.Hosting.Azure.AzureBicepResource'>; + +/** Handle to AzureEnvironmentResource */ +type AzureEnvironmentResourceHandle = Handle<'Aspire.Hosting.Azure/Aspire.Hosting.Azure.AzureEnvironmentResource'>; + +/** Handle to AzureProvisioningResource */ +type AzureProvisioningResourceHandle = Handle<'Aspire.Hosting.Azure/Aspire.Hosting.Azure.AzureProvisioningResource'>; + +/** Handle to AzureResourceInfrastructure */ +type AzureResourceInfrastructureHandle = Handle<'Aspire.Hosting.Azure/Aspire.Hosting.Azure.AzureResourceInfrastructure'>; + +/** Handle to AzureUserAssignedIdentityResource */ +type AzureUserAssignedIdentityResourceHandle = Handle<'Aspire.Hosting.Azure/Aspire.Hosting.Azure.AzureUserAssignedIdentityResource'>; + +/** Handle to BicepOutputReference */ +type BicepOutputReferenceHandle = Handle<'Aspire.Hosting.Azure/Aspire.Hosting.Azure.BicepOutputReference'>; + +/** Handle to IAzureKeyVaultSecretReference */ +type IAzureKeyVaultSecretReferenceHandle = Handle<'Aspire.Hosting.Azure/Aspire.Hosting.Azure.IAzureKeyVaultSecretReference'>; + +/** Handle to SqlServerDatabaseResource */ +type SqlServerDatabaseResourceHandle = Handle<'Aspire.Hosting.SqlServer/Aspire.Hosting.ApplicationModel.SqlServerDatabaseResource'>; + +/** Handle to SqlServerServerResource */ +type SqlServerServerResourceHandle = Handle<'Aspire.Hosting.SqlServer/Aspire.Hosting.ApplicationModel.SqlServerServerResource'>; + /** Handle to CommandLineArgsCallbackContext */ type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; @@ -56,6 +113,9 @@ type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicatio /** Handle to ExecuteCommandContext */ type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; +/** Handle to IComputeResource */ +type IComputeResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource'>; + /** Handle to IContainerFilesDestinationResource */ type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; @@ -162,6 +222,30 @@ type IServiceProviderHandle = Handle<'System.ComponentModel/System.IServiceProvi // Enum Types // ============================================================================ +/** Enum type for AzureStorageRole */ +export enum AzureStorageRole { + ClassicStorageAccountContributor = "ClassicStorageAccountContributor", + ClassicStorageAccountKeyOperatorServiceRole = "ClassicStorageAccountKeyOperatorServiceRole", + StorageAccountBackupContributor = "StorageAccountBackupContributor", + StorageAccountContributor = "StorageAccountContributor", + StorageAccountKeyOperatorServiceRole = "StorageAccountKeyOperatorServiceRole", + StorageBlobDataContributor = "StorageBlobDataContributor", + StorageBlobDataOwner = "StorageBlobDataOwner", + StorageBlobDataReader = "StorageBlobDataReader", + StorageBlobDelegator = "StorageBlobDelegator", + StorageFileDataPrivilegedContributor = "StorageFileDataPrivilegedContributor", + StorageFileDataPrivilegedReader = "StorageFileDataPrivilegedReader", + StorageFileDataSmbShareContributor = "StorageFileDataSmbShareContributor", + StorageFileDataSmbShareReader = "StorageFileDataSmbShareReader", + StorageFileDataSmbShareElevatedContributor = "StorageFileDataSmbShareElevatedContributor", + StorageQueueDataContributor = "StorageQueueDataContributor", + StorageQueueDataReader = "StorageQueueDataReader", + StorageQueueDataMessageSender = "StorageQueueDataMessageSender", + StorageQueueDataMessageProcessor = "StorageQueueDataMessageProcessor", + StorageTableDataContributor = "StorageTableDataContributor", + StorageTableDataReader = "StorageTableDataReader", +} + /** Enum type for CertificateTrustScope */ export enum CertificateTrustScope { None = "None", @@ -176,6 +260,14 @@ export enum ContainerLifetime { Persistent = "Persistent", } +/** Enum type for DeploymentScope */ +export enum DeploymentScope { + ResourceGroup = "ResourceGroup", + Subscription = "Subscription", + ManagementGroup = "ManagementGroup", + Tenant = "Tenant", +} + /** Enum type for DistributedApplicationOperation */ export enum DistributedApplicationOperation { Run = "Run", @@ -318,6 +410,10 @@ export interface ResourceUrlAnnotation { // Options Interfaces // ============================================================================ +export interface AddBlobContainerOptions { + blobContainerName?: string; +} + export interface AddConnectionStringOptions { environmentVariableName?: string; } @@ -326,6 +422,14 @@ export interface AddContainerRegistryOptions { repository?: ParameterResource; } +export interface AddDatabaseOptions { + databaseName?: string; +} + +export interface AddDataLakeFileSystemOptions { + dataLakeFileSystemName?: string; +} + export interface AddDockerfileOptions { dockerfilePath?: string; stage?: string; @@ -339,6 +443,15 @@ export interface AddParameterOptions { secret?: boolean; } +export interface AddQueueOptions { + queueName?: string; +} + +export interface AddSqlServerOptions { + password?: ParameterResource; + port?: number; +} + export interface AppendFormattedOptions { format?: string; } @@ -351,6 +464,10 @@ export interface GetValueAsyncOptions { cancellationToken?: AbortSignal; } +export interface RunAsEmulatorOptions { + configureContainer?: (obj: AzureStorageEmulatorResource) => Promise; +} + export interface RunOptions { cancellationToken?: AbortSignal; } @@ -359,6 +476,10 @@ export interface WaitForCompletionOptions { exitCode?: number; } +export interface WithApiVersionCheckOptions { + enable?: boolean; +} + export interface WithBindMountOptions { isReadOnly?: boolean; } @@ -367,6 +488,16 @@ export interface WithCommandOptions { commandOptions?: CommandOptions; } +export interface WithDataBindMountOptions { + path?: string; + isReadOnly?: boolean; +} + +export interface WithDataVolumeOptions { + name?: string; + isReadOnly?: boolean; +} + export interface WithDescriptionOptions { enableMarkdown?: boolean; } @@ -397,6 +528,10 @@ export interface WithExternalServiceHttpHealthCheckOptions { statusCode?: number; } +export interface WithHostPortOptions { + port?: number; +} + export interface WithHttpEndpointOptions { port?: number; targetPort?: number; @@ -475,6 +610,92 @@ export interface WithVolumeOptions { isReadOnly?: boolean; } +// ============================================================================ +// AzureResourceInfrastructure +// ============================================================================ + +/** + * Type class for AzureResourceInfrastructure. + */ +export class AzureResourceInfrastructure { + constructor(private _handle: AzureResourceInfrastructureHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the BicepName property */ + bicepName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/AzureResourceInfrastructure.bicepName', + { context: this._handle } + ); + }, + }; + + /** Gets the TargetScope property */ + targetScope = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/AzureResourceInfrastructure.targetScope', + { context: this._handle } + ); + }, + set: async (value: DeploymentScope): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Azure/AzureResourceInfrastructure.setTargetScope', + { context: this._handle, value } + ); + } + }; + +} + +// ============================================================================ +// BicepOutputReference +// ============================================================================ + +/** + * Type class for BicepOutputReference. + */ +export class BicepOutputReference { + constructor(private _handle: BicepOutputReferenceHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/BicepOutputReference.name', + { context: this._handle } + ); + }, + }; + + /** Gets the Value property */ + value = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/BicepOutputReference.value', + { context: this._handle } + ); + }, + }; + + /** Gets the ValueExpression property */ + valueExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/BicepOutputReference.valueExpression', + { context: this._handle } + ); + }, + }; + +} + // ============================================================================ // CommandLineArgsCallbackContext // ============================================================================ @@ -1711,6 +1932,135 @@ export class DistributedApplicationBuilder { return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); } + /** Adds a SQL Server container resource */ + /** @internal */ + async _addSqlServerInternal(name: string, password?: ParameterResource, port?: number): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (password !== undefined) rpcArgs.password = password; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/addSqlServer', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + addSqlServer(name: string, options?: AddSqlServerOptions): SqlServerServerResourcePromise { + const password = options?.password; + const port = options?.port; + return new SqlServerServerResourcePromise(this._addSqlServerInternal(name, password, port)); + } + + /** Adds an Azure Storage resource */ + /** @internal */ + async _addAzureStorageInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addAzureStorage', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + addAzureStorage(name: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._addAzureStorageInternal(name)); + } + + /** Adds an Azure Bicep template resource from a file */ + /** @internal */ + async _addBicepTemplateInternal(name: string, bicepFile: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepFile }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/addBicepTemplate', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + addBicepTemplate(name: string, bicepFile: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._addBicepTemplateInternal(name, bicepFile)); + } + + /** Adds an Azure Bicep template resource from inline Bicep content */ + /** @internal */ + async _addBicepTemplateStringInternal(name: string, bicepContent: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepContent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/addBicepTemplateString', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + addBicepTemplateString(name: string, bicepContent: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._addBicepTemplateStringInternal(name, bicepContent)); + } + + /** Adds an Azure provisioning resource to the application model */ + /** @internal */ + async _addAzureInfrastructureInternal(name: string, configureInfrastructure: (obj: AzureResourceInfrastructure) => Promise): Promise { + const configureInfrastructureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; + const obj = new AzureResourceInfrastructure(objHandle, this._client); + await configureInfrastructure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, configureInfrastructure: configureInfrastructureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/addAzureInfrastructure', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + addAzureInfrastructure(name: string, configureInfrastructure: (obj: AzureResourceInfrastructure) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._addAzureInfrastructureInternal(name, configureInfrastructure)); + } + + /** Adds Azure provisioning services to the distributed application builder */ + /** @internal */ + async _addAzureProvisioningInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/addAzureProvisioning', + rpcArgs + ); + return new DistributedApplicationBuilder(result, this._client); + } + + addAzureProvisioning(): DistributedApplicationBuilderPromise { + return new DistributedApplicationBuilderPromise(this._addAzureProvisioningInternal()); + } + + /** Adds the shared Azure environment resource to the application model */ + /** @internal */ + async _addAzureEnvironmentInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/addAzureEnvironment', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + addAzureEnvironment(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._addAzureEnvironmentInternal()); + } + + /** Adds an Azure user-assigned identity resource */ + /** @internal */ + async _addAzureUserAssignedIdentityInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/addAzureUserAssignedIdentity', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + addAzureUserAssignedIdentity(name: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._addAzureUserAssignedIdentityInternal(name)); + } + } /** @@ -1801,6 +2151,46 @@ export class DistributedApplicationBuilderPromise implements PromiseLike obj.addCSharpAppWithOptions(name, path, configure))); } + /** Adds a SQL Server container resource */ + addSqlServer(name: string, options?: AddSqlServerOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.addSqlServer(name, options))); + } + + /** Adds an Azure Storage resource */ + addAzureStorage(name: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.addAzureStorage(name))); + } + + /** Adds an Azure Bicep template resource from a file */ + addBicepTemplate(name: string, bicepFile: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.addBicepTemplate(name, bicepFile))); + } + + /** Adds an Azure Bicep template resource from inline Bicep content */ + addBicepTemplateString(name: string, bicepContent: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.addBicepTemplateString(name, bicepContent))); + } + + /** Adds an Azure provisioning resource to the application model */ + addAzureInfrastructure(name: string, configureInfrastructure: (obj: AzureResourceInfrastructure) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.addAzureInfrastructure(name, configureInfrastructure))); + } + + /** Adds Azure provisioning services to the distributed application builder */ + addAzureProvisioning(): DistributedApplicationBuilderPromise { + return new DistributedApplicationBuilderPromise(this._promise.then(obj => obj.addAzureProvisioning())); + } + + /** Adds the shared Azure environment resource to the application model */ + addAzureEnvironment(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.addAzureEnvironment())); + } + + /** Adds an Azure user-assigned identity resource */ + addAzureUserAssignedIdentity(name: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.addAzureUserAssignedIdentity(name))); + } + } // ============================================================================ @@ -1854,312 +2244,205 @@ export class DistributedApplicationEventingPromise implements PromiseLike { - constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { +export class AzureBicepResource extends ResourceBuilderBase { + constructor(handle: AzureBicepResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBicepResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new AzureBicepResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBicepResourcePromise { const helpLink = options?.helpLink; - return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } - - /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } - - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); - } - - /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } - - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + return new AzureBicepResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + withUrl(url: string, options?: WithUrlOptions): AzureBicepResourcePromise { const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + return new AzureBicepResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBicepResourcePromise { const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new AzureBicepResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); - } - - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } - - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); - } - - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } - - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); - } - - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } - - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); - } - - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } - - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + excludeFromManifest(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); - } - - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } - - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - const exitCode = options?.exitCode; - return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + withExplicitStart(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -2167,113 +2450,113 @@ export class ConnectionStringResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBicepResourcePromise { const commandOptions = options?.commandOptions; - return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new AzureBicepResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): AzureBicepResourcePromise { const iconVariant = options?.iconVariant; - return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new AzureBicepResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -2284,60 +2567,60 @@ export class ConnectionStringResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBicepResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new AzureBicepResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -2349,161 +2632,264 @@ export class ConnectionStringResource extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsConnectionString', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + async getBicepIdentifier(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getBicepIdentifier', + rpcArgs + ); + } + + /** @internal */ + private async _clearDefaultRoleAssignmentsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + } + + /** Determines whether a resource is marked as existing */ + async isExisting(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/isExisting', + rpcArgs + ); + } + + /** @internal */ + private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExistingFromParameters', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExisting', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._runAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExistingFromParameters', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExisting', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/asExisting', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } + + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); + } + } /** - * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * Thenable wrapper for AzureBicepResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ConnectionStringResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class AzureBicepResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: AzureBicepResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); - } - - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } - - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); - } - - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); - } - - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); - } - - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + excludeFromManifest(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } - - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + withExplicitStart(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -2511,208 +2897,288 @@ export class ConnectionStringResourcePromise implements PromiseLike obj.getResourceName()); } + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + getBicepIdentifier(): Promise { + return this._promise.then(obj => obj.getBicepIdentifier()); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + } + + /** Determines whether a resource is marked as existing */ + isExisting(): Promise { + return this._promise.then(obj => obj.isExisting()); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + } + } // ============================================================================ -// ContainerRegistryResource +// AzureBlobStorageContainerResource // ============================================================================ -export class ContainerRegistryResource extends ResourceBuilderBase { - constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { +export class AzureBlobStorageContainerResource extends ResourceBuilderBase { + constructor(handle: AzureBlobStorageContainerResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBlobStorageContainerResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new AzureBlobStorageContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBlobStorageContainerResourcePromise { const helpLink = options?.helpLink; - return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new AzureBlobStorageContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + withUrl(url: string, options?: WithUrlOptions): AzureBlobStorageContainerResourcePromise { const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + return new AzureBlobStorageContainerResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBlobStorageContainerResourcePromise { const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new AzureBlobStorageContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -2720,113 +3186,113 @@ export class ContainerRegistryResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBlobStorageContainerResourcePromise { const commandOptions = options?.commandOptions; - return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new AzureBlobStorageContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): AzureBlobStorageContainerResourcePromise { const iconVariant = options?.iconVariant; - return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new AzureBlobStorageContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -2837,60 +3303,60 @@ export class ContainerRegistryResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBlobStorageContainerResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new AzureBlobStorageContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -2902,126 +3368,151 @@ export class ContainerRegistryResource extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + } /** - * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * Thenable wrapper for AzureBlobStorageContainerResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ContainerRegistryResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class AzureBlobStorageContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: AzureBlobStorageContainerResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -3029,1227 +3520,1513 @@ export class ContainerRegistryResourcePromise implements PromiseLike obj.getResourceName()); } + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + } // ============================================================================ -// ContainerResource +// AzureBlobStorageResource // ============================================================================ -export class ContainerResource extends ResourceBuilderBase { - constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { +export class AzureBlobStorageResource extends ResourceBuilderBase { + constructor(handle: AzureBlobStorageResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBlobStorageResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureBlobStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBlobStorageResourcePromise { + const helpLink = options?.helpLink; + return new AzureBlobStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageTagInternal(tag)); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withConnectionPropertyInternal(name, value)); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withConnectionPropertyValueInternal(name, value)); } /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - const tag = options?.tag; - return new ContainerResourcePromise(this._withImageInternal(image, tag)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureBlobStorageResourcePromise { + const displayText = options?.displayText; + return new AzureBlobStorageResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBlobStorageResourcePromise { + const displayText = options?.displayText; + return new AzureBlobStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _publishAsContainerInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsContainerInternal()); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNameInternal(name)); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBlobStorageResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureBlobStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureBlobStorageResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureBlobStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterInternal()); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBlobStorageResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureBlobStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - const helpLink = options?.helpLink; - return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new ContainerResource(result, this._client); +} + +/** + * Thenable wrapper for AzureBlobStorageResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureBlobStorageResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureBlobStorageResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureDataLakeStorageFileSystemResource +// ============================================================================ + +export class AzureDataLakeStorageFileSystemResource extends ResourceBuilderBase { + constructor(handle: AzureDataLakeStorageFileSystemResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureDataLakeStorageFileSystemResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureDataLakeStorageFileSystemResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureDataLakeStorageFileSystemResourcePromise { + const helpLink = options?.helpLink; + return new AzureDataLakeStorageFileSystemResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withConnectionPropertyInternal(name, value)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsInternal(args)); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withConnectionPropertyValueInternal(name, value)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureDataLakeStorageFileSystemResourcePromise { + const displayText = options?.displayText; + return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureDataLakeStorageFileSystemResourcePromise { + const displayText = options?.displayText; + return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureDataLakeStorageFileSystemResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureDataLakeStorageFileSystemResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureDataLakeStorageFileSystemResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureDataLakeStorageFileSystemResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureDataLakeStorageFileSystemResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureDataLakeStorageFileSystemResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ContainerResource(result, this._client); +} + +/** + * Thenable wrapper for AzureDataLakeStorageFileSystemResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureDataLakeStorageFileSystemResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureDataLakeStorageFileSystemResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromManifestInternal()); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForInternal(dependency)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - const exitCode = options?.exitCode; - return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureDataLakeStorageResource +// ============================================================================ + +export class AzureDataLakeStorageResource extends ResourceBuilderBase { + constructor(handle: AzureDataLakeStorageResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - const password = options?.password; - return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureDataLakeStorageResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureDataLakeStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureDataLakeStorageResourcePromise { + const helpLink = options?.helpLink; + return new AzureDataLakeStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureDataLakeStorageResourcePromise { + const displayText = options?.displayText; + return new AzureDataLakeStorageResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureDataLakeStorageResourcePromise { + const displayText = options?.displayText; + return new AzureDataLakeStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureDataLakeStorageResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureDataLakeStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): AzureDataLakeStorageResourcePromise { const iconVariant = options?.iconVariant; - return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); - } - - /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new AzureDataLakeStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -4260,79 +5037,60 @@ export class ContainerResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureDataLakeStorageResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new AzureDataLakeStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); - } - - /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -4344,401 +5102,719 @@ export class ContainerResource extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + } /** - * Thenable wrapper for ContainerResource that enables fluent chaining. + * Thenable wrapper for AzureDataLakeStorageResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ContainerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class AzureDataLakeStorageResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: AzureDataLakeStorageResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); - } +} - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); +// ============================================================================ +// AzureEnvironmentResource +// ============================================================================ + +export class AzureEnvironmentResource extends ResourceBuilderBase { + constructor(handle: AzureEnvironmentResourceHandle, client: AspireClientRpc) { + super(handle, client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withContainerRegistryInternal(registry)); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureEnvironmentResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureEnvironmentResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureEnvironmentResourcePromise { + const helpLink = options?.helpLink; + return new AzureEnvironmentResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureEnvironmentResourcePromise { + const displayText = options?.displayText; + return new AzureEnvironmentResourcePromise(this._withUrlInternal(url, displayText)); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureEnvironmentResourcePromise { + const displayText = options?.displayText; + return new AzureEnvironmentResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._excludeFromManifestInternal()); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withExplicitStartInternal()); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withHealthCheckInternal(key)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureEnvironmentResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureEnvironmentResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withChildRelationshipInternal(child)); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureEnvironmentResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureEnvironmentResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._excludeFromMcpInternal()); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureEnvironmentResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureEnvironmentResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withLocationInternal(location: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, location }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withLocation', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Sets the Azure location for the shared Azure environment resource */ + withLocation(location: ParameterResource): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withLocationInternal(location)); + } + + /** @internal */ + private async _withResourceGroupInternal(resourceGroup: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withResourceGroup', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Sets the Azure resource group for the shared Azure environment resource */ + withResourceGroup(resourceGroup: ParameterResource): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withResourceGroupInternal(resourceGroup)); + } + +} + +/** + * Thenable wrapper for AzureEnvironmentResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureEnvironmentResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureEnvironmentResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); - } - - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withIconName(iconName: string, options?: WithIconNameOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -4746,4841 +5822,5174 @@ export class ContainerResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Sets the Azure location for the shared Azure environment resource */ + withLocation(location: ParameterResource): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withLocation(location))); + } + + /** Sets the Azure resource group for the shared Azure environment resource */ + withResourceGroup(resourceGroup: ParameterResource): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withResourceGroup(resourceGroup))); + } + } // ============================================================================ -// CSharpAppResource +// AzureProvisioningResource // ============================================================================ -export class CSharpAppResource extends ResourceBuilderBase { - constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { +export class AzureProvisioningResource extends ResourceBuilderBase { + constructor(handle: AzureProvisioningResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureProvisioningResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new AzureProvisioningResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureProvisioningResourcePromise { + const helpLink = options?.helpLink; + return new AzureProvisioningResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReplicasInternal(replicas: number): Promise { - const rpcArgs: Record = { builder: this._handle, replicas }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReplicas', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureProvisioningResourcePromise { + const displayText = options?.displayText; + return new AzureProvisioningResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _disableForwardedHeadersInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/disableForwardedHeaders', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureProvisioningResourcePromise { + const displayText = options?.displayText; + return new AzureProvisioningResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - const helpLink = options?.helpLink; - return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureProvisioningResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureProvisioningResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureProvisioningResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureProvisioningResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsInternal(args)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureProvisioningResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureProvisioningResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new CSharpAppResource(result, this._client); - } - - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + /** Gets an output reference from an Azure Bicep template resource */ + async getOutput(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getOutput', rpcArgs ); - return new CSharpAppResource(result, this._client); - } - - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _withParameterInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameter', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterInternal(name)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + private async _withParameterStringValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValue', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterStringValueInternal(name, value)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValues', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterStringValuesInternal(name, value)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromParameter', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterFromParameterInternal(name, value)); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', + /** @internal */ + private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromConnectionString', rpcArgs ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromOutput', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterFromOutputInternal(name, value)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterFromEndpointInternal(name, value)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsConnectionString', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._publishAsConnectionStringInternal()); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + /** Gets the normalized Bicep identifier for an Azure resource */ + async getBicepIdentifier(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getBicepIdentifier', rpcArgs ); - return new CSharpAppResource(result, this._client); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _clearDefaultRoleAssignmentsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + } + + /** Determines whether a resource is marked as existing */ + async isExisting(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/isExisting', + rpcArgs + ); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExistingFromParameters', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); } /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExisting', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._runAsExistingInternal(name, resourceGroup)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExistingFromParameters', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExisting', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/asExisting', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new CSharpAppResource(result, this._client); - } +} - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); +/** + * Thenable wrapper for AzureProvisioningResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureProvisioningResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureProvisioningResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - const exitCode = options?.exitCode; - return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - const commandOptions = options?.commandOptions; - return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - const password = options?.password; - return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + /** Gets an output reference from an Azure Bicep template resource */ + getOutput(name: string): Promise { + return this._promise.then(obj => obj.getOutput(name)); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameter(name))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - const iconVariant = options?.iconVariant; - return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); } - /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Gets the normalized Bicep identifier for an Azure resource */ + getBicepIdentifier(): Promise { + return this._promise.then(obj => obj.getBicepIdentifier()); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Determines whether a resource is marked as existing */ + isExisting(): Promise { + return this._promise.then(obj => obj.isExisting()); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); } } -/** - * Thenable wrapper for CSharpAppResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class CSharpAppResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +// ============================================================================ +// AzureQueueStorageQueueResource +// ============================================================================ - then( - onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); +export class AzureQueueStorageQueueResource extends ResourceBuilderBase { + constructor(handle: AzureQueueStorageQueueResourceHandle, client: AspireClientRpc) { + super(handle, client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withContainerRegistryInternal(registry)); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureQueueStorageQueueResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureQueueStorageQueueResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureQueueStorageQueueResourcePromise { + const helpLink = options?.helpLink; + return new AzureQueueStorageQueueResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withConnectionPropertyInternal(name, value)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withConnectionPropertyValueInternal(name, value)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureQueueStorageQueueResourcePromise { + const displayText = options?.displayText; + return new AzureQueueStorageQueueResourcePromise(this._withUrlInternal(url, displayText)); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureQueueStorageQueueResourcePromise { + const displayText = options?.displayText; + return new AzureQueueStorageQueueResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._excludeFromManifestInternal()); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withExplicitStartInternal()); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withHealthCheckInternal(key)); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureQueueStorageQueueResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureQueueStorageQueueResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withChildRelationshipInternal(child)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureQueueStorageQueueResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureQueueStorageQueueResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._excludeFromMcpInternal()); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureQueueStorageQueueResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureQueueStorageQueueResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } - /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); +} + +/** + * Thenable wrapper for AzureQueueStorageQueueResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureQueueStorageQueueResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureQueueStorageQueueResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } -} + /** Adds a health check by key */ + withHealthCheck(key: string): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } -// ============================================================================ -// DotnetToolResource -// ============================================================================ + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } -export class DotnetToolResource extends ResourceBuilderBase { - constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureQueueStorageResource +// ============================================================================ + +export class AzureQueueStorageResource extends ResourceBuilderBase { + constructor(handle: AzureQueueStorageResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureQueueStorageResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new AzureQueueStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withToolPackageInternal(packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPackage', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureQueueStorageResourcePromise { + const helpLink = options?.helpLink; + return new AzureQueueStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withToolVersionInternal(version: string): Promise { - const rpcArgs: Record = { builder: this._handle, version }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolVersion', + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withConnectionPropertyInternal(name, value)); } /** @internal */ - private async _withToolPrereleaseInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPrerelease', + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withConnectionPropertyValueInternal(name, value)); } /** @internal */ - private async _withToolSourceInternal(source: string): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolSource', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withToolIgnoreExistingFeedsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreExistingFeeds', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withToolIgnoreFailedSourcesInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreFailedSources', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureQueueStorageResourcePromise { + const displayText = options?.displayText; + return new AzureQueueStorageResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _publishAsDockerFileInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFile', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureQueueStorageResourcePromise { + const displayText = options?.displayText; + return new AzureQueueStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; - const obj = new ContainerResource(objHandle, this._client); - await configure(obj); + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFileWithConfigure', + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withExecutableCommandInternal(command: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExecutableCommand', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { - const rpcArgs: Record = { builder: this._handle, workingDirectory }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withWorkingDirectory', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureQueueStorageResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureQueueStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - const helpLink = options?.helpLink; - return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureQueueStorageResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureQueueStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureQueueStorageResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureQueueStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new DotnetToolResource(result, this._client); - } - - /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new DotnetToolResource(result, this._client); +} + +/** + * Thenable wrapper for AzureQueueStorageResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureQueueStorageResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureQueueStorageResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); +} + +// ============================================================================ +// AzureStorageEmulatorResource +// ============================================================================ + +export class AzureStorageEmulatorResource extends ResourceBuilderBase { + constructor(handle: AzureStorageEmulatorResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { - const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): AzureStorageEmulatorResourcePromise { + const isReadOnly = options?.isReadOnly; + return new AzureStorageEmulatorResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { - const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Sets the container image tag */ + withImageTag(tag: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Sets the container image registry */ + withImageRegistry(registry: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): AzureStorageEmulatorResourcePromise { + const tag = options?.tag; + return new AzureStorageEmulatorResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withLifetimeInternal(lifetime)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _publishAsContainerInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + /** Configures the resource to be published as a container */ + publishAsContainer(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { - const exitCode = options?.exitCode; - return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): AzureStorageEmulatorResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new AzureStorageEmulatorResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + /** Sets the container name */ + withContainerName(name: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withContainerNameInternal(name)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withBuildArgInternal(name, value)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { - const commandOptions = options?.commandOptions; - return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureStorageEmulatorResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureStorageEmulatorResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { - const password = options?.password; - return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withContainerNetworkAliasInternal(alias)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): AzureStorageEmulatorResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new AzureStorageEmulatorResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { - const iconVariant = options?.iconVariant; - return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._publishAsConnectionStringInternal()); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureStorageEmulatorResourcePromise { + const helpLink = options?.helpLink; + return new AzureStorageEmulatorResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); + return new AzureStorageEmulatorResource(result, this._client); } -} + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } -/** - * Thenable wrapper for DotnetToolResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class DotnetToolResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } - then( - onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Adds arguments */ + withArgs(args: string[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withArgsInternal(args)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withArgsCallbackInternal(callback)); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): AzureStorageEmulatorResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new AzureStorageEmulatorResourcePromise(this._withReferenceInternal(source, connectionName, optional)); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withServiceReferenceInternal(source)); } - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withReferenceUriInternal(name, uri)); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): AzureStorageEmulatorResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new AzureStorageEmulatorResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): AzureStorageEmulatorResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new AzureStorageEmulatorResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureStorageEmulatorResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new AzureStorageEmulatorResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._asHttp2ServiceInternal()); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureStorageEmulatorResourcePromise { + const displayText = options?.displayText; + return new AzureStorageEmulatorResourcePromise(this._withUrlInternal(url, displayText)); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureStorageEmulatorResourcePromise { + const displayText = options?.displayText; + return new AzureStorageEmulatorResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._excludeFromManifestInternal()); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._waitForInternal(dependency)); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._waitForStartInternal(dependency)); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withExplicitStartInternal()); } - /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): AzureStorageEmulatorResourcePromise { + const exitCode = options?.exitCode; + return new AzureStorageEmulatorResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withHealthCheckInternal(key)); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureStorageEmulatorResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new AzureStorageEmulatorResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureStorageEmulatorResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureStorageEmulatorResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): AzureStorageEmulatorResourcePromise { + const password = options?.password; + return new AzureStorageEmulatorResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } -} - -// ============================================================================ -// ExecutableResource -// ============================================================================ - -export class ExecutableResource extends ResourceBuilderBase { - constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ExecutableResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new ExecutableResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureStorageEmulatorResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureStorageEmulatorResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ExecutableResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureStorageEmulatorResourcePromise { const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + return new AzureStorageEmulatorResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ExecutableResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ExecutableResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ExecutableResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - const helpLink = options?.helpLink; - return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ExecutableResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureStorageEmulatorResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureStorageEmulatorResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ExecutableResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', rpcArgs ); - return new ExecutableResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): AzureStorageEmulatorResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new AzureStorageEmulatorResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withDataBindMountInternal(path?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withDataBindMount', rpcArgs ); - return new ExecutableResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Adds a bind mount for the data folder to an Azure Storage emulator resource */ + withDataBindMount(options?: WithDataBindMountOptions): AzureStorageEmulatorResourcePromise { + const path = options?.path; + const isReadOnly = options?.isReadOnly; + return new AzureStorageEmulatorResourcePromise(this._withDataBindMountInternal(path, isReadOnly)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withDataVolume', rpcArgs ); - return new ExecutableResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Adds a named volume for the data folder to an Azure Storage emulator resource */ + withDataVolume(options?: WithDataVolumeOptions): AzureStorageEmulatorResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new AzureStorageEmulatorResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withBlobPortInternal(port: number): Promise { + const rpcArgs: Record = { builder: this._handle, port }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withBlobPort', rpcArgs ); - return new ExecutableResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Sets the host port for blob requests on the storage emulator */ + withBlobPort(port: number): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withBlobPortInternal(port)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _withQueuePortInternal(port: number): Promise { + const rpcArgs: Record = { builder: this._handle, port }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withQueuePort', rpcArgs ); - return new ExecutableResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsInternal(args)); + /** Sets the host port for queue requests on the storage emulator */ + withQueuePort(port: number): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withQueuePortInternal(port)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + private async _withTablePortInternal(port: number): Promise { + const rpcArgs: Record = { builder: this._handle, port }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withTablePort', rpcArgs ); - return new ExecutableResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + /** Sets the host port for table requests on the storage emulator */ + withTablePort(port: number): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withTablePortInternal(port)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + private async _withApiVersionCheckInternal(enable?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (enable !== undefined) rpcArgs.enable = enable; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withApiVersionCheck', rpcArgs ); - return new ExecutableResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Configures whether the emulator checks API version validity */ + withApiVersionCheck(options?: WithApiVersionCheckOptions): AzureStorageEmulatorResourcePromise { + const enable = options?.enable; + return new AzureStorageEmulatorResourcePromise(this._withApiVersionCheckInternal(enable)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new ExecutableResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', rpcArgs ); - return new ExecutableResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', rpcArgs ); - return new ExecutableResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', rpcArgs ); - return new ExecutableResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new ExecutableResource(result, this._client); +} + +/** + * Thenable wrapper for AzureStorageEmulatorResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureStorageEmulatorResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureStorageEmulatorResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the container image tag */ + withImageTag(tag: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Sets the container image registry */ + withImageRegistry(registry: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); } - /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Configures the resource to be published as a container */ + publishAsContainer(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsContainer())); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); } - /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the container name */ + withContainerName(name: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerName(name))); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { - const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { - const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Sets an environment variable */ + withEnvironment(name: string, value: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForInternal(dependency)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds arguments */ + withArgs(args: string[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExplicitStartInternal()); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { - const exitCode = options?.exitCode; - return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures resource for HTTP/2 */ + asHttp2Service(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { - const commandOptions = options?.commandOptions; - return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { - const password = options?.password; - return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { - const iconVariant = options?.iconVariant; - return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } -} - -/** - * Thenable wrapper for ExecutableResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ExecutableResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds a bind mount for the data folder to an Azure Storage emulator resource */ + withDataBindMount(options?: WithDataBindMountOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDataBindMount(options))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Adds a named volume for the data folder to an Azure Storage emulator resource */ + withDataVolume(options?: WithDataVolumeOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Sets the host port for blob requests on the storage emulator */ + withBlobPort(port: number): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withBlobPort(port))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Sets the host port for queue requests on the storage emulator */ + withQueuePort(port: number): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withQueuePort(port))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets the host port for table requests on the storage emulator */ + withTablePort(port: number): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withTablePort(port))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Configures whether the emulator checks API version validity */ + withApiVersionCheck(options?: WithApiVersionCheckOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withApiVersionCheck(options))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); - } +} - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); +// ============================================================================ +// AzureStorageResource +// ============================================================================ + +export class AzureStorageResource extends ResourceBuilderBase { + constructor(handle: AzureStorageResourceHandle, client: AspireClientRpc) { + super(handle, client); } - /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withContainerRegistryInternal(registry)); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureStorageResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): AzureStorageResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new AzureStorageResourcePromise(this._withMcpServerInternal(path, endpointName)); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureStorageResourcePromise { + const helpLink = options?.helpLink; + return new AzureStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): AzureStorageResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new AzureStorageResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): AzureStorageResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new AzureStorageResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureStorageResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new AzureStorageResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): AzureStorageResourcePromise { + const displayText = options?.displayText; + return new AzureStorageResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureStorageResourcePromise { + const displayText = options?.displayText; + return new AzureStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._excludeFromManifestInternal()); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withExplicitStartInternal()); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureStorageResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new AzureStorageResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureStorageResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withChildRelationshipInternal(child)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): AzureStorageResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureStorageResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new AzureStorageResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureStorageResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } -} - -// ============================================================================ -// ExternalServiceResource -// ============================================================================ + /** @internal */ + private async _runAsEmulatorInternal(configureContainer?: (obj: AzureStorageEmulatorResource) => Promise): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as AzureStorageEmulatorResourceHandle; + const obj = new AzureStorageEmulatorResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/runAsEmulator', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } -export class ExternalServiceResource extends ResourceBuilderBase { - constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Configures the Azure Storage resource to be emulated using Azurite */ + runAsEmulator(options?: RunAsEmulatorOptions): AzureStorageResourcePromise { + const configureContainer = options?.configureContainer; + return new AzureStorageResourcePromise(this._runAsEmulatorInternal(configureContainer)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _addBlobsInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addBlobs', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds an Azure Blob Storage resource */ + addBlobs(name: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._addBlobsInternal(name)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _addDataLakeInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addDataLake', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds an Azure Data Lake Storage resource */ + addDataLake(name: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._addDataLakeInternal(name)); } /** @internal */ - private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + private async _addBlobContainerInternal(name: string, blobContainerName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (blobContainerName !== undefined) rpcArgs.blobContainerName = blobContainerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addBlobContainer', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + /** Adds an Azure Blob Storage container resource */ + addBlobContainer(name: string, options?: AddBlobContainerOptions): AzureBlobStorageContainerResourcePromise { + const blobContainerName = options?.blobContainerName; + return new AzureBlobStorageContainerResourcePromise(this._addBlobContainerInternal(name, blobContainerName)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _addDataLakeFileSystemInternal(name: string, dataLakeFileSystemName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (dataLakeFileSystemName !== undefined) rpcArgs.dataLakeFileSystemName = dataLakeFileSystemName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addDataLakeFileSystem', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - const helpLink = options?.helpLink; - return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds an Azure Data Lake Storage file system resource */ + addDataLakeFileSystem(name: string, options?: AddDataLakeFileSystemOptions): AzureDataLakeStorageFileSystemResourcePromise { + const dataLakeFileSystemName = options?.dataLakeFileSystemName; + return new AzureDataLakeStorageFileSystemResourcePromise(this._addDataLakeFileSystemInternal(name, dataLakeFileSystemName)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _addTablesInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addTables', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds an Azure Table Storage resource */ + addTables(name: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._addTablesInternal(name)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _addQueuesInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addQueues', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Adds an Azure Queue Storage resource */ + addQueues(name: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._addQueuesInternal(name)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _addQueueInternal(name: string, queueName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (queueName !== undefined) rpcArgs.queueName = queueName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addQueue', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + /** Adds an Azure Storage queue resource */ + addQueue(name: string, options?: AddQueueOptions): AzureQueueStorageQueueResourcePromise { + const queueName = options?.queueName; + return new AzureQueueStorageQueueResourcePromise(this._addQueueInternal(name, queueName)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** Gets an output reference from an Azure Bicep template resource */ + async getOutput(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getOutput', + rpcArgs + ); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _withParameterInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameter', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterInternal(name)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withParameterStringValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValue', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterStringValueInternal(name, value)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValues', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterStringValuesInternal(name, value)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromParameter', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterFromParameterInternal(name, value)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromConnectionString', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - const commandOptions = options?.commandOptions; - return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromOutput', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterFromOutputInternal(name, value)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - const iconVariant = options?.iconVariant; - return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterFromEndpointInternal(name, value)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _configureInfrastructureInternal(configure: (obj: AzureResourceInfrastructure) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; + const obj = new AzureResourceInfrastructure(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/configureInfrastructure', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._configureInfrastructureInternal(configure)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsConnectionString', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + async getBicepIdentifier(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getBicepIdentifier', + rpcArgs + ); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _clearDefaultRoleAssignmentsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + } + + /** Determines whether a resource is marked as existing */ + async isExisting(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/isExisting', + rpcArgs + ); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExistingFromParameters', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExisting', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._runAsExistingInternal(name, resourceGroup)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExistingFromParameters', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExisting', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/asExisting', rpcArgs ); + return new AzureStorageResource(result, this._client); + } + + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); } } /** - * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * Thenable wrapper for AzureStorageResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ExternalServiceResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class AzureStorageResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: AzureStorageResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -9588,225 +10997,378 @@ export class ExternalServiceResourcePromise implements PromiseLike obj.getResourceName()); } + /** Configures the Azure Storage resource to be emulated using Azurite */ + runAsEmulator(options?: RunAsEmulatorOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.runAsEmulator(options))); + } + + /** Adds an Azure Blob Storage resource */ + addBlobs(name: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.addBlobs(name))); + } + + /** Adds an Azure Data Lake Storage resource */ + addDataLake(name: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.addDataLake(name))); + } + + /** Adds an Azure Blob Storage container resource */ + addBlobContainer(name: string, options?: AddBlobContainerOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.addBlobContainer(name, options))); + } + + /** Adds an Azure Data Lake Storage file system resource */ + addDataLakeFileSystem(name: string, options?: AddDataLakeFileSystemOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.addDataLakeFileSystem(name, options))); + } + + /** Adds an Azure Table Storage resource */ + addTables(name: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.addTables(name))); + } + + /** Adds an Azure Queue Storage resource */ + addQueues(name: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.addQueues(name))); + } + + /** Adds an Azure Storage queue resource */ + addQueue(name: string, options?: AddQueueOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.addQueue(name, options))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Gets an output reference from an Azure Bicep template resource */ + getOutput(name: string): Promise { + return this._promise.then(obj => obj.getOutput(name)); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameter(name))); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); + } + + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.configureInfrastructure(configure))); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + getBicepIdentifier(): Promise { + return this._promise.then(obj => obj.getBicepIdentifier()); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + } + + /** Determines whether a resource is marked as existing */ + isExisting(): Promise { + return this._promise.then(obj => obj.isExisting()); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + } + } // ============================================================================ -// ParameterResource +// AzureTableStorageResource // ============================================================================ -export class ParameterResource extends ResourceBuilderBase { - constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { +export class AzureTableStorageResource extends ResourceBuilderBase { + constructor(handle: AzureTableStorageResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ParameterResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ParameterResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureTableStorageResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new AzureTableStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, description }; - if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDescription', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ParameterResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - const enableMarkdown = options?.enableMarkdown; - return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureTableStorageResourcePromise { + const helpLink = options?.helpLink; + return new AzureTableStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', rpcArgs ); - return new ParameterResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - const helpLink = options?.helpLink; - return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withConnectionPropertyInternal(name, value)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ParameterResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ParameterResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ParameterResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + withUrl(url: string, options?: WithUrlOptions): AzureTableStorageResourcePromise { const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + return new AzureTableStorageResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ParameterResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureTableStorageResourcePromise { const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new AzureTableStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ParameterResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ParameterResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ParameterResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ParameterResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -9814,113 +11376,113 @@ export class ParameterResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ParameterResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureTableStorageResourcePromise { const commandOptions = options?.commandOptions; - return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new AzureTableStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ParameterResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ParameterResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ParameterResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): AzureTableStorageResourcePromise { const iconVariant = options?.iconVariant; - return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new AzureTableStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ParameterResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ParameterResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ParameterResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -9931,580 +11493,12341 @@ export class ParameterResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ParameterResource(result, this._client); + return new AzureTableStorageResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureTableStorageResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureTableStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureTableStorageResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureTableStorageResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureTableStorageResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureUserAssignedIdentityResource +// ============================================================================ + +export class AzureUserAssignedIdentityResource extends ResourceBuilderBase { + constructor(handle: AzureUserAssignedIdentityResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureUserAssignedIdentityResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureUserAssignedIdentityResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureUserAssignedIdentityResourcePromise { + const helpLink = options?.helpLink; + return new AzureUserAssignedIdentityResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureUserAssignedIdentityResourcePromise { + const displayText = options?.displayText; + return new AzureUserAssignedIdentityResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureUserAssignedIdentityResourcePromise { + const displayText = options?.displayText; + return new AzureUserAssignedIdentityResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureUserAssignedIdentityResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureUserAssignedIdentityResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureUserAssignedIdentityResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureUserAssignedIdentityResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureUserAssignedIdentityResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureUserAssignedIdentityResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** Gets an output reference from an Azure Bicep template resource */ + async getOutput(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getOutput', + rpcArgs + ); + } + + /** @internal */ + private async _withParameterInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameter', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterInternal(name)); + } + + /** @internal */ + private async _withParameterStringValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValue', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterStringValueInternal(name, value)); + } + + /** @internal */ + private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValues', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterStringValuesInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromParameter', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromParameterInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromConnectionString', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromOutput', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromOutputInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromEndpoint', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromEndpointInternal(name, value)); + } + + /** @internal */ + private async _configureInfrastructureInternal(configure: (obj: AzureResourceInfrastructure) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; + const obj = new AzureResourceInfrastructure(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/configureInfrastructure', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._configureInfrastructureInternal(configure)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsConnectionString', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + async getBicepIdentifier(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getBicepIdentifier', + rpcArgs + ); + } + + /** @internal */ + private async _clearDefaultRoleAssignmentsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + } + + /** Determines whether a resource is marked as existing */ + async isExisting(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/isExisting', + rpcArgs + ); + } + + /** @internal */ + private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExistingFromParameters', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExisting', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._runAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExistingFromParameters', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExisting', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/asExisting', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); + } + +} + +/** + * Thenable wrapper for AzureUserAssignedIdentityResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureUserAssignedIdentityResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureUserAssignedIdentityResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Gets an output reference from an Azure Bicep template resource */ + getOutput(name: string): Promise { + return this._promise.then(obj => obj.getOutput(name)); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameter(name))); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); + } + + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.configureInfrastructure(configure))); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + getBicepIdentifier(): Promise { + return this._promise.then(obj => obj.getBicepIdentifier()); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + } + + /** Determines whether a resource is marked as existing */ + isExisting(): Promise { + return this._promise.then(obj => obj.isExisting()); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ + +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// ContainerResource +// ============================================================================ + +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + const exitCode = options?.exitCode; + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + const password = options?.password; + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + } + + /** @internal */ + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + } + + /** @internal */ + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + } + +} + +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + } + +} + +// ============================================================================ +// CSharpAppResource +// ============================================================================ + +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + const exitCode = options?.exitCode; + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + const commandOptions = options?.commandOptions; + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + const password = options?.password; + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + const iconVariant = options?.iconVariant; + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + } + + /** @internal */ + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + } + + /** @internal */ + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + } + +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + } + +} + +// ============================================================================ +// DotnetToolResource +// ============================================================================ + +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + } + + /** @internal */ + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + } + + /** @internal */ + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + } + + /** @internal */ + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + } + + /** @internal */ + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + } + + /** @internal */ + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + const exitCode = options?.exitCode; + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + const commandOptions = options?.commandOptions; + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + const password = options?.password; + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + const iconVariant = options?.iconVariant; + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + } + + /** @internal */ + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + } + + /** @internal */ + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + } + +} + +/** + * Thenable wrapper for DotnetToolResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + } + +} + +// ============================================================================ +// ExecutableResource +// ============================================================================ + +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + } + + /** @internal */ + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + } + + /** @internal */ + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + } + +} + +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + } + +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ParameterResourcePromise { + return new ParameterResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; + const obj = new EnvironmentCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + } + + /** @internal */ + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + } + + /** @internal */ + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withServiceReferenceNamed', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFiles', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitFor', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + } + + /** @internal */ + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + } + + /** @internal */ + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + } + +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets an environment variable */ + withEnvironment(name: string, value: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Adds an environment variable with a reference expression */ + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets environment variables via async callback */ + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a service discovery reference to another resource */ + withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + } + + /** Adds a named service discovery reference */ + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + } + +} + +// ============================================================================ +// SqlServerDatabaseResource +// ============================================================================ + +export class SqlServerDatabaseResource extends ResourceBuilderBase { + constructor(handle: SqlServerDatabaseResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Parent property */ + parent = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.parent', + { context: this._handle } + ); + return new SqlServerServerResource(handle, this._client); + }, + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the JdbcConnectionString property */ + jdbcConnectionString = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.jdbcConnectionString', + { context: this._handle } + ); + }, + }; + + /** Gets the DatabaseName property */ + databaseName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.databaseName', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerDatabaseResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new SqlServerDatabaseResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerDatabaseResourcePromise { + const helpLink = options?.helpLink; + return new SqlServerDatabaseResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): SqlServerDatabaseResourcePromise { + const displayText = options?.displayText; + return new SqlServerDatabaseResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerDatabaseResourcePromise { + const displayText = options?.displayText; + return new SqlServerDatabaseResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerDatabaseResourcePromise { + const commandOptions = options?.commandOptions; + return new SqlServerDatabaseResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParentRelationship', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withChildRelationship', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): SqlServerDatabaseResourcePromise { + const iconVariant = options?.iconVariant; + return new SqlServerDatabaseResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerDatabaseResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new SqlServerDatabaseResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _withCreationScriptInternal(script: string): Promise { + const rpcArgs: Record = { builder: this._handle, script }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withCreationScript', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Defines the SQL script used to create the database */ + withCreationScript(script: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withCreationScriptInternal(script)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for SqlServerDatabaseResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class SqlServerDatabaseResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: SqlServerDatabaseResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Defines the SQL script used to create the database */ + withCreationScript(script: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withCreationScript(script))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// SqlServerServerResource +// ============================================================================ + +export class SqlServerServerResource extends ResourceBuilderBase { + constructor(handle: SqlServerServerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the PrimaryEndpoint property */ + primaryEndpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.primaryEndpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.host', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.port', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the UserNameReference property */ + userNameReference = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.userNameReference', + { context: this._handle } + ); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the JdbcConnectionString property */ + jdbcConnectionString = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.jdbcConnectionString', + { context: this._handle } + ); + }, + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the Databases property */ + private _databases?: AspireDict; + get databases(): AspireDict { + if (!this._databases) { + this._databases = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.databases', + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.databases' + ); + } + return this._databases; + } + + /** Gets the Entrypoint property */ + entrypoint = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.entrypoint', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.setEntrypoint', + { context: this._handle, value } + ); + } + }; + + /** Gets the ShellExecution property */ + shellExecution = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.shellExecution', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.setShellExecution', + { context: this._handle, value } + ); + } + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', rpcArgs ); - return new ParameterResource(result, this._client); + return new SqlServerServerResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): SqlServerServerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new SqlServerServerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new ParameterResource(result, this._client); + return new SqlServerServerResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEntrypointInternal(entrypoint)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); + return new SqlServerServerResource(result, this._client); } -} - -/** - * Thenable wrapper for ParameterResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ParameterResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Sets the container image tag */ + withImageTag(tag: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withImageTagInternal(tag)); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets the container image registry */ + withImageRegistry(registry: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withImageRegistryInternal(registry)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): SqlServerServerResourcePromise { + const tag = options?.tag; + return new SqlServerServerResourcePromise(this._withImageInternal(image, tag)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withImageSHA256Internal(sha256)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withContainerRuntimeArgsInternal(args)); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withLifetimeInternal(lifetime)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Configures the resource to be published as a container */ + publishAsContainer(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._publishAsContainerInternal()); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): SqlServerServerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new SqlServerServerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Sets the container name */ + withContainerName(name: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withContainerNameInternal(name)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildArg', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withBuildArgInternal(name, value)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuildSecret', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); } -} - -// ============================================================================ -// ProjectResource -// ============================================================================ - -export class ProjectResource extends ResourceBuilderBase { - constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerServerResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new SqlServerServerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + withMcpServer(options?: WithMcpServerOptions): SqlServerServerResourcePromise { const path = options?.path; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + return new SqlServerServerResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { + private async _withOtlpExporterInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterInternal()); + withOtlpExporter(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + withOtlpExporterProtocol(protocol: OtlpProtocol): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerServerResourcePromise { const helpLink = options?.helpLink; - return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new SqlServerServerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { + private async _withEnvironmentInternal(name: string, value: string): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + withEnvironment(name: string, value: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentExpression', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + withEnvironmentExpression(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; const obj = new EnvironmentCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): SqlServerServerResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + return new SqlServerServerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { + private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withServiceReference', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + withServiceReference(source: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withServiceReferenceInternal(source)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { + private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withServiceReferenceNamed', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -10514,15 +23837,15 @@ export class ProjectResource extends ResourceBuilderBase if (isProxied !== undefined) rpcArgs.isProxied = isProxied; if (isExternal !== undefined) rpcArgs.isExternal = isExternal; if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + withEndpoint(options?: WithEndpointOptions): SqlServerServerResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -10531,72 +23854,72 @@ export class ProjectResource extends ResourceBuilderBase const isProxied = options?.isProxied; const isExternal = options?.isExternal; const protocol = options?.protocol; - return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + return new SqlServerServerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): SqlServerServerResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new SqlServerServerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): SqlServerServerResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new SqlServerServerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -10609,293 +23932,278 @@ export class ProjectResource extends ResourceBuilderBase } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + withUrl(url: string, options?: WithUrlOptions): SqlServerServerResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + return new SqlServerServerResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerServerResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new SqlServerServerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); - } - - /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitFor', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForCompletion', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): SqlServerServerResourcePromise { const exitCode = options?.exitCode; - return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new SqlServerServerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): SqlServerServerResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new SqlServerServerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -10903,130 +24211,130 @@ export class ProjectResource extends ResourceBuilderBase }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerServerResourcePromise { const commandOptions = options?.commandOptions; - return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new SqlServerServerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsDeveloperCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): SqlServerServerResourcePromise { const password = options?.password; - return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new SqlServerServerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): SqlServerServerResourcePromise { const iconVariant = options?.iconVariant; - return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new SqlServerServerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -11035,15 +24343,15 @@ export class ProjectResource extends ResourceBuilderBase if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): SqlServerServerResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -11051,56 +24359,56 @@ export class ProjectResource extends ResourceBuilderBase const failureThreshold = options?.failureThreshold; const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new SqlServerServerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -11111,60 +24419,79 @@ export class ProjectResource extends ResourceBuilderBase if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; if (tags !== undefined) rpcArgs.tags = tags; if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerServerResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new SqlServerServerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ProjectResource(result, this._client); + return new SqlServerServerResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): SqlServerServerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new SqlServerServerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); } /** Gets the resource name */ @@ -11176,151 +24503,391 @@ export class ProjectResource extends ResourceBuilderBase ); } + /** @internal */ + private async _addDatabaseInternal(name: string, databaseName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (databaseName !== undefined) rpcArgs.databaseName = databaseName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/addDatabase', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a SQL Server database resource */ + addDatabase(name: string, options?: AddDatabaseOptions): SqlServerDatabaseResourcePromise { + const databaseName = options?.databaseName; + return new SqlServerDatabaseResourcePromise(this._addDatabaseInternal(name, databaseName)); + } + + /** @internal */ + private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withDataVolume', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a named volume for the SQL Server data folder */ + withDataVolume(options?: WithDataVolumeOptions): SqlServerServerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new SqlServerServerResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + } + + /** @internal */ + private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withDataBindMount', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a bind mount for the SQL Server data folder */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): SqlServerServerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new SqlServerServerResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); + } + + /** @internal */ + private async _withPasswordInternal(password: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, password }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withPassword', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures the password for the SQL Server resource */ + withPassword(password: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withPasswordInternal(password)); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withHostPort', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the host port for the SQL Server resource */ + withHostPort(options?: WithHostPortOptions): SqlServerServerResourcePromise { + const port = options?.port; + return new SqlServerServerResourcePromise(this._withHostPortInternal(port)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + } + + /** @internal */ + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + } + + /** @internal */ + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + } + } /** - * Thenable wrapper for ProjectResource that enables fluent chaining. + * Thenable wrapper for SqlServerServerResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ProjectResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class SqlServerServerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: SqlServerServerResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + withMcpServer(options?: WithMcpServerOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + withOtlpExporter(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + withOtlpExporterProtocol(protocol: OtlpProtocol): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + withEnvironment(name: string, value: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + withEnvironmentExpression(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + withServiceReference(source: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); } /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withServiceReferenceNamed(source: ResourceBuilderBase, name: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -11329,163 +24896,163 @@ export class ProjectResourcePromise implements PromiseLike { } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } /** Gets the resource name */ @@ -11493,6 +25060,295 @@ export class ProjectResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Adds a SQL Server database resource */ + addDatabase(name: string, options?: AddDatabaseOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.addDatabase(name, options))); + } + + /** Adds a named volume for the SQL Server data folder */ + withDataVolume(options?: WithDataVolumeOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + } + + /** Adds a bind mount for the SQL Server data folder */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); + } + + /** Configures the password for the SQL Server resource */ + withPassword(password: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPassword(password))); + } + + /** Sets the host port for the SQL Server resource */ + withHostPort(options?: WithHostPortOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + } + +} + +// ============================================================================ +// AzureResource +// ============================================================================ + +export class AzureResource extends ResourceBuilderBase { + constructor(handle: IAzureResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsConnectionString', + rpcArgs + ); + return new AzureResource(result, this._client); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureResourcePromise { + return new AzureResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + async getBicepIdentifier(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getBicepIdentifier', + rpcArgs + ); + } + + /** @internal */ + private async _clearDefaultRoleAssignmentsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', + rpcArgs + ); + return new AzureResource(result, this._client); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureResourcePromise { + return new AzureResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + } + + /** Determines whether a resource is marked as existing */ + async isExisting(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/isExisting', + rpcArgs + ); + } + + /** @internal */ + private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExistingFromParameters', + rpcArgs + ); + return new AzureResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureResourcePromise { + return new AzureResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExisting', + rpcArgs + ); + return new AzureResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureResourcePromise { + return new AzureResourcePromise(this._runAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExistingFromParameters', + rpcArgs + ); + return new AzureResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureResourcePromise { + return new AzureResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExisting', + rpcArgs + ); + return new AzureResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureResourcePromise { + return new AzureResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/asExisting', + rpcArgs + ); + return new AzureResource(result, this._client); + } + + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureResourcePromise { + return new AzureResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); + } + +} + +/** + * Thenable wrapper for AzureResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureResourcePromise { + return new AzureResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + getBicepIdentifier(): Promise { + return this._promise.then(obj => obj.getBicepIdentifier()); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureResourcePromise { + return new AzureResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + } + + /** Determines whether a resource is marked as existing */ + isExisting(): Promise { + return this._promise.then(obj => obj.isExisting()); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureResourcePromise { + return new AzureResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureResourcePromise { + return new AzureResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureResourcePromise { + return new AzureResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureResourcePromise { + return new AzureResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in both run and publish modes */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureResourcePromise { + return new AzureResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + } + +} + +// ============================================================================ +// ComputeResource +// ============================================================================ + +export class ComputeResource extends ResourceBuilderBase { + constructor(handle: IComputeResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ComputeResourcePromise { + return new ComputeResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + } + +} + +/** + * Thenable wrapper for ComputeResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ComputeResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ComputeResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + } + } // ============================================================================ @@ -11932,6 +25788,21 @@ export class Resource extends ResourceBuilderBase { ); } + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ResourcePromise { + return new ResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + } /** @@ -12059,6 +25930,11 @@ export class ResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + } // ============================================================================ @@ -12892,6 +26768,36 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + } + + /** @internal */ + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + rpcArgs + ); + return new ResourceWithEnvironment(result, this._client); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + } + } /** @@ -13004,6 +26910,16 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withoutHttpsCertificate())); } + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + } + } // ============================================================================ @@ -13270,6 +27186,8 @@ process.on('uncaughtException', (error: Error) => { // ============================================================================ // Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting.Azure/Aspire.Hosting.Azure.AzureResourceInfrastructure', (handle, client) => new AzureResourceInfrastructure(handle as AzureResourceInfrastructureHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure/Aspire.Hosting.Azure.BicepOutputReference', (handle, client) => new BicepOutputReference(handle as BicepOutputReferenceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); @@ -13285,6 +27203,19 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceE registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure/Aspire.Hosting.Azure.AzureBicepResource', (handle, client) => new AzureBicepResource(handle as AzureBicepResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureBlobStorageContainerResource', (handle, client) => new AzureBlobStorageContainerResource(handle as AzureBlobStorageContainerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureBlobStorageResource', (handle, client) => new AzureBlobStorageResource(handle as AzureBlobStorageResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureDataLakeStorageFileSystemResource', (handle, client) => new AzureDataLakeStorageFileSystemResource(handle as AzureDataLakeStorageFileSystemResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureDataLakeStorageResource', (handle, client) => new AzureDataLakeStorageResource(handle as AzureDataLakeStorageResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure/Aspire.Hosting.Azure.AzureEnvironmentResource', (handle, client) => new AzureEnvironmentResource(handle as AzureEnvironmentResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure/Aspire.Hosting.Azure.AzureProvisioningResource', (handle, client) => new AzureProvisioningResource(handle as AzureProvisioningResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureQueueStorageQueueResource', (handle, client) => new AzureQueueStorageQueueResource(handle as AzureQueueStorageQueueResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureQueueStorageResource', (handle, client) => new AzureQueueStorageResource(handle as AzureQueueStorageResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureStorageEmulatorResource', (handle, client) => new AzureStorageEmulatorResource(handle as AzureStorageEmulatorResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureStorageResource', (handle, client) => new AzureStorageResource(handle as AzureStorageResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureTableStorageResource', (handle, client) => new AzureTableStorageResource(handle as AzureTableStorageResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure/Aspire.Hosting.Azure.AzureUserAssignedIdentityResource', (handle, client) => new AzureUserAssignedIdentityResource(handle as AzureUserAssignedIdentityResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); @@ -13294,6 +27225,10 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.Executable registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.SqlServer/Aspire.Hosting.ApplicationModel.SqlServerDatabaseResource', (handle, client) => new SqlServerDatabaseResource(handle as SqlServerDatabaseResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.SqlServer/Aspire.Hosting.ApplicationModel.SqlServerServerResource', (handle, client) => new SqlServerServerResource(handle as SqlServerServerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.Azure/Aspire.Hosting.ApplicationModel.IAzureResource', (handle, client) => new AzureResource(handle as IAzureResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource', (handle, client) => new ComputeResource(handle as IComputeResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); diff --git a/samples/volume-mount/ts/apphost.run.json b/samples/volume-mount/ts/apphost.run.json new file mode 100644 index 00000000..f23fa5b7 --- /dev/null +++ b/samples/volume-mount/ts/apphost.run.json @@ -0,0 +1,11 @@ +{ + "profiles": { + "https": { + "applicationUrl": "https://localhost:19627;http://localhost:29714", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:34428", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:42013" + } + } + } +} \ No newline at end of file diff --git a/samples/volume-mount/ts/apphost.ts b/samples/volume-mount/ts/apphost.ts index 1b08c6c9..78cec584 100644 --- a/samples/volume-mount/ts/apphost.ts +++ b/samples/volume-mount/ts/apphost.ts @@ -1,25 +1,18 @@ -// Setup: Run the following commands to add required integrations: -// aspire add sqlserver -// aspire add azure-storage - -import { createBuilder, ContainerLifetime } from "./.modules/aspire.js"; +import { createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); -const sqlserver = await builder.addSqlServer("sqlserver") +const sqlserver = builder.addSqlServer("sqlserver") .withDataVolume() - .withLifetime(ContainerLifetime.Persistent); + .withLifetime("persistent"); const sqlDatabase = sqlserver.addDatabase("sqldb"); const blobs = builder.addAzureStorage("Storage") - .runAsEmulator(emulator => emulator.withDataVolume()) + .runAsEmulator() .addBlobs("BlobConnection"); -// Note: The emulator callback pattern above assumes the SDK supports arrow function -// callbacks for RunAsEmulator. If not, you may need to call runAsEmulator() without -// arguments and configure the data volume separately. -const blazorweb = builder.addProject("blazorweb") +builder.addProject("blazorweb", "../VolumeMount.BlazorWeb/VolumeMount.BlazorWeb.csproj", "https") .withReference(sqlDatabase) .waitFor(sqlDatabase) .withReference(blobs) diff --git a/samples/volume-mount/ts/package-lock.json b/samples/volume-mount/ts/package-lock.json index c4d3800c..d4cd921c 100644 --- a/samples/volume-mount/ts/package-lock.json +++ b/samples/volume-mount/ts/package-lock.json @@ -1,6 +1,962 @@ { - "name": "ts", + "name": "volumemount", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, - "packages": {} + "packages": { + "": { + "name": "volumemount", + "version": "1.0.0", + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz", + "integrity": "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.3.tgz", + "integrity": "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.3.tgz", + "integrity": "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.3.tgz", + "integrity": "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.3.tgz", + "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.3.tgz", + "integrity": "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.3.tgz", + "integrity": "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.3.tgz", + "integrity": "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.3.tgz", + "integrity": "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.3.tgz", + "integrity": "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.3.tgz", + "integrity": "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.3.tgz", + "integrity": "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.3.tgz", + "integrity": "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.3.tgz", + "integrity": "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.3.tgz", + "integrity": "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.3.tgz", + "integrity": "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz", + "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.3.tgz", + "integrity": "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.3.tgz", + "integrity": "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.3.tgz", + "integrity": "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.3.tgz", + "integrity": "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.3.tgz", + "integrity": "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.3.tgz", + "integrity": "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.3.tgz", + "integrity": "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.3.tgz", + "integrity": "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.3.tgz", + "integrity": "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@types/node": { + "version": "20.19.37", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.37.tgz", + "integrity": "sha512-8kzdPJ3FsNsVIurqBs7oodNnCEVbni9yUEkaHbgptDACOPW04jimGagZ51E6+lXUwJjgnBw+hyko/lkFWCldqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.4.tgz", + "integrity": "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/esbuild": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.3.tgz", + "integrity": "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.27.3", + "@esbuild/android-arm": "0.27.3", + "@esbuild/android-arm64": "0.27.3", + "@esbuild/android-x64": "0.27.3", + "@esbuild/darwin-arm64": "0.27.3", + "@esbuild/darwin-x64": "0.27.3", + "@esbuild/freebsd-arm64": "0.27.3", + "@esbuild/freebsd-x64": "0.27.3", + "@esbuild/linux-arm": "0.27.3", + "@esbuild/linux-arm64": "0.27.3", + "@esbuild/linux-ia32": "0.27.3", + "@esbuild/linux-loong64": "0.27.3", + "@esbuild/linux-mips64el": "0.27.3", + "@esbuild/linux-ppc64": "0.27.3", + "@esbuild/linux-riscv64": "0.27.3", + "@esbuild/linux-s390x": "0.27.3", + "@esbuild/linux-x64": "0.27.3", + "@esbuild/netbsd-arm64": "0.27.3", + "@esbuild/netbsd-x64": "0.27.3", + "@esbuild/openbsd-arm64": "0.27.3", + "@esbuild/openbsd-x64": "0.27.3", + "@esbuild/openharmony-arm64": "0.27.3", + "@esbuild/sunos-x64": "0.27.3", + "@esbuild/win32-arm64": "0.27.3", + "@esbuild/win32-ia32": "0.27.3", + "@esbuild/win32-x64": "0.27.3" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-tsconfig": { + "version": "4.13.6", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.6.tgz", + "integrity": "sha512-shZT/QMiSHc/YBLxxOkMtgSid5HFoauqCE3/exfsEcwg1WkeqjG+V40yBbBrsD+jW2HDXcs28xOfcbm2jI8Ddw==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true, + "license": "ISC" + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/minimatch": { + "version": "10.2.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz", + "integrity": "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nodemon": { + "version": "3.1.14", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.14.tgz", + "integrity": "sha512-jakjZi93UtB3jHMWsXL68FXSAosbLfY0In5gtKq3niLSkrWznrVBzXFNOEMJUfc9+Ke7SHWoAZsiMkNP3vq6Jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^10.2.1", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true, + "license": "MIT" + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "license": "ISC", + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/tsx": { + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz", + "integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.27.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true, + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/vscode-jsonrpc": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.1.tgz", + "integrity": "sha512-kdjOSJ2lLIn7r1rtrMbbNCHjyMPfRnowdKjBQ+mGq6NAW5QY2bEZC/khaC5OR8svbbjvLEaIXkOq45e2X9BIbQ==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + } + } } diff --git a/samples/volume-mount/ts/package.json b/samples/volume-mount/ts/package.json new file mode 100644 index 00000000..0813eead --- /dev/null +++ b/samples/volume-mount/ts/package.json @@ -0,0 +1,19 @@ +{ + "name": "volumemount", + "version": "1.0.0", + "type": "module", + "scripts": { + "start": "aspire run", + "build": "tsc", + "dev": "tsc --watch" + }, + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "nodemon": "^3.1.11", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } +} \ No newline at end of file diff --git a/samples/volume-mount/ts/tsconfig.json b/samples/volume-mount/ts/tsconfig.json new file mode 100644 index 00000000..edf7302c --- /dev/null +++ b/samples/volume-mount/ts/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "outDir": "./dist", + "rootDir": "." + }, + "include": ["apphost.ts", ".modules/**/*.ts"], + "exclude": ["node_modules"] +} \ No newline at end of file From 4fb0d96304853331b0ffb179ad930ee050f2b48c Mon Sep 17 00:00:00 2001 From: David Pine Date: Tue, 10 Mar 2026 06:56:54 -0500 Subject: [PATCH 15/25] Fix TS apphost patterns: await, ContainerLifetime, withServiceReference - Add await on all resource creation assignments - Import and use ContainerLifetime.Persistent enum instead of string - Use withHttpHealthCheck({ path: '...' }) object parameter - Use withServiceReference for project-to-project references - Use builder.executionContext.get() pattern for conditional logic - Match patterns from corrected aspire-shop/ts/apphost.ts Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- samples/Metrics/ts/apphost.ts | 6 ++--- .../aspire-with-azure-functions/ts/apphost.ts | 12 ++++----- samples/aspire-with-javascript/ts/apphost.ts | 20 +++++++------- samples/aspire-with-node/ts/apphost.ts | 16 +++++++----- samples/aspire-with-python/ts/apphost.ts | 14 +++++----- samples/client-apps-integration/ts/apphost.ts | 2 +- samples/container-build/ts/apphost.ts | 19 +++++++++----- samples/database-containers/ts/apphost.ts | 26 ++++++++++--------- samples/database-migrations/ts/apphost.ts | 12 ++++----- samples/health-checks-ui/ts/apphost.ts | 18 ++++++++----- samples/orleans-voting/ts/apphost.ts | 6 ++--- samples/volume-mount/ts/apphost.ts | 12 ++++----- 12 files changed, 90 insertions(+), 73 deletions(-) diff --git a/samples/Metrics/ts/apphost.ts b/samples/Metrics/ts/apphost.ts index 7f7f25d1..856ac512 100644 --- a/samples/Metrics/ts/apphost.ts +++ b/samples/Metrics/ts/apphost.ts @@ -2,16 +2,16 @@ import { createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); -const prometheus = builder.addContainer("prometheus", "prom/prometheus:v3.2.1") +const prometheus = await builder.addContainer("prometheus", "prom/prometheus:v3.2.1") .withBindMount("../prometheus", "/etc/prometheus", { isReadOnly: true }) .withArgs(["--web.enable-otlp-receiver", "--config.file=/etc/prometheus/prometheus.yml"]) .withHttpEndpoint({ targetPort: 9090 }); -const grafana = builder.addContainer("grafana", "grafana/grafana") +const grafana = await builder.addContainer("grafana", "grafana/grafana") .withBindMount("../grafana/config", "/etc/grafana", { isReadOnly: true }) .withBindMount("../grafana/dashboards", "/var/lib/grafana/dashboards", { isReadOnly: true }) .withHttpEndpoint({ targetPort: 3000 }); -builder.addProject("app", "../MetricsApp/MetricsApp.csproj", "https"); +await builder.addProject("app", "../MetricsApp/MetricsApp.csproj", "https"); await builder.build().run(); diff --git a/samples/aspire-with-azure-functions/ts/apphost.ts b/samples/aspire-with-azure-functions/ts/apphost.ts index 7d761cb7..5a0ebc88 100644 --- a/samples/aspire-with-azure-functions/ts/apphost.ts +++ b/samples/aspire-with-azure-functions/ts/apphost.ts @@ -2,21 +2,21 @@ import { createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); -builder.addAzureContainerAppEnvironment("env"); +await builder.addAzureContainerAppEnvironment("env"); -const storage = builder.addAzureStorage("storage") +const storage = await builder.addAzureStorage("storage") .runAsEmulator(); -const blobs = storage.addBlobs("blobs"); -const queues = storage.addQueues("queues"); +const blobs = await storage.addBlobs("blobs"); +const queues = await storage.addQueues("queues"); -const functions = builder.addAzureFunctionsProject("functions", "../ImageGallery.Functions/ImageGallery.Functions.csproj") +const functions = await builder.addAzureFunctionsProject("functions", "../ImageGallery.Functions/ImageGallery.Functions.csproj") .withReference(queues) .withReference(blobs) .waitFor(storage) .withHostStorage(storage); -builder.addProject("frontend", "../ImageGallery.FrontEnd/ImageGallery.FrontEnd.csproj", "https") +await builder.addProject("frontend", "../ImageGallery.FrontEnd/ImageGallery.FrontEnd.csproj", "https") .withReference(queues) .withReference(blobs) .waitFor(functions) diff --git a/samples/aspire-with-javascript/ts/apphost.ts b/samples/aspire-with-javascript/ts/apphost.ts index 608407a3..c2cf9b7b 100644 --- a/samples/aspire-with-javascript/ts/apphost.ts +++ b/samples/aspire-with-javascript/ts/apphost.ts @@ -2,37 +2,37 @@ import { createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); -const weatherApi = builder.addProject("weatherapi", "../AspireJavaScript.MinimalApi/AspireJavaScript.MinimalApi.csproj", "https") +const weatherApi = await builder.addProject("weatherapi", "../AspireJavaScript.MinimalApi/AspireJavaScript.MinimalApi.csproj", "https") .withExternalHttpEndpoints(); -builder.addJavaScriptApp("angular", "../AspireJavaScript.Angular", { runScriptName: "start" }) - .withReference(weatherApi) +await builder.addJavaScriptApp("angular", "../AspireJavaScript.Angular", { runScriptName: "start" }) + .withServiceReference(weatherApi) .waitFor(weatherApi) .withHttpEndpoint({ env: "PORT" }) .withExternalHttpEndpoints() .publishAsDockerFile(); -builder.addJavaScriptApp("react", "../AspireJavaScript.React", { runScriptName: "start" }) - .withReference(weatherApi) +await builder.addJavaScriptApp("react", "../AspireJavaScript.React", { runScriptName: "start" }) + .withServiceReference(weatherApi) .waitFor(weatherApi) .withEnvironment("BROWSER", "none") .withHttpEndpoint({ env: "PORT" }) .withExternalHttpEndpoints() .publishAsDockerFile(); -builder.addJavaScriptApp("vue", "../AspireJavaScript.Vue") +await builder.addJavaScriptApp("vue", "../AspireJavaScript.Vue") .withRunScript("start") .withNpm({ installCommand: "ci" }) - .withReference(weatherApi) + .withServiceReference(weatherApi) .waitFor(weatherApi) .withHttpEndpoint({ env: "PORT" }) .withExternalHttpEndpoints() .publishAsDockerFile(); -const reactVite = builder.addViteApp("reactvite", "../AspireJavaScript.Vite") - .withReference(weatherApi) +const reactVite = await builder.addViteApp("reactvite", "../AspireJavaScript.Vite") + .withServiceReference(weatherApi) .withEnvironment("BROWSER", "none"); -weatherApi.publishWithContainerFiles(reactVite, "./wwwroot"); +await weatherApi.publishWithContainerFiles(reactVite, "./wwwroot"); await builder.build().run(); diff --git a/samples/aspire-with-node/ts/apphost.ts b/samples/aspire-with-node/ts/apphost.ts index 5073fad3..c900b535 100644 --- a/samples/aspire-with-node/ts/apphost.ts +++ b/samples/aspire-with-node/ts/apphost.ts @@ -2,19 +2,23 @@ import { createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); -const cache = builder.addRedis("cache") +const cache = await builder.addRedis("cache") .withRedisInsight(); -const weatherapi = builder.addProject("weatherapi", "../AspireWithNode.AspNetCoreApi/AspireWithNode.AspNetCoreApi.csproj", "https") - .withHttpHealthCheck("/health"); +const weatherapi = await builder.addProject("weatherapi", "../AspireWithNode.AspNetCoreApi/AspireWithNode.AspNetCoreApi.csproj", "https") + .withHttpHealthCheck({ + path: "/health" + }); -builder.addNodeApp("frontend", "../NodeFrontend", "./app.js") +await builder.addNodeApp("frontend", "../NodeFrontend", "./app.js") .withNpm() .withRunScript("dev") .withHttpEndpoint({ port: 5223, env: "PORT" }) .withExternalHttpEndpoints() - .withHttpHealthCheck("/health") - .withReference(weatherapi).waitFor(weatherapi) + .withHttpHealthCheck({ + path: "/health" + }) + .withServiceReference(weatherapi).waitFor(weatherapi) .withReference(cache).waitFor(cache); await builder.build().run(); diff --git a/samples/aspire-with-python/ts/apphost.ts b/samples/aspire-with-python/ts/apphost.ts index be361490..86e166b0 100644 --- a/samples/aspire-with-python/ts/apphost.ts +++ b/samples/aspire-with-python/ts/apphost.ts @@ -2,19 +2,21 @@ import { createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); -const cache = builder.addRedis("cache"); +const cache = await builder.addRedis("cache"); -const app = builder.addUvicornApp("app", "../app", "main:app") +const app = await builder.addUvicornApp("app", "../app", "main:app") .withUv() .withExternalHttpEndpoints() .withReference(cache) .waitFor(cache) - .withHttpHealthCheck("/health"); + .withHttpHealthCheck({ + path: "/health" + }); -const frontend = builder.addViteApp("frontend", "../frontend") - .withReference(app) +const frontend = await builder.addViteApp("frontend", "../frontend") + .withServiceReference(app) .waitFor(app); -app.publishWithContainerFiles(frontend, "./static"); +await app.publishWithContainerFiles(frontend, "./static"); await builder.build().run(); diff --git a/samples/client-apps-integration/ts/apphost.ts b/samples/client-apps-integration/ts/apphost.ts index ebcb9574..39d98ce9 100644 --- a/samples/client-apps-integration/ts/apphost.ts +++ b/samples/client-apps-integration/ts/apphost.ts @@ -2,6 +2,6 @@ import { createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); -const apiService = builder.addProject("apiservice", "../ClientAppsIntegration.ApiService/ClientAppsIntegration.ApiService.csproj", "https"); +const apiService = await builder.addProject("apiservice", "../ClientAppsIntegration.ApiService/ClientAppsIntegration.ApiService.csproj", "https"); await builder.build().run(); diff --git a/samples/container-build/ts/apphost.ts b/samples/container-build/ts/apphost.ts index 8efa7898..37ea1d6f 100644 --- a/samples/container-build/ts/apphost.ts +++ b/samples/container-build/ts/apphost.ts @@ -2,27 +2,32 @@ import { createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); -const goVersion = builder.addParameter("goversion", { default: "1.25.4" }); +const goVersion = await builder.addParameter("goversion", { default: "1.25.4" }); + +const context = await builder.executionContext.get(); +const isPublish = await context.isPublishMode.get(); let ginapp; -if (builder.executionContext.isPublishMode) { - ginapp = builder.addDockerfile("ginapp", "../ginapp") +if (isPublish) { + ginapp = await builder.addDockerfile("ginapp", "../ginapp") .withBuildArg("GO_VERSION", goVersion); } else { - ginapp = builder.addDockerfile("ginapp", "../ginapp", { dockerfilePath: "Dockerfile.dev" }) + ginapp = await builder.addDockerfile("ginapp", "../ginapp", { dockerfilePath: "Dockerfile.dev" }) .withBuildArg("GO_VERSION", goVersion) .withBindMount("../ginapp", "/app"); } -ginapp +await ginapp .withHttpEndpoint({ targetPort: 5555, env: "PORT" }) - .withHttpHealthCheck("/") + .withHttpHealthCheck({ + path: "/" + }) .withExternalHttpEndpoints() .withOtlpExporter() .withDeveloperCertificateTrust(); -if (builder.executionContext.isPublishMode) { +if (isPublish) { await ginapp .withEnvironment("GIN_MODE", "release") .withEnvironment("TRUSTED_PROXIES", "all"); diff --git a/samples/database-containers/ts/apphost.ts b/samples/database-containers/ts/apphost.ts index 4b7602c8..e5dd3d56 100644 --- a/samples/database-containers/ts/apphost.ts +++ b/samples/database-containers/ts/apphost.ts @@ -1,4 +1,4 @@ -import { createBuilder } from './.modules/aspire.js'; +import { ContainerLifetime, createBuilder } from './.modules/aspire.js'; import { readFileSync } from 'fs'; import { join, dirname } from 'path'; import { fileURLToPath } from 'url'; @@ -8,44 +8,46 @@ const builder = await createBuilder(); // PostgreSQL const todosDbName = "Todos"; -const postgres = builder.addPostgres("postgres") +const postgres = await builder.addPostgres("postgres") .withEnvironment("POSTGRES_DB", todosDbName) .withBindMount("../DatabaseContainers.ApiService/data/postgres", "/docker-entrypoint-initdb.d") .withDataVolume() .withPgWeb() - .withLifetime("persistent"); + .withLifetime(ContainerLifetime.Persistent); -const todosDb = postgres.addDatabase(todosDbName); +const todosDb = await postgres.addDatabase(todosDbName); // MySQL const catalogDbName = "catalog"; -const mysql = builder.addMySql("mysql") +const mysql = await builder.addMySql("mysql") .withEnvironment("MYSQL_DATABASE", catalogDbName) .withBindMount("../DatabaseContainers.ApiService/data/mysql", "/docker-entrypoint-initdb.d") .withDataVolume() - .withLifetime("persistent"); + .withLifetime(ContainerLifetime.Persistent); -const catalogDb = mysql.addDatabase(catalogDbName); +const catalogDb = await mysql.addDatabase(catalogDbName); // SQL Server -const sqlserver = builder.addSqlServer("sqlserver") +const sqlserver = await builder.addSqlServer("sqlserver") .withDataVolume() - .withLifetime("persistent"); + .withLifetime(ContainerLifetime.Persistent); const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); const initScriptPath = join(__dirname, "../DatabaseContainers.ApiService/data/sqlserver/init.sql"); -const addressBookDb = sqlserver.addDatabase("AddressBook") +const addressBookDb = await sqlserver.addDatabase("AddressBook") .withCreationScript(readFileSync(initScriptPath, "utf-8")); -builder.addProject("apiservice", "../DatabaseContainers.ApiService/DatabaseContainers.ApiService.csproj", "https") +await builder.addProject("apiservice", "../DatabaseContainers.ApiService/DatabaseContainers.ApiService.csproj", "https") .withReference(todosDb) .waitFor(todosDb) .withReference(catalogDb) .waitFor(catalogDb) .withReference(addressBookDb) .waitFor(addressBookDb) - .withHttpHealthCheck("/alive"); + .withHttpHealthCheck({ + path: "/alive" + }); await builder.build().run(); diff --git a/samples/database-migrations/ts/apphost.ts b/samples/database-migrations/ts/apphost.ts index e13e1da6..b983c5d4 100644 --- a/samples/database-migrations/ts/apphost.ts +++ b/samples/database-migrations/ts/apphost.ts @@ -1,18 +1,18 @@ -import { createBuilder } from './.modules/aspire.js'; +import { ContainerLifetime, createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); -const sqlserver = builder.addSqlServer("sqlserver") +const sqlserver = await builder.addSqlServer("sqlserver") .withDataVolume() - .withLifetime("persistent"); + .withLifetime(ContainerLifetime.Persistent); -const db1 = sqlserver.addDatabase("db1"); +const db1 = await sqlserver.addDatabase("db1"); -const migrationService = builder.addProject("migration", "../DatabaseMigrations.MigrationService/DatabaseMigrations.MigrationService.csproj", "https") +const migrationService = await builder.addProject("migration", "../DatabaseMigrations.MigrationService/DatabaseMigrations.MigrationService.csproj", "https") .withReference(db1) .waitFor(db1); -builder.addProject("api", "../DatabaseMigrations.ApiService/DatabaseMigrations.ApiService.csproj", "https") +await builder.addProject("api", "../DatabaseMigrations.ApiService/DatabaseMigrations.ApiService.csproj", "https") .withReference(db1) .waitForCompletion(migrationService); diff --git a/samples/health-checks-ui/ts/apphost.ts b/samples/health-checks-ui/ts/apphost.ts index 7f4a0bb7..1a439034 100644 --- a/samples/health-checks-ui/ts/apphost.ts +++ b/samples/health-checks-ui/ts/apphost.ts @@ -2,19 +2,23 @@ import { createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); -builder.addDockerComposeEnvironment("compose"); +await builder.addDockerComposeEnvironment("compose"); -const cache = builder.addRedis("cache"); +const cache = await builder.addRedis("cache"); -const apiService = builder.addProject("apiservice", "../HealthChecksUI.ApiService/HealthChecksUI.ApiService.csproj", "https") - .withHttpHealthCheck("/health"); +const apiService = await builder.addProject("apiservice", "../HealthChecksUI.ApiService/HealthChecksUI.ApiService.csproj", "https") + .withHttpHealthCheck({ + path: "/health" + }); -const webFrontend = builder.addProject("webfrontend", "../HealthChecksUI.Web/HealthChecksUI.Web.csproj", "https") +const webFrontend = await builder.addProject("webfrontend", "../HealthChecksUI.Web/HealthChecksUI.Web.csproj", "https") .withReference(cache) .waitFor(cache) - .withReference(apiService) + .withServiceReference(apiService) .waitFor(apiService) - .withHttpHealthCheck("/health") + .withHttpHealthCheck({ + path: "/health" + }) .withExternalHttpEndpoints(); // Note: AddHealthChecksUI is not yet available in the TypeScript SDK. diff --git a/samples/orleans-voting/ts/apphost.ts b/samples/orleans-voting/ts/apphost.ts index ce117b28..c61325dd 100644 --- a/samples/orleans-voting/ts/apphost.ts +++ b/samples/orleans-voting/ts/apphost.ts @@ -2,13 +2,13 @@ import { createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); -const redis = builder.addRedis("voting-redis"); +const redis = await builder.addRedis("voting-redis"); -const orleans = builder.addOrleans("voting-cluster") +const orleans = await builder.addOrleans("voting-cluster") .withClustering(redis) .withGrainStorage("votes", redis); -builder.addProject("voting-fe", "../OrleansVoting.Service/OrleansVoting.Service.csproj", "https") +await builder.addProject("voting-fe", "../OrleansVoting.Service/OrleansVoting.Service.csproj", "https") .withReference(orleans) .waitFor(redis) .withReplicas(3) diff --git a/samples/volume-mount/ts/apphost.ts b/samples/volume-mount/ts/apphost.ts index 78cec584..cf6665eb 100644 --- a/samples/volume-mount/ts/apphost.ts +++ b/samples/volume-mount/ts/apphost.ts @@ -1,18 +1,18 @@ -import { createBuilder } from './.modules/aspire.js'; +import { ContainerLifetime, createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); -const sqlserver = builder.addSqlServer("sqlserver") +const sqlserver = await builder.addSqlServer("sqlserver") .withDataVolume() - .withLifetime("persistent"); + .withLifetime(ContainerLifetime.Persistent); -const sqlDatabase = sqlserver.addDatabase("sqldb"); +const sqlDatabase = await sqlserver.addDatabase("sqldb"); -const blobs = builder.addAzureStorage("Storage") +const blobs = await builder.addAzureStorage("Storage") .runAsEmulator() .addBlobs("BlobConnection"); -builder.addProject("blazorweb", "../VolumeMount.BlazorWeb/VolumeMount.BlazorWeb.csproj", "https") +await builder.addProject("blazorweb", "../VolumeMount.BlazorWeb/VolumeMount.BlazorWeb.csproj", "https") .withReference(sqlDatabase) .waitFor(sqlDatabase) .withReference(blobs) From 9f5e912dfd6d285e133917e370e45f212428d632 Mon Sep 17 00:00:00 2001 From: David Pine Date: Tue, 10 Mar 2026 07:43:28 -0500 Subject: [PATCH 16/25] Update sample READMEs with cs/ts directory instructions Each sample's 'Running the app' section now explains that users should cd into cs/ or ts/ before running aspire run, matching the bifurcated AppHost directory structure. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- samples/Metrics/README.md | 5 ++++- samples/aspire-shop/README.md | 5 ++++- samples/aspire-with-azure-functions/README.md | 5 ++++- samples/aspire-with-javascript/README.md | 5 ++++- samples/aspire-with-node/README.md | 5 ++++- samples/aspire-with-python/README.md | 5 ++++- samples/client-apps-integration/README.md | 5 ++++- samples/container-build/README.md | 5 ++++- samples/custom-resources/README.md | 5 ++++- samples/database-containers/README.md | 5 ++++- samples/database-migrations/README.md | 5 ++++- samples/health-checks-ui/README.md | 5 ++++- samples/orleans-voting/README.md | 5 ++++- samples/volume-mount/README.md | 5 ++++- 14 files changed, 56 insertions(+), 14 deletions(-) diff --git a/samples/Metrics/README.md b/samples/Metrics/README.md index 4939b01a..f61947ef 100644 --- a/samples/Metrics/README.md +++ b/samples/Metrics/README.md @@ -17,7 +17,10 @@ This is a simple .NET app that shows off collecting metrics with OpenTelemetry a ## Running the sample -If using the Aspire CLI, run `aspire run` from this directory. +If using the Aspire CLI, first navigate to the desired AppHost language directory, then run the app: + +- **C# AppHost**: `cd cs` then `aspire run` +- **TypeScript AppHost**: `cd ts` then `aspire run` If using VS Code, open this directory as a workspace and launch the `MetricsApp.AppHost` project using either the Aspire or C# debuggers. diff --git a/samples/aspire-shop/README.md b/samples/aspire-shop/README.md index c1f39c45..d29c2002 100644 --- a/samples/aspire-shop/README.md +++ b/samples/aspire-shop/README.md @@ -18,7 +18,10 @@ The app also includes a .NET class library project, **AspireShop.ServiceDefaults ## Running the app -If using the Aspire CLI, run `aspire run` from this directory. +If using the Aspire CLI, first navigate to the desired AppHost language directory, then run the app: + +- **C# AppHost**: `cd cs` then `aspire run` +- **TypeScript AppHost**: `cd ts` then `aspire run` If using VS Code, open this directory as a workspace and launch the `AspireShop.AppHost` project using either the Aspire or C# debuggers. diff --git a/samples/aspire-with-azure-functions/README.md b/samples/aspire-with-azure-functions/README.md index d5163cff..40cf7064 100644 --- a/samples/aspire-with-azure-functions/README.md +++ b/samples/aspire-with-azure-functions/README.md @@ -17,7 +17,10 @@ The app also includes a class library project, **ImageGallery.ServiceDefaults**, ## Running the app -If using the Aspire CLI, run `aspire run` from this directory. +If using the Aspire CLI, first navigate to the desired AppHost language directory, then run the app: + +- **C# AppHost**: `cd cs` then `aspire run` +- **TypeScript AppHost**: `cd ts` then `aspire run` If using VS Code, open this directory as a workspace and launch the `ImageGallery.AppHost` project using either the Aspire or C# debuggers. diff --git a/samples/aspire-with-javascript/README.md b/samples/aspire-with-javascript/README.md index 6a31204a..2d948a19 100644 --- a/samples/aspire-with-javascript/README.md +++ b/samples/aspire-with-javascript/README.md @@ -17,7 +17,10 @@ The app consists of four services: ## Running the app -If using the Aspire CLI, run `aspire run` from this directory. +If using the Aspire CLI, first navigate to the desired AppHost language directory, then run the app: + +- **C# AppHost**: `cd cs` then `aspire run` +- **TypeScript AppHost**: `cd ts` then `aspire run` If using VS Code, open this directory as a workspace and launch the `AspireShop.AppHost` project using either the Aspire or C# debuggers. diff --git a/samples/aspire-with-node/README.md b/samples/aspire-with-node/README.md index e318bd56..42a3afeb 100644 --- a/samples/aspire-with-node/README.md +++ b/samples/aspire-with-node/README.md @@ -15,7 +15,10 @@ The sample consists of two apps: ## Running the app -If using the Aspire CLI, run `aspire run` from this directory. +If using the Aspire CLI, first navigate to the desired AppHost language directory, then run the app: + +- **C# AppHost**: `cd cs` then `aspire run` +- **TypeScript AppHost**: `cd ts` then `aspire run` If using VS Code, open this directory as a workspace and launch the `AspireWithNode.AppHost` project using either the Aspire or C# debuggers. diff --git a/samples/aspire-with-python/README.md b/samples/aspire-with-python/README.md index 4e45023f..9eca086d 100644 --- a/samples/aspire-with-python/README.md +++ b/samples/aspire-with-python/README.md @@ -16,6 +16,9 @@ The sample consists of two apps: ## Running the app -If using the Aspire CLI, run `aspire run` from this directory. +If using the Aspire CLI, first navigate to the desired AppHost language directory, then run the app: + +- **C# AppHost**: `cd cs` then `aspire run` +- **TypeScript AppHost**: `cd ts` then `aspire run` If using VS Code, open this directory as a workspace and launch the `apphost.cs` C# file using either the Aspire or C# debuggers. diff --git a/samples/client-apps-integration/README.md b/samples/client-apps-integration/README.md index f9de6cb4..166bf478 100644 --- a/samples/client-apps-integration/README.md +++ b/samples/client-apps-integration/README.md @@ -20,7 +20,10 @@ The app is based on the Aspire Starter App template, with the following addition ## Running the app -If using the Aspire CLI, run `aspire run` from this directory. +If using the Aspire CLI, first navigate to the desired AppHost language directory, then run the app: + +- **C# AppHost**: `cd cs` then `aspire run` +- **TypeScript AppHost**: `cd ts` then `aspire run` If using Visual Studio, open the solution file `ClientAppsIntegration.slnx` and launch/debug the `ClientAppsIntegration.AppHost` project. diff --git a/samples/container-build/README.md b/samples/container-build/README.md index 9a8197d6..2cde622e 100644 --- a/samples/container-build/README.md +++ b/samples/container-build/README.md @@ -37,7 +37,10 @@ When you edit any `.go` file in the `ginapp` directory, Air automatically detect ## Running the app -If using the Aspire CLI, run `aspire run` from this directory. +If using the Aspire CLI, first navigate to the desired AppHost language directory, then run the app: + +- **C# AppHost**: `cd cs` then `aspire run` +- **TypeScript AppHost**: `cd ts` then `aspire run` If using VS Code, open this directory as a workspace and launch the `apphost.cs` file using either the Aspire or C# debuggers. diff --git a/samples/custom-resources/README.md b/samples/custom-resources/README.md index 55f8c606..87b2180b 100644 --- a/samples/custom-resources/README.md +++ b/samples/custom-resources/README.md @@ -15,7 +15,10 @@ Read more about the [Aspire resource model here](https://gist.github.com/davidfo ## Running the app -If using the Aspire CLI, run `aspire run` from this directory. +If using the Aspire CLI, first navigate to the desired AppHost language directory, then run the app: + +- **C# AppHost**: `cd cs` then `aspire run` +- **TypeScript AppHost**: `cd ts` then `aspire run` If using VS Code, open this directory as a workspace and launch the `CustomResources.AppHost` project using either the Aspire or C# debuggers. diff --git a/samples/database-containers/README.md b/samples/database-containers/README.md index 0d90b54f..144aca29 100644 --- a/samples/database-containers/README.md +++ b/samples/database-containers/README.md @@ -21,7 +21,10 @@ The app consists of an API service: ## Running the app -If using the Aspire CLI, run `aspire run` from this directory. +If using the Aspire CLI, first navigate to the desired AppHost language directory, then run the app: + +- **C# AppHost**: `cd cs` then `aspire run` +- **TypeScript AppHost**: `cd ts` then `aspire run` If using VS Code, open this directory as a workspace and launch the `DatabaseContainers.AppHost` project using either the Aspire or C# debuggers. diff --git a/samples/database-migrations/README.md b/samples/database-migrations/README.md index 6f67f699..5b1b6654 100644 --- a/samples/database-migrations/README.md +++ b/samples/database-migrations/README.md @@ -61,7 +61,10 @@ The `DatabaseMigrations.MigrationService` project contains the EF Core migration ## Run the app -If using the Aspire CLI, run `aspire run` from this directory. +If using the Aspire CLI, first navigate to the desired AppHost language directory, then run the app: + +- **C# AppHost**: `cd cs` then `aspire run` +- **TypeScript AppHost**: `cd ts` then `aspire run` If using VS Code, open this directory as a workspace and launch the `DatabaseMigrations.AppHost` project using either the Aspire or C# debuggers. diff --git a/samples/health-checks-ui/README.md b/samples/health-checks-ui/README.md index 4f0b980b..efa4f74d 100644 --- a/samples/health-checks-ui/README.md +++ b/samples/health-checks-ui/README.md @@ -13,7 +13,10 @@ The sample is based on the Aspire Starter App project template and thus consists ## Running the app -If using the Aspire CLI, run `aspire run` from this directory. +If using the Aspire CLI, first navigate to the desired AppHost language directory, then run the app: + +- **C# AppHost**: `cd cs` then `aspire run` +- **TypeScript AppHost**: `cd ts` then `aspire run` If using VS Code, open this directory as a workspace and launch the `HealthChecksUI.AppHost` project using either the Aspire or C# debuggers. diff --git a/samples/orleans-voting/README.md b/samples/orleans-voting/README.md index 8e6d802f..f979f45e 100644 --- a/samples/orleans-voting/README.md +++ b/samples/orleans-voting/README.md @@ -13,7 +13,10 @@ This is a simple .NET app that shows how to use Orleans with Aspire orchestratio ## Running the sample -If using the Aspire CLI, run `aspire run` from this directory. +If using the Aspire CLI, first navigate to the desired AppHost language directory, then run the app: + +- **C# AppHost**: `cd cs` then `aspire run` +- **TypeScript AppHost**: `cd ts` then `aspire run` If using VS Code, open this directory as a workspace and launch the `OrleansVoting.AppHost` project using either the Aspire or C# debuggers. diff --git a/samples/volume-mount/README.md b/samples/volume-mount/README.md index 56945bef..b759633b 100644 --- a/samples/volume-mount/README.md +++ b/samples/volume-mount/README.md @@ -15,7 +15,10 @@ The app also includes a standard class library project, **VolumeMount.ServiceDef ## Running the app -1. If using the Aspire CLI, run `aspire run` from this directory. +1. If using the Aspire CLI, first navigate to the desired AppHost language directory, then run the app: + + - **C# AppHost**: `cd cs` then `aspire run` + - **TypeScript AppHost**: `cd ts` then `aspire run` If using VS Code, open this directory as a workspace and launch the `VolumeMount.AppHost` project using either the Aspire or C# debuggers. From b076e01844575a187ebbf0495af2b0d1622d0d4d Mon Sep 17 00:00:00 2001 From: David Pine Date: Tue, 10 Mar 2026 08:56:42 -0500 Subject: [PATCH 17/25] Update aspire-shop frontend, fix apphost.ts files, and update package locks - Updated aspire-shop frontend UI components and styles - Fixed aspire-shop and aspire-with-javascript apphost.ts - Updated package-lock.json for Vue and NodeFrontend Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Components/AddToCart.razor | 3 +- .../AspireShop.Frontend/Components/Cart.razor | 12 +- .../Components/Layout/AppFooter.razor | 29 +- .../Components/Layout/MainLayout.razor | 2 +- .../Components/Layout/MainLayout.razor.css | 82 +-- .../Components/Pages/Home.razor | 105 +-- .../Components/Pages/Home.razor.css | 8 +- .../AspireShop.Frontend/wwwroot/site.css | 596 ++++++++++++------ .../images/aspireshop-frontend-complete.png | Bin 1037441 -> 1118881 bytes samples/aspire-shop/ts/apphost.ts | 37 +- .../AspireJavaScript.Vue/package-lock.json | 12 - samples/aspire-with-javascript/ts/apphost.ts | 4 +- .../NodeFrontend/package-lock.json | 3 - 13 files changed, 494 insertions(+), 399 deletions(-) diff --git a/samples/aspire-shop/AspireShop.Frontend/Components/AddToCart.razor b/samples/aspire-shop/AspireShop.Frontend/Components/AddToCart.razor index d2dcedee..78321e9b 100644 --- a/samples/aspire-shop/AspireShop.Frontend/Components/AddToCart.razor +++ b/samples/aspire-shop/AspireShop.Frontend/Components/AddToCart.razor @@ -3,8 +3,9 @@ - diff --git a/samples/aspire-shop/AspireShop.Frontend/Components/Cart.razor b/samples/aspire-shop/AspireShop.Frontend/Components/Cart.razor index 10939057..49e61295 100644 --- a/samples/aspire-shop/AspireShop.Frontend/Components/Cart.razor +++ b/samples/aspire-shop/AspireShop.Frontend/Components/Cart.razor @@ -1,17 +1,13 @@ @inject BasketServiceClient BasketClient @inject NavigationManager Navigation -
+
@if (basketIsAvailable) { - } diff --git a/samples/aspire-shop/AspireShop.Frontend/Components/Layout/AppFooter.razor b/samples/aspire-shop/AspireShop.Frontend/Components/Layout/AppFooter.razor index f0e6f03a..afdd814b 100644 --- a/samples/aspire-shop/AspireShop.Frontend/Components/Layout/AppFooter.razor +++ b/samples/aspire-shop/AspireShop.Frontend/Components/Layout/AppFooter.razor @@ -1,27 +1,20 @@ @using System.Runtime.InteropServices - + @code { string Message = $"Powered by {RuntimeInformation.FrameworkDescription}"; diff --git a/samples/aspire-shop/AspireShop.Frontend/Components/Layout/MainLayout.razor b/samples/aspire-shop/AspireShop.Frontend/Components/Layout/MainLayout.razor index 0fd1b20e..5c431f71 100644 --- a/samples/aspire-shop/AspireShop.Frontend/Components/Layout/MainLayout.razor +++ b/samples/aspire-shop/AspireShop.Frontend/Components/Layout/MainLayout.razor @@ -1,6 +1,6 @@ @inherits LayoutComponentBase -@Body +
@Body
An unhandled error has occurred. diff --git a/samples/aspire-shop/AspireShop.Frontend/Components/Layout/MainLayout.razor.css b/samples/aspire-shop/AspireShop.Frontend/Components/Layout/MainLayout.razor.css index 73e2b672..30eb4081 100644 --- a/samples/aspire-shop/AspireShop.Frontend/Components/Layout/MainLayout.razor.css +++ b/samples/aspire-shop/AspireShop.Frontend/Components/Layout/MainLayout.razor.css @@ -1,83 +1,5 @@ -.page { - position: relative; - display: flex; - flex-direction: column; -} - -main { - flex: 1; -} - -.sidebar { - background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); -} - -.top-row { - background-color: #f7f7f7; - border-bottom: 1px solid #d6d5d5; - justify-content: flex-end; - height: 3.5rem; - display: flex; - align-items: center; -} - - .top-row ::deep a, .top-row ::deep .btn-link { - white-space: nowrap; - margin-left: 1.5rem; - text-decoration: none; - } - - .top-row ::deep a:hover, .top-row ::deep .btn-link:hover { - text-decoration: underline; - } - - .top-row ::deep a:first-child { - overflow: hidden; - text-overflow: ellipsis; - } - -@media (max-width: 640.98px) { - .top-row:not(.auth) { - display: none; - } - - .top-row.auth { - justify-content: space-between; - } - - .top-row ::deep a, .top-row ::deep .btn-link { - margin-left: 0; - } -} - -@media (min-width: 641px) { - .page { - flex-direction: row; - } - - .sidebar { - width: 250px; - height: 100vh; - position: sticky; - top: 0; - } - - .top-row { - position: sticky; - top: 0; - z-index: 1; - } - - .top-row.auth ::deep a:first-child { - flex: 1; - text-align: right; - width: 0; - } - - .top-row, article { - padding-left: 2rem !important; - padding-right: 1.5rem !important; - } +#app-root { + display: contents; } #blazor-error-ui { diff --git a/samples/aspire-shop/AspireShop.Frontend/Components/Pages/Home.razor b/samples/aspire-shop/AspireShop.Frontend/Components/Pages/Home.razor index 40f835b1..d8e155b0 100644 --- a/samples/aspire-shop/AspireShop.Frontend/Components/Pages/Home.razor +++ b/samples/aspire-shop/AspireShop.Frontend/Components/Pages/Home.razor @@ -5,31 +5,35 @@ Aspire Shop Product Catalog -
-

<AspireShop />

-
-

Product Catalog

-
- -
+
+ -
- @if (catalog is { Data: var data }) - { -
- @foreach (var item in data) - { -
-
- @item.Name -
- +
+ @if (catalog is { Data: var data }) + { +
+ @foreach (var item in data) + { +
+
+ @item.Name + @item.CatalogType
-
-

@item.Name

-

@item.Description

-
-

@item.Price.ToString("C")

+
+

@item.CatalogBrand

+

@item.Name

+

@item.Description

+
+ @item.Price.ToString("C") @if (basketIsAvailable) { @@ -37,30 +41,45 @@
-
- } -
+ } +
-
- + + } + else + { +
+ @for (var i = 0; i < 9; i++) + { +
+
+
+
+
+
+
+
+ } +
+ } +
- -
- } - else - { -

Loading product catalog…

- } +
- - @code { bool basketIsAvailable; CatalogItemsPage? catalog; diff --git a/samples/aspire-shop/AspireShop.Frontend/Components/Pages/Home.razor.css b/samples/aspire-shop/AspireShop.Frontend/Components/Pages/Home.razor.css index 754f74bd..927c3594 100644 --- a/samples/aspire-shop/AspireShop.Frontend/Components/Pages/Home.razor.css +++ b/samples/aspire-shop/AspireShop.Frontend/Components/Pages/Home.razor.css @@ -1,7 +1 @@ -.catalog-loading { - min-height: 500px; -} - -.catalog-item-image { - min-height: 295px; -} \ No newline at end of file +/* All styling in site.css */ \ No newline at end of file diff --git a/samples/aspire-shop/AspireShop.Frontend/wwwroot/site.css b/samples/aspire-shop/AspireShop.Frontend/wwwroot/site.css index b113400a..3b41782c 100644 --- a/samples/aspire-shop/AspireShop.Frontend/wwwroot/site.css +++ b/samples/aspire-shop/AspireShop.Frontend/wwwroot/site.css @@ -1,281 +1,461 @@ -:root { - --font-family: system-ui; - --border-color: #ccc; - --border-color-hover: #aaa; - --text-color: #555; - --text-heading-color: #222; - --quick-quarter-second-transition: all ease-in-out .25s; - --smooth-one-second-transition: all ease-in-out 1s; - --dotnet-purple-color: #512bd4; - --dotnet-purple-color-hover: #512bd4; +/* ==================================================== + AspireShop — Modern Catalog Design + ==================================================== */ + +/* ---------- Tokens ---------- */ + +:root { + --ff: 'Segoe UI', system-ui, -apple-system, sans-serif; + --ff-mono: 'Cascadia Code', 'Fira Code', Consolas, monospace; + + --brand: #512bd4; + --brand-dark: #3b1f9e; + --brand-light: #7c5ce7; + --brand-10: rgba(81, 43, 212, .10); + --brand-05: rgba(81, 43, 212, .05); + + --g50: #fafafa; --g100: #f4f4f5; --g200: #e4e4e7; + --g300: #d4d4d8; --g400: #a1a1aa; --g500: #71717a; + --g600: #52525b; --g700: #3f3f46; --g800: #27272a; + --g900: #18181b; + + --green: #059669; + + --sh-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04); + --sh-md: 0 4px 12px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.04); + --sh-lg: 0 12px 32px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.05); + + --r-sm: 10px; + --r-md: 14px; + --r-lg: 18px; + --r-full: 9999px; + + --ease: cubic-bezier(.4, 0, .2, 1); + --spring: cubic-bezier(.34, 1.56, .64, 1); } +/* ---------- Reset ---------- */ + +*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; } + html { - background: var(--dotnet-purple-color); - background: linear-gradient(0deg, rgba(81,43,212,0.15) 0%, rgba(255,255,255,1) 100%); + font-family: var(--ff); + color: var(--g800); + background: linear-gradient(135deg, #ede9fe 0%, #f0f4ff 40%, #faf5ff 70%, #fdf2f8 100%); + background-attachment: fixed; + -webkit-font-smoothing: antialiased; } -* { - font-family: var(--font-family); - user-select: none; +body { + min-height: 100dvh; } -.d-flex { +img { display: block; max-width: 100%; } +a { color: inherit; text-decoration: none; } +a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; } +a:focus:not(:focus-visible), button:focus:not(:focus-visible) { outline: none; } + +/* ---------- Page wrapper ---------- */ + +.page-wrap { display: flex; + flex-direction: column; + min-height: 100dvh; + width: 100%; } -.flex-spacer { - flex-grow: 1; +/* ---------- Header ---------- */ + +.site-header { + position: sticky; + top: 0; + z-index: 100; + background: rgba(255,255,255,.82); + backdrop-filter: blur(16px) saturate(180%); + -webkit-backdrop-filter: blur(16px) saturate(180%); + border-bottom: 1px solid rgba(81, 43, 212, .1); } -.pa-4 { - padding: 1.2rem; +.header-inner { + position: relative; + display: flex; + align-items: center; + max-width: 1400px; + margin: 0 auto; + padding: 0 clamp(1rem, 3vw, 2rem); + height: 60px; } -.animated-underline { - color: var(--text-color); +.brand { + display: flex; + align-items: center; + gap: .6rem; text-decoration: none; - transition: var(--quick-quarter-second-transition); + color: var(--brand); + transition: opacity .15s var(--ease); } +.brand:hover { opacity: .75; } - .animated-underline:hover { - text-shadow: 0 0 1px black; - filter: brightness(50%); - } +.brand-logo { flex-shrink: 0; } - .animated-underline::after { - content: ""; - display: block; - width: 100%; - height: 1px; - background-color: var(--text-color); - transition: transform 0.2s ease-in-out; - transform: scale(0); - } +.brand-icon { + font-size: 1.3rem; + color: var(--brand); +} - .animated-underline:hover::after { - transform: scale(1); - } +.brand-name { + font-family: var(--ff-mono); + font-weight: 700; + font-size: 1.05rem; + letter-spacing: -.025em; +} -.justify-space-evenly { - justify-content: space-evenly; +/* ---------- Header title ---------- */ + +.header-title { + position: absolute; + left: 50%; + transform: translateX(-50%); + font-size: .95rem; + font-weight: 600; + color: var(--g500); + letter-spacing: -.01em; + pointer-events: none; } -.justify-space-around { - justify-content: space-around; +/* ---------- Content area ---------- */ + +.content { + flex: 1; + width: 100%; + max-width: 1400px; + margin: 0 auto; + padding: 2rem clamp(1rem, 3vw, 2rem) 3rem; } -.justify-content-center { - justify-content: center; +/* ---------- Grid (explicit breakpoints) ---------- */ + +.grid { + display: grid; + gap: 1.25rem; + grid-template-columns: 1fr; /* mobile: 1 col */ +} + +@media (min-width: 560px) { .grid { grid-template-columns: repeat(2, 1fr); } } +@media (min-width: 900px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 1.5rem; } } +@media (min-width: 1280px) { .grid { grid-template-columns: repeat(4, 1fr); gap: 1.5rem; } } + +/* ---------- Product card ---------- */ + +.card { + display: flex; + flex-direction: column; + background: #fff; + border: 1px solid var(--g200); + border-radius: var(--r-lg); + overflow: hidden; + box-shadow: var(--sh-sm); + transition: + transform .25s var(--ease), + box-shadow .25s var(--ease), + border-color .25s var(--ease); } -.justify-content-end { - justify-content: flex-end; +.card:hover { + transform: translateY(-6px); + box-shadow: var(--sh-lg); + border-color: var(--g300); } -.align-items-center { +/* Card image */ + +.card-img { + position: relative; + background: linear-gradient(145deg, #f5f3ff, var(--g100)); + display: flex; align-items: center; + justify-content: center; + padding: 1.25rem; + min-height: 200px; } -.align-content-end { - align-content: flex-end; +.card-img img { + width: 100%; + height: 180px; + object-fit: contain; + transition: transform .4s var(--ease); } -.text-align-center { - text-align: center; +.card:hover .card-img img { + transform: scale(1.07); } -.pointer-events-none { - pointer-events: none; +.card-tag { + position: absolute; + top: .6rem; + left: .6rem; + padding: .2rem .65rem; + font-size: .7rem; + font-weight: 700; + text-transform: uppercase; + letter-spacing: .05em; + color: var(--brand); + background: rgba(255,255,255,.9); + backdrop-filter: blur(6px); + border-radius: var(--r-full); + box-shadow: var(--sh-sm); } -.container { - max-width: 1200px; - margin: 0 auto; - padding: 0 1rem; +/* Card body */ + +.card-body { + flex: 1; + display: flex; + flex-direction: column; + padding: .9rem 1.1rem 1rem; } -.grid { - display: grid; - grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); - grid-gap: 1rem; - transition: var(--smooth-one-second-transition); +.card-brand { + font-size: .7rem; + font-weight: 700; + text-transform: uppercase; + letter-spacing: .06em; + color: var(--g400); + margin-bottom: .15rem; } -.grid-item { - border: 2px solid var(--border-color); - border-radius: 6px; - box-shadow: var(--border-color) 0px 0px 5px; - background-color: whitesmoke; +.card-title { + font-size: 1rem; + font-weight: 700; + color: var(--g900); + line-height: 1.3; +} + +.card-desc { + margin-top: .3rem; + font-size: .82rem; + color: var(--g500); + line-height: 1.5; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + overflow: hidden; + flex: 1; } - .grid-item:hover { - box-shadow: var(--border-color) 0px 0px 10px; - border-color: var(--border-color-hover); - } +/* Card footer */ -.grid-item-content { +.card-actions { display: flex; - flex-direction: column; + align-items: center; + justify-content: space-between; + margin-top: .75rem; + gap: .5rem; } - .grid-item-content img { - border-top-left-radius: 4px; - border-top-right-radius: 4px; - } - - .grid-item-content:hover > img { - cursor: pointer; - filter: brightness(90%); - overflow: hidden; - transition: all ease-in-out .25s; - } +.card-price { + font-size: 1.15rem; + font-weight: 800; + color: var(--green); + letter-spacing: -.02em; +} - .grid-item-content:hover .quick-view-overlay { - filter: brightness(120%); - } +/* ---------- Add-to-cart pill ---------- */ -.quick-view-overlay { - position: absolute; - pointer-events: none; +.add-to-cart-btn { + display: inline-flex; + align-items: center; + gap: .35rem; + padding: .45rem .9rem; + font-size: .8rem; + font-weight: 700; + color: #fff; + background: var(--brand); + border: none; + border-radius: var(--r-full); cursor: pointer; - color: whitesmoke; - font-size: 1.5rem; - padding: .5rem; - margin-right: 1rem; + white-space: nowrap; + transition: + background .15s var(--ease), + transform .15s var(--spring), + box-shadow .15s var(--ease); } -.text { - color: var(--text-color); - text-decoration: none; +.add-to-cart-btn:hover { + background: var(--brand-dark); + transform: scale(1.06); + box-shadow: 0 4px 14px rgba(81,43,212,.32); } -.d-flex .text { - margin: .5rem 2rem; -} +.add-to-cart-btn:active { transform: scale(.96); } +.add-to-cart-btn i { font-size: .85rem; } + +/* ---------- Cart button (header) ---------- */ -.grid-item-text { - text-align: center; - color: var(--text-color); +.cart-area { display: flex; align-items: center; } + +.cart-btn { + position: relative; + display: flex; + align-items: center; + justify-content: center; + background: none; + border: 2px solid transparent; + border-radius: var(--r-md); + padding: .5rem .7rem; + font-size: 1.6rem; + color: var(--g700); + cursor: pointer; + transition: + color .15s var(--ease), + border-color .15s var(--ease), + background .15s var(--ease); } - .grid-item-text h4 { - color: var(--text-heading-color); - } +.cart-btn:hover { + color: var(--brand); + border-color: var(--g200); + background: var(--brand-05); +} - .grid-item-text .item-price { - color: darkgreen; - font-weight: 700; - } +.cart-count { + position: absolute; + top: -4px; + right: -6px; + min-width: 20px; + height: 20px; + padding: 0 4px; + font-size: .7rem; + font-weight: 800; + line-height: 16px; + display: flex; + align-items: center; + justify-content: center; + color: #fff; + background: var(--brand); + border-radius: var(--r-full); + border: 2px solid #fff; + font-family: var(--ff); +} - .grid-item-text .item-description { - margin: .5rem; - } +/* ---------- Pagination ---------- */ .pager { display: flex; justify-content: center; + gap: .75rem; + margin-top: 2.5rem; +} + +.pager-btn { + display: inline-flex; align-items: center; - margin-top: 1rem; - font-size: 1.2rem; -} - - .pager .button { - text-decoration: none; - color: black; - } - - .pager .button[disable] { - pointer-events: none; - user-select: none; - color: #999; - } - - .pager .button:not([disable]):hover { - transition: all ease-in-out .5s; - background-color: var(--border-color); - } - - .pager .next { - padding: .5rem 1.5rem; - background-color: whitesmoke; - border-bottom-right-radius: 8px; - border-top-right-radius: 8px; - border: 2px solid var(--border-color); - border-left: none; - } - - .pager .next .fa { - padding-left: .5rem; - } - - .pager .previous { - padding: .5rem 1.5rem; - background-color: whitesmoke; - border-bottom-left-radius: 8px; - border-top-left-radius: 8px; - border: 2px solid var(--border-color); - border-right: none; - } - - .pager .previous .fa { - padding-right: .5rem; - } - -.cart-button:not(:disabled) { - font-size: 1.5rem; - cursor: pointer; - border: 2px solid transparent; - border-radius: 4rem; - padding: .4rem .8rem; - background-color: transparent; - transition: all ease-in-out .25s; -} - - .cart-button:not(:disabled):hover { - color: var(--dotnet-purple-color); - border-color: var(--border-color-hover); - background-color: #ccc; - } - -.fa.fa-stack-1x.badge { - color: white; - background-color: var(--dotnet-purple-color); - border-radius: 50%; - font-family: system-ui; - width: 1.5rem; - height: 1.5rem; - font-size: 1rem; - top: 15%; - right: 15%; - left: initial; - line-height: 1.5rem; - border: 2px solid white; + gap: .45rem; + padding: .6rem 1.4rem; + font-size: .88rem; + font-weight: 600; + color: var(--g700); + background: #fff; + border: 1px solid var(--g200); + border-radius: var(--r-full); + transition: + background .15s var(--ease), + border-color .15s var(--ease), + color .15s var(--ease), + box-shadow .15s var(--ease); + box-shadow: var(--sh-sm); +} + +.pager-btn:hover:not(.pager-btn--off) { + background: var(--brand-05); + border-color: var(--brand-light); + color: var(--brand); +} + +.pager-btn--off { + pointer-events: none; + color: var(--g300); + background: var(--g50); + border-color: var(--g100); + box-shadow: none; +} + +.pager-btn i { font-size: .72rem; } + +/* ---------- Skeleton loading ---------- */ + +.skel { + border-radius: var(--r-lg); + background: #fff; + border: 1px solid var(--g200); + overflow: hidden; +} + +.skel-img { + min-height: 200px; + background: var(--g100); } -.fa-shopping-cart.fa-stack-4x { - font-size: 4rem; +.skel-body { + padding: 1.1rem; + display: flex; + flex-direction: column; + gap: .55rem; } -.fa-stack.fa-lg.cart-stack { - line-height: 4rem; - width: 4rem; - height: 4rem; - transition: var(--quick-quarter-second-transition); +.skel-line { + height: 11px; + border-radius: 6px; + background: var(--g100); } - .fa-stack.fa-lg.cart-stack:hover { - cursor: pointer; - filter: opacity(.7); - } +.w30 { width: 30%; } +.w50 { width: 50%; } +.w70 { width: 70%; } -.app-name { - font-weight: bolder; - font-size: 1.5rem; - font-family: monospace; - color: var(--dotnet-purple-color); +.shimmer { + background: linear-gradient(90deg, var(--g100) 25%, var(--g200) 50%, var(--g100) 75%); + background-size: 200% 100%; + animation: shimmer 1.4s ease-in-out infinite; } -.text-danger { - color: red; -} \ No newline at end of file +@keyframes shimmer { + 0% { background-position: 200% 0; } + 100% { background-position: -200% 0; } +} + +/* ---------- Footer ---------- */ + +.site-footer { + margin-top: auto; + border-top: 1px solid rgba(81, 43, 212, .12); + background: rgba(255,255,255,.7); + backdrop-filter: blur(8px); +} + +.footer-inner { + max-width: 1400px; + margin: 0 auto; + display: flex; + align-items: center; + justify-content: center; + flex-wrap: wrap; + gap: .4rem .9rem; + padding: 1.1rem clamp(1rem, 3vw, 2rem); + font-size: .85rem; + color: var(--g600); +} + +.footer-link { + color: var(--g600); + text-decoration: none; + transition: color .15s var(--ease); +} +.footer-link:hover { color: var(--brand); } + +.footer-text { color: var(--g500); } +.footer-divider { color: var(--g400); } + +/* ---------- Error ---------- */ + +.text-danger { color: red; } \ No newline at end of file diff --git a/samples/aspire-shop/images/aspireshop-frontend-complete.png b/samples/aspire-shop/images/aspireshop-frontend-complete.png index 83296a912bc0f4018a8625f356ede1f1465ba3d3..2a350e4649ca53b53ad83029288c5eddb741e113 100644 GIT binary patch literal 1118881 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≠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

9oKZ60! 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 z

Cy(gjAag`DU!-(;to++5T!nIow-Kd2fN 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
#qNT%E~D=M<3A@p@u!FH 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
h<<{c0dkrJ@^d5;z;gA4^c){@?L^EZ=#s7` zglAxY3$mV178XZ%ix|VZ*x}0f5MiAMvslK|&T(+SQPs4%*BoeWU7qdv)!Jqj(^-k|=vfgmkwe=QlmUKO#yq3Gk zm}3i;;qQUJ1W?h6lYFs{of);qvZcVq8j=GB!%B2Yv;JNfN0Qjo}6B&^9Fzsk5#^{vOL8 z;A~!q4_woL9Cd~9jSL{PQ7}?{an40(m8kQVz2gjs&9otEwgAJD$Xs=7haJZGidDev zXOdfgobBaFto~q183lY*0D*9m`3giU^qSDQC-RYEEjyOn|zn^u|Dul z6uRp=Q6z|o$}h)}2C;*zoG@vccQrx;&)vD4qEeB?0{WE-1tlXDUKqx<=wbm4D2c0B zXIBz5Kw`yYWMtmEw0{4loy`k#Pf=R@I%Igy_Py@IBXjzhJ@$0YcM?1ge&DVpo)&s6gskqnO0j3;bfHU>&m52~<|huK^K0P=a_)`xE&l*a7vhz-A-jB+=3s0OSB0t~5eO zqeuTUW)i7Jm+y^jgKr%3e2PVc8SWdbcB{fV`voFCm+Eq!o$@~{ptEHq9$t*~3y`_; z1DYF#5e9W{DON;a0}1J>>QWs4YV!t@0fFkt1Vw;ZMMO+h3@5jAkXgSImMphUbw<=1 zJ6+8Id~bb!bs!r?-&O{+fV+56RcVc{CwX4I;+v9b2SZC=Gd{mzOhQ0!9D3J#E<(EX zgxs`iHqB&OqQ^ucaC!A{_Bq9g&iM?4$-(@O=P<~iM4h!Byx5JA5-Q${i6;hYA_nBS z`h}WQXEWtGp|$c;iv^1pF4J$H+^a=8>hjN@%3{PXJ&?PBy-Pvm-y!7SbUk)L?Lyi` zZ}>K_2`NU%56t&6w2a6$$#R5?sV8e&;qx_+iLsU-DPoQZGn)z{j>trXLvnDMu(|(y zju%8q=iC0V`fw@CDbH&CV@GD>gtgX71AL@=5Zw)PS3^iYQ1$M^BB0|TYQ-g;bll1z z%lztfCi=JU4z=j?Z}q8`KH@2A@Hk5`uGE=q_l7m ziJq&t zk$-3UvI-nSfPxp$n`a!;R2E|kJM0rXKr^{7?wJaDw`K~e3{68TIs7Wu|j#c8Ve z16AN_)YHLC`yDn(uSI_=JqoJ-(clx44s52)4F=?Z2Bg(6o(n%oVU!3!b~(-mfbiCm zy$(hU3C%(UMz@KJ7?U3@Z8}%}b{n=5A*}{FNhn<6hE@;C zTlgAxt_gj~%JUV!h?bq$oILWFIM?`W0B)FZp#L77h6&$poJh^x(nFJc741cJAP~X2 zhfx8|$0zUmrR8#lkA&`1J%TC8gL6dx(h`VoMH5?sv2cMH3=;qcD1i@J!M?+-e)IN$ zFL1PNe9e7^A%@$2t1M| z_$}`-egj%K7sAS=d++$n8t|i5Qq^t0aKwx)Ls(=|StXA6b@pH|d8E3cGsRLYp^}mV z8Rm5Tr}VE8ighKG!oKZk3#F!mRb8~cX6N*d9vtCS|6wTN1u&p+#!4nr)nf;3bVD`) z+2;jjK~dOj_^50eB%XhLDFRSAKJ3r`J&EUEKPN^lO--fv?6Pp-aGdkq){_`YbNV9| zF(Cc|A^!mej=|&x4$_`^E zoy3?O0CVXV*sJ5((lDbuXG}!EgQ0I7VSssTJfITv-dzwvR08*$f6)dapra8_vL>qk zyWnMvv6cPronutd59gd@550wcy4d3d2*x$%a19a}*YZ}8g`e4Q+5-l`>RCWj%8jU?iTkVs>_hIE^151@km!0T{3$u!y7*m+RKyfUC&e$VW6h z7_*RMlhSnTHUO)b!#R1@=1bBXyfGzG!zcf)hn{TEivW2x*z+$l$uD2nKB^r^w5&8T z0_o|K;zuXDe8s>z^z*?i^Cv0#PjG`E43{0i#;41v6o$) z9@`TOF>VIZ#R#V_V>lof{_Pt+(9v+XMO2Z!xvu3vkO-qV!JPIYEx4xG1f%|nc>v?$ z>wPnI2NtAPCn#1XQ-S3Z(ZY!lw8Hf2Aje!Gbutyq8pNctvh+Zg{j|;7v^vpA>+|I~Dn!OONHVfr zaff>Kw+mZTmMl1uL@;b_Rj?}Sxj-sF7Yo*=K8t{cut2j@@rXF17Vz~3t?RPy@yLd0 zwTMQLdKB20Z?pu~SB)!9vt`2+1ieDQ-u%kmiVc)pq~4MSN`YwF7Z`3S|12<&tdgUo zAN&RYZgpO4crT7n!<+s7r(BoY$ZG8SKR%5t74RekPM-J|C&BvwIFHQXNl0U*nshnS`S#A;B+Cn=fFNie{M_*e=%rCGTF z!C>Q$+$unA_Qj1I(s5mgCk3kxn=po!T8e}#gQCHI;s3vV;#7*`A=T`TSAPk3Tn z*m;}A0sP8v?3&VlRZ&b{OiPN+!OoBBW+j146Y6iKv&V~&vIAH-;~+|13E@v>{w zAmU1ZW={PXUQpUJW?|d0!NBPlgG<6uK_vux$@)HI`@Ush5rMP0OpskYjkb?Z1moKc zsAAR><`2Y3p~gI1KyfAL-#B4>abzU|oWL3l&`F}ej)YLKDXN%j6az?USP;=r6?XCP zEias{oIfWwsmqj22(6`b*RyTBk zT}_Eeg7T@^2V<(sSisdl9UDd}FdbZ}CLVKp_{X>o-C^^lTgIZ72XAEmjA`I|!6p2L z)P~O)CmxP2*sS6&2VISl{ouqREa=Hcw+3N70Z9^&`tx=`@;E8}E&5(EU_L#f+mwMA zps4IH9c>m=xn@qfpcDAM49A|v0YD_qXVDrR5$o{)gnUSJd zZs@4L)X&XqD317L`nCavRX06|zrV@h1cS+HK*gS{?jTx>Zko~r45gm!An@ZKU-p3l z=xy0!JIXZKAPW?dbqbBAi=R*hrCfwk55&14;PX%L*wHO9AjUye6n1$;C;tKNDhdw* zV9GJBW{3ndL5WBqa67Ce(a~U>ll%rAeM~%;d<3_BZXWfG86AWEUDwTWCHojj7P)C2 z;SIrussKS`rNX9AE&)=C5^NnOb5=%H(k@{(v{k0gR8nV{!S^?hWB8qv-tpwWmmubn z1pmC1OdVjKC8g0-o>T6E0h^$%St&X!QV<{v0JFvcJ;;&C{q-*p^g=PB0_1(KMsk(0 ziuMkqdJ(ODgKN=fGdj-6gd89e;cHKg`ptwZ?1O`^H_-aEhX?JE=dLL=`<<}@$3Nx<&bEU`Cz2G zYg*7^zqhh|Eht9V2u@c53jyZMqG84Of<^7=k@-g@G&SncgX$xX{^b>Mko+_D=j;Ia zErBxfki$fWw$P^^2YDQd{&v3j6rxH^H~H)FMP%y4E8REdowFg{d><)DgEan3gjMx^ z*oT6$1dUM1~6-bpq5 zP~a{2!OWhal=T>846s%Pd_tmj^U2SxM33bF5IFk&3yG$}U3uuQliVpj?m&fKym6tJ zHdXWapslwkj_#|_mKHBavd@Fs-yZ@Kk zsoQzKS87xWBS(FYg@)5mcg-0;%qU&{Mm=-a#bQ*~aePOAbmD!nen2*~%j6tNHht{Q3HQ?oU6)aQrRnt?tMa+X@O@$77Fz zFAVECSL5{~5IBo_IWlHE(JEiC{<145Z27m$!m!{BDFZPW@%>Q_2#|U!#!91X=GjVU z2q7!qFJe{L3-#Iw=Rf1~sq6ArXNh+kVd2-kGp8@V<*sCrNqd<%_KVI7hWn?(WO$YB;4c(qyy0JN^y2m)BqA#GA%78rK@g6V`HRBCrp&?a zv*n>tjDkng_1ZJysoc=t=i#;2m(i33y(D~@;7v*d184(=z_yY>vOlyEQQxlTEQUox zh#=(L|AN3PRXF72RLw2j(470V0RPR*@uPF_#kz0E`RR-k)r{<8#%I5FY0}3+I4uGj zXM8~}*&l>s?e^_&ObD+tzFt{(Fu#5N;^X$+f5>EJ(`GUqte|IWK(Rz%rW)pv7K(Rcf&UpvCjZ>NKbPL{j&Z??krx$l-jIX{j2y5OPw3H5~ng?#H@0|%HKIMP-@Q*_8 zM%eS?J0Yf}`{-L~Mum-Nd2W7Tl_CkClR6%n=wUQcFZuvVDmeTHxd)Z-CbeP1WZWu% zsu`^h0du`V48dQ2303v=yB)rblI@^iQZTp7el~TT;Zy6nonXsJOJ4K?>_ZltrAApi zSj~U^nkwYSV?*X;tL7k!v)?Wu^5J$LR%bkO?rdBxM7H}2qp%WvLp&8=H|~QaJlOkn z__@Lv!h+wc$*EpLmh&Oz=&++dBMeclnuk9sE~i^V{@#sWNi%=5>^vF$D_4P;i9~#i z5<%!bX=ClCn5BsgK>OBhC=18Y$XqXx_H5OtCE##tnfdhZjMnN#nCC|2-mU;!xFQ37 z_)-q>*mO2T>PfN^3rW6;`XB#XnY2=E?2KYVW}w(?R|(3nTNh;=R-8NY*qXh6T+z){ znUmAzNITafu0fk>3CxNw%~py+8HyNjK8^fWB{8E0=1WDDzjh1{{hd|yiNDY?bW_X8 z!6vd_boyLo%qwG_b@JXgO)xG}nJzyTrT;ocFiiKQzn{O$@Axp0I_gEt_N*k?`0@;~ zN_O_r*kblJw9WtQB9Vp$JHH2YxcCBEj2#2b)&oKZ0IaGi{|<;q2)IM6qcb(-r0m*i zHCk)FXC&(vuC3cRSy-0mkQ3KXq?lHTmudJ5^lLd{tdEosp#Se2gKSJ+T&+UF?n~B1 z+Z%zH&!=@s4gA_)I+rEyGrqhoG*`IJ*ujXmK6L3(B~Iu37@8D<{iXONmU{~dOS^}d zPm?9Zx&WBCNfP<*MtGV4Af}rxc>QW}D&%kc&mvv<4z~=;SFaBml74*d@iu*~z%pMR z1e^R29Sns2l*&kREc2FX0DmRM8=5V*dhk2oW%8<7p>e3V%}z^h>c-ODmDXy2SHs?Y z_>cS)K`8jigD`UqG#rLnj#Fks^8tW*IL>p)+53b{xq5MWjMIDxQmOwcRB*`p(bB<- z<0q!-%>6Gnr@nr!&o=OP4>a`Ghb8@=ehT|uH1x3o>3?w~EH+7X!_Ts*B7q%lR?NFRne___#3muAzb zy>0>q{!=G1{VstGN)~ofep8eA;p*<|V};-ETg_6>SRW!j(qqSbg-n7SWSmT)-VjJV zojS4!kz@_$9Z=*)0_3$&_PSe>U&P;h&Pkq|?Ku?5dnI{7zts;U-8`*l>Iv{F`TY0K zUi$I}U52YqPq){SIV;qZxL9Zw^#>IKfq2ivtMCrOM763>2;DGVYqTTR^N1RNc)EgyC73lU=$HO0=9Y{(mLVC!!NCt+r#V}f|}2+ zO}!=KUs~cbDV3sM*TNMBo8cVtd;U25B6Y~;XrwkBQB)1F&BtdkOJW>dy|r*a@_FCb z?Awp8e%tkB5q#eW^889&H)f^v8}Rfi{SNTxMy&Gar90;%(Eg*;HxldH;k?pn zZyt6#OvmC9f4h4247K&)2Qe{Fms=Px0Kh>=F$%9eaKIx%FRIH&|v zP6)yNe!qN&50Fh^JFShto#1m+(-Kv8bd-%3>A)iX5OD5e({=aF2ii5OcrF-9Ej%2+ z&?=C#{EEY*1KpDCa&aopaByFD7Sy&v$>nrt*<0CjTX*D|eHJVyR;Ln!C&oi#!p=zV zhy4OXOZb*Oum3HOH7cXt@A;Ej=L$$#bZ;fW0k%){1ga4mY7g*!UqWn>>?-EHI|FF7 z+^&cKFE&U0Jv}BU3iWpTIvs4}Tsm7KCz)}g&5)#Cm0qlM=eT51EO%1QmKA1W%f2l~ zh;1Dura`QW#Whm$tmw=+_^>AB<)0O?W6P=op&Z=C=ia$Zwt8e`&g?UOf}qCP zcuOm+_p}D9-p%%S_^c;iM{J*6HtLyRfu5SD74jruN54<;AR_tFeam&<(d0%wR`#0L zO!WHMyLx6lC2j7H{1e&ArwqKio7JgQN=8R|6bi-q3B~g`gz-5n%s7!nL%S}U)7%N~ zMViJGoi~5NTtC*n<#B?4DlRP~zFiY~`Xyv_yny~F(p)V1IqRHW5m=i^^tKp_%7(aL z3wq1;F8j)L&Pu?#GR4qIQWQ-l&8u#2kUU{^6@JB>`tHU)^);J+HWPYRB?3pWrJLPW zxD}sLD%a_uJr6dqQd%4>HQYO!N9oBo&4NT+)~Gr8jFl=?dw{Z@Au4HEoa=ju<;Oyj zk7f;jtvqr5CJE%I+DH{*2Y6O`{asrSlABxa?R`Q?r?C!s);6 zBJSD7QZ(>+>{44b^?CxmNIeRWJ*l-KEJGJ+Okk}|(=p7cKjKO48?TO2ze`rordrLV z24eog-9{Rur$1w^2c3Q#7rLTs&v#(cTl%T?&rj^TS9J|{udLUoYqQ+MX733%cXz4| zQ#KmIe~z4)KW4*zuDbMmPLM~4gM%K)X52g2I2)uus2f2?%u;K%Zh*c;)#@FE@!V=c z_sEF5)3eLH3^m6o1Soqfd%}l~x2F1yS?{&J*^F(^Vsi*CiK|TZfTvl@oa6jRWhmGh zNhzWMq#|OBK9K~o5j~2Ovk@QXcg{NT#f!s@NHH$k&fJ6ApGfQ}B*N{d0G`j)Yt}A% ziv*Y3#(8%w(qCrR4B_BJ#sMRX$G-S^^8g=Nc=J#Q@sxVn>#L+qyb%d#Ep4flkpc** zGA~^#<7bbpv+)I607+k%x9IIc`p+d9CmZ8H=H&3s4lAsEsEcZZP zC4qz8%2**+n=mr2Ce8u?qRlv(-rkDg?-P1+dR}P>mzo3{F&mX30U&CQ}(cFW^S}Njv%s|16NlcY@Z(lR?#M@`se6 zd^DKx&~R>R1zRztgQ85;r8i;z^@GNJRW?8CeyxVLgY4M-6oXejpP|RM!E&#(zdc)c z!z$zgMlkh_=v$9Pz?AjUYz`GkgTWBdLoiTPptK*Ki$O${2#$h7k=dHC1T{`hmihR2 z(kGN%6gkmD96lAQ!j5u()FMHHR{6912SW4iE?-`zeR56y{cReqZd16wv3jvhE=zEz zMog|E#idbXOhel^^2gd(7G`H06n=D!?eMNj^L=%s1&qy#7>VqYD5Qmjg>kvFoDgO%ghp|g59&uAh1B2cQ>*aSwIhwHaL zN*(x+C*Yq-6dv>ZgYG4T8-p zANv_HnUg&_A+e_Ac_Tkcmrz@fjM6{>uTg?-Z&HzU?aB2LR$WnemjM4kK>J@k8oEy# zlOwpnQG^hwQ3!x2i*#PjaZ3d(Kq~bpX?++kjQ^S#Td&(Z!&MAHYh3_CD5X*<2pVx%Ah@6^-cV$?I!vV+DM;eU_|_q&ubLF@%`1{UdGA%Tnu4!=5YAwe);X?h;Eh_DCY^*32P&3R~(3UcsG6zlCOU2amXuT zBY#|bLehrr0p)Tm1ek~llo68ev$8>iIfzh#*6Og)q(qg>{E-ChNJ8NAnL#YN-=(6H za5$Tiq8UpnO5Q}{37L8>ONKZE7j_sSNH?{$b53-$LjtKLS?Y{CLuhi_qbRN|jOx7y z`c$~n3CW~|&*>P$#1OIswKUJv-JVhu=J$8FJz|XY*QWYJto{b<&U2)|!b(?b$hRz| z|BRM`c61bM1#3nrWASE;+UjuH{5XQtXjS8urpHIVDt|0R;SxQ{o=!$z%?p7}s;{s_ zQyF(FI?mdWG=v-;X8v9-DILnz{*a`cmP1%o3R5i={oF;NI@>KQ!!SlTc|NrD4G`AU z@#qIk;HjuJESbXBg1aSrptR)`GmBVpQ-7faR9@`mqwF_qd#_$0my-s6e)>E#Ab{&a zN+=Zv9>4~1vKQ5Iyy@GdnTs^JdT^-J-e=yQw8P=r4ZtIYM3kx^YU7P+hVbdSp@HuB zU)IbH#&BgM8#!I_0NXOg^J|!P;=9yf1HT%P3;wR%;7CnV3+g73Aq@zfF-V$y5LwzM zb?Q5bZK^5^Hd4gZgB#5);-^BQqZRbmmsk6qb-3z(6?*N@)2k5W`S1qHS1hvW9&!sF#aSBISM3%%ogfJqG6E z;%BFlTl;%CB>k%hj>AfMP@JKH9lb(R?w8=7h<}PqAayF9g8=71+c>qtIH{IwZ0z>< zv@TfA&Kr0}@Vllc?CL>C1ESQC_dJSpi`K9nuUYC))fppE;-+xo%K2!Q@TSerWlbO)~w`N}(#uM$uSaos(IfK5aD25%qM3RT=KrE*yOx{R#%CW%XDmv2;)o z<@yNG%(BjktpyR1q$}YEPzT6$IL^tLNxuEGO3qZCSH03F6CE#1vHZ-jN3acNfkTPZ z9!001=?DlZ_hDbAz-V_~>9_?OK@D!;><`|RKbR;s#Mp&hn^WV{%ZkpX&to@#RLbGG z!jdJIDHvaKT<&GmH2JQeNr*)g1%pJt`X(Keoz}Wg(ncP$v{?$%CnS;f=~-GH2v|XU z%=c%8m|sU}jJ(xe3kwv~X)lpyd|&>DoQ`$JI1SbXr{mq{cFx-U4mPovJtz?s-}^S+ zuF&g$_}icF)!q+GX9DE7l!>+4SO%HzZ!y%q#LQPWSIr_yuHNpaG6NrFls%j_EBeuz zd@Gj{?ull6B`f%uDe9QIzD4P@)~5!B@9--5t35$;BdmkGIkJJmK*6f4Nl3X4D#H^H z(7dMV^WLT=CDlizFz>>aardmFK~OT)pdzLXolAXPPkB4m&KFEA*DsrT9#wRz?vZqR z9!6pGB-M`8-n)cMeMC|t@TqU9I%fj1I&4^4CKM0&Z0~z?$D;>*!PoC8g*pQ(AYMnr zMfV9MM$*YR27|(UG2;eL=076Kf^aCd$ZuOX+vVPJ!K7Qw! z=Oe@48_Q23QH<`xi4E~q#^I_tyzR#5Ia|*6DSvA&jU*N<308I5RDMm7!&Iz&I~EhK zLE6kNM>K4x9qC3JIZZ$f(gwb7D{oz&eD=(L{5yeDq#;DyXSCt%~0=YW%(kSSHZ}kUex)xg7CZ!lJG({PRrT%_vr&*B9uY4cn7WH$NuB{PagFMvl zJmyDjE?!jg{{ey5l_tCx3#E=DU8pT&Ja6K<@NChEh5@XQTSCAP@v-E)63b9tzRj)P zP5S9upG-y5CzDT5CZZ$w8s|fPTRHO~?>tUPnD0+FHh%Qp1)iM@pK|v+r4$vW7^tge z=AKu^O2EGxF9lvnU=bcA9_bD|s8%wvsMY(uL7IwA+it|Z+-1w_^cwCg#^L=dJC%^; z9ZlH$nDnP2dLmExHQ&osReB3VB5}I%$&OI=i-D{Kp+4JNJg%fBDGU}RK!O{QA^mNh zTrl|flJ-Lz6nCXN;C-!4m+v^of>6+^2&SzH8bT)^LZg`!Z@O@S9D32QYSH68vG3pa zyY!ViiTUQ}n=YP&?Fx2fI0+y^IR-|q5<^M`uZAIDQOul!H6@*8zNZhEZ%>_=yMA@P zX*?+2uFKaCiJhH~xIr|qtTCw+d|sN9!O}boVVFN-yqs@64v}>aReF%8$9LH^L6(5q zeXb)hv=yD{{%C?H-*3H(;7z{I93}bwB<+fIGvjurkQ#* zr^x$=zKs1S!BBfPQtx}itY-qF@AqoVTfG>g%y=yCU%f+xiT~E>Y0>xlg(AcsvdQ<8 zTk6FPoDCx?@?Y&s#bHb!8Zunoi|H61zpYOd-QgWKV8e!G!6x8;q()r*_=s`nk2bF!ZrjlYsIJ)qnQpbX~u zaXC$?5aKX!O(l1^ruw7*{>UKE%d9_vTb1mbugBy}^YPN3rGyVJzi)?aSYDn7BAITd zS!dZcOfD~#^F9Y=?2Y{)!5R;Ia+D_U=J(h1Un{@Z6f7_1TjdygHP&%ot$i#nbHZt| z)MU@&xpbbQw^)^QF!{^nV=T!mNv3^E@8cZwC6i8ah+d*B@FrV3GK6tYHKv;PZ)y5; zld2z6vwj+u?8d{n@az8rtw2)0$A^CKuO`0duZExhmQjt(zOgD9!C7E=qoxhN_I<-X z@UgLz$2BJuSz**O^kl@O=6Ae*@cVC^G;UI}sawUBEOAm*7%4a3n|$$^HTck143d=w zum)8k1IjolNn98}U-BY?Tvc|6b9-P_1_x4rClG4jxisHRz0d4kegE25U&~}RsoqCc zKmXHLpZ)cU#ak)NV?qgC#t%R~N4eGcZ8xuc`d=5#|G`U7uT(*f*e5^DsaLz#{ch#c z-^S`_3p>Hpq|I61GE%FiH z_^>E_&n_uP<8a7dj*yS(P3|u2=_BtX)UQ40suO{;9Qr zU;5t>?7Iak#=%P2PJM3h(BiAA_NmTz5Hm|bMxD_ZYAm!gUE+8ri(>}--7J+pyQ#17YkR7*$7 z3^2=*S3d39L~ktLfxSl2dLgYLNn(P{C?YP;_Eddt=!C+UslDSTWMj^5mfs&}Do7E2 ze=Ew2^Ntk7m8_T0qP!dW_1X7*bj*i8H5x~h%dVX`Vr0lxM$D?Omf`VB-!=XNA8kGP z_)&4E>PND!nXh>7*!O>A@Vt5BnRDX4x^B7Oz!j5XMH~js6APAk*dF-R1b(Q5sWL5t zgDTxA6mWs0C!&N10{rJ7yb1GilzlC=@#Z&PdpX_K=661~eZ^0gJo4-1i(d6SJhqaY z$qHH6q&NQ_hm*xPOU(b?lE;3x=GCQvoFy>7{mlxn%!-Xme)7V7-&usmoHBiP(L=vq zv2>kh9%o>d@1@>F-D`in?D6j{LR6Xm{iRPm+_rTynWruK^9}ybF`+e|2Rs9c{5-w7 zWOG+LsnA6vAl!4Td{BSBl;wr-^x$#9=xOPZ<8n=Py%r+~?6FLwx*}{}c!MA8W$+48 zR(|;Sx~twb=EHwA;r)L#_MIP?+LXw}f&d2yu|hvUA~7*ta@D90eq!WBmyWTymy2f@ z-wx}BHC}Y}s1JQ&^f~8DOxOj+@3T~?yi{cYGKaDD9l>j_Z1J&k`YNH{Z(?H^Wu}0! zmPQPuq|*Yz4pkapd?1*CN&@75Ngf7FZw;?9(vWUL!(~Yq4XXqpgEU^urJy?~f?V3C z2nTt29X;D_edeD3eEhE4SFCJH#=Wp(;pSKV_2q|u{mR1EdgNh~C`fsow>|x*A3bsB z_g}pKJBuFv_M-XUdHLb*KK<}do_^}}-rfR9@Y}Qfp0Mk&*B}4!!h65<%EOxGe{0FZ z-&*|Ww-!JB(3W*wc=nPy;f~&IzkT$!A3u4=f4p?xw--P3t;LUgYvE)6_Tu8w)EL@NtjiRp3VAHy`T(3 zTZSSM;w*!Xg*dJ&E+{(}I_WUc>o!?+&34@Fb;E#hGGkA1KD2woL{D5)q3x!{b$=c1 ziz!!m_1ic1ZrSKzaZ9a(z0lE8)&6CmAZ=94rBEp!VjskvTyTkb4bpzsy)VuG(G!2X z`}J4X2Ub@scyY}OKYihm@4xWW#sH@%iTwe2-I=z>S3dpoM{oW93-^2%uZ9;swIU32 zIL!pv$Cp0#(*-yG#|!s;Z_$G~Vm$Jlmmc}flMnxH=_{DxP{#ymuH zA3puZ?=HIkTT34L)+_VB^Wr1ld*b26ogH{3jfy^b8#~tj=J7j!@XVe6_A+cF9DVzx zNB{NFhhJ##zyb=fl1Ldi}@dz5f$) z-*dwWqsP0Jl_x8wIH#S`T=tN%Xv#57!^T^_L&+v<;&gjx zO9*2k(S{s^;tig&%1I@f#3o+XO%h3bQ6bb=nIN9BTP%d5c)W`d%}|-7??ebqq>~v2 z6MC*S$TL0GhE>_#ZmmC9RvHT$z;-fjAe3;(2JB;CKyVm91wn`_#E;`#f2xa6hhckdDlqJUJlmwIyLvp-pI^ABG5({~p= z_~WI|J-u6A<%EUqCze0`)5res{TJ>9)X!2egE4gCH1E zN`>TY-o5U&XYc*t(|7*+!Uw*!WIj$N-+AfLe|z$g1sgZy$((tDb?xhJedknamCFRhekiaD)8|ci z=MA$z`0=@X7B%xfjP7XgGgM>vhJ2d=Cf+j-LQgd_rlSSQ%X z#g$JXtDNIcJ8}H*@wVMSgm^N;o;cZI3%`NrgHjwwXtHyJ15d2SYN5I&Zg5i$q85b; zJ`uz?uYlm((#-Kh+Cp=>zY2|MVF1QTxx2UeYgSUU5eKl_C#=vCIvcrREt=Q~S(o~{ zK+iyxXsK8dDzyhB!-MZre*V%&{%gS>f421H*YTDZuWWX%{>7q)fAZX8FQs~V#a|ez z%(E+>|M4TYe*gJ&9+BA7^ry%|_^B6b%?U?DRwnU4PTe_kH4o_uhEyamNp`oNi@h zvGEB{C~~MM$XSJfZrj4#AN8pOKTyMkQ!e2giFUbN|xE|M1GQFYeye9oViP8=4LW zb!X~2I}071*@B1h_|$Xr%a8y1mFJ${v2}O0VD$!8I^*^1UbA!6J+D3X>t`NcLncV| z?SiNLbRnJga=nFI+ROKP`Lti?)szbYtTl_gwAc2V7aslX@CYv|HhoZ`KLKw{+rpK`=>dd`R1I@eIueze17)a z>U6B|bkPc~52Aun*!_RyWze|q-kzj53b zzk0?6=QX>r5S7qXW#zp3jUWE3Mr z-?nvkPB~tpId2c@&c(aC@@>09-^&xNY+wG}`+xnp`G5HCi;vy4cGcQ+st1w5EBGWo z0=clTWaG*g*R5Ee?(X#S2pT#mhcUg_N3Q9#8)Zy~!iz4M9JU-+*l9$qakjtgyG`%j;LBDN8By z?f1nLxkFneS!$!8RmhJ6$A!9B^A^*f(g_u9{2dFiPwTXyCH z$BVUQoxwf%L{}=`-IYtHn7kD`SN{0%-~QeGzy0}|>JzV)@IZ-3>5 z#cjKGdf8r(pV^UZdt%K?x4iVk^X)18qI9Iz-?8Y)UoT(0sAJdeD4t|?rguNJ_SIi3 ze)grdo%qUCizj+Yk7%Yc8CtVyrwZZ~d#-v!Sg;_$lpDD1n=;QYNImlK#xcja*ZlRY z&wk_N&wT?i(UFy z#RJ;8rDxqvuW=}i8}Gzo1+3D*&Ux{j@A&wP&%*83=3IOI zK|nw-0~y!|08Q~AIp&Qhw|K+ipFQ{JLz_2l$tm( zBGZ=j-CZ4-;&w#WfPx_OLssYny|E`B?|EiPrhbh3_K#2c^fylX{5OvM!q?|~{_AsY z`s(bz`sVDynZs?%~I_r|- z19!KwJkQAm!!xJ9edOo9KIe;HpYgtrjvg{1M9@H=JSUqQ)_v-ABR}_zIe+_)bKiCK z(4nm!o;vjNj;i!Ounb%7Xix9hnxSxDt9@#s)^w&fGZCQxDpy61b)+M7QKLr7#3;#y zZ2!oLtaSzkLdA&d%(w;!0sw*_AQM_I-En}1*kqbBGqI60KUAjHwQYWO&64$Arp<}@ zR^qa=F8St1KmUyne&QqNUVQAZ5e-Z(`5oO`A6mY6mGashx2|c(4VS(1udaUQF~eE{ z)w5G|KE7_{s*F6L?b(-tSAZr|SQG37PQtSr^VFCN8}mWZ4;@*^`DN>t%wMx?wM89H z%wxCS3llzG6Xv?D?91&No>=qxE*;w7oY{;VVvUZh8BqOo7k3k+HHtDRtEUT(`MMY} zRffXiAYd5E(8M7^3Z#ZGt7qGxuk+nC}Oo;!DHYn?~zsaWm-1`k4Hqrg_aoBj0PzvZ0E+*8hX&$^)gl+#;U2Ei%8D@U7CiqXYX!kAIe zCFHEU0(Z9MrJ4ynR7y~n5N!c5T;l?21eKK(kRLR8 zY0BQSdPA=L-X%-B2rq6bdnlCx@*iKZ@bUG_ zH`%J&b}5Xs}JBMkwu+$Tq(QJ3*v#NDBEdeUfi+f zzE_vx@l1E7(tk}p@@8Q7&U9Evlwakr-gl*OV9AtZ*@0pAE`RCMUC+O`ert{!}yGr=A$4(W--BjOxtbx-J)aNdN$OPXpi}sLEUl zFa&VW1Q&&L*XHL}FI$-D-R(F9%ROuE+5hy>FZ|05fBmVqU3Kc%@huXPy|o=17p!^y z!A;9w%64tFtsch-846SUPtvEU~?JPa3lto+JM+sm8R?<$0TxsRxU zLP$aSwXJLKTl?BNRp@l^YRyUb6c0S6d>5ydv~7HF^_n(PD>p2Da>KHfmg;m8A-Q#4 zP$$mw?VNqSedDtm*LD;6B;BA|I+AC=D^SO-JnO&mV>XLqkMSrVa@m2~xw&`gb8Rm^ zyLDTJhROazKKL_#k56a=VT@ z&gNcP`r^7*mUUPOnm)T_#K=aA@FF?=?wiiO^xDK}7sxr}v@-{d9Z^SwSf&Cuecgvo zx#aCJs7}5BN0i|shSy;~h!Pft1{eWWYH@Hjg>^f&;rEb=h^cvCoJsxzGp#F9+M8nS zMsti-=Ni#WigM{fk--dv(jFRM`$4Fz2puP1=uVtf=%8hDFLLF?a)}&KPCU;&W;`Wq90gR#F{F@b@W{Gpb6TiCt6yk) zc@`4#(-~l1>axFrv08yMF&=?+PUeE@xVH$K+hx+I1vO<8kvYH=Nu)HWRzk? z#P|<^NtqJ$N#?PH-~{?gD%lNC5iTQ>Dg(ICumKse%tjGK@el}Jws*Df%%%zq_iVE} zXX@;^O%u-^I{SUcUGm9`FFScyvW_zOTyJ+Sld~M(iVtrZap~lfFB~`P^zmaGCvN6vFfiZ@j)WsD(C6;So((wuS~6g`#|xGMS3sN0?XG zq7;$IuvhR(z~}CqwPiQqbtB#zSOq_5qfKx4+c)#>-NX(#F>+%Ri;*0~O$fnntawnK z<>ecC=bbxqP#vW=s-^erT(dmWt!VlQ4e{no&dqv>+^J{98*Ey3U-oZ4di%o<_n;nr zq;qb1{M=zDo|b^>l?O6k`@+3XJln18sISVj5|zpsHiag#hKNZLI4J8=&%?`>Ze_b*+X+>7#>6xK@m)7vIeJ8^ zmk;ou#ooj3+c)3<01yC4L_t)qF6<=l*%hzs4hmT(5!lU_%sA=auXyiyBgZ!R1zQ$i z{;AiOcM@)h_@#rqA-Zmj{qN3zqOQ(t7`UXYa!0UCN(GkND|fgE;w7f<1zXp)b!|{C zk?SI;P|pt9xsf)mD|B{}A4o89;>t~sV_UY8eM6++fR*@VJ2QHGd{`^xJA;l?-D5B3 z!WfMl9~(Cqaj0$hgxE>*lA{}~1;1VYwU0dV>S8anbS*9n9mZ#z93Pdmp1yO-KY#S8 z#V=bSl~>6tmLjNAk684W@u5U zWEs^Goe`lqFk*`KHW79AcJJuwOj~%awJfq{PCDlJ`Y~s=PJj3GQ~&n-OD>)|9k(DK z_}PL_c|TDIodCfYcUPK6b%dmll9TI3ee|@ee*V5M+}S39Rok|#=}`r$r6YX?IPj>ayMUE|g{7kPZU&_R zh{`M;);WhkhjIoRfu|y%NK*j>* z(DF{XaC+Sk@>BHe!)sn!*x8$>5i=V`jBId1FNk-aa8|q}NjsL(S8jadSO2+Oxhy?k zHGF#Fn6qPp8fn9#^yfc$-yiSX;kf7(y4Z)5G};Ff2-_b+WLB}ZUEKt$J!}pPfCrFt z4)qv80UZU`%?KiGB9DksluMxka)UxJgrdTAfP^Xvb4tV=h2Ay0x8a>!z!urgh(RMx z8Z`Oz!85O(e)^X$zwUf|y~aZgUbtj>aIP9~!~>=*1)F#8 zf=4n*MuM(N0Vk6@o_L7t&>3Do_HVEK#GN<({arWy-5+oKfB$mLJLl9g-?KuM>P>BE-`r8?-n?xaPPbNIH@k@;iMRt7dr+#U zCtoNah%)iemLcQnny8~i^Wxz%E|@rV zWIP@ZaRljrV$QCu*IJCW7Y~7kn z5Q?U!yXWc0SFCws)8mgl`{E0)DGiE3E+un;KS&&d{8V5 z0^h^4AkIld*=**KCl);M`m1T?dM7@*zNMb6I8i)^53?FCnta0h&bw&l(AJndR+&F0 z!UR*3+j#BSZ-38emz_I!!m0H`E}t~z*ioZh$6>Nqu@wgT5twwswCbD+yV^G|-?6>h zjr*1b5A((xcfpX^=ZzdW)V6W&Ju6(_zI9!&>$R;L3XbiO>$t7QkD7M**g0p6oiNlP zH!K7kZb@~tVG@kXl5bP2@gr&mI@-EJ-=;lx9TgMqFMiyLC7mljXLau;^CzbG{dw%s z=N^0X*`=?%{@7!S(&?&zqV3@wPbOGjcuZhC1x%gUkgTUQYu9G|u6yR+xhq9Yt#s*y zC%AU!&=H9-BPp}1cjZev*S+Tc===Aj)8d2KYi_p2kEGu1ZL40|vF_FQLl3STI4Ypi zQmgNUeWUE|u52#XPbd2t4_wCXM*}QL_9LS}7$d?1A)y2V2q35+0}&aQCKLrkM#TCo z$y%mENJ@nP{(}dmK!tbQbJv5fEX=cA=fuXw6N8+j!U;BT2Xo_@W2b)p?e7>_SC0@; zY8Lm#sULLB8E^aG-1E;LJn^*p;b#vTb?%JmjtUulROqF$lw$a=qM$q5v3A#%F2~JV zaf_4Z&N}JLrb!o0o8DZ=xnWq~U~8uHvgX$&#&E_M|J$j&zL)|bqsNiZvD^uH@zNv^x<_|x0xkg(M6aJ zOw6#fNVz+A?DJ$ZuotaSN?|}kx+s3J=ZM%OLQ+J4DM|{Pkp+U8$PuhFz{o3%Q93~K zgTM;{LW>;wes1w=OKyMe@lFaHyMAP{afoHR#17fbZqf~utyC)2wRQXEPEM`gytOxz zx0IC()b!C~aR^bSJEW7AJqmYpwuSmPA>k$`4Ie+De#Dgeku&N?PO58cVJw8)@^vdy z%vm=PSc!>)#=dR(N#~56Jgq*FK);mgQr>Hu)}wziZ`yH<9fdQXDAk?I<8$VKW7F#? z`r#ELh20ohv8>(GQRu`^4&lRQxah^Dk39V38>=?{=}(KgQ?mWd-iRt=4e2$Cx*>b9 z7JKIGaYGwv`_9bH-c8TF_{^3~ffb|c-gS|US2+#V^r@EDLu(edz43~F%WsyfUr(WS z6mxm{WIO1g*I(TJ#?t(gPqaaWK55^`HNg_3#erBhoA1$`9LQkbxEY?dV?Sk z5rHu{6P`dA1Ass*O!rPpBnc1*AUH^%K9?d3^UpwG1+EE2Gi<|+K_tV#SSl);5lpC$ zfvNDVhT~RrD@EC(`HWe z^NAq6HM8TZcm3=$zxl66cDDC8jg3yr74uG;8ONte-4lgCtOd<{72+)%dhXl)D?66H z?-yUa>gQkm=$*g#AKY7^YZ=ZYd zTW2^9u~-dou~*;hkD0`XWv9Mn^uOP8$(O!*?u^m(Rs)@K;pDI(uabnVYRPnMft7@6sw%_dVLQbh%_s;P!o={8So1D<-wh1!XrU{w^L#FnL#Q1 z)G941pJLnFvb`B1CaZxiyKdfP*PVRU1yioLa?YSuEN?0%WdzBze=hyu5S62^dCA_(uJfp#KdMyrI82MHXM2X&%ok^K)$(D1V@;L8Nj$$iUZcTR+ zg~b+F8ZiY@dM$%TWt~ZpiO>&C1ep#lp({B4k)98cwHGvB@+ct6VnHGo4RlV>2#8D! zq+3eMMte}48 zjX5e{3VI89yii1ilIQ&tYG!Y?8Nf>RypRaD8tdHbNs%>zBJ@hHcoH?~q=-Z3wddDS zFTtX&$vN$!W6rwxm~$_le);A2gyBd)F+Q|gF+!0Q0#e>lR--d*5|${9IF|qO)=&P& z_b!?{uYr@!oO$DijPSTF6Ci5%tdnm@;YyR{2>;2=R1+WwaA z^A(#NNiP+{`24K&L@Hj&V`h01(=CE@P$5+?CgOp z_Nh_YLL5b7jKT;qP3RN`UgU(~OHrX!M)x3tvH`{8#F;FqM1)fV5y2EhM69zt zIU((#GMF)jOxi#MA_FoKG5(`NPLqa@n>TLeaB>3r;+>mB}n4=@*rgm%;gz>kC$6 zK5+A?uJq3JUdJ;#-uS`8f4F1G!W~2%1+Nfb!H^2E+}Oo`WIM!h6*z$K?B{!VKX2|} z*>6ocQfFX*JING}JIO?>pJAbfp*?i?LgEzcu3fzyJ@Vj#Vxr!?=!$vMrw*xO*YBZB zJEgYKt}WEv9aE~V!T~m^|CYC&*bt|D7wy_?b$2Fq?@DyGF>H>RJ9bc9b*$eI;Fmc; zv7x>nYac#ufQqdE01yC4L_t)^w&4W}!BkGYtKP4ad zf`P)Wl~&-vvbmu#F|hRkY7m)}RMAX#MkDA|CBdR(P{Pp};6i{TJD5vhWaQRc^_R|? zH=685ui&Uc!OHCndzN%>{?~hd|EuR7+d`BhJL%Np(P&IO*&Kwi(8tNsw1>tqHB30> zghXD3dX}_p`q{HjE#I|Ug>HivJ7&h z5Xu!I&FC)RLq`G8$#^k!w=FLi4u`o@!4(i#?yEalP6U*6_UToqbumeBo zj~LT9atL`TN^Nq|yXw+yb(_~Itkj{Cc--W{K}uz@vSOB7m$TfqA;YbPCL*kLvhp7H z=7?gpQsZel3&vOd9!=9DdT|a;F{(qZ)-)gT=AiK`38&Tgn zB$*f-gmL*-nAq>qCc2vDeE|ZdG>YkLKV1?1oLDiZurAiG#q`I?Ss2Bh_2qPpCf{#Pmj4AKo%d1DVbmY%~ z<4{9mk{C;4z`>z;J#w7I7Zs*Af}nh{UZJE&_j zb?l1c#iE$Yr4)yuoj&{g6NWU9ouw@sDAm@O-jQhEW%UF!ewsaegx|hnn~$L3P~!+U zaM~Igz0t#45ZRb$*S7XNLJd^IozQJ>X!ZuR;t5V%%LNONNc~;9=kO!@hW+N2#{P^B z08?;?=44V#Edek$07MeZScs%ADas`irhzg8TrM1-Wa@I9>&`vljPaH`D3^~1cn@3H zO_>!vJAV1({Xbf8-_mRWGsna;Mo+ool1mf#GQ=UU_Drfrg+5zjMvngIb=MDaoIVi) zok6XF=X;s3pY`*A0|t#vE9fiG>r(xjb%GU-P^chSE6@!!_Kwx&&KOU^Xxgp zmEYBqBFiQxS)h1l(~xXqGvVb969u74^%6Pc*87&*Jz-*E#PGO91Qqp3(!mM{iyBk} zVsR%?e;`9HRxITR8qz2-A}|&PNir0PwM>#A%BV%umn!!IDh(M{T{2jaRiUXJ$MR3j%mltg?1)bAIz5Uwz@; zjhnlOeU*P>=jP2F-2uCePW{}`Q|68uKPu+9zTeT+xudh)CyII$WpE?Z5O10}=9n|b z&%SW%^m9jzn_Aysg+a#3ZOCtYc-7Ju+H<{5Qn6KC2^Db{492!)+ZL7$z#1LNGa&a9 zm!W7bPZThha8b*t*;A>872p(;KhSx}CAtU$tJEA3lAr zcmMCZZ~n=)Uw;3M=bqgigw3UTN-?v4))|9skCr`^`{z&n=^sD2@GGBr>c9VI_x5fY zG}bWWeRgDHJO-At~q4Z2oo_yDkdb&G{V9~#eikzSpY2` z3}YfUL9r|5oPOQ$r_F3=XbL4TDE14S-%6c-Sn~LvmM`lhd@qdJLDTpAHFd)Cj z?_BuCvp;(L-rsNAyxod5xXovbne&w^-#<0x_WLS_*dk&bhTsH5CNV&f7=gsL@!KS2 z7DNORhUP#bGPC2D9~)yrM}0b42iVktS2;e(kw@;a+|KAGMMSOG&VP=(7|Jn75Y|w zThM*?re(J;c>$lWeZoY_9N;9ugiXvO3EaX3BJ%QH*Na%rl0L#0Pd;?8_I%g<}aZ{sWoF5^0%$2w67Ujw5DLk_#%TNJ=T&vK)*1;1wn{ z@yM6~tOv`X#-=!a%g|%2OHk!D^wm!+`tkQ) zS+RxchtctKhIDP*h0j!!pts$4_MFpO=bboo`bbOfJ>I#cr)w9fdV0$Zr_MOL@!ZR& zj~T&^LYEZ!wol^7B2<<)ct|6vMZm#jaEE3UE>qu>O;4*3Q_x(D<*IBus;Bh_%;3xr zHe>S4nWugDq%%%yXlleXhlED*cA;H$-n07E->!J2UEhZ7sa@;0Z1%#i&Q4AnGU?=T z(%uY9FBm;>R_ovfi+s+tsg8S>z5I0h zE<7wNibD?c=S>;$q%$n%3Y zHl%Uvo^#@eQ_dcA;iat;Cz{_xbVoOWXviXffkcw4Bt}9!=_VUpY&TIJ+=T{(aLJtL zAW{@GCWsa^L&@aQSV<}gKov}o4M5dD-Fg&Ypt60jz(oNnnHyx9$~X)#oqa$QF?ZmH zgDi@T8a&}c7rpbw)8G2eiL>X$8k)Sk8y0-a+nVWKxOLO+pnKhxH~xG61Is$Q1H0+? z3A4X)+55h9*|ir!p4 z9#8M8Tlr$=&P`;6bkT)V@@Zah_x5x*%{_b2=f8C687H);EU`zH-@IW}`-6A2WxHwK zS%W_LsS8g!W@wlukVL$nv5c(jsDYVEMlpJ}@Syz4RoU5;yeC(O=|=I?GLSd;fK#W`po8SnV^1F>xB2sIpd3OyLMhPevHT#2XN}AC`719 z0br*tS??(2s1V)oLccf2=ZI3u%Z0uo4#`O-8b&p?G?0boJw>4(=Di>rP$3lrJyzVe zZA)>|a)%`A(Ulq<*)za2bVP&Y=FFp4G#0GUNE$E;SY^XP-lLB8uIFER>AnZ=z3+j0 z<}bMa(I*~w;pN9)TlLbW%^NqZ+mX%|0{tV+lE_lwh@pdKjJFX_mc7!wVH0(=C%W4c z?QL}{Rua23ar`L1$6Ijss%`7}tcxdnn{7$b4P#l zOY^2rY>gE}6$Gsc-@=NWRiqH`iY2Pv?W{Q8JlIauSHWfD{gV`tnI!O%Oce>BDfMFj z2t<*GVnzp_;7!x8x?xwGe#J-5z4~3#PCT`-byzOzgr0AEU0%oXE$i2H7cg786;`@` zc!#2kC?Og^EVP9^_r0<3`w!jq?3S&)esWCxnCs`9{;BiddcnA{EtZAfBusZm9^y$S zQ4f(vPQr5P9Qny$@>G~Z7|D{|>3Idq35o5Hnw-SQ)Gi_ab;ccN9c&OejAlKPVOJ8~A!TI;!{lLBR=im4E;}1Uj;-kw~EZn?d`KB#fcXtMXa*H0A z6gR{hPM$r~@@U;^dSgW|o_BiM<6UjB<*!i?(3pu%bK{u#e^|ZhHJW(R&`*B){Butk z6i0n5ar`dkn&;oOZqsTSKfB=*pT6+C(+0=UV~>Kc!RL5LHvGd@;gUg^jCE$1(NKMZ z(>#a|^?3)5OTh#(5#v89CuT-LE@YZ2Wew~vvncAhRDfs*g_6e-q98$`39`bRYq`Xr zH&jBzxp8E8S#gk3drx*}XJ)uFFyx4Z2huT zz1=(Ay3lH#GiuhnMC(b3meYr{4zdeb>RH^r_352kvZUI3+a6s0%&m)_d~o%e9RocztuI9Q`NIz6uKzHq|#ZC+clt#mZxU z!?q1+zhlF$?HhAm)|OA`tuSyc8-wdR5rArRB+bCy`pPtTgfntXYd?z`n*u1PpZfU8 zv*T`TXluie!HMHeo_W#br(E^U)31Ej>2JUOw5#58(!1Y#$~BkHYl``@vmy_8)(>)S z!EQ<{_*4F&+tbSy?V_Mbu@x`WrPq0n-_w5A?dg}7Q(iSZaQmj)|GW3WdwL#wIRC&M z?SHyu*L}Bl@7m&p+4{SFv+9oD17$hSP*xj zo={!AGkNMT0A+)Nk&5o9%2OF7Dk&<#l8lW-hbO_4=ZC?XO>IMBL$928+W$NI@~@mQ z@A&2xo6&^;$Cb8Ry7VfC2_RJ`1s7S$Jooyuzk6}PBe~x8c+>HdPyF~s51y z4oNb}uNxMM@nnZwXiF`8R6TI(?q$nT-9eqtF{NUj*L?52JMXz8y<}mpUnW%k;s=6gdTtN|5QC&Svo<5AMETgFU9|O!H1(QO730u~saO5ybG|=pM z)6Tne-j(k-TjI&}r(OM?ldt*Uym!9ugu!tqUa%M^;Ha`>u|(p@X9^G8?mhp+W>yK3 zE^v02{mO&8?*4=S^vk`4RP!_Uul@c1?7I8z+~bd=AG)Xg&fo5O;LhN+Rb47I{H1#~ z|KYc7_uQ3!`oY{IckaCNx7+XeqrY*Fw2m&{8E*l1qX%5yrv}@{+pnh`_ye{7>=k4Z+&7;p9GVa7g-9@d#N4j>7y>%*o`_hGYZ`Kp^KEG!1 z?Jqxm$Lq`1_R9aUrpvLxiIxe;hAD~Uw0Qjtw_zj)c$h+$10o!a;>6gitB-nqRu>#=R&_9&V>aum+Bs8XY&W(JsL`4xx5xcy@%Ha52=u@i}?q~x+l zRf$PyBI0CAUBjrl3#m2iH=zRR4!h+kj z-+K!}P5Qa#+Wq{9<jTsM&@smxn`~)S_((wHhBQ20*Wft$Y&uY3 zXyF}9c4Nn;P2{g9e|b9BMOYC^1z|3q%TW4HFFo{=C-42?)A#@I>H8jDy`+QEk8gVQ z2haZLU!MKr*Pg%cYtKFMvqdlL@_pZm1(X$z@v4`(^<>p^4y!F?M?)$^CyKZ^y55HTwc~cLWq_8haEgDF31rQfx-*Pe|M%Ry< z=pwA6Tq2_`6%Rnb2HC^9gp~wiQYu2Q3`Ejr6hU;534Ql_IeqiO2Y>m}V=tw@A>r*-`F;lo?KEZ!8Sg4C1ip8mn`aIm8w-@93Spsr!RnX4@$AEoZdu<+R)J%7;LI60YA_Lg z1En{$>&Tq}rpYs{VPh=jLNo}**3%S~`(#iH5^(4?#@qxoC){l>=T-R6*_S>Z!H}oiiH$3g*?XbK2`Hi>y z@}+z4TDoa_Pa#wH;uC9b{q+ks|MKNW?_GD>Zx-GBKZ{;|aU0sq>^!|?Sewz(HH;J7 z9g4d{ad&s8xNC7OPH=a3cSwQa?(SL~3KTEyU(Pwt`~AqDT*;N4eb1hmJ+s!D2fP{M z*9c?r7MuQV`_Jo6sb26$8@fO-(K{>n!Z>EwIk-3&h?~d(7;G#eKd3!~F<3=c zK#qZR6-57(-!XBfKS8o;E^!<*Z(!C>|9jEG97U`AvV7ShV#M)jY}9sKP|*3x)4=RY zIoe>o;pG3(Qy}E>m{8z*Et2nZp5#dM_v{-jGRgYMkMFtw-p9F#hD5~C`Pg!(exO;|75S6Gwz&nq#vfuAE2wdN_VnM9*4sCl}xPagAmRZWzx zaQHQPY7}ydRy^FzFo+4FI0t=*&}op=A|5y~#!Y2}M0DTPT7_-~Lf#Y-URZ_y3Vmq$ zF1HR-BdzW!%)v{MtQCSIS(i2yrJD#Rf+)NhFwCG2L4FEloQ@&ng+NuPPHRIp#%T zLL$NUi~iTo*V*49z4kw>L6+BTwu7VbD0Af$0?mI(x_ms|1;5yU6aoL%N!Dl5p7T+L z8Z3TnNEFD1NmgBY=BO*IbpIn&5xEYvzI>gn`0zeU&d~Px+p_e>Sj6MZE5H4~es=4& z<@oY*Hlx63VLs0Vy`U{W4`aNXU!IuLMcNRZDg>%#fG98L|?pXYpIn5N`mrg^!fd|K8HaBV`AlT;&I52cQ{uvH@D!|KN+KwkPF=2G)?gE`X z7z=uxT^Sj5^M`de*`3ylyqVoF_ZoPAZq;1AyxaeJGuul^=oJ&w$lPDe-}GbLA8)|j z_B#I8>0}t+_iw=M>{d)M>!2%SQn=Ke4rUCWvZp4FU`No;A{KuvK%<4+3@53r8TSWY-Sb)-S*Fp>Bh@-1U7h`#*sajY@_Yqme`m;CK97|A z`aGY9=Wg);I#AZ5xL}T=kaA7g5exZgCOhK&;#chM^1ONc()0WSe3RbIzBiok#5NaF z{=!ZnMUucA_`PhkeTBIzdGr0PRZHL>3G1c7{bpIhhxcj8XVY8NRfD%r!06@o(R(eX zk^7&cO1WI6K6L99%2`4~N<+}ITHW8=Is@NF7-v0yS?}o%fBPGrD}0c7qNUuv%5_?q z16i&cQvQY0W@s%F7)4q|)~cX-ndEOQI`(#m`Q* z^@pr*-^2KV*@9lX zQI;@hN1IWJ z=hL$Fcf%G}toea2`MBC;VkMHPv|i`9-Lqw~Gz0 zG`9`w8rV^;kdP&i`TM8UjN@>MZlc$~rOpP=$7A@a_Thq_0B*JS&&}%x z>q%VD9?b54*HaJ*)aa?y5o2tfpy{gh*6ZWYkj@uDG6MPSj-w^Neogn5_d+t>XveAvlys%X+xjA|0*daN(Mr=795pVNF94%BkYQL}<`vixv?^sB+3!FQ$oyLS@91IbD48wU6#1~A&qzf+F#^)SsHxc!(Yms z(c77cv*pfO3SG(_J%ppOa=Lm(M}7M8{dnRHx`{JC0SP$8n3BQG3^$ z$(e=!qg0J|{_-lw&hve`FNf4ze(AR9mgXxeBKD8!wtDIe58-Qw#wO;?mUG=;?%t*M zL(*T&Z6)UYBo}C(E~8i~=XBU>O-!5OQ~gO5hmw0i;sL}JF(Y{F7;mQyd(Sr4@F2h{0`aNG{~BTf|T6~6rGEdB=jN^O*2h8-cQ4EyV&hBqb{ z+Ny6p;{x>O+%RZg%dqj_P>%UV6XJ?2A=1*}Svc_wEB!Uozo5T}!e=m960&vimeC>X zK^60zdXj~dQs-rLpo_7g6K7y2BA6hn(wU*7GDk3dp~w9Dm#5A zk@qCwizn43*Vv_5b8KW5Fjj5v(xI~uVmY~9r$EbJOeMBtF7|@rFLWDO8udjr?O5 zXvsJv)GA3}h)bWd4kaeVBt<4(B!OrVyC<(%OU%u?E-5Vqvm-g-%s?wGjzF|C6PJsh z>+&5c9YTI+3BK@MuF`TUR`n0lb|yj=o3wJWZYDO_iE^|9KeBz0e&8-L7fBAU+L)!U z7wdM{ey~=|)mEdgg44{+L8$9Eqjmnn!$G`#neZk-i@Z|Nvx&~@W&YfwgF=x)DPnNO z{XYVcj0Yrwv7XtXdtw!!1AGt8#`${O_u}Alr1F_=hmr9?&Mz}^40nQ(n3kh&hiuEP zi+XtZnmVK<;JZhB;OZUU0p~gmt4aX**$*+3&U}H6#HS@GooPqMx{?J$ru%9dVq4C> zA=JFU(-Tul63dDxC@boi+(-OKv-L_T-c!D+qfXMN>H3{F@6l+FXU`pZJWXM|!=KyL z)LVg1Bq2DTa!F>zTV4|j}3kv8Z(q>_~*l{U$~Dp zu#|0E)^WgtE)GwkXTEBDnV)gcVJJYk`L2ZU2fk+ri?smmIm}=eKKgH-_wP}6hTkh~ zc-*6enK>%>0=FGh%XjQstvN+lZMt1gMt<#^NIPHzwnU zsp_qZ4PGd)k|xkG+y{|-jT)Sopkp+Yz8#Y|MIneUR?FfxMaL;hY&0{WCq4{obu^nq z>vs4XH;t+C#R$wHn#mWXCPEsI8BzYRbB+b?vbej}m{8!g&RzueIMdbwxZe$4uFn+G zJ@2sve^HZmdJheu<$7CDG^aF4b|rfGtBZB@yXFk^-3yB7jN$y#>rK2t^m$VSHg$-b zc^(XT6?p%-@wkEE3*DCxah)mqSvOQ@z;bzv)C0u9=|FiNg2g)SaoZl3kS+cci*MAv z0H1ZM>>tqrrsa+TFFrB>evLSdc}=o0=7}VQNy(y1Kl!|G{-E@}H~d~~xbwUpL01tq z+W5Xx8SuC`lM~qDI6k1PQBd=MMA$5+Oaj2TwpB#$qLQbJgI2FBRuoLqK$QF47`bL< zrYVjgnG~JYSBe$NXkdv6qa~|Ko1W($>vk@f1H-&YTnS?=j;Qz=*HvVnM9acWhKo_o z9PROP%0N-tlD7zun3zJfqUa`@JPDf=8+K}-$un>=xAvi@abx5k~*l(mH0WAtkP?6ckdB1J9yqeWk+tK_Uglf9uh zsiq04LSi(ev>|2M8Fzft4^&x}YuWf!lN4}41UCI3Q&9%A- zeaQzhh2)QxVSdg(Om=;cJY9wUKSXY&=fe5h>t~a{k#b-LhJCIfPnU_Ip#Ana`vGB; z3|}2-$4U0A!9#re^dLMQK2F5*B_CG&`$P+m0k_A9>(FZm|rV31%RL8HyJ^J}$NetoVd=vuPZn1|z%uUSC1 z*<>{2)${zX2dJKi!kumjMc`M&?AGedzDB1&C#Jlx^aUR+TZu3{e0NbQ6Mg)7mhM|W zIzdWhA3h(J`VbXo6YQFiY?Z2BH&!{V3ctS%F_FaIi(x-fhT)+p3w(}bD$8*MsDF_% z1VP|kGteK7Rb&YzVfsa+FP$%Z2Go#=wY3yM=G?+AuUl&znJ4W$7c%a;s|J&>4m6`_ zxg(Sp4*m%89Lw%U8H-lZ@A`ia#t_nXL##jo!jk)w*-Ee7yh)-HbNcPW(&n<~rqt-G6p{CpGvTjSr7o>;sAIwDcBg;>@b!&kI%|{d7AQ8MoaFP` zH!PM0^Yb%CO1s|B#^CL)KH_q{)ki1^qzX9!Jbu{(U+*_Nc0Vpi!n|iZa2}#VF!2CT ztvJY1m2HLU^15Lwx{y@R*&K2U#r0%m?``g|sAH#H=YO#xVw=$h$B8h|QOwR32o?EA* zd9EvMr-QCv*@d6#+*I;6QZwfS&(~Zy!`+06QEXJVv++sYFQV}LZlckQcugl{Y4B#~ z10LG+0=>52Z_50bhQHk|Wgm=tNC4b{mmNZ7sOr1Srlt=cb|q>X+@5#vIQ7k zx1M@T!w%G#qUv2Csc9L4rH*G3c@>Ab1yjH<#h2yHYcdR>E8QX@_jXp{)`R&7&#R5^ z{ixVnl4U~^k%~iYbn@sZ1T9IFhFaQsRr2#rkO44gQMXDG14ujEb@f^k5w3FZyV{^? z4Amwextkgd#aJm8mIeQuMHp2-ceRz(D0Z|fJ}z~reLQ8>Oql7!e5-6)M)e7bzG_+r z!?UOvPs>QSk;lK~&xcFa-!2C_y&hX05}fV)zwS%NM-91r_YZZ6(YSGwhA*#&uH8oR zo>ZK=Z_s$&7vD+WU!X~!k2^)4eto+3d+5YwvdzQ|BQ#u{spNS7o!x%q@d`XA4fMV5 zWX0!Z7xOq)zplD(YDBvCC9bmFr?ByQ^IFw3gs;B9s&k7AM28a)$tGF-b8^@&!nmJ1DN-yvv53zomBkkF7tv2R~moaISdE z>DTvf+DG$z_S)n)_oJwa5E#n%C=;G5&OSdLdS6)f$4NzQ%2M{@Sh#vFmL@-*#sht> zM;b)DHDHUp4_2>U*F-+9x2{NJmIz6o^EK)_?xBs}7iB(oL<&6i++GlP}d_A$AU^DWI~h=w?RfORh2j; zP)k&u#xFD(De4b3UuzgA$NS>;@L2!$WXR)pbG&LKvf+6?2S&v|Y|>0+X327MeoL}e zRCkpk`J#EzN>?xCnF7kXVG5M zj!iPU9;>1p=qd)v$PGmP!?Cv??|)T3)v5z8f{8x&dh6fj zHb<2+cSp=5W6A7>rKzNQJYIZ01EwpkFmf7pybeU(4x`b!{eL&#)WB+v0A%DOJs zQ@X=tN-OQUZF5^Jc}L(EWH$~V#E3>Jif5X%FX}@BKsfqg4r_}Mb){!))UaTr+huvT=*);Scmv<6 zLT7#K7X~m{8PNEx6@Eo$&7b|hS^&l{QkxhCvs|+|31=U|G$ICObhK)pY%_rrLSYhI zHg3t5K!jVw-5*27)tkm{_H;WC~o^R|?{DNt`lDO@0o|93O zf8Op-ub!siKR-TldLH^@dOWXCKCg|PKF3~ZX7lr8xzT+ybGdCMR#`vS3=5t%99IMX z8ZKI+{PMQDeVR3T9^ct{QbF6ki-UK1d3opgIAC54e3+yy2vl~vb>5UNHLE&VTAy~4 znR;G;z3M$0{CwJt`+VC~`t-gP5V;*UR}mslvcZPt#Vgk5=eLHi{{}b0lIJeHrH7}q zr%U7_b_EyBdpZ<-vlXF5*NG_r(JAX<15a>yao-Jbj9yFMWMRhG=$b{A_lK+*_V1Nh zvIi`S$bx2`rW`DF%7UijLPe>GO(X(qacRK(K&7g>_IA~k;A^q1n{q5?D{i3#S!}^D z7YhPehl{xA9QHHwHKa6veX{jOkM|b?=HBadp#jrdzV=@X0vy~lO>-f(+5Eh(W zd|{ z&JQy?_Be^cNjB$v6(tT#tdPVgXQ0JE8u7u@O->l_`iGaM^%xXNEn`;}z zBk{=uCeb`|5h4NShvt79uOfwrV@^ItU8=&cAst*~7P8oWcr zi#XHM)yUXIS*Y+P0QA?QvQtn95_`MjG>q{YL!}lm4t5o`u8Fz$L$p;xfN%Rz-yUNB z7(}F`{Ee9Uj_>C%xSMq!M`_3>{&fUS#TGx>TfKOqkApAEp-D5OHeL7ZE}YyA-4rae zDlAE7lDkC5Jyw;Y8I6N7y_kGI$c#jbMMK3Vcs-(j{vtPyJ4E~y60MQIY7(WNFhngb zKAWI#TKKd!9Emk&{p(j5&uoB58CgpPBuE^+QQU{sK`RSVMi5eLF1i?xiNSDNfKmUk z#jI{_s`AAJJ`!OIih#&jS_+JQjLWez{@gpzmzmq+D*(!eK$O5rAW|q($3CPc1w%u_ z7h#>?^J<1eGbMk)mN14v6|^34i(X_SUk3vK3;C39o5|SeWfe7}=F=Bt59#Ni%?SQE9#Md*`W0%)XWW=^_c1^aX0O9DDj zqY=xH#Y8d8U(!TP#9h<+RTH!!v9U7cwGqUjDcS+#O2=lQHJS>3nhb>kx@O`P;E6~s zgYln7#(}phkN$`6KdmUsox>!yu&0=EME`lAa+5DnUL!QM!u*O14y^^4#)u{fIY%6l zZnCojXcS>6pd$1%@vO)cM5~ogU@Hl0(&Bf)Pa9qex~~qFI=jwmi_NzF?FX2gh1O9V zCXSq9LM;Fn9wa7NOF=Y)dnmDM&(Cxz3T;NjRC9yFfqUwi0d>l7oP2jnTLQ zv3R0naAsaBnuVvWo7kwDhNO;7rJy&XIcJkMLoctc6g8Y*JtmHQ{f%P%H}!IUh_EwV zmE;NfeU4<^E*pPmk!&0v3sXHQm;0YU|C6iBj#DRLw};b6T2JHI z6B?$bDlt&Q^oTV_;S@T$M5X;0MR+jz7z8s#xjJT@lrsRcz*Suvtm&`W_)FG4hFB`R zTv}!wSr_QUhG!&vlKTtAmQcM>J}@WL*ah7aVlp6VB|>~Xwg4fK35$W&5dq6aR2l*v zV?t9|RP@MI3V_*oD1+$Q#8+JyPcg)v3B63c#e*#x9TX~`IPg5AMoAlX)n)qtB&dIb zD_Lz6v{45j*}&aPfbVHmFl@w(h)D$6j z2msXf!5o^8UVD+73beqzl!{!TSb7?M_c+B6izFD7As{BCX$g%PrU))p&j3;Gco58w z28YC%Qv#-Nv`s%lk6;&D!s^a27%EL;R~cFxicu?N~7?}57m!rvC! zdwvu(`9X^TR5Xr&tL7^hMpY3{d4c{Jn0`v8#%E;6c}X)fcg-Zt($eCN0pPk9RyU`L z&D)su@e)d_h5up^O|wkq*9+-M3UUM4@=l6E76_(s!jp(JlsQM$76d`va^`E0?L43m zL#>Gl3lWZ*Aym?WB2Qeo3>?Fj=!iUpz+ML#T;8~S-0wIW4VPo zmK|qf13_eZl2RSzd4iws3T#H46X8lpuCkx<>MORd#BzM9c8JcPzx?Y0k(+KX84+qf zdUW<&&tcowcw#CF?Bshd`hoR{Q@O8RdCq?d6Z}7bE*j?lD2;3T*T&wpHj%!gb-y331&_VD2u*8jdxQ=7mV^P21V9JzC$sTjH+l|BZZXOn&+zR(VuxYzT1^4j3QvXG~%E ziKkJ{q3c3k=5>k#AB^r615jSvW<;NPGOA1y?;jqOyWU8ChR4k&=c@bz&hC}H8e=oy zLQ2kkc@L!?>ys+VBuag$Dc1sElQB>9aH1h~RF>A3VKRy*xs~Cp74y?Rj8C+oO)@}AY3Ct#7P z;Hi}tN|%X{2p5f^W^or$EJ`hvYyos_!#yWs_2Xk){VGJ45m)-dWC&9RO;oMP0s_)v zt{9?#EcAX7%@Y44RBHZwt_N#MYy=f*Z0yHgBjm-f2`hsp%*AkF`HOLO@ZeHyd*_qv zJpYEz?C6NWeLg{o6^*%z_h=0KIg`YOylI+UFd1Ne8w(YO4Iaf}*Nh`J_3@&47_5t;TT=QgeVTRDQSz%B@U$($cC!^RSOA zi%`Gzp`4rmK?*Fim+ZNyq7+B;C|?74;y263<~(Ey7mXN^Y`S$4&c!GoK963Q4ACwv zvy42ZLY|URO5kRG^|5y7w#{MpR0+I*@x2$L7b&%y4Kv1IY(x};RzXY!5KA{G>WV@# z8l|XHQ_lsGc- z4K1X10fa+Hm(C#xsZt=<|CWdrJ(N{chRk-rBI9oraqY41ctz}f5m7PCU&N($mGb7JT*_>z4xQF0 zCkqcf&_PH4if3X}#fAeB!f;b;5RWsm;Ou}F*7{hffgqZG9T7VYdhZ`J6qM^ZC^z&xOE566CyBWMB0`e3R4Imqpnyf2JF`QVgXyo_3z6fPo2XAKvjZp zpa&Gc!@Gxw%@ zxSYc}k@A0+-mv}srK2--vE;nV%(&^9HtOgF;G>lTa6#5wxyrC;UH($Orkb7lRlVxM zoK-Cj%I{%xG|7~$1&kR@_Ip$s?Rob%A60aB$N=P5GTgfqd%T^HSv~Bc#$aJ|Fh31 zLzTl+Zx@G3-H(H}Y4xrTN4&IJ5e)9{a~5(`VrOQqW21!)h7|?mO4ecYhoF+Dz1`h3 ziF|*oB`zh%|9`cBPLY$0$)FLdvU>aDbMIO z(ZeJ^eb!BL8!gz>N99KCSA&H{)sZ+or*I-5x^pvh6CI-};@ZE|G%e)}*IzuSn;rvt zQT8HVFAPcZ1rOTzyY5%gh9dZ^BHbG^EcMjW<|_{+sf%`sAs+`U@sSIXuZA5&wW^+z zRZV@_lwWT(_FQ);2)UY_G@63yEWkrRGJ_{_#^VVE2YTM}C>uUcnyd|1c>UCW<^9Is zznD-ySS3Bidj6$zBzDz)IWdze%#--BrFFy*A+vzWwfN!QaOfxQ$?v{#-a$fHQ99FJ zd*e@<2b zz$VnSi75(7tc`Gv42oQ5Xkd&>Ctmw}8+kRqJCO6PdL@DqJo+glRchSI{?GVj3r}p@ z2Nq{Tz*R0-LG5dRyuz94uljz^+{86nA2=jzB#fTe;2``EWR8Cyx5+giUx6+>b-?(wmmu(|GD<&5}1Gt2?a-l4;-7k0xdXD6`eZ2uOL*! z6R>yGw-3kBGEa`gKM;J&5y$+J`p|-r8jrlI{uOSQnC+Pik{SS%608162I&_9V71ik zlMe;e=3zk*M!M@t7@|7JP!r{fNnoW^pz)s#(69D5&HNA+KFdan&vXsJdcQh2cf^r^ zFMgNf&qSYLDML&Xm*cK~u(!@+wNhjgCYDJRHk=~~KC3o(;5!#3WC0cHHT_oU@k;4I zts&7|UWSe5S9jE51oP;EzS&puBFC8BuK@XGmPrYt4SlxYk8?lMs}|!41TAzyJ@YOG zQf2R7E-r(AiQH?kEBq!yR74J*%Rr|S)vRAzO@?+C-N%7JOl_4+jiGL9S|{PIzFfnS z>AKI>yXv@E18>ZWj}CQ&l5;NatGCpnME1=vPqHEwbc&WOT z`Cg(UoR)>a=j%3fw2r07@<)xl8O(7ZgDxHgIt`gvvEtB1%P2CjmZBi3Y*7e|Z4@k&Ch$xk)bQ_t^VGRcUv(+(N#zME9x zl#B5h9F)XZFxP=fk3Lsp(Y?j7M#9r{+U!Pa;Pak)CgM5O!V|}T2?pm!4!3?;>t`3@ zn&Ovu>eJzNP)G$j+g32KM!jyayoYqm1h8qsVZ=-Db8_AJj6@!(2D1=ED#010tBQ^e z>ndm=lQeK!0E^f({l#;t9a<*(jjL6+CVMq&T0Gk#M zN7P84mP*kAtwvCcGd&kG#59~>4+r>ZR<+Q*fL;}A&PlDh3w?x##dp}rE@X@cL z()nR-zVq=xZf&&0VP`NEhjqYL)%!|0NQIn=N@p4a59ujvhC+mv#zFyvNhvInEc}bT zE(;)6`?(N*D5Q)|=DBFhBqhWb`4G*O6pA{~zg+W@VnYd&hh|3;N3Q(0MaWb}g&z#BtixBjS3{%`6S8=Q z!Uo0oH)M-e+K;0uo&d|g;D7Z}G^^~tW2_Xgs#L=AV|4C7S(&?8KYkKqjkc4zHx;A- z43QY2rnY!bA#Aj)*Jh_|qiaJsD*Ksit|amWe&Ch;0!dB>mhlh8quYf9GuOkQJ6Dp5~m=y(R&-g$5& zASMkBB8J< zwMgG9B^|ph?@N#bTpCaqJS7m}rUY|=3qze(aQ8NL@vB?q{{W+43VtI$RhN6<%1; zmlQRd8RW2ZyIO8&nHOZXy~I7LcGE^KyK13h_v6%Hs@n7Q;y zOc87!QdHJ18lMlXsGlqed7e?6kHpq*Or0*7I5pNttQ9^^zf94nA?CKLMI)@KMwUc5 z(Bv>B^1#1U;MF1-e%m0I8|b(XHOHl1i_E&V70%K|6Ag`Ll+xym z_7mwrbf%Zvr-%1z%S*@BVh<+YuwVLTpvE0b>A|$Ua?iW!u>$m1^ht1kYZwt(gG5%dHdDH)8p% z?#Jr#_nn+zp>JPyg*o{UT( zJ~Got6s~{L{>HBS6`Nqjv>kh#U7Wku1^zQuhm>3%y&sJz3%@vz!aM4lo3EMyjvI1h z5X`G=I5XmI_5@ipwE;L0=1rwarW21trDQeji^6a`yqbYD^^lNAl> z;{#4!v>Z-?UbHSwzrImUFr_J6;{@}1(OSh?ozsIiCgqUOB+XB?)7eDL$j~G+7$$%3 zImLMVwKcM@Hf;cXOz2$4W@J@mKHdmXvw>h3J_b&XcCrCfOrtYVIDLwsM3e|;Y*k0V zr;c?Hf&ljGQrtKsS$g4G&TVAzEbWPfyD(qnbc8&0u@II!xUrrxut^L=%+*APG=XP< z5h{k|Eet@Y4nPjV+zZ02PHa~6SMN0;&CzcHpQr(3lRO1M_I|1lD-;@l3x7V@Wznyb z+X8z#4DJy0QRG9L5V;RWoP2FEBA9_aa+c1h{B8M?YSkkDCJ6@#ZH_|37!Eqzwy(C( zm7>~*`2g6Efq#M`i88DV)KPnT#dO0i2zF&{%tE@9*_1C`|wVKO^8^}vmCahrD_lAE*=)pRCinS@H z7z*WCfInu2@!rp0i_;Y4?bRBYlGZ>WWI#7EvLz_7%BKw~D^WYmoM7tRe- z-HL^|#=U8KLMie?Oe0KPVHEPjU1+u8BJun!cV`L~?5<>&|6A(|0U(s@+7GD$5liv< zL>wq8_Cp2d##}|BK4>@11ev37;5G@w5KsTl0;ft|nvT&ODvPF!54j{kPkre<7AOp& z58-4_k#fKhj0K&9*;R2vw-E5!SqDXl0-cLAi&Pt#BF4;U$gB6$A+wk$;Px0?>Fo(x zVihG5O$TBJGxBDSP9c()D4{C!Uyx=*>#D&2qLtv<&-h~<%F`uM;loeb;LJSC>YqEc zHA$49eu-MH1n?_eP_hlB9S68lILgY13^2|?*5xN8pTRF3vFB9H2`+Jl!?xt)+XQ7X z;b4+iCdzq>g+h7Xfy!swA*H0KapcJc+;A8a=2RzIFZ_fP8lg+2TL>zr`#!@6`u2t% zp`;H*nN;P)gOQ1f#6cgdQd95t$kiq$R0wPxs?FdUf1)Y|8H1cbGKBURHPTXv83Ta? z1VI~BAsq)6=eP91^W949a76DoyZ@}^6Nz)z=S!2L9`}I@0;JMaz!1&hZYHF&M50(C z7d)kZGX)u$IBb7uBswtCY%^Z{&mf*XitaqXOi~rBa>QKoUxWHh0Pw?kD!SkW&;jW2 z0Y6azii#K*n23_97-@XbL191P(*8)|QtAO{S{>oV0H2bod(=tA`qlsa@?QcvY%uzB z)RU=|DdwiOGy+M?6$p`@F(~gQ1_o;;x)jedq>2LjOa;jb`$#6j{6F{Dmen2M>^PmV zr$q6?y|-PM1fpqcRcIyu;IKnUeVPN8^AUkqssz>;!E^=`6VMpN3B-Y8;?O|~40Swk z`YITB0M{m=st^heXC<}aVlmAnIEt9U%$xZw7Hq#;ZyN85>ghhy{NU_Po>gR%vkFeV zvcpVZqm^t&`aEfDa&q~goJEBp)1XDP=HgH)6FTEQzoGf_GWCRhCii6{%uWas7{M@w8i~{`>2EBa% zW0(TzLyZkaL84su;J?N)&jAhkdBaelO2>B4AC|?0rCLZvLUh(Ycb^_8q7LI zJv2643@Zk}!i*2*|<|%xIBd9W?cK1iF zC4cEZs|rjf=yTH%Hty4LcL=nyrPz3tpDZOU1EA?JQLLyYehP^2Swj|RQ4m35Dz78(}@L=mWAE@xL zisRT!093sBykdpU!U%(|Dw+jzq5NF`vzusw>vyt(Nr8BCz1HC=Oxza&T|VOTqFQyi z+Bt~HTU31EnPU*&EMpJJ%Cg=q;eRc48=2F2?WJ&RP@B~|-tp(~kYpsC3D6C$9-4Bg zzLxA5okTx&79<~<&IggEMoI6}6HQDHjgWv&0U%qbqAJu(XS9P{g`uYG!f;V>Dt`%l z&HO));%f!5Nea9!qf7g%+>Y@7YX@4oI!w;z7?UGrnu@boBuNrg%VNGa*E<*%#Yxhv zjJMw0Nu9cDqpA&2Nw)mYMcQ%}O2GBtq5O8rO>u3{wLBR1#vid^1Z*G!f(P z(hSj5ltOPu<%(qs^G=@Jw^Tkwdk2`7>lUT2{?}k;k#|q&wqkA(I&qDT*qS79D9S&u z_J{HjQT`6X&j<`vB5_!G|8BbWT{G+CNsCvEl(z$m==;Fg`8Q09g2`V!5SG52YyZd; z#34gM&C*F&@ld)RO=bNxaLOaIqFy&-^+L7NlqKeh5U=U(u*G)$|4;bX83%k@1hn#K{^LB5NE#HoN6g3C?$=QI15R(F8#b1eqrpt+bC&ZLoD zbHz;$2*ex%t%0s(BXkDI3B}!1mn;8kV*1v7w{POxKbhaG%^xWN$j;s;L?SQBk?~TN zs`+`>02y4&;E$++VtxXbWzyVxi1<*@19_>&pLaoT*9@wt-le`da5Rk%YLyih`i z-KEHXK$dGV`;9--#(;AO(3Gr@@d^r%h+*gOh=t6KpbgDv<8G{WmKrfa<(Cq`sRl4n zjP0QdQfN)31%zUyjXhz0N5b zDsy6DQUMYHr71&j?_|^=((=gZ0Lg(W8#IMv3vgTC;#<1o=9DM*w=oO1B5J4QegfRlCQ>S+2AE@3L~d z;2KLF&xt*MoJ4e2<)95+d;KBgpCX?aj72q z#SBQ$80;C2Rdi6$Ny^k>@>0;c9D}6aS_ji}rg1wu)Xh{o{~Odx?BTA-QfGgpAMt|I z3aaL`5$kwS@95+{Rlzl~p*@n=CU!W{SV+;a0fmuhd5rKZM>*7OzQ+eEHy@S$=Km!d z!LxliRpI9Wi=;5X%ldpaveEt@V8xRF{c-C0*dpgRjMFLnL^;B!p<)N*Ywn83pN@O| zGoDQFXoiM)TQ(b&c3uBHhTw6b|CZ%ga%L_6;clV|bM5&6sijI{Lgd(`(aoZgD8mA< zN+K1=_TeqcTo$UBIQOzf#TjiFGnjWBTi?|tS6{^uAA;FaDwv_`Q6<~veWEHR6zxwLsHcD)w;Fa`SuY^{HT#@{v%q<$0%rj ziWSKM#!my}_Z&Ga9AiO;ZA|IMEMG14o)W(lp7tdu%gup%v#^>>%m4nnA4($7Qy^mo_c!m2Cgxl+d~*%~;@{|r@3fl1>;tIY zB2<@L4lvWqD+IieWTAIi@Zlk3oTV=KnZKJgZB>)wAQ>Pb#Ud-kP4zIhsG9YZ`SY&8 z95*p$j++13Jca;t52?Gy*J}s-& zh@9jIBxKeet_0N>nHi=s^$ZYZ#Nva|YOILNT(LNXV#X}~fbbupcg|wc04U1G$m95gGLU=5<1(PX`eF~1lxOql9%R3ZvvGjERAj>jckShxmQ>!|Rjph0!jN=H;P76wPUzZ1TS2tv0M^%7W# za`W^!j@L7J(IVsIck&DT;LuB0ci93S$T~~JLiM8(^-9uZqeD|AW2mCn_C+Dv@Zw<5 z+hrv-7ZM;^=*1@Pci6C8^4_pD|L}F&s`@hfI4C?XGgZTakPS#!wt}k#)!_Ws(};W` zXU0XML}mCW2#F-dbEtSx<1Ln6cCOZ}6kz47vzJU!H8y6lob` zyA$f|tf5`Z8T?owhusNqICmFU?4O|>3ayT2N|H|Hz3ziCSfVKx9aU6g#-(J2CU>MY zG!a*4Xm%Df^}L5pIP2j4wyuauUY7VMPSTosgK$RppPEd`%cVIfzAx6+D)isP9)WV{ ztOHJVBW;Vt^~;&mj7J9$xQ$l=)x(XU@K-<|2qkTDf|N0V=mNn#%weEf1prHhQ8fR5 zOnn7VTTl3H0wDw|?(W42P~6?2xEF^O_fR}g+%=TqE^X1`6iv_~r4;w#P^?IS^7#Gd z{pY>enasU2nYnX!zy0p+*>ldv01JZ;$tL_6QXR{(&Z=v%Hne^hlP;PHJfM>I^r114VzL{;tBnfT` z^9c-0*=mCxxh;7iD3@BhvVN7vb%37Yc;+ZX$n(ASr~F}yeR%JG2aM&3t!z41=!EDC;Pju z`Vyob4hpp=C$mq_4Q?PW71HFmT}|1983<*E(e#wi6wNT?g2E{oi=ThUN>&(8j2D&` zW{ekm8nqkFtb_f%z0vi~4C%t&E@hQ9T-+N8uS>i?smf7F-l~7Dt)BR5zrhc0##+Yx z=agZYkjSZP^bep#|A1|uz^<-o6v*a_!$9^QbBX~!K<}QcsCW1l1>9IN7B{s;Wv3*G zSKY=MeO~>;%WOrGFK%KbqR9zNZ)c`g(+;#ZFo?zD9GL=sn7YXsO`=|!*djT_uu*>; zDQAlRM7AHCtmkX2$GmgxsqGg0k%cXJyM~HGu^>c~2gsOn!L?82c1~>>psc4o*{qT2 zfKqkN4dtojcwAq`^aN8w&xK041|tWnU&UoppAd08AF^D>Ben)zm+%z0@-Fyg^7E^G z#Vw!1dUiJ$xp4=~M7gw9)1I$KM|B3o}DH8+A{;Z{!K$MsAu|8kX0~ zUbIU#jo!JER{Vc_uh(hbt(Hu(6be}CjsuK77Y}Tm)WgJzo^2c} z5OB)iO34iW>h=}SJJ2j&)DK;4%K9a)Jw8pn=tWUo5{8ac5qf0X#K5mz{z$g#Xt#-$mFXB8o8N09jG$lnf9^6^p?r;Hg&d|M$0Tjj=iwYqe{x zYaAo0YmZcp%+vJx-)3zp9VI65+?J$bkvxSXi>bQQ?EPM zg3&;ZKHU^lS-5n&$kC(upNB*(VE+nT2KfBx!ED)?b==d z!qL4zBd^Z(Iq=6Il|4g2mRWm5bMGS>*x5nnFHZ9vxwGx07x4D!%IVGK)Qas5`b#Um zAq5Zlpk8Ibv762He)Ojnk-HG8?WU@Ni7Q)~itkeUC*KT=&7C}IDpSYI2R|LFKKCNf zv%u^`K1YG((30!liNFd-A+Xeso6wlc3dYLkw z>5v2-%_uG`!3@upCAlf-&l)csEA?iS))^wRK>Br?+@VZS zrCo)%oNR*%sqc*YlM_f35PqA;T3}_%qqnGnN~2xCFt2HZ5|#5@mKKJS!o1m%PNfxE;*+ z6+wh4i%Iv0;;i>mL#hsviY>khX?1sOizJS9=_UEKh86f(ivwH%er2*q_W!;z_mKRE zPoFZo%(TkSTG%qa-O)Yc%bw8IOjhv{iGH+TS@PfB3Vc0zxM!nI@artrZ^V-a4vfhb zf&f8Nsn*_DY&nu|D3f?8r#-WyVA1YH5_`mLhl8$POilOrJM#A@{*=vdB$jji__6T) zNAAI(yi(PXYVIBUiQ<>~&7CIz9TTm+iMSCs)aLRVyg5g4Xtqhv(#&0x>E22o*=PFhJ*eqPmsm6S4g-KR8>e=P12InsUJRfkMYI|tN z*K~I5hrEF5Dha)D{tcdjCpvr$X85>nDPV`7F*xG568ynqU89lGfBFP0R+v;D9Q^LN z#ChLwH`b|FeNs?h;9+L?T&Klk44Bd!2h#i6+3|F{)u-#;chI~x|A zn9LRq1M<3SaXMQRaPpZ-=P`<#YCB8K^;rzyOaZ=rtpNkFV@kzMpJRse{8_Vu1Xca~ z)I|oJVjxvZD`^LuV^l|({{TlPnO_D?exfmf>IDV%4!9|ODcffNqz!kcO{;kaBV_{Z z1s18-+(XHYc3-G{{zhS(#`%lM(fe`&(qH;L zCD!}(noKpunyWYB1s63LOrhh+>^DGQ3+fpe4QVFA74aorYB?(M-$Bru@5h1 z%^t;GC${jK%BhRMD}slxs!S8SmQlt4p+V4wA^ZT!h43r^0);!!9YrrYrx83$z~Igy z{1%JU5sO7Ix?zvWoLCKV zd~#dU-hR>8mTk-y<>gyRpk)j7)st5r|6;l1jc{Y54zNhm8b!15b>K|yj*11Ef-FY5 zAtS;y&hm*dB@udc&8%?^z@kBSiGWy3rMIOlg^Fwm%8H7CGu?V?8`iK}j>Do@~o%Sd(Zm z^M12{2Hc@BA3dM=<=EO7X^W*uqy=sAp~Y-_cdRL{gmx&;s-J}+@Ycvo*Q}grp-PAa z63@>}sKyQu$K-nI6Vj-)P$TC3CC)W(! z2&UpHc(&=2?aNK8Iyehy=F(uIE;Aj)P~)0t#sC~a69GpHs*#3=sCAiUf8ndH>VR~m z08@!fxql=9w+}k}7ZS@fvfV#{jIfaktR)WSK0-DFMXJiePZE*}Q34U+^&n`KK_Ag9 zW;HhzrLcTO#t+GZ_GLNF(YHkLj%c=u{Lh&LltSz^CJ_iVONkkya3#YqzjF1cYZu4Y zGK)@+W2I|m7A@Hbc~>QzPnW=?h>PDSwAB(MU7W#W%Gu z=^^9RQ3-yHZm2=xpGwcu5KJ#8v*{MI9WvZT@@=!J>JxIJO{?8lI>fPg&erR;dkg#&BxF)ir*t zNL@79D@WG+^3hL;1Pc>mc*mYYAO}|w1H|bTZe-0@Fe1N{iid(R=DZ=rE8}tNg~wvn zj-u zm1xnoSuA$~n;G0D#_XJ)#eGIdxJEe&~@+R9+HT*I`CMivI^8`k8Ffq4dm6bIWfOpkjD z5u?bRoD0NcwL5$Ja)@XhN>OUWqL3$>@K%7>{Yi+2YpW)bod|NnT~4AzpO0Nfa^Z3Q zDv`rQyJz9t5!)C9qN#OwF|)6j#PL6xTzO)!F#0f6Cd0VFVuUItK6a|}^$bf53p00= zjO7%$B=RG&VaJssJ#o^DqnYpW%$N)<7X6e0bsAF0nZ|5=#|i#YW~{0|ZR%4gwKc)! z?AOm7cjPLV=roWoeWA*Uw6WFYa*0w#F=kLgT_suaMsr4#?#rM3B(K|@X*Qn6ht0+p zXNSwKgJ|rdr0|Lathuc|8M307jL$;xHnEm%MLAw>^B7%5n=x1(ZGABq`oYZUU2US5 z%jqupY|t~Zh$7A3-GKEI#;n}Owluq$sHaZtg=xCJc{(@Js%Y0z;%%$zJ&@3wMJ`8i zV~I>(Cp$+rVuNLIMc{dvm?;EnNRr*Cq`Cd2KLh=Q^~202^|=(zFm@$z=UF{CbE`ya$S=D zYC)dzj!0wk45k@iA_@{ABjzB?QAos}ysr6$2heNYP6Jzq$DyBx^Xf7W1tp*lx zj8AGm;W{GKNkdMO*?TSo-&<_G=2bmxXi^4nS=?7(AS6?y$x}R1O2%=fGHZl4fD-K* zqQGNM^MTfr_61QKMF-(eZvi@V)n|I0JNfL4_IJewIXW9UX^XIXZmD5 z-Pp`3FG;Aw=DDR9?IkbH;XOk!Sl_;lWZiyNA~rmQ{j(cRli-qvU=gX9u;wl|!8JE3 z;PIrh&d#^=GR)@sm5zl5))r*5qCjUJ=!IkzJ=Ms>EifdWu+apzORjjNlEhWgcpj9n(Mx zVN|D=J_b8_gYVWlD<#_h11|_ zsgx(&4g|GBJQ_i!Jssr4tS}6I#e_17CDLX z!6Mt6b^40qA8hz7U-`61iXPwfkIH*Web;|y_NZ&j>5IOJ;HiQqNN(%)!}=NQd^Z9l zq~<79Fu7~@gQ(S_iGX|vSBk&U* zVgJrPbg&lR#q01e zN&1z4!?K`T)CCsgOm_V+Y({irs*U{ts55s3lN?{(>Wh)0!^ffjjCbCAm*0M^${<+b zo0@xv4t#mKQeZ83qN$?Ic*4-D8B-Vnn&N%-FOB4f@!a=CoeAs$SIN51Y()3i6+6?V(_xrz%g_Ms{f!^Md*D?CX z^!Qul9^Tg}C=QsU1)Li!v9?&>5E;z!r%jk$>Q3z)idycAW}n1^*JE2)aPaBN?z1?< z#Z;N^1ETI|J?y8(z1q3M9x6De=6YpqeK9ik1h1SBP#)sHKbr`bc@Z;|QuyPZZ^_DR zLpoP(Tn_IZwnBwI;RZ?5;lI*-B_vAz5E~|)?9YB&t3~4(Htvd!^Pz0^V&m)4TcJn5 z8huLb4U}>azn&SCIRr52rIlU0f`w}lNzx1PgRw$swzuXnSWI1kVZnuaRdG^RWDDIG zyzdTfVbc50wfN5H!!*zPoPoKJf@3WODf$$4{WBekrLF0I|6)+vbml?Q5~tb)I%wAw z^SBJqU=@7)>l;*L7TwDHfZS^Lc+>vw!|l=OzhLV^FF{x%g|!I9__!VI%$C>YUH%&_u49x)3qd-F}RW>cTJ%1)9DO~p&I zrg?64_-Fk9IY$;otNA0fa8Qz0pvB-;pTmn_={EkScvB6VB9bn|)fwKsz`BM>-r7CF zK$6ZC1s`rN&R~*zsGCy~H0r5=Et|*0Fv&ullgMkpSy{jp&f}@O`8_POSPW)AAL-98 zgXk}{gQ{OrtnatbHOKw-`Mb59`(lKBn?%-j0{tW<#%uDev~%j2=uyFu6ePfGjE*F9 z<`qVAabXH(kHnK$(6yg^U&8h%O&L4U@AC3|Il@UWz`ZZ>U$A6&*t|>ue*MG6+1~8d zNFnOs%zjSlhVU_%P_j5ps^EGz!(d5poBfgH&Nu$+0Zf|iy7KJd_Q^Atq3amy!-mw& z>kVet&KN#_B7711fRv`S$|E)09zlec^9^j7ezNl^@nCC9K_YHYZCdwhD=R5T(+PRX(6g|D?poMy}T8?nAcU6hms z^gIUUh1ik7S5`+58y__($AV!#QK%Sa;?yD0HJGyZRg{U&k*#)WvB8~%Xf=NF8Fkj} z2jqQjfrp@#fx<08Axri2n&T;9YGmK_H7oxPKWzvtYfo4}%eOBoaKNLTIcaKyTkGGe ziGW9Qs+fV;l#uX{{2u$FfxCRnOpWOGlwj$rYy5b{(+%@!?D*6nT|2-x0n*?i{%ipn z$3B&vu<>Z?bgQ2%jOcXCop$jG{mU0sFW5lVRylZtVK6L;qi5f&`s!gv%y{99d)<1$ zHoI8-r70;-35)KB)D1JwHYV0^3O*A5{Tc1izX)4BT;aJ3&wciQl9W58&GJ@zZ{r~s z;q*t!Yxipu7Z>>%6T|lT+46}8eaPrE?Kk^1eiC~67+8T_Ou*jVgFEow$@817(63?3 z=RyGKlfWH`hhygBP#M)2WEH)!6$&(rv{H0P{m5ktv+QA54LA|r~s{0?gi&e_t5;|`$ z`u3W;orz_y0H168)*FvAHm#80<=@x%kGHCw7o2U>D_bK36zpALfZzPWNMTHR`gQzP zyL)~gFnx|+9?Fh><=O1kIi9q|(U#BFCpxqPJJq%^SfWpVt5+rUIfQr0G5oW?KHn|l9vb0a%xR2dFn5)+OO2`0GP#+S1Tat!gzr-uZ0O8%IyP7wlq@_qVvExWHt zbMs#vgY5KA&%Az%-+0jTO;mdj2K#`?@BB-%ZtBTA2(qq(lL6~rEl2q5)+>M}lK_V2 zJzq|Lm462+WcrN|HBsZVQ607y{dvN)4!9;n4cJ4KSu6` zv2ID0Wro8%2?!-_90`R)*IH#xZZ9@m{>s8ISAJjj-X*CA#HQd&R#H5kZR|xV$ELVV zdBq&lhSBItFLz<2kQ2ep6C2nHCNA*GYhK~}oA(b(${R}Q0t5KKYq$V&im4W>VNxbo zA1!ii*p?Y6i&LM}dLw@l;newi*)+#ndxpRZl*6h4Z)~57d$NUf`tTLk}sQ3Ke>$>7j)s ziyeUU1=DjDPEL}728;X)4)#P!LMBv~6^O}l>haSpXEJHP_!o&~Npqf?j*!m4c)og1 zBpfRACAvOw0P10@=axZ!!T8}1zmu2iDK+J)6RE6NWn@q`cFB?Z3kR!S2?ikULbYD5 z28y-qk5)BDDUmO3Rbygi1N?9%(-|AS)OV?c+1rfS)v|P4)ZT?R;D5>F39I#3i%$@8 zOner+DDr!b)Vp4&|8iJtYWHwQ7~M3bV%S?&;iw&$Ln+NeBp zywhMWW%U{&@Nc+XUdNfwSeNSi((}+x!}soM2mbo}*IkfWd2e+kp9AF6zFS!3m*`6J z2etImynt_5^SCObeQw%lk?9=w(R@v6rh&M9G3$<=_Ij3w$Wv##RP_dZ~K0ec+S;w3%D-2P!(aX7=5HVu?tRAl64)TO zST)&n^z{uqgc88}=+#%W>aoVq+f)>T3RYf1M6sk&qFZ(Z;>{$$MrT$T*P6&DUY_$k zsCk07b-jP=lcriZXGaJjsaAPoxv^?iJeh?x6O=?NeX>4<(BhZwFJIN)WYTSbUll@J zIM4hj6`m!RF0bXS!E>-K9p78IDkx2ld~bIuN^%jiK`2$^%w(m z>xW`CqHEmO+;J7{3D6;9A0Qg=R(y12f>)_L^*s)LLa)eY01ocLakfBFtdGX>bRA23^tU)x5VX52sn~_`T z2ej-xkoEHZrP1(q>tI8_nsw+Oh}vq8wZX!xhzD+h72KDxwyg)sHF9y9L$%Gh9<(42 zoJNp!JM;@->RAwc9=M_$MX9D?jkFYc>Ljj5m9T#|s^trB`1ufihA(=;ba;=#88%y( z!3GvYRxGunkuVD}Jy@_|i&K5O&yXh!PNS$oKw%MBgDS}Lo^4RFPR$&}F)DVzwhMpJ zx5lQ{9lS}j`Oo3v+;!T#WNm&m$qnaiF5k4=M>dw$4sTt@L0D-*-N6h^0mp-Eudrg0 zJbZ;S$qjO@Ob%)#4dVhOrb=5uSNGI0F2>*JTVnY6P&LMwH7P2yIvP^RhA(mKZJxHu zC)|o*Rqu0Ydc7ybD|S2}3sxg7SG=XROlz=Osln_1!DM>r)w$uv)p$&}x76xUQ?sPi zpGL*HLXhP--`Zj5Ie}DBl4ZSi81rjMVVrP_jT9Oc*amDMpW z(GgIBF;v9=@_(^_bDz*ziYPv#7jZc>Lc%`c8}fi76k21Rqfvw@8E_ge{NscsN2YJO zgk!p6?P8?bo846`-etzCz13GT$$B#!Yzg~XE)(L&F&iCW3;q`Z-`-LAWK?Nz_S{H# z1B|*#1xc5wE{B2w6VHPX$D|wq(Tu&RZ-}3h;O<~Yp%p};Upq$X0ih8yfZ%v_B@j|0 zQMepKEN^ek@2-)0ho*kaDESDc6^pyP8DOoM>@j|3NkD|YMBfD^L8hGK(I@5gX^*N@(iJgerh{{^Ej3vmNDghGo(y(R3!cmFGAwpHw3)8#JI!@f1i${^aowZAr^xrEKJ`fq4+368Qm5tIr)c?S5ddx{*o(vQlpx5l*3@#G& z@A_>WE&3P*r|)@55WD1)(f8|a05r*dG|Qru7c*EhuxB3bLH89mT^vSH(d+?0sBAQQEvpU^o7-lRoF6lL5uS}?7wQ&oB zH}fw!ri76seDfdJY*j*)tVJCW?jkK^Z#_#6dJ~hzCfa@BiN9%e?AQU44XZA%RGXHG z3TmvCg%G7slaEk3g{t;;M$YY)*L35Z9(&FO#^>LUl3rHAho;hPt2$ut@5u(`Er`PY zWIYhzR>zcg`MYY{}QAGiZoT#o!Q5- z{bmT{<3LlZe|JbNH~fIz(|1Jzy@7t>RBNR+8KOta75MZ_HK_z%s=?P&j^pPQ%1Xr? zN(J0bePnZR4$s(2E8F{poroOSg!Ne0Ic3{LnD(>SjJNG7Cxxq!-m12;Ull~?#XXm| zTH;4=yHepN6+3&RQkGGP;A2L&LcmE8<=!ar2K%&T|FbHa&>QPiCq+zve8m^bL=Har2XDuhbOTqhJUHIU_M)toU-R=em-+cIzAM#D^WdY(wn7zHr7G$;V|x73temQPO@C z?bvA4FG{c`pgZJ^NZ!#a7Y9vs8_Jqzsr0P>v4HDsDD^Y{l6X(QO%xW-w$bZt=PQI6 z7!}=L3n@=u)=)yvwx=*Yr&lZETvc@??XMp!EUB#_s4`G$<+ByX&k31km`wsux5u^x zC&Pog39~9Ox_zW_G)Y_g3PtLZIuB_aGO4>Uf|BOHSWYO1rAP{ zS#e)%*aNy)$kSJRHv#qyJ4g5h`u;acYdYy$2lZ`gCZlo!f0W5HMceyr=%Urh=E-T0 zX$D%Fkp8x-nwbEtBdMf*Vx09Li@?oNf&y_0Sp^|Z8oJ?c6%F*8%tNuu9HrZy)WT)l zj+gWY?F_Fd4@JP57ZIBC3SOENIfe!O_{sy`GbZvy?tZozKaSLD?4>W!6xsjf0vyK0 zdp{gjarwM(5Qs?*m$2c>{jmVy`Qz7JVK$4#FL0m0lfJ2)1xQ5<)UB>_rL1zWU1jhX z>sBv~v+?t8Krv*gHLh#`Zk#66#VmJ?nDdH70ISTB7reQdpi~gY0x|q7T|q4=2vPlX zJpQ2VgHaJ8_Umw2+J3D8wygxNmZ1mP z)Q-wcfqHVV6Hn{a2F@^8`}4p%FN6B$-6oq1X-S5~CB|K9U!4e4ZG_AZW$v_d5>osF zzrOh5Wc~?JjFG!Z@*~q@6as#%fi{HBx8Vz`y9o#$F^>0_+S8mrh93rP;%ulxnb%4Z z{dwA;sXUdqE)}Cmoz_+l%1nlwr}ZkvVuq5!W&8NRM5bOoY6VN6;}o+ALln6Z*qtuC zZ@wfz6<_%~I0EpQ@wYw2UnjX@^+VyC^Tw<>i++tKH?+NdDS3{&|HYa7`AzLX zd4IZ|KguA^k}FDHOa=cd>uJ<=zMJ932c9qc)7>?aQ&L8T-neL)WqH`IHit}aTzRb% zYs@P}!z$xdy-FpK<~wVYgL#}8JfkC56L~$kkU6Lyw$ymC%|G6yF}P{$C?I&LzpS1- z-4lD1{FG@O!Cizh5>B&xvaSM4i~v#XNP5(!3SF?8n5+;_hS&G!?4p?7k$OzH_nW~ywHU|d z$_%FZ3D$Ylk*4RE^-i_?(DJ^fk};!|(ap5i7`*S*=P5+GniN^JOOJrbeUysm##HTe z4lG)eo(N|pa>W%)(DU0{*?K4-_$p%Zmcm zW32y{{V4EA?W#sa4q{u`!s4y*;V%DPgrNW6js zPC9gZ3Yt!U_40FX=NS4jpkP-@Kb}bzhUPkbP>(SoMJGFs>X}%Mn{`z502`F+Ix5Ve}EKK@$uUFo<)2}##eFkNc60_2@3nly|;}( zr@*bY15o4AJ7Z2ppBgj@qs6c^+)jKSvGRKxYh<<_=&YZ;V$ee+Yg;{mxnTT*T+a}6 zYvKTBXS$zB4M^70Y-WxA%t?rX_K56nXU+YU)e|8XgL9^1C8zcNejZ(Gm>-W-}pf9jRWh+ zIl{cALJ+rJ?$$@ZAb94qu8b%m0y}9jriPPAB8Bt)U{NzL4nrY33QvtE!+=xsF@Hkh z&$m(DoV9QskF-fj2Swz^jSCD)S8o(!`@&8ndy#yyVA`1_F?4PV3#`B{D6@&wRFiKUA<})(I?e@u!Z1~0&qOpm8)RrUK z-~o(u&GZnZvb_7+z@%_gH`Shc{J!@y>pV51>ExR)Al{)@W9o2Ys@_HceH&STY6&q( z^E_P{p@N@N>;}W)&bF>7?yCKWRSYH#TkcVv{W#B5%SZ0ZekD%|`!MtH=cIIb=&JHX zr9A)ScZhr4l>ew%Z!#&9bfy~hoh;%HFl_ zQ;V_5XHGm04V@NB%1@!SkrW>x_+v83Gde4;#H@ofygcMO>spo(*biPHAM53AF34Jc-wHtt?$eIcn~Btv!9iKt z8HrvPwW9C|G*&%nFVpgc-gyMgR4`$-TmT!R>dJ_Kb$-@x{b7yn_n3Ue>9$wN(W}jJ z7zNm-ryO_-L&q`>j0E%KotYYSds`|mqNi>EYy z!wp1Az!^+PgV*0!(sznVU%FESeYGBN*6vNj{-G1f+C;gk#_gM7E8N? z)B5Br9R{CQt$7IaqQ_eKFpr(#9Z-77OSn)lk&OY3+|*z>j0 zZsKWsiG@aWqhj?9E_#CdUGoU%<9w=m)1N2n&(Z!0`0KT>$0&-bobdQrin-~LA||+x zDtl3~l-@UhhahTCF1OrW(<5A`;Oy&A@Yw=RiJySUorG{--V7iSC&i?MF^8Z)<4(LN%4v-MBc zS5tq`POXu_AN#cft3?v)74#{>Z9`k1JPW^)#q5eFG^ZYoA2s&YBnOO@yhwz%Bfuzt=WNl~P zfKqQ9d-1Z_G1R;$?4k#r&M#WwIeuwcPz6`4*n4#L!iaxW{(Wr7s!b&RcD~|jxEh-i zlAyrm(ro%6{z7o5xz?Bc)v4jlSE@hzZ?6yAs0Mwu%NEgHPkZnKL)FVfVO_o2V}J;i z>rF>~f#FzmBn=cH`>po40s*-8PSexG-)OS+Q#PfMsA$0vOo9fD|_yM zpAjjWA$djPZjJwHOsC{Y(uvk&VdPPuK zTrKTXsr+l{cWyL|7L!mCMU)tWOTv2F7uKrh^8(S>^cON}P+HtLP&n{YbXlBNxZwb>DFPv%19oIlPR@+csf=@4#;8+w>K@^;b{tFDK*Be19{i$*%C8E&{ zC$CjF?SG^${(Rc;4EIahJL=$b=|`@1L202z3JeKReno9g)LphB@M~SH9lv!jlLS9l z4bU5D>h8;*vwre+DDo~bS7@XlmMFZEfe!t?7n$O2Pu}`i(?2XdLWL{+R#^UOP{<9o6OaNzmJ4RlBf>+j)50 zq&6l&=u$8zkwd%Y>^$}xTDELmnH=h>DM+=1lVJCka!hXJb-t@rI!@0lB#YDr)wh@AA#vN+Q8cyZAY72#z7LHL{%xpJ5}+`SgHN9~7$Koa zqCzvk+9RrZB>ynd+qqQvEykvj7xq-u#c653Bj$i2WyYWbJ6TbAmdvx0=;TvMH%5xjv8*Ix>8O zln&>*);*}AdFxgF%65OULyorgs{dv%X^Arvfjhziw#y9COzpXHMXQV*fxkb*8B zIHC{=#YU|f2!<2GDd-Qx4>*P+g7H(!HoJ3UB=Y#fQ{X#fOkbE5WJ@@XKU zH5#gaxq>RUj+iI0FgKo^`{}c%?AhLWx{Vtyyu1sHNr?~}Kn>~XMxNf#4#2W#AIyDz zr{fRGs;+aLucz&^?OTp9s6;X#UVqzT(NJQOWad*DJ=g!qa@MF&9~*{S|F34{#(^)D zpF)7Y=M4CM%t3C5z`FM;oIDa`H7v!Fa6I0B>XwizA-b7!Bv-h_Ru!`5F!H+~_?XmU z{W{1^-@j`blO-QhC`a<9*hjJh(ho%vytSjFz|2R9rP$0!wxjcp3u-T&cR0=_d7ErO z)D2nHYxBHHU0%b!yCPD+JH0`O;Qp^CM(-|EasyiT3M10+5A_IzLxJVD^bA~XmgoSS zN(}M))`u_m;IN(qvI{fuGITblVM=Q)>L}m&A{pUWt?t9m9Jbkg1V8tfq+8INz{*6g zv;hx;u$#|EFOn_Ym$>o^@g8i)Fz>tlyDA^W^ZLDJ#g&D1qPzmAwxATaL~C;h62O}M z-PXYBbXd8}r=NL23*FUgCwwp5Eg5Q4`x!)^OCoPmDKmcLIXQdn`3gJATC@Mjb3V2y z6dC!dmy@zD;Qx9Y+rSmQaOa-Va_y_cSN<25SEf7LQYN}qLt(6>xlA!KWQ6VbI<#F8UHk|cYn z;91(DTbaT&WbqF^m8xvr{s4W(gCZTxZbYb(M+63H*{%z+mQFt8fobJa=sSo)(9k0j z!&Z+a*3Jq)-@M*=c}4LG6e4GVwPS##tE`7LKCoW>s}d)i11}td?wQsA288?}l`LbQ}S^_}M*pnGauAZn7VN`nSxVN}+rrOb=u>rtq>4c49D)REUJ@=)zmzF*JTA%w(yAQP^YoqIj7x5eq+rWQfcB~#u zIIxlMHJ^Xg@{}G0^okZ_vDg;TpBobz!2opC%Jtq*wh`N}%){Q6Nv{VSsu@J=QgT9B z__p!U$jcvPy~=_cFhd2e`j6MjzLo`(x>{ep`0H&tY(H5wLQMMb#&LNdn{(@g%x=Ah z^#W<-gB<0KqWhlyK~~0P+~qF!G^Bv|<^zJoPi8kX&c-ouz~OQWrs-2fZ@C)w(Ryt@ zx#flXbB=qYrL~^d6l#w>O^~Y8;GX{~=naHBwEs{?WHn^m4gW^QHtUe${5JgJ3&`b# zDnA|iAk|5zme`2$^zTovC0$M=DTqAKZOjZ`m=7b_B?&O_okx;sFAj2Wn7&W1+GadN z%L(&Nj;p3YF=yg-Avp0V%%ZMCs0y;__#A@scexuh!xzCz-$mR{cKS7+6@Sz}rmdXh zS6FTsv-je&&%cdhI^CeNMJC)1UvjpMt55wxQ*z-Sd1f7E?+h(7sdfg?z46rH!qPXZ zR)3@a?X~Fn^fOy(`s-D3IlM7o>>P`%%TmxM(i~}hPX=7imJF9Dr%C6k7L&M$Ikq*6s!9 zna?6P?L{y9-xhXnv@j*IX8+e;wOMhfd=+sbAb9~Ac zT*~O(fRhlb;RqfU3%Cdrj#q#%*PROeT43)Ea%~T91IfOi+|qoqS_o~E7f6W_=&`J5WdJov^=oeLl~mC%o!s zdrbT+BeSl8!X9B@hjaLC%Z|w;9 zq7?|Mr&GB*b{{X>2KEK;J7gYI9niQ~vQwcK=trji; z-2r-Oivm<+7L?t;*Vjd{6q z@)v9UmrP%0!pUVzRr!$-Y}W!jMjY>lC3u8;FG^|-N zfJseKGElcNuHfZat8r)xcF?Kz&A<4W%0Q`^9T_1@O%}vSj#5Ef4KhSeXhEymCu!H= zXYXA1tkiW{=3`B&!}y5Q>*#EuBbceiOVHs~JQLOe>RC;S=G)I;n`Boop%&|-xph&(G_#mq)DIVXFv2w3V!nkdcL1R1$d?cQY0ERH6(#!`ewPX8hx#3T!L;HSW3Rah2a#D<0L2smaKOui+P>{|+n zV5mvaz<3PMHPH}$VW_^yO!_ARieqTe0Wbhz%+D-L8ylWL-dD+gA}$(w1X7jU@Kw0R zRVDvPR8m5Q9EV2;(MaJ_Q;i9Cu8PpS!&GvIg)>E?6tcn zXUBmwv#P#?@Gs0B?il4}{{P`OL#~5mI@l(R?_1DW4sPStq$BBZCwJ^z`i0!8C24mN znBb0Nh?}?hia9P@sv$UDshTrOkdjJncn-E^WQINkJ@_*DPGChjcYrafAco^1|ILqR z!(rcl3z%$jaH_n~69EZf4;2t%Fkoy3Ri(=J`TydSD`-Kz2nc`Cs6O(n|5WcaK8cvy zoa;1Vm$4&yH&Tn=_v}?wsyU&dFTVutnFe(VOtM&A1+b7hNbrvYx!_$Ox2j_34x9$1 z0ZvKbOnek%)#?y#!p2CCUVz$ANV1`Xf{KWL(5Ahl?ED8QdIsE^^^%z{xb!BaEl8>C+LJL#qvoZaDplc?HW&CqI71B`7Y%3RjJ23zx4E% z+Mw27D)8Srxvz^uYmjYnlo=(+HXvYmpT8_?QnPWlLI^+L7`P{zAyErR8HZPwiU+qX z!3qJ8_B|NUr=1*kI^4o ze_sFq5CBO;K~%7@Yy?M!I3BfO<3oBOkCbKf&2|~*ju7j7QdOKNH4nDO7ZUyOE{iK} z0Sq>_V8I18fjM_5){1YpD)0qj!=1!mzP}w6(2|;V&YFaWMH1|oQ2OjBT;ke%uZ(l~ z1}4dv2ZE}~x^x(6A_-8rHar;E1#~v%ieuzCaEhTU1bb*1msWiD$ewu!AW1KCm=qdg zkzwR3T3AEljDL@t3ve|q%kjECOaPAQ@VvYd5rGQNUhoUVQILr3x z#LFzm+#^MXB~Dv{?}rQ}B8(Ju@i3e!9?V|wWHHT~<9}DJ(mIwU)M*g}|Y1RS?zKen9|6a%Zc|nHeB(T?LR%(o3qsF(?g8Tvg&v zHAMjE09y2_!V9l%<-xlJV4Q6{_daB)rhqAdf&pMH0Ek)Ai$Eb^e;`2fZ<#lnwH9E1 z3j?s^{aiNq1wq8QaHeCKn5Q_X9sF)b*(tlGQjkX;7G358m%$B=6am7KG*oN`PLF!#9J_L&ddFocYfLpTKAPNW9JyRn z<)L(zo=S`+$G{`>&fyVb4J1-y*aH>5RMT!H5iDvLaPE`RR9e5-(|nP zCyu4h8E>5HFc?AHqyxMPX5L3WA$Rc*yTW9DBtXUy;wj#8Fjm}UN~Ivz0_<#iLX*R{ zVaQ(Bwn)pasTKA8EEJ3Ciyf*m8z-Yp@D*gwSZ5a?T-YF&vq&??ieQXGuy3+`Pl}T^2GbS?) zPkKoH=|C_5UDMZj6{y=uB4*lXdU~Q$AT6w;vB)APK2kkSl0uyJNQESFru)th9GPbU z*mdsfxrCI7zNjigoW%^J*gttNmJkPlzwHc^Lr)*N-TWVW8cTwnNPnV@%xNF^f5;tI z#bK|jIx*QcZWDNu@X*h^}G(ndTE zy|)CCjN_H*gaAB(DmCUYqYfCG0EIL$KyDqjSMf)U?FnPi#Sx0HGRE}k?m@C2@-(mm z;V?-TGE|(}OZqI3L>5z83j($9%EB))c=%X`z7!ye{W(FoWxiBriMpLw2dp}fq=h%` zB&7@1mu>j!X4Y?>z>qixc^J9>JPv$!w`WHAYc?275n88FD$RdE95=Abg%mYVjjG~B zCQ=%ROJ^(pG#_}VqWBmk>)K1|l+sF-QIJON#!db$J|$CWxH1b7v^S8JpiZdwf+`)Y zREE@4Bhjitf~2D1W0HzL_$o)dNNiT2wQ?%3(75dRbl+LHmVAyS^!6& zfrG8S5mgEOOIBG>gfig6O9fET9b5!V7#Bf;S={(VV2b`z0h)iqayedT0jU-SU`ks+KNra2TsQ!e+gVmJ zhTpBp!|R%I=oC-vXsm9Lv62f)cz*v>NTpSk{OQ0sCPJ)|O=+c&15b>9CtzJ*SxG|A$blf<(-sL^*Jq1-qY3x@E{6*?}pRComB znZ**rG0u6DyomkTh8?h+1B1|BtdyY*p-~MOwyr)l^ed59kO!@Fn zLRKNekZc`(Y;!m;7%tJ|!B5hOvqNGXFF?4k!RHDk_+?7iv)Bwg3?T-_h9+S= zjEBxvzF&HqLWHsf#zV%S%|>wlS5~Y})C^#^PVLNlTw*7kGN^`=YzDtfB`~7=a&1i5 zrjp4+011O%)}eP>a^o?MAt0Pw1{lWjmu@m5WPrgd1B^#^6B(VPlk(F7`ob*uBIR0N zrNVn|7JGBNT+5IJD5GIqR=yY%QY-L?2?7{JGltD%V<<9&ldPgba5ZlMh!3_s(GnQb zV;AzMkc=ur1XT&}Tw9=zkq`-fjH?QjtfLB`CH`(5C<|Z?55h-}Qt8o`2fWe3sNodRvBb9Nk3wDL;+)0*yF-MO; zC3_MmO))rV5)VfVn4UO+U1J_Z16Se#d?C)IYzj5hit&$(7Zwpq}r_Ab5z2B+Xiabf4&Ca-hf2&iOZ=N>Y>0dSEp3or1y z0*d^C7447#xjWOV%0}nbjH zSapTIKyZ$d94S;U-aKp@L4$w5vn#6h>HutEmc?MOMH;W2`;-W*Y5|_$G!CS%ck^df zd;p2A6^P`z93y+9pjRBDvDHqxlWOvl0K!!+0(~!TQ0OjCsnO&BQt&%@7_0?UNd?aV z$GEK)2dlV=fte>TiV<$^Tg#S71+r4kezm zF$FB?|9#LHV(0QtWS6jr(F0#LISujz0J9tf#vTV81W62xhr;{VjL?uLBbF{kNU@S8 zPN==XU^`5Drt4BGZ*{T++ z6P_I887#p9RH-@zI^fQsIqeXf%sb>;bnpusa9`V!HRD^@LGI*{?Sn>8er`HCWyKRX zxaFQ=!8kTPtigpG#q;Q3t%0m)60RfO ziY~(SHZ%UhZaA>fRW5#fK`wp)rY&r6Of)8k^^HEf0!&9~Sr`Lv#sQdvpI(=%W73%- zK(4d-SR@3};dN<05O`LnFEf4^usVB)gxzv!fqqs2&ES_I0FzpOm&9xsjFicvU^DnO zvKW}T06Y`%*d#$dJr6L>Qp(Y>ncz9MQx=(E#Ad!z9lY}te@BN~RT3??z)$B|z%B5Q zNnmeK0yN1I+^5Fkg6a67MUraF6lZchA^jrbbXRBp<7!=ZZ$0JA`%pmgj)Y_q25TIjD5-=hRh1-qEP>=$RZu|tA$-Y9L17HjR~hrgS~TD^ z29^Iln_0#TVr;V#q$+y`2zw$MT@LL|EZ{T-Rh_jiKcw)^FqKQH@eD zD1zd>>armuLP=F6ot~hGV6baSB4MiZ@3pFPwW^63u--(~f+{&EsrZ9;q^gqa8G!Z) zC6m(WX9`B*r7fK)NhM~h0wh%dPft)p@Yt48TG6D6aYt1^9KVtI25}cVQ*bH-Wv}9f z4huS~qw$0QdE1q5erEfQ7i1fPVy-+FS(D47gRDFZ@hf9MxsW~AOgbgWU~*@RY5|p+ zKm~vl!&zYvVPtvorkGkCn{q%$V*`;oJqT-^3lkt?`NNxF4Oa%Pxy&&3aHL2h^iu9t%1xccTi^j! zQUNz}XcCH)y>OfTM3A}Mjw+I_=3v11B`|U0<0`MwDY+rwslu1+=&<%B2uU7A8x`o3R3)C! z_+Y|P!ATog6{@Pt+64iotg0lrkfFP}AuwpBl9ie)rDcHe=zfwxQt?NBy|KifDB@Y%h7A57_x&ht zIhX3eo3r4oJsO%sATigNDLUIETR>_~>hhMIf+1AHoI8LJ-4yUD&{Z%92mhLZKvH`h z&2weaTjFLT#%s1AA-JSQnD9;k(4+94hYk;<6w{NUvAgI?_^_pvWGd`D)^vD9Sk9Y_S{WlG1?@1?xV>e`)0Ut zzPG-g0?_fpLmbbajhN7eK6WzbF-R!DCvRfN+Z=|JGY<5V6TqI~ZG^~19-cvPYz(}N zRf-=p;@LpK+?C;9@xYk_#MoA>b=omiVouS)o|?JfW)?^)+(pm~o=v=XhxEf*&=I?E z;j^X>aysxk+eqFFlqVNx_%6o4?|kPb?COj1d7 zd#;qBh(IRA6^o~UJ)<4m>Y~Fat(Eqq5Qt$lZ8!5S((yFGQ61D?l7BRCTD7IQfI=#eS1ee>Wl1=!DRg$WfF9NJ+ z8AxJb9g9|uie{n+!T}g<&46xI-~!1~&1SM;sbmwa3e1RsCaxnJw($R+ahk_s^KNvw z_yyqK;*In(gA9Yj0N4T(qv8q5lb2Ml+uqMd%Sg2$1RUN1!rhJ(6|ffpO!1sBFonvT zE&u~#Y-9)lvq}YVTB0idv?*6$nKRjls+}stqq)-9&pNRuOo)wyent+9mxn(R; zKV`}GtB`VV-^C_XE0I79b5Z5ovrQis^W4dQ+mbCym+O3CfBx-cPTWVvBW!}>8r0Z zWLIaf(9Z;yS)2GQu#pyTp>NZ60fapZZejli1`UBmj9xWWhW?(6K586dBltAsQ6w$^0l9lB%qW zK!34OuI)GKFab4JfnV0-3IpK$5Rcw4A7`#YbL&G!6aipn=f~1K*9Iv!-xTnV1qeS0 zQjVF7_Abl4Ln-C_;FW~BfvJJNuu_w|Z-JF^BgKGU4B>912-~|H!C}1fbE}H{p#O&Tv(!Ene`D_djC7p|XUtjUY`ysd%+bd;&wv?@7zSs&k*VOh zbQHtS2ItNQfp4xo4Avx|Wu(Ae6b8EphBFAJObHn2L-v9t=6HEE}=_rYKIw2-->o zsETha502$l+n2g>#^hh`wUuCr6)k=NQcD1d!C;lm43Jc}QW^sms4BxLkTHE3nkphy z#Y+rr5*Wx}Uu91q!Q1*6MdNVBsOAV|RH6;dS-~NnVwh!8fe)`>dqCTf zYMHtnDJvB>gaA{wL%`U?^ka@9fytxN{4Bs=XfViNTtmFo9XoKuLusP*A$LcL+l=4I z9XmBrr`aI~uuPL1?*JYela5FaV+7)v_YfMg%sY@l@x&nz1L5GGU0{e}evUaQCOIqw zj1c(K3RrH8hn2~e>lgyev*RI}F+*%l*eMmw$&);h`QPbTa8AhZTI!R)s-4_1xfN2V zaeGo2B)%Ci00UqE3=qNbF(CMC=suG>^A8KEce$^~6A_Y>7Y|mG2cGhThs!82tL*%+ z>1fo!i12MlCg4$tmQaNxMnEAv5uVkff%BstviLM)E)f$^Vc_)V+#ASH zI(;dPp-vL2=nBJ)Bft~JhqdD_Cu6MD#u1Whasi2x9C)3LB-Swin|Ps)GCkZYZ8bnXp`RB@JhgC*-WPW|g&N>JmEmeTx#OksIUd0hEO2CAMo#%)fSAN1qN9b7j$wcr z4|ZHc{$!6ar*P|rjEiiJ0l-ZjsbH+F!D148M$xE%H|2pU8T#B1#ReX_Jpk2)L;RC& zU+XR2N%rQwgo;~HKM@Y;ox(5M$sHqDApmOzz&YXx%QppxacAa{6124d3{Vwfe<;N=!^*A1Ac}4?&j?9&mSQ*!!3vlJUJL+(!4`PIgu8VGm<1X$9czroTCkH~ zNDS~IAZ#nnfpjIZA6&JAU{13TIPT6hkD*d*4m#QZz)fG`fL)-dSP~}M95j+`_TY3@ zKnP46mV6Ko8oROKMPby-|7B~bZ!SKsE{Ol2Y zCSfoRj4ajw25a2pj!6y9w&;V0e(u1?ut@s@vByc)Cl04`t*3;Bx3OBRlR$Gazj5#WdaBas^4i@(qj#fE5OfEcNTFO&!%3EBn& z_tOJt+8zbR&14UY35a72e^NR>y;s!S!W8NE8&`Lobe3w=g2q=RS8SpMM(Hmh+zay( zB6w%~>+VLsEdSFI|Cpc)_g!w>y9D!SEj*8=;~#rw9)fk1&EYYUcnrWp48V-v_TCw( z7g2}1*L-y3#%I7eo>rpbea%Y4WaB3BO91}swodE^r8pDz(E{ODzIU0Q*w$ zIlG**eViDN(0M;E5w1;^$60g)5uR167 zA3(=0*eci48|bSAoB5tgBsfNtiN16{5Ok{j+xeYpzXTn&U*rxtHB`kzkOTk=gzeGq zM#wRv%g|(dCyrw=mJ-G3r9om%Rt1hxG^n#0!Ee||nVzuYX8yN5XM*(w^1+;V-L>Nx z+b$Bx7G2;EQmt!2`)2Ta2=2YW@3xaW?k53dlkExNDTNtt{SA;4bQAH`Fi4RH4q@M!|)SA`V&oRgq24|>y_f_`6_#Iz|(wBr!J>Uxp( zZ{D{*D&tA+){OmH1`H4I@kQ20WD52x>va3CH1ZO~M;ikV{^ok{+386GC^rkdpbvzs zDfve9W=fTd$6tTvsuQ47ud;#7x=0I({mUIZG;}ucO2r? zA;4bQE&g$K6Yh{n#hI6Iy0pHAgF(>S$$9+RxgI{3~sV zmIC7pA?uAi%EK{YMZegO2sYrfd*&>_$047Tuzt$?`580%`-gMgRU7Je*IRl3)};U# z)d&H2FaQH!fRHy4fZBH4%zw!D_ImLhH-rDYQ{O8RZ8Oc(!QUR{R(9feqeVbE<4pDN znQ8vj`&}Mx_y~D)^I{#L?8>wOz38@MG+@65CIH_qyZ+q&Ic?X~;D_+tM(KXI7PCwOp;ye>xmF(LSM(k1@s zCA}5wr?B3r7HTTtchAqsOWMtTYj4w$Y-{mv1au9 zZDi)|f4|0m{S0o$+daPUIf_$AhyVk?0_2ZE~x`U2v^A7?Q*w{QqAZg~)x zEGya&n^IRB#IXiD*;rKo%z`RjJ;#*`(o>5chE5s_oY5DYKEFIQxqDBcV>@g7^3=>_ zoXMF6e0IBR6 zH)Bn#qjid?CjxAXbufDtnfUGSQ^DI=P5OV@thu*etmDgJpHUl&)1hl(1(Zr>1Czy@ zs!M7GKM)QaC`Vq_siX%o8clWS6EW8co_m5 zxkGdKc!|9B7P4xIbqXNKVv@kCg0{BE7HpXbEl3F*c(U67$y^8o_+=g9e;`Pz{MpSD zRZND$AJ&J}T;4~4W{G%DCFJkAhDufCX+z4W-)#MOoSr(rS>b<0-sj|Znlv#d)+RR~ zZ%{lzdof`0DA{v7A&f;M*q%X(x1c?F3<)6szcAslMec&PBvTd-AjI}rjUlIHZ;eSc z*nJ+UJcO{V82wz@dx_yJzw7hKL=uBC*_}%khrvT>FX1sHl*S9y90G&m2s8H(poe-* zK`lY!cw8%|&k#3j9+T!bq#qRT2|pLG|A)4vv)WuY5ub6!&NffDfbqOEps$)#o8xp|!Wr#eQuC@lRj_n+W=zxr zF&3P0o2y(zZ*>Zg?1HeTn<+$d=V!{q5pn+y_`{Jp7?SpYU$?dE1zzSZet{Q(ckJ9y z`wVu3SgRZ0xhA|x5AJ$BJt=fN2or4%plJ}9iLS@y^M5;uoZvB|(k38~+mPAnC!tg_ zf&>{mg0h`tKa=ME&F=NZwzRjM{ET6+rGLSMHu|C1pl>H(+mXMFKS;IiYXK))T*)Q? z_N2e&>#t4!<=Jc(doSlxeR)7Eq_Z{roZ|n2%&%NX@xwTJJ`w{Q1zmet zKxB+a95N(mH<=!wT$F*bycJ<>-UCDi=jhw#gy=8YUic`*rVl9A)}L#uG63_%$kiH4 z#>#=fU{}HM9f<^@7u(4lAF`jG(0jqVQb)7 zDNwLL44pdu$_BZ@7!+u*^I!rpF~%1QVb6CjJAS z&)~U>b=AEQLTup$nrz=BzV8L#YA>oz=AJb4JK;dwixW-+ca-p~W0mHnZ!#VY#%c3u z=TSj$Ufof#Nj${#nM>FP`FU2Se#Pep@gbzv0e>*EXLj3yea7T_d-y0?K*|O~ObX9g z5n{nE2OpM>51TKTi5A;P@7at}(h8b2EyJ%Q7Th`~ut$3&cXAExv(M!>J)Pqcn%v z`A-Ds*w_#NrvaLgVx&*1C?HKND=!HmN zD6p|rFzJ}Fpa*GN*`<53bb2y}LE7X7V2H0mAjOH+V3G;q$V^R#Q($`Xz?lL`?*z>q zsi@;bYcPF=RtJ(-gXuHGIkoqm)yxts0RQI%O#DUTiHx#u4jwxmy+EE(@24?R05Lw; z+XFYlYk)T=FX9f>rAdjJDEU5~ol7}KZOcJ4_Dv$2qn4}K%&$nKvJ*zDcd`1g3 znEunw;ls`SS3w+DCy>BS>4yRom?Zqwh*Y$sa@5=o(MZJjJJmrR3>g6<_t+ki6h9LU zOt?4ZzDhuMV?Q=)wvILhNBA-hr{xOzqP5^nlI1Wl7YXZPN&{elxrjp2(ez9kTvU?Y zI5ZdN?>A&%6PTnslfw7#IWa6^xq@0KsjT z;y&*1nrKg}EpKJc(VF3eo}HfuA}kA`Gz* zlxTJ&JgE4iowwDm{g-LkJPDsW=fp&7oq}q0J$DPIRzMZwmwOntw`AMdVaS6Xngwa)dhJw>)LGtE>AO?Ue39)3~ zn6OQbuvX)RVC-2-V8VS!97w0){jy-Y@Ja(**5%vtcU6@tX?80SWv(e>7|jNi z6t9>i^WzTR3hM`{W8GnzDHgGDBhQ7kg5_Fp0C+4a#=mO+=jL;|>zWo`fYgb(BZoD) zdz2!pb{;r#1mA~0cH9zh=TJG!{ec|A^ze+_QEn+I3;-J-JUtf9N+RaklSK@QO#w^{ zZZgOS4o?a1WaW}-vi;2TKz8uAR+&8Frz0_q%?uw7@r*S|19+Ypf8HpTuzGih8 zfu@(pYPRhBcsU^!eHofg0kDNz0Q0xlDoZsg<1ua^zHJG}Vw3bv8}f>sG)k=51qc^L zXQTVBdg#>jkkif-)mf`e&09RAo2}{V9N~Y>K(u&>5N< zzK;W9jmC5*%MXJS#IcIE1F?trUEoxAZ%hM0hw-d~NmcS6r9u&_o0Ehj9UEz4%?5`F z7H#p1X{o9lw|7J+cUT6SyWR;*!dI2}Q_R4sC=6x=fkBdrKdO@3ttub_1&RR@6KxJ4 z0Z)N+U}$v%O|s*@O$Yw_$9|kgcf+{e5a^}F|Emoi7~VoAcla0z6ip%tA5V?dC_r;ST7dWbK~{7u})IM z{&PBIo$@BGX;=xz#(1cxqfgC~T)|0q5peZvnYRf9Q}K(0U$p>3^3;55UZHICq%%E7R& zGu}`gxIz1aW6uj}rP$dECWJ%^z=HwUjv)z)zc}lJ(hj_DZ^seY?c|P~OW(<_FhUL+ z17K_k17MKr$iDMc4r<=nIUs;TW8i5(-*xU8#){@cfcxO8=H($Z94dY?QRQmI(>wT_ z@Z8{8&b|aIT;Z4%foQ~1(KH1!$`BU?NL4DORZSojP5;3*eq-&y$s#XbDHw~K=7LC zPg&|y&^E;CY{Yda4C2m@)F-sUm=OUs0vT)q>~-kxz1+s-3CG}Q@J=hRa1(>7Zg^F7#zR%GG+9Ph4LOd7 zK>x4J6BwMyguXL;R*3lf7kt|(KpEpG8Of63u<^zcJWm}VBtRVY5cda$kSP{GDoVVc z2w4n1c!xtM0T^@fN&_>J8nQqVDYgnD2@fv?43U!ThuDL_c2g|*LowKw6Iwj ziJ#5#_i$s4(Kx{|L4zypj|Q_V-=@yc*MPjD=El212QYxv;~f@+a13pW1YlLrjAFoy z{*GRC7F(#i$gEyfjTo>4FQ}@Ci;wi}zz2!G>L4W$CaKC})#f3mZDb3O&lJZzs-}P& zdOKE>1dBmdF{*Mq@S<@aB-rAHe!o;eP@r(M*nU zyWPI?%)^aCFpO|$oT4bfAld{Jg6tF-@JMT(FaU}qb^@=STGIdb{r@A?#%3BYkE)H= zESMz-m=)d%dhS2%t9+bul?4}&s#Z`mr3Fkr*erneh7o-xK~%7Jhiua%nIcWBPPISC z7QCb!TEMf)eP@EYA;!2f6|UwdMd)+d2F646Nx&={eDS4v9D>}&km^>R%l)dO_-Ov{ zgjLL8#UIR=ZgWni_z7B^jV@&Lq5+EG z2R61G7~2TuVqC)H$YLD;hF5iVG{wj9lacvp_C>%HY$G}3e%=gn%H&y>YY*6@j?EyWPEZA8h}zs?jD3}sKg+tq;!d)XzZ&@Is`K)ZIa(> z?Q;MC5CBO;K~y}cg#I;cz>ID0&>T=97;4Wz1xyqiooAMxbK+grN z5ZNAre{8L{ro0D(?t}p?u!q@9!AP8v?85-slu#0(6d%T6fUmtot9}!dH6`C=e1GM$ zSh^t?$(Cqw4vkACwM;VTqk!yLy0)b>jc9m$>0QAj0uQsBhruQx?N~=^vgEb=gXiEg zRwc1MfrQkpk`{M~|#?Yl_}#3Ma13V%&*hFq55J;202ZA{1h^z{G2iQJR5 zD=#f9 zZD0nXO3JwZst5!VkFy}_8V@1&Jn_% zA%=5^6d4`^m<9bS#&T<&h1mes{2~c`fh0U|WS5<{j7;)m8D9lZr(F-k#Z#gM9BCp~ z;Pm(~BIrjg0^fpN(3n}sz!j~t)pZbI2xOqb<4!NB1Y1h0nt-Tk z;`*5Y@xN?&HnS#Yhc!F^Q3N>dzi)dFJT0WAnc4)I+X7f?V3tuM>~9FRxjcmwWNuY` z@1H=#SZlcLfGmN)>kM(`&NF9>dM6-j8%$FKAU+`$dpSqWgU3MN-!7~0s?f_3z6e&T zL3wq`G8a$1rl)5vh;5dO5AZbLh<ByK(Ef`=DU1Jxe0)ah|SZZ6Wpe$CJSAjTj&==18 zUnxprD`c@4i%pI!)&YQZxrl(~tn4s;77u<&Ih3YAQfrjwc2bi7$dZ&}=(*PLnoXpBiW1+yYEp*!O~af}%ZVnp4BUIjggL?y+da^V&HFbe@Rz zgS}APf^klCj?Szxsx*d_0f)H~)1d4bBwSVDml1(;Q>#j81*2liL{$JrN~@}|N}z)M zbz?sE>-t^EL~Js@vuxF=E^(3bJSpXZ?!c4e#KvcmgV@Ml6tLVwCodUv2gn+TCBj9N-91D?qAz{9<);pV>8+2#wfEL(C0BBn$ zOo-6_*91(&toJnfaa_lAQ=D6GAbxxg7eP>5ryz-fJstqeD)v9%eq($F0M2pYSBiGUT#Pa)>9LpJd7Sa=apB@%7Feb6X6bsRMSA6O#am zQuClc3zS9?Qb2r{UD!Zs^3}u3jkRA>L$2v00H{OIxY8t|5?I13tpu$0qLmw?55dF# z>*on@yH)_kW;l*9pn3m|8BZom46=B}z&s{{GoQ~0Ge`QX0GY&n(E*Tk1w14vGoYBm zp_w9(;zVmes_kSHO~r#tG&J^fnGa_mX{L6nNf<6oy4^~&IFA9vw~spJnw5j1DQ$u( zBL74dz*YeTtK_OqY=+22mqWV~iJPiS)`dCB@!zgquurL4OJ@BR30980uZJtPS99LynWiP2{`uEzt z+QMuF>rE_@uvB=A!B#j`ZJtOXE<1IrDnQX>mcUjxRb4#6Y1fpblBo)i2!PWwaG!}W zV+$FJTU=$1KvJm#ZeK|RH{NRHyCxCQRZ1(912wlj#GDfBzso4r6KZ39YEhFKa4TD?W9}HnNnhMWaLG8xtob=LHh1)`I8+rYF1E3nqo*oc&TXObTk_zCSCt; z<;F^oBx^Jy4+9^Pk@=!=zLf~vdzgX@ z#r!ewWZOgdC&h3n=APJxY%)ch@%wZzj|2k~4r6T2NjfnC04%dlY|8xu5w=9lZTP?&B1M0%x3#kXZ!n0WY@r2CRahG2qv&Ct6=xcma6hPL)(T zL!uIGF$+vm5w|ZDpsj*SG*4lW7LbfdPNr0Ho1vkaf^o`SG(!CE+V9Sq`s+bMVwa`) zgqcEzk%>16miS?_u#U!sm}C$FKDYe*(P|VRGe+I`O;iew7mWxLD~@5`)R4^j1*2}C z1UqMS>J-BM)YSj#NgVmPzjZ_lh%*%}-)1EE7_-I@UM2j*+$g2(yQz+)`BGmUu~8oc+zKOxaD9q$!~Ay113Rv~Ot{=FUrVRAjPC=>A= zk^!`VF;e(8KY>;g@d(BYk&EXMcz8qiWDc?e)9xL$=ft5dE9pEq9jygi!a;bPWZ13- zyMXZ)EV#fg2nN3xB5OM)<|vvvuAPW%@24@oZIKjw%wP@`%AMLuYewiURS|Dk7eYjCSjw&|#+j zj=suL3~b{*5F7?`K<};bzJVox#CCzN+tnt`fVCiJ#Sxltx6Jjy7@96SJ;IB?l9jS} zWzEtLBPW*f=h$=P1|VJeaS4X1+!`=|a1egye(|?CL`4@2Wmtuo-e!7d%n!MB?6p9l z7)jvUz&29lg2q4Uc`y*LRe2Sql{_~9-asM0HLj%65LXMhzyg*mYtKbV4n->(xH`oE za7;>xs$j}kB@y5m>>04CU~+ORm520dJQzxvx>D(Ab>M(%x(V^}$mgl@Xb_&DlA5bGiC=~SyjBmM)4|vwFxj|CPw~^t zIl4F`R{WLtk#gI*K!3FiA6F z2VrRJF0Ns)gDTu`#0#RVFlHp*mZYJ{j9nTYru_o*dl&IvFdqlgy&DGhr%IavL#OcA z3IQ)h7JDK0kSw+{;GF?ukg+eWZd25TGbL^(cbuf%PVU&bOV4e-Fa(p##EI8U%>4=J z^szl-ZY4J|c_3wMhroEIGTAW?rH9pd97~mzn8wo?jKeJQP=~;Tv5;aai0<}mfYsm$ z0HbLA(?T-zBJfoz{but7rvAdLVd*dEK1))+XSe5iP=PV9^G5#c681&-Tp=;8&I-Ys zY`l?7F)ud*1lL)w0)#C9U|{Yv1;K}P4Lk+OV*tX=69U=;KHE=IUkMi9fJG?|=GJog z;GY|6uBG=1=F-3b$ez3~DHyUC;1G1w9@?OlhX4|5euAW6Ff%|unNWfp82cp@gic_{|JvV40h&4kFK z*RM2w03+Ky;s0UdTzz$YJe;5d?sA5Z%}p5rcI1Ib@Tl=%pZgGCKt*=qrVf&Pr|=5{ zFoZj~Fe!`>0RU@^UwDC?Y)r~KBl!Q>dlv;ca^qM#Vz|4y`y9*m|Nf6?OO|bE$-)0c zCV)cs^bCi4p(G!HS&7KVKmr9+*9@DwU<9XEGLj70239r8^e!(&fN!&2widvXoEVhY zG96Z3=cb1&tBfYu!Qwk=U)+>U+@18AK&w^pyWj0z9kr`%K$)sQAKUx}(#@C1i?#QoKGM{S-H3{VQ7HYVVw4Zc$&FOAVy3oo(eGkbjo$n+#Vgiv<8 zgunk41}YUUK}3+4W(%CPTIQ*l`5)cczG}FdGKI1-oS@RxwWSSuVJIpoNNi)k^HP8@ zvKXMOpyP8b3XCPHl-esC7nW3o%5S_(us8{1$H{4UZh}~=f%&x1$zZL1iIg z6R(H3d&o9MG*iDFqld;r=f3!;1i^KANhA+E&u9wBVXk#Sfw9y`5id-CVsdCPcoxwB z0n2I}{wrKJr@{O^WrJGC6r4Qx5D;C~JaK`3YYV_=BtTwd%325YW2?K6U*Hv~zIT^%%{F1DU4 zWeq&!J}poH01yC4L_t(3cDNRTFbT&VB!NIz%QH(3Vz56c7@4A%+C#QNX@RD7E(}+Z z^s(U4>p=s+7N34!CcT1`HdxA|ANCkOnU! zg8>)-gTWSf0>5gEc{NvwA1~-KtOm<_ZhcS+S5ll5PX}H!WaiQgksWIQx)UJH#^cZk zt_{fqm7BOlcqU^CSg_P^Me1g|L3yfR1-Co%EOPTd5uiNw!-_Ew>#_Z}EHKQ*gjmA9 z?U7%{U~-e=x|u+Rk&srekXmiCi|GEML0GY?PjF!n7H&?_QGBi>m@%CqV1>{e4gelN zsLwUTpOgHMe9E$jcMLrjd17v^c#2P@?DCt4Laeu=ZPH0SdODmIp^~S znZPvx6{?2>M$AVS+a#DnB?RCZxd8h4(S|&%3qv5l_=kLahxoQ;8o%bLvr}M(U@%}j z*5D*h96=QI-ySy&V&rusb_pRC#61;KTHRWJ&?v3P6;g4O#I)Os0K(Zvm0W2|0D~n6 zZA67HR}2mdIlI6Ns2&H60dDL8b(8{xQ_y6Ffq2Zy3jSP<1yFjfVdS$89?UzkT2kB& z#%<=-h!uVy5UqbevtIIiZtSd3i5gP~$K!`@dvIn|&?^nVI(p$Li@l&H z@kWX@uc~9>S_up176;FQp=TYC7yPPy*75d)tScWCc66{xET2?~+tATUB~^!15`v0E z1Lx5i(x!l5b^)?60J|fXAOpz`rPL<%H{a@Z-dZIBtQ6<1U6?FZf;ZeCSC5xCEO1*h zjc#^V@MVX?VfH#Tmf&j+U-jD3F0XBAoTXGFbeOY~>}_n8NAN$&bJ;;jXf z>*xD+Y<>_u z>Q_e(J#jOC$9`|h23p(KJAd$6?Gd+f`4slZVh&jGbhE0}i#t>&6gV7~sy1k#`ww{RSvbO!$Ls&$|Jo9^xi@-a9?L_C=sY(TabGO}Zvg)JY_8yk zO>iyIH}~**HKxN}&wp{o$A}XjbU|`$6=^QF)`Dx((Re)3hZuRaUm;XKVDR8O<8e&s zIrJ`>@Fv3tkSgPPV0N}a{K)it02s`?7y#P<{Bv2Re|PP1-Nnrq_>KWs*91U<0T=)S zU;t7LzyJ&eTi_{MO#Fs1@{Q~psoR0;4VD3G_TWB`LWgU`>DiNcP~$pAiE~%lXwVWn zb6ZZPTtHoCr%-{F4F%CZVRsAcw9NVOa7Pd5=CTxF7J7#?0=)J;mN# zm_fA_J)nN1HJpA_wtZ2+oMyW8#g!`tw0hvJAVjVblp|VC%!7Itulxdf*?h? zc~zqrf`a#MkGfCn_^#IGAA;AW+2TWRKpv{4*la(|waw(3j_1Ol$~N2}n|nJpOo`jg z8yb329tlGBN8PAG+{X=W62I{VMWU^K&Oj1tGCTp@oAz-3L%w6|we0&ThO!8D0f4DO z)n1PB3IkMHwCQiJEaH|SI;8dykSe>V!3Li_JsdStnZDR*?_0&z}k2L_Hsdi zBiJ#|sUT~on`F}f15&h(@QvH=Fn|v%VkwxFXg1D#6ohX;1b_!%V0_!g8^90Enp7af zV*u;~6W7SbxkuO7BGF@>7hM_4#(+uCy|gh)M9^6Coh4Q3*6X%qlx}2N?Tu7RTJRD# zgD*iHopQ4h1g6!RBr+M(mu;44li-K;P;inb-W5*r#9Qzg(DxM4g%a&+6yh^Y^?sDN zD=<%9$U0Iq0~V@G>_LH{d|@|~7GJ{>0I<@i03VUj0FNPR5BNH^r`zCe-pz0Ds-X7b zE_;SuAv?0zW{5Tbw>8rqW`n!)g2&F9r(pB^vjj!jI8KIOga`nhr@;+aeD(%$V@UuR zQZ%sXUfAd}J$RTMF$C)nfHl7Jb4YdNl5fyMzyOQ{7>@^OQH7@NEcjCwUvuNYHnkRYUJ6VUH z6|^k(%7#YWJ0F@TZ*V$x7&;)l@>jV67gJ$5%2Z$O{enlzDiPE5> z0i<+c7rrBJ1u`2Z+8%{`Vky9~(!fat&I=x!fg(eo*BfF4gX@vzjwZyWuu!>4TpdN{ z9bDWSh`UI3D1fo-t_o|m=E-0(f5JPiu&1Xpr0HWo%yr>+ks@%KB63O_af(c8F5l@W zZIYw-&iTMd%(aXssvsN&#AATAuGaW9|L{Z}lCM>m{5dg89um`Is#OxITFdY-$%?$r zMv9OWi@*nSEz79FXR3!39XC_OmU}Tpu~U{2*F`2%&`AiuTCF(YAxS~wgF(xB&5#iI zi0KI0c;HavO%*nf_ZeMBqd)e%rt;s6aHi^EU*!2h!XqP$8+ilLZxZ}>ZEX2mzZIN^ zi<_JrUC4BjmsLN?OQFH(5L757;v|YFETv2F^yo?9Rc{+G00T4$M%Ne*ABJn8Ch>5w z;tA>TVMGCzptF(M0x&5&2Egt?#W-wcdE8hqcQJ~ao+L()H2*ry%V$nJ@&Gnw-U19p ze0oBPwm-`@E*@7A4?1x9z|@?n4l5Y#o7u%X>{R<=a22hx9l&0-gF@6r@!U+~Y;w>w zi0RHC$y|&|SJ#P)h&#z$U;`8n1@O1V(p;ZWh5~F?e%K8vTG$F|UoeAQlF?mCF>wX; zyOR{`cqT-n&N-YR`_40-TcRDic?%#Hq3} zHV{jC(h8S88KG2+~!5hM{h+5;V2p2F-83`3YvX z^B1@>byHbFQS8XPjf7+2rcG#SIGp3*#LIvY(Vrl?0J#91t|Qz$|CL zTgE36!@w8W%eLGC>k<_66&;Jhdcp>-pfM1D0k92D42i*D8*B`Nt*{|cj9^>hTo6}B zuq~{_ap<-oXrfcS_-62xZH_0sBG|*AutiKbyBoH-_A7DIzmaO)8-k>Il`X|XvEsZ+ zLG@`}xSptfg2ZzZElSD#8n>!33U-uWSoz%$#d^V%1cwU!KrjpPMqx5C%wiA%P{l;u zUw}9Q#twQ6qK%4xFtvh->9UBrf^V*fZ-^fka9_K?i64@u0E}%}0~m}YVgL+43V;U# zFo0xR)@*<_Vt^_Gz_h>0v0gTcT;%%&kCeMkEpJ9Su?hDH&yyvE5=*|i$rLuXFy#EA zFc5fN>(L6AI$IDTqL2cN;XGN=>~uCeIUFP&xuXjNEYdbm=8w3nYBm5%5STt$;~H^g<87k*7pM}qWHnwQ9| z#xMDKFnVmi7Z#2lyp4TjkRwmEyDKSfVyt7hOILU|mJqAVba&xoNBYO9WbQ8(+*H6C z8{91GhpdeaS%6INk;DxW5SH6E9B7hy7~W+ zVa6d+{-2Hu|fVC*4z@~2>9z)PcMNCtZ@gV24Ylbx;{tVCp- zrSe1g-jp=}01yC4L_t*DS^$fMnQ=uEht5@;CRxG6N!C?GCs~3Vh6KcYNnGEPUT1{B$@l#@g@p9zW6SG5upk`U-cJINDo;Ysdl8z6fqfWI{s$%ENk zK)+ZSyVi_=XBr=aEK&5WWLN7qu|$j_B*!wqh{0j_s{_M^<=S#~AsC8$djL6%x$N|^ z>99`Wu?_*4K6LEY@c$^&;|DU5Xa&X&({)%}VFv#mp^1%j920c}!39HA6^ zg1nr>SlcR$kExnfc#sSruK=Ykbv=Rjq%%>-yVKr zz+KqPCIN$6%38=|cN6BJGIT7M)b0Nn`GASB;BVRcw)9LPy!&Tz#n^2_nnnSq;tBtIAth2mIcn_ZD*M+vShhT z)q=&|iw4GH01SX_aN>}Lhy|yYtc?S#Zow1X3+#x>Rm$-d4m@{fZfz*OD=a@$-|U^0w1Nt9Lj@NEw8;X%UA`E?HdQz*00!9} z(AJ@(gzX*t1eWA!*#R(-g;J|E#v8`66ilZydcvSDxfp_7BdBr(w}@q7&ZM`AM7GnF zAb{&So}nb;$9UctNsJWA9*)28Olp&zqRbOxk`?`sO5i7Uabm%%T7wb@4~I`35RZs% z$x=t4ZYG^@q=zbOnoNYV2=W7&o>$TGN#-(BWNcEznYYAwg!6+4j?|zV;yWPAu@aXpj)#JOYwM>Z33v=NeRULviHIVgQ9la?D8uQdfb1p# z7z}BA|1XLLP=>$WhkYjG0R*Cql9?)nXGtRrEInk zl8R7ezz1ZWVyhO4poBMbRkhGNOR&gr3v*j!+UCj$xUEYNIUF{>F9uEu2x@Z_GDiyumw_-5C}Dw4;l&W{1c7KE zZq5AeF@UTjT{fl`0~HG=G|?Asz(4@D0rXmc% zb!#sLlc7=xdKq0|dn#X61$Txt|ArAo&hGK9ji<0M9hnW``BbC@o zfIP9_O;cTx5OCM=>IR%f2i3y(Xf3>m0O_RiA#Cx-5M=~0Nv743gH&hVBwlIc(}`S$ zb4l8yB=bjU1so(D0$Wx!2e{zZa(!#e2EYKEdOdXo31)vjJN3L2&k(HOOM$r^vRDbu zszp?BvTa0w_;gbY+;*j)ICkR8(6f&$tPPy?L|9YtAP#xIqsAoBWRV>W1e6^_x#+f~ zdQw;MohpFdJQ`z^FY4BfF^flVn<5H{g1Z^1z^Y;-u&kM}`Ls%Y=4Y#;Q@25vMcJ_6 zEK-4xsgbVaL#Z$#$t!|>R4_d;a&{?z0qJHcvI$FarE1QU%>aT?zbHgs1ONk$>N1W3 zSYjxwI281W>@1z&-jclMc6>J`+JmB`?b;K?dwD6LR)YuPF+dwQn1ro$tF-IjRRJ}U~*W_ zi7poM9Rg&|JFbQ(dkuq`Qx*&A11+BjY8p34dDmDxEDXLasY0Yut?-@8u}cUrt%ex0 zQ>nQ1Y7*E zYk7Dm{K#E|m(x@o{>jG22_W0DXk)&<_?n8?#=-u>?ss5}$poBu(m9!&OO7lQGWHTr zfM;9r2m+w`A+4h$q8>b1G=TU@QGsk2<+L`CM5<+yHot+S7N}bDzzu?#LV}T|mjbS` zRtgvXLwD62_Ufz zZ^+F`8{P^AXT*_^#Z>K9P?WCWl0GM}S1qHpx@}T&_C>Q@dCQZNH3F?BIh(_ zRU+-i>=_k7CJK)rU0(!_U@YJC^iIKGo*kEL5iT%CF=q>!%z#{@Nqh-d!xK+kOsNH^ zC1u|t7zijZxVm}^M4U>AfOIh~NaF3Og>|8j1e9WQjDVUT7K6D0NSL;b$x`)>BrKjj z6Fd?y<(#gR6KB9zxaxK?4*&~dGZ!M&=ll$ATg!&)&*$_L~2_|(QGJ{ zlYrZZ)^jfDMzBKLeD8_ZYG91W)Dffd%mh~`8i1dngA@V&fxt$Ql&f)Iksg=Hk73WT z<46GseJg-GZHyG>L9$uR$^Z#d6?6(L=Q(n<8k-?RcNJiiB?+G^7`cvygq2lZo`2F= zGVcdh0~;cIT`~=_j6miOPdDC%UHSwkuf0L`*2D4gzFHfM4--N+`u zFqWcbbb?6&A!DGW1cvEwd)SQ|z+iV6273>Q1|@caSMU=uEcZZnYd7RM{#G`lEtv7+ z&IirDca+0%?VnYhlCqu%CAC)?(8NQwiOt)1NEVGAF9M!3NqJ)r7fvcK1K8}pAO|jQ zVmaizqTv~?QFZfiJTY)+vFE|@CaR8683C@U2{Ql<5cLAUB}n40bnP1jVAm=Jo0xlm z;agS=z#wIpBNhm6+vqCV;ss2$nAI;DiMv_3!hW0o)jW z{YIoY>P*QZl%|(KYDSuX5Sl4CaR8wtfTW2nOI-Lio$cX{90E4>h#tYWD?B_O|AEFjupSJ+ z8vk$e>=jmb#X-^E`<3k!Tf7DAZZIb)MP(6Q0`^~$MQgG>A(pW%P$YyR9O??eQVp$_ zBq_}nLBXLZkOBxrd*)|mh5(1ctHx#&F&NK+d6-Ca2!l0Vo)WAU3BIi{o(ByNiH7GA zkMY<+=Bs2%oyHOfm!JRnlniF3GThCpIcf@CM%}6JRC|Vzz<2o4lX^{1DMnyOetdC? zU|lDm>I1M%p19|Q!M;d<{vBp<+EZs6WSV5z@iKn~mnFI0koW}kO9WgQif~pQmljyn z=rC5!SkB1=bd{=G=ixFb1aMl>yKP?wwta&P>`AQ2#_PL}FY3Bb1agRf2nY)io9-8dbnGAu8>1Yzb*Cle`S zO_PAma@Z(40auw;v)#}K4{q}Gkl4w5JjIA*A7+Gx|79yS#4wDMhN|+1fkRe7z zi|8`RysV1)I!AZB$f#jOWOn2{0+^8MKf^6o!3f z9ZF->`6Uqnw@m^LZ0ax>L5xA8N+rmQxfnRu4}RH9I^r>UUNVPZbgIZerU{jc;h|xo zm-&n^!x#pVTYR|Su$i*NkT=##zo9Cygh}zyP@u3@BMT2*V6u%*PvQ(;Vgy+80PGIK zV0YvW8@%G@S2-q4iCeoNw_t-?adzR3c@(l6n;ts=)N!%@Km?s?3<-k~wgnG4hdRKq zS`|V1!7=AlBY;X;N}?(O#vsJWeLkX@fUA5$;|OHgTzJfocKiw;B=bjUwiP@i* zws3kntST@EGR8r$4=YQBSTfM*5+W*VoL>+K6#+eDP=yRg2&Uljn*_udvr{c2EKBw)Tx?pc zAya{ENY$tS01yC4L_t*3)pe468_+KW$T%lF+4c=k_9%P=BOlPgjd7Eh)TD~xJ<~r^ z5^_y44<6C104l4|q;4xzsvWZc#<17RXAH3(NUX_wuPGP>qOY;Yq@>_gt4b<_W~#b4 zCh$p`#*p$jOr&l7qrHCz*mkV+Y&`wFUs+OZ2-sshAH$sluco5aNrDf%ksLgbw^yD(5Kmej)2k~EH)`6^Me65EkLaNhNF))E zBqd5HjH;26Qep~90Tzieob2i8OvH$7D%^oh$}@J*-E7js~`;80u-ggk%}NYl{#do6eCf3`Un<21q_Ih(p)QI z(K3EcNY`X$Ak}sXn)!O3gHgm7(+`CyfY2<*a(`s^`8;2 za;oAphq5XLs2U)j&|!n5Co@GQwlj?<5)Wkt+X3-bysQ{ARBttD(F&@dRyV;+8QQe4 zjYDw7Bzcmc!VZx6Bbqbo08ASLrtt<9-bO{e?d+Q&>;NCF47s602LO!h*6@)yG|8 zvRJssf+!yeN?kj)veej+Q5YILHdBTG3I+q=od%RS8T#!mtKtqqk7pZ7>Gj8;2G zHC80rtw}r#o;3jO43gh{AtRu>tfz|4%8O4>00&uP^UBHC%9SITH%^iEv2t*75+K{a zRRj8!rrjnNy3W_@$dQWINp6axCG8~Z(rQKVNV`ViNh6+n$ryyor_Y5H zwyeW~b4cSK>2J$k(MB6E5g%84+vYb2pB+fgwfPN-Ow=k6RwRzMexh7;*MK&1fcP55 z^GJAFQjE?h=xh$%VL&942hA9iA@IZez@oV4p;RWPBhEBdf{0t7)d*887ceYcqQH42 z%tgJ)Jm^XQpPmw+ZQO4#%S$JlJXV1MN)XVLLgu;BYD=&*RLCPs2V>(To6dBq2BI%t zPGpSRW?8CBN=H-`(kJEus+*M@*ixGW0E$NUq%9!Apf$Td@Qe(Mg>~FlymB~ex`+57 zxkjWv1a&Cka&3MC*uwJ@2gVl3BMZDdsWw=^=?PEk)XCgoUSvFJkSN(-00zbYLpi5G zKu*F1>ugidJc2U^9vL)OPIzmPx8RoF(TyNMWg3)^8_FDbOw|BG&S#u366H4Yc_uF7 zH1ZkGTcmb;Gz*QiFfL>+A+0|0@Ew4#jT>ywu98(MrspDs0Wd%d0@lJBUlB3V*hU+` z9;Jz1*ePAfy4M|uEmCdIqE_GJ>B-!Mcg&;dki4|lmwj8Jr`zL?@X1H81vhu{IYBBM z8fNa}Xs+?BOm3p;N^v6y-CwJKZeGO1+cM)7Y&5|!36JU|t0Q!7EeeOh1&5mK#mIck@HZv_CdY)(=5bcf`mFMJA^6T5P+qn4dxx3*V82zV$U_1IAJxE-ar%S7-D z02QDoIxS2+MjM=2aCka46JJXDwxn|LrVPQ1bVbmYtss4_gRD~Fauv@MBPTqA)z!jR z@Kf~cZ7=mpi_Mh`#sM+FVGvz6f`e}e`I>+f8hiwx7e)$hh?UR1CS1m#3CDOWXvJX1 zDKWLP+av&LNG;aUHc2X&?#MDFWE0M4H;ylefRkn2mh*GHW&(>>fPQf6m$iTJ_`lhK zy_wuteVp^c1ZTCK$W|sQvMGE;Gew914~YlIIv_R(BKrplF~>o+K}Wo!nrRdL&?R7>{O)7{jdv2h}I1-tA$O9gDIQyy_7kZ4$5r!OG8J0QMPy8JF2n>gzSvR6XZQO!6S@3QFu+E&16O z`Q)cCg(si5t|kjkXWeVGTBq7C?xx=VfeMCEJp6X|@wj>Z^5o6V4eS_nN>v1&K8SfCmFG00zJS7=W+E*cAXaKiWb0wUe^%G2V1pQlZYWT)Y1wFKw9C*CVP$rB%f zyxbqA`1#uVP+}xl!MR^_giTIgTlmg*1!G^cA7A0M%6~P!cIIaGi&?1q-pVDN&mgJh z0qpxw`dkD`03H$uP@E2*OvM1KBuM#bU%r%0qQV~HP3{V<+&p0$0zmxA1w)mc7$TBf zz_L!mU`61<^|hXi{3}f@n{0lmjR`Gh0l zfH$u3My^tWBK%D&zYJB}jwOs*H$cxh7yt*%c8tL?B1eE29)B5Z+eIye6kAb>Zk)&c z3jR(I_xZk+B5ZpoC)NB09k$;)2G{~{XYm_1h{kT*y9$QH0O;!(9)-um`NWcM<6LGI z@vR}aCD2~P&Teq!9-&&oeS%LG!!Z(D(BLFD24E%VyJ1`ml8$OT-m;efuB>icm8g`e zQK9;Wu613h1R=6h>5Et{|3?9@N>wb=|^ZSL6cl!|EMe_;4P(*A-R|VoSNQShah>QyuBmU7vqU|Pm zlsL1Q@J2U-=26c0OFO?lpo_KujNNHpGIxRwyF%ml`#FkzooEgvGMn!izTQ1?ps!~u z^Y8|m?D~yM+wP=UT9c=TjAjiCKGW~RH*W!Px6`BzM&8!CYmj%$qdgcm8lsvmD=okj zU_Q}gayLZ|L-R=2)7clMSR`a9+({7m{r`^CZdk`air zr*w>J4`4qJ+^cP0$;Yk*?e7##w!cet*s1o--1$zmze`EBWu*l)k~TJwOAnfhyZmw2 zWL89vL9j37W#z9~oIdY6+abp=4OH(h`ghtx*{G5aQ-7}{JJ>e`7;K-+pHX+?^0)2* zx2V7G8Fuc5y@Fm;`-?5~kgUvfTfht$kH<{xZgATx7z-Tz9XG?-Q4*_L zpv)wX!4p18)MJ@M6^JlFdaheIs12FLBgO`iCmB|1-LzMHV9g z#y19(%^w*}wxIYpekNv1M(W=QM)Kk5M+H-?MJjENY7lB&=wFgoGP&AX>NN($m<($n z0{-cius_#M-e8y#q<5k19BxME61EJ0O+_C{1&qTA-a9)Zc9tzA#?WmN{3Gow1T(;a*%{AlT9kX0^m?W9mz=%uJ4l z7LU~j1QH<-z~+K^crMJz89KkgT_oq2;o<2y73)@@uhz0Ct%WF!wa_)c!AYL@4FRdt zZM6dEdi?4D01yC4L_t)w+Tz%$MLp{G8XhHI9sA}e->hTT^+prCQRI!(9Q-qN{SL;j z`aC$?PCbrURNVyJ!aS2G!;U;%gm>5@ze1wHNKqM2MZ#MfE8Jia88A{^;vGbV#-fo* z4B}g&6089EzO+ zVR}-Fihb-J3QqFGRU(B8;MSWBc-ak!ni!k;v6d8ydzmy{zs~?`#>_z!Xkgm|UfLU}OPm?5s8J8JlPlNs z=Y0=s-GxC|vEAQ$;$`#*?>+JQEC3PAt?!^cJ63=vJ?kzUWnEzaC%FpFQe?3)_dohU z{AG5xSDzXDdj0+%JiQ;D>b&F`Hfoh)3vw$&2=LA31{xiH3y{4OgseAdkJy3@?gTBv zzfZu@v(<=s&@l#L04yZWdG4cbjl{A_$+q~@%k#=rZznD%G`T{E=EOK_z6({2kbY3C z5yAWHlr#K&gZ|!Bobp=o0r_-2V7DOKPk^xq`lCRRLt;NqPbi5|0bJyi z1_Ok^0HLJDcvagxpvfLp$vF6QbxlFt6BvWWV*re?_%=u^m=Y7|5-S5|xka0ULCR9n-&~z<>cqul$tQW@62zV4i8DBP zo#crt8OMh%U0qwS0rY|Sh|R(WIkyGnVaVDJ?t~H? z)3aUaygrAKL$Dv&91ylS@OrA@+7?Geh(uf<3{Z0Vnu~rJSuD})0+*Olfip9^_X$e% zGrRL%9^#Wc*RuHy&MY`Qw>uO-T(&Ww4I1#8KT~MhhEkIhK-D;KFbu|qbJ_q5QnIaE zK@P+ukcvhge~}5qkeI3&=t7TO&GR_*Wh{l52Lmt?z{*)!0kI1BU|2fY=Hi#j_+X^U z8$k$=^YK3fnvEKud@8a5R=q~>>INZEOu~1d*(%bFN0^wIrlz`3fLaRuOKSmZAk`S~ z#nyLnH>}An+W4X1jy%JMqfWt3gJ{OSZ=A6!QhUIF2cINwp(UV*+?r>3{t;cjMK;OggWTFFQ@CEzkLkFerd>(to z^H~UIo@t=KX6E|Az%;>xUu@&L!Pmx)EaO4);gokIAD+pKOhlN4D;O{&5UUrBz+&@& zVvC#}4c#OW5G*^%3tJOwff_YQa0x8QYSOwIjI9|Dks332(2;6E`c$sPjLBQ++ z_mwAL1t(tIgMKc)s)3`}*n+_XNP<3{aW0H6BQT`&4)lR&)pR|8%0`91`?q)Jp35jn5YmGN3S3Z|y8HSGlROWcQ z>f(v;Eda!zBmjqvm&A}3s6Kv^JS&h`hVlypN^u>n=ejEB608)xXuUi%SRc*{+Oa{^*^J_XgHt00zcmfd7@&`*gkl!&uohJiSTsnG+3yN8n09 zN$5EZQj+jn03hriBQ2PW(x^H(t7XA{9{OZ`QjyjtLN#gd^Tbo|$ss=p!Du`MDnX59 zR0-4qaG0d@DYCAxuqsT}m4z=R%EB#}p5>9nl6oFJB>tHSxg7);%hU6SpEWC+WeA=- z^)mp2?}->Yc#_#N_UXoplYpCDQl3n3(QGk_>8snR;ya=|(X9`Ws|MYsiegP+$Mbl8 z*7GO+46f&)=jZV;Ml?PZ`1pL{Cea+^2-#vh#t;mE0X{wuj8B^cV415(@ECK*Sj=-k z$T3)9#*%s-&trU2dHC8gjckg2J>xvaY%F(O&u=!RFT#)r>1wP4&|;C$g`lEEs&M$6 zQU^5``9xgXP?-yZ!v8#G8tcyeW&)Al2v@VV=ObGzplez@OUXFsSc#I{WB-X_Px`On~4kJ`&GR+v`(+6?L0ugq3 zKw?HvToDs81djlZ^`;HZ9_pb{W$_yVut{I2i-n$CckM$Tf{nifN%0n( zU7cv=QaI5PxB{y>NgzoK5G@^7Ofr9lBqE$>pv%;WbXFSLWCJDhM>I&;28k`MuASuq z5fu1}?%|w}Sg)eNxj>k0Xu$h^3g_kkZKMFp-=z|+6i+9`!k}*>1|R@zgTYqFD0UPN z0d01Y4kOM$K1tew;=*Q@85DGpiwRW~$`K7AAln|WY)C1tS6Y8a+P{!6R-M{qp|GW7 z=_%g#)}LQ6#=ExG3luN%bc0n=jPKtgq~NGe=okvls~}a!XaO7m{S@bu-ucsy3Mh;! z^$ACDp;!RxBLj#}Voh23TBO7ssGH>mkv7WMg?@^DuJVmia|xw5aS?HlSdg+_Fw4aN z7(fcIS~?5{i2*PGDFAkY*Dx}StYn)@()udL;Cn-JPZ2*-Lf;u{!zv*nPkF}xgJNB6B%9YQe}rrZ__0ivIGTSO#|c2Hqha*26m^GCypf) zDGVrk0iYHRIdMc^axo11k`a%!6v1Y0-Te&dHgkf;>?(q7gv~dzigI>Moc<&)d{nqd zj%k-IK~e=M7+eCtY3ysg0rCt4BR!0ItPXv=au{GttF?d#0sf)Ak?L_R{ zmvwN^O?(y4sqBftd(OFZ+2?1x6zJ*kh>@KF7>rcCI)K@u8v(n3iMmON`yYithn;07 zmY7tlO|r+fuT*P##>?v(i(nAeO`QT&TPgZ{9BkyW@wOYZH%)pfZzw6=IN6q_*FW0( zc7XHT!p8AA2A+^)2+iM1VG>Q!V4kMIZs%!Y<0GrH?aw25G(&R#sgyGs4lSSi=P^Eg zdj9zQ{PEK>f93x8>C;ERr?LF_nAE3_&&32k7amLS{4wMU!PJk)ZUoJA+2!Ra}~G93i3+Hw;`WCef-N`{^!5{ z`%i!Rum8mU_@DprU;q85fB%nv|HB{u1N&qAiJSbxAO3if6aV24$^PMw|8YO+4{r$m zy+-{zqYnG`kUa`dSv)fa^b`onLKgVLfBffv{qc`~{KJ3#=O6#{r$2Hd|MUI-aBE|5 zkI$c;KUsNLZRcs_$!Dtvzmw09$K43#PH{RAF$haGZg~}kTqembvOVE4eZ^*H4NORf z0Wiz>HZN=i;U(GW?ec0bA`m8l)7#|^Krop>HHh-yVyoxb44IB!VCkI#A-=O?Ea#It2viM_=UgEbk3dDLTVaj^0X`{?uE@?ON(Fk3 zwYb0n<%oK0d@(mJW0lkx@i)0VD*Nan$P$cvWzJgBt2__0o%+Z+2q`P z0$>MD6K(c%ia=2qpDQ2Au%g*=e zE{XFH%Vfr|;cD<8H@mw#gQ%y6ZLHje+%uCPglRTyl=|vZ42ER=f z7*TxT1~94+U@ob7{AJ=dKe*QWF@q^1uIMl%Z=%@TI2F9UWwbj z1h>?RD#ci=sSOCh7~nJ*Y%<(PRY-Up1MJ{Pvtr1o$HeH+4=FE!fv?8}DvY`j%~9li z2vTyiW(iP4kW3|zS0D160zr?AV5p`rg6C&EQ5Xge$tVWC$cgi6NlcYX&{IsWYG`_4 zW7ruxpm}2<8ubFJu-wY1e%hizpwtJ_{}>z0%u1@niHrC54?`b5eH!0?eE$A< zd>s13N1-TxXq^jMB1szX4vWVuLS0IURz#rT@z&wu`JzW(^n z|N6tn=fAL5zy9?ve)qdy|MTzv>G!|??Z5upKmY5${r+G7_4oe*_}AYD|65_m22Fle z(Bl8^a}~Pmzy9;T{OdpOx&Gzfe*Z72|9jT3@IMDbV*dvI{UP{gR{nqf`FFqhr(gf_ zH{Wqg-+%nefBxw|{_{_N;5K<=pT{#ld$@5Ch}VF{>rP{a&O;AX`{ulND$$@ukwF|! zcUf(zs9YO7G%_-H+efMJAz~@Tef}pYzmTW#U48aaLG~x zA;FC&xGV*3vr^)%000mGNklx_~cvGzx0tu87VVF zAkMn#k`ZbQLC7UQ4AT~oc(ZZEBTHFwI$D*@C_Z;rigIXd*<6)!2(B0pSh~6*kn^Wx zn=^FKF|DND5S zr*ZLvs`T8`1IdCi}4^s7UpAm2{{KG_q`{7A&O+igG z#IY+yM3CYo=qD~AWvXjI^V28Apt-!LR^>xLxd_R;;dx5$!i)M<4io32lx?1iL0UusC{8}Cn3mla$&)9Hdq$B~E z7I5naPBe&7Cgs-YC%YJ)v;LiCHXK6MTU_Zc`t-4jG}sqVZa#W zM*5oz2D_mMhH_JYM@DMwhp+^;uK|IzNGs$^U$na2Wg!QbGEmi8P%tFn+X9pbkYQlV zvbjK#H5=fO!9CgdDcb{XxHEqy*!9~z-g^(gy6E$B_jOpT6{~^7z{u!e@{|zuAroX2 zLEeNVNL(v{1jD&LPIJwbf~QAdPGra>z(b15qa#w(FTp($}XHja)CV2>&Va5qo*ZZ8P#8kit;TwQ4Fa|gc2HQ+9i@-L; ze3Z2(hXROi0V%*3=0ryY_(uZeRd5Oz1{a^}b`%AQyb)YeXz>Fu|F`6M>=EEGmaJ~8 zY>`pdGr?YW8n8&FEOBl#mz+O!ilmU^r@*r{DG^H34=Ko2H9LS`sIem6=TfD9=)O<> z_o!ko_p-r!RtW2u=wp!S>I$wsi9H{XaaIQUlOn{S?;KJXmr=}8ErXZ%0RAJ`Co_+a*j?@hk>_Q`zg2ET56;tQR@ z!_6LPu(wY(=GDYr!*T#_L?C-%dMuo>=?!cYK#Sh8X3J;s`T6mo^23Lx55TsK0oWZ$c#O=<0dXMU^7QI9NnS@!HKPqPxG=Hj2~l6$ zTf?S+_fyGU3IuQ7>jR}3Vm>usI)XCG7#}1$W-mNsa)YZZfU5-0WWXwg(jXGl8u(Z; z5z9>?%PvS+@D_lRrd+ZqmMbh{Qy~z=5-#%`#w-kT@zJz>3R%$C6BAv=d}JQzY6X!Nv^7V6aUFXHxpF zWH!4s=ei&qR|4(WhIKVS8xaD0g>@DT$COHvNF9PYL$Z0L4FO&Xr0@}FkLA%Qt#%^}xjtpVJ6FJ| zFnkD#t_2h##g803ktxR`fyXrBbj_}AL$XXkfdarhfYxk0X(r$zZ}G>7!Q?Gs3`S;U zf(Vt)$E!~?@{(OCx&BCWN~0Vmk+wvKw{bvKb0LqA;NoP(RLx3?)mHS1%Ni@iY*@j= z`NCwejsaNqxVn>s*oFZ7dN!FmK`4fm73QJpTL|Fzi{xYofp`oMLx-RXwuc2gGKA~X zMH=0$k-msWf}PDCS8#0=2vfFy05C~-j2`bqqB)lnQKotcB;onVL?;^aw`rXg_iUcI z-X(4uQDevJEFEDPRYn2y04&iKP!$XH<1g0y zxgsnWyHsn4M}COmuhc!__ggG13#JH`pexKk>|01KUpS1i_{W0Bu;jF zVsQLWH78`FD=%{>5*U*-!$mR#MiN;}H12049N>~wf8$6Y-ltX{o?8KmB9PIq2>2Om zeTyFACNJ+SHDLh;1}mgg-lCPOP=|Lg`Zm$bCG*!9davw|r6O z9&UriRA{h$03y0KjiY>+f55+4EvrH>ZV%N@!s^g7i+O^FkR@2xBp1uX3r;0rNIGeX zl{Tc}G|38Z@TvwN1U?jyx-SbQl@kr{P(Z3}mu*=dS#C8sX67BF7C@AMJUogrHVPIM zTs$3ov>h=!!IvB3_PYgubqxU4`0v-VqkHjSjL=$tq{&#c3s(pu3zB`u6XGZ4!6e3B z2m}MqaZS$;p^wkwdzmkB_?!O+ehqzkvR&z~=$H`uiWB|>Q?W}=Px|nUv8NAX)c-Wk z$p6|45B)Q*dgkC`LI6m}r-Ctf;!)l7#C0T-n_buv5cj8vQWWI7j6Z+>=l}W3e?9Bt zZ~y5xzx$`({_5Ai{D$vto^o=oma%`omsK|r#{>Dzw;#B{-{nq!^GVx_Ea{c`aA?&krTJVGz3^qZhC|m1FeWfK!pCx515SwHvsm2ns2D2oR z(=2Gs=1Sppkv_2_psY_4%)EHnekkC6pP!$UX51JyJyuJT`K&_Q7Jm?D28%#Nf#}PV z2`4Lzi}T=?ZHKaGKmn`*aROS^1~FFHvSOmyV0sKRu~)WOjW=Ky3+EI7 zN4LiCFas%*91l}01Xrgh5gfiN;NcFxQvqm?6m=oO7a7boWc!&f_6v*68&p()0vLq= zPh?mQkq<@3P^@%l3I=f*0CR>DBY!AJe$25ZKzeI%%wzMHP=RlgDLzvV1?R#TIr`sP z8O4-|bB#P@EDtvI*R4@DS=b233_@1mK;G6}3NmwqBux|#gJ2-;ve|8}=k?dgfvAtN z@21nhW^AXLOE%oPU@@`gdElZ^4ll^eL4?G4)(2R$>L7vZnUb8R7?&iM#UDb^x^p2H zFFa`xMlT zq7IrQm>Y%+S33%ZWJdsy;5$K+j|ChhX^BxSV5|!9*{5KK5Rfdb7~nR>!EL|!2HXwy zh5#93LNz3+JIdsKS{0`O&#EODkP zGV>-u`B*{m&JQR-Kwmu;lCXS;T*Nn);y1*7uqVAwyo{^Xr9Y+vUVIIN(WWvmMD8kN zVGcByP0@8`C?`3@TOtEWplU-}r<~$lAwxtX8F|9MB_MMcnH~klL=l6^NYRH}b4&~? zWfY#p47&u|t6EA8P2U2Xc@KZ5)wlbU)a}4<7k9KaeBZYXoC6 zT=(3}@?nGN%h+FfhTvU?2A&2rbT81wl>8IlJMf%-^9^6(eB=2udFUVQOLxHI=>uQr zJh7S2;urZ(6yU`+x016V#?1cb3T$$E2$73vHEMC#Em#~iKYjZ6mydtu;C}O)U;Wen z`R#Y#ebZmyEXhyZ|83N>&24`7-M9be|NM>{e;%LmZO-$@ksmO_Qp|a%9SB1p1=rOt zv*K(^knKeSVF8um)J#JH^;OKrT$#BhwJz2d)SbXeYjS#p<7!JV6o zMT|+Z)7$0MUNjIEP$|W;^9l*Z1m<_Jp~CH*&YEqQ=Ujt`XB&@ME>9N#PMWS{>0ew+ z@FG#??tInqAk|clot{tJHA{0>TzW_>FxpBc&IL)=Rue;%LD7#4;4X<`Tt!Ct{7iJF z2&**7KsvN#RiqpweW&?-0T7$Buz8)&pnNV+1VW}TN)wit9(P(Xhs=Qqtd7kX^9-g6A zYV}aD^%)8N!IxcC$5nu`*cCTA1R>54+(zOhpnQ`6Y~vP7rm60jEYMy-e2!n zNH&fT0P=@y&d+z)@-~1eB*d)-XMU4WTjocP_LojBY~A7lFM@Z zy4t9B#TA3l;js-~U^3fCev$QJ-Zi9d?4drhbDdTAoJPtRKBLdM+uSMuMufZs@ak4v z;09D1!=?*;U1JR*Gb$J}36UIOkP44@9gS3vYHoCQ_)`GRnmapEY6#E$;Q2`wzXhaJ z&po4h3YeSqkLXE7Hap;D#XTV!)ZwaMpCQMfB%k!`*rk3is=;%WVC=mk|BiHQ&|dAv z8%TW)c2VVo=d+e=CY@*uB@d};P6(L*%$Z15T6r>j-SFw@!}#VK*Oxd$B7?`CB@Cb+ z*!~|IX0vs|efWkibR_;=R-f`gW1F>FBs|HXi<)uaTX$~!#*BM@{{H*FeE;#!-+uey zcmMR;?|$*^x&7GL000mGNkl8_(Pkj(CAX9}K_E`!H+oLxIVDRFLTXDx4#8yUD=<=dDcR?Q; ziM7DW67z3yTs$s)V8BDXNdVTe26_7HS?&p%dHC-f-p5wuTu?@hOO+oq} zWh39!N=GGE6YU^R0h#*{>J+~WVSXliecq=BtGrvp-Qe5o&H1g=JcAneP;i~%9D=lM z#@)?29q^znu=;v!cEIQc_-ok7k~pk0?PYrGNVC9HvCOnQUakf}1H?}p0ny)>jVz0$ zv#hyCwOkks^0LAGDQbGKW}Bym8WJnINkeWim@EcZJ|RYr{&)Zv|PHwe7 zW5ks2teyo&J=mSW7;x<@J*O3ee8r+Cg%p2loC2kFx!E%#x}2Nc8v4^?mhCZoI*IBQ^2x zUOUx3fa9Aqg~>(C zd0$|NQ=pQ!ShsCGO_8@C=vH$@rAB~VWEDTcm++EyCoZ+3w>bS3hZn zQ@{s(2m3CY1Y?bVkgps0l99)B1+&lqmYsF;ET$T4$O(yp>Iz+_aPu**)OOJj%xhxx!i81|>>2M?bE_fh~DYsLVi0eCO~17LtA@n9GXi~%qJc7jKk?dcOndt)Vj zx}ko$fCXcz$FsvsSb`VV6ou!s)#qBI3j;AAzD+zBWsnyJy|k3@WBOokPxqz%C36h^ ztHS;35vu^>FWZ}?{A3WV89cjJ9`38zYZJm_ECXK;fXoBKkqoi#7^%07QR8jJ56e;% zd&k)Ksb-;5eBzt*POuL%aoa6H`r0El?N*V9Ok09CFJy1#-;w+>$!j;ZtK`lq*h}LU zd0BOc=P5~^zfPokc%g!C4|r)k$s2-~LpJl-Q7ve{N1dQk?N5H=N@a~a;@myfDL|z< z+8!m=AwQ4i_l7=PEgJ!kW&?@C(Qfc$HAx~#?V-nb z9^=!~lRkXVI-Jl1WeD3U`rCFq57^(#8t1-o7Ej-J`1yH!dTniJUQ6BZl;n^G-{bt{ z`T6@_{^~pI>8aQo-T!j|oAAqD{o)tD`u6)zfBF9V@1J?9*{J%Jlilf;4}j<10~hLGz#2AUk0N4f_-)&C|ngjzd#8?B!!ki3N=cIWk z=TGIr8BsuQw#eQTyeG-eD(YZ}*BXJbmt+gb1@sC{3uKa8c0J*X$fQQ5mvbIF`0+gEMoghjolt4#=Q-uMR3*#arzzA+FsaqzI zZ^wrE5tlzdHg{C20Q9x2;5;x%GzO8xpBBbha19DLvlBagoG*dHDzCPuNa;_h`$LdCCKZ?H>SXNO3J85gaO`bFV?|uewbv5ihGggR(a<5u)NIZuhp{V z-hn6kn-5R&^U%ke^JQtM@Y8OB8*bg#;Cq};A3r{S{O*_Ee)o%S{q&@4h<@7kXdT(& z_ssHe>^lZB4tt02v4ov?`tG~$zWv2Fe4F#}lW8nmx_hl{~rLG$XUeI@~6Gnwv+K--d; z7u*Z9iCJ>SM^~d*`4SBEZ_h0W+i3eS5vc_)W}@m4RR0cVzYw#e9(bRc%AKDo&7Iea zRu7mf9q$OrNjJ5_&5I6`UJ9heZGp{ej;#p6Uppm%Fdhy`B!ly?1J%y}Om_L^9=ZY< zfXtsrFHBUVDY31e$sPXmAoEvM09G)!0_cUjLEZ{-uZWvuIMx^vjBNlu4IVq0J4_b4 zBX>w@+a`Yma2?IN3NY`xbng@OytP4A4fZ0sh2Taf_W&YWFd#JGd5Tf zaExR?iO69rXB43Xb5r=*XC=Myv(oB*V1b;9NsDHsf{jy)Q%#F0SbRgK@A#&~}6`0zmvo2xQEiDRm} zIxm?!!4VEUUd=c(e+TedE<60;8$JZjw0uJM?GEp-m zzy0=`U;OerzP*rET0dFq#iZPY5^>!V_pvVGLX7)5=BE!&Y|A&_e)#_5Up_s5Vm0gz z9}Cwm`F0f@x>B8ScRDEj1nps2ACq`ZvH^r23U~;}l^yVsx>M69%B2W4kO&i*K3FuX zg7RYw&xkDyvaSZc6(Fwcm`84Y0t`mkO$!{Ww^&HmlWZANHA`lcXdz91Z$n5lTM1xh zsF@0#ORu#ILBRTJF)f1}V%kIlXBmGduuqZ?a(1RXci2&@HGm>8)T>O*j7Hon`C<$qaU&@gUSH?^A}JAJKNcL zzVKTBMl%!v7$7x{7zR@{0CozBe(0iNiif!(BPj5|@gOl#8@dLqD}1xC7Vr@UObuT% zK0B@ARgIo_aBulI&{GRyKKX^jAQE&fR!d-Gk<6?48O+X$T>a#`o8(C3s_Ve(>ag;a zzA|^{-C@^4-r$@7^0XGb!JLA|?e~zo5T4I)&MArXc?4m3A%G@Xe37rY2s7l$-!Vs+ z-(b+qlLNhJy&EmrCr5bUQp|8;;=(A!Gbi;~Iggai7F8}eAA?~8on~JOWaUf1Gl)RL ztp;!xn7nQtHFYv}UUa9Rar`U}tT7Y-hU6y)8xENOL?-BGyO;^<^4v#*FZHaGv1VsP zvEc-@@CKBFmclD7fYeEX{e=Q5F>35lj1TVO_#s(o_+Se%F&B6(Fe#WjYXLcq@Gey$ z8B>7{-&UAppJYeVcc;047U&)AX2Hx?6J4aLpyMIiM5r{!5sB+c69E@f|3`vT3dQcfDddO2Sq~@gw5J=h{fmUnfPC+*Yv~_snJ5ioeJ9Vw0QaFmg z6u^+;)7pAIz=R6}$&}~mhvm&z1GbDD7z6N30#GrL`faNp+&q44g&#ci&or=4ri%yX zK^q-P*|Lxz;9-!6Af$+b39t&G5O7BE&EUym08XSm!@!)OKG~l>eBd+pp)&fZ8WWn; zq@3d>2J%3#K)`2gWJ69(>acKl)?RjI!3Z$G+lB^vRYMMYHT~lfcK%mgr048?Zl=m* zOT=fX13VdgL!SEG000mGNklCgoAK*k|MDsSd7RFDfu|t$#(+#C z%}tn{x)EWGr@xOgaB{Po!gq8Gz}_KzQ}W@%hhP8ZS5HsR^S@>_SQ3A!7!2atmauky zoIdAJG3l>jJv&qN!T{KLK#v8r#!gMo%9o|WDX3?w>zBtt9iHfREDvgztxP_!QByY% zZrlnyv*!317i*LeJtXy86+gyv1oMAPy_h?Ja%weHtJR1EqY*xXridajNOlh&;iHSx z3jrK9)u1H+HVMF3Qo^A0xxi)R)PgKe&*hs4&(`FPMkmQGy=__5tcmF$Y)e-AbSC7I z66CI3Es>Ku?Z?0`LTY zc`So-5n(~CB$ap;0B$1>j_ zE$BQq6Pp1m7us>uOt!*u2&#e}Gz48d{$-w(OEYENHO2}-O)yW^m$3{eaGE%m$0N?_UaT@CZ_V!F-u$q_Pk;}#GCFtQU@0EWrz zgBf|iMu*N>p;AB?{5DoeCVsGVl2vQDp(2NjqOtB98LDjoVdJfX0k;RVF$8d@ zgn7+cpX|C93SK08Hn{R|Lbh=;0ES$?#wILqlVbEy;T#*9s|556$6B!00MkZI47@$c z#!Z5;jj2HR9%Bgh9wnOI*r~srBX4|e0}_w4eXo+R!4UcECJa?5H$V#8U<{i_y@Gaw zJw;Gtr+6Tr>pyaYAm!M>2*&d>M2fdeMCaR+;jwk z3iNoEXPSU?F_38Pe0(B7o2DWFn8YVv|7dqRz;SIRn9c58TWm<4k-^3G*W-knpkd8Uo_p%B4+dT#D+g- zzx#$lN##kX+6JZ-gWx&s)AOhAfBDPro<8*8&iys~UgFO&`Hw69^yFXs^1F{8|MKb6 zr~Jfc@0{)8qK_SGwxOed1DOW;TDE7))N4}93+l1J5!i>92-+msKy@>b42neQ3z-8FwLU*BCeF}e^BABi{C<}zto9uPdf)DZ8NR63@XFux**4~7%Per`02V*) zL<8e700zJ|I58v!gKcnPNDKzs;KU)V{x9+ctCr;WD})rM5|WcJSXb*1aZ=ou1f$!= z{0a2RU{Z|e3v48%`#-=z}SjbU&U8&^}VH2&!%4)IjxSl$Kp|&4$)Bh z_+yIC=!Hgi&h7zgAD6jUAn5yxyZgQBh z!WVrwYOj% zTdHV!69D6fXyy`;8w85CIR{1;vU$7vCKq0$BzuuSExbrc_9B6rSYM^}X=EyH84Jos zruw+g3baNAEX)JNV7u;RkrBWimf~bjV|T;OH3S~ngtvm!Tmoi8z|@%Yp+LGOD~&ll z6wo8j%xF^3B$zRXv5djP0;ZwNC^Tf|*t)lwr$bN9nRf~xw^6`MGCGCN!gm%hP-F^H zeBvsAUFMV}Fuz7jJZke=QL++e6p;C9IIJ=>tcJR{MFS(1M(9UPo z1X$&5-W?U-UNOTX#w<)%FggiSuBiS zD2-;?f+Qw$bZk>c8xTIkO+Hsw4xu!Q4{=;^taoIh!jK38b8+-?p4y=v)jlEyOO;vz zZhgv7LDpc=+!@;p*hU04`PE4ltW}L)`6Td=WCKJqPzHRlrOZ19{h->rZjWxC+pk22 znZHmDB0+M&iwq9Oaa33CBu`w)xRX3_a&_I1`2>r-Y?4(lIT(XP4#2?EO9*r{!i=I* zQefRSGLTe&2IIF)(rN&29-_6Rgv7eCdb`!Ymay8r+rg8~P7<~uU}0nkr>_cxZ4s1$ zFnFykVdL^W7Gd)pUY@TXOO`Am5*5;iNyn9iF-3m!N`#{Bdg+^c>1TzPiOsxLq4>S+ zTMoF$(y%JX_DqLmWivIvyqB>Slrm)94|j23j&dZQ6mz7|78H+rEI>w1N`+D|_NIbn zdtJZ^G1Vvl2F7E(asURI=>&Z4I0ZlPi{<)%vm)O0H)e%c^R{IkfKQ)3 zetQ1+>)-s!c4vNS|G%SN9u?ca{_StR|MdOybM`ru*hI5&WjJ-SC$>zJLkFb)X|9`U z1kN0Gd{1CcOo!c(gzjZ&bxN~M$9n+pmDwO<2~1PcZf|%s=JY-)RH6k*$?={7226tuDf09&USx;no z0fON1j}b<-p!GEcgD^f};SNE_P{{=6%A0mP)%t{p5)glu0r z$VyePQx61ZDGHWx@ZPyJxW;G;;C`5ZfnUKm+&N3#S7V!?p)LrA6>Tp> zxFG<85u<|UjRz`i15H87K%RD`V384DhMs-3JH;z~r8FCv@jUDjH0QL2cmh_159Y$q zVp2Jg+5&ZRNT3x^0)Xxtk48PEQ*fJRY_GhF2freKrb3=0#$Z8k%*g$&TXPbj)Zi2} z=J_o#`5{z1v##Zl5Di|T(+_~cn+Q|Ko=vpLnv4nQ;}oJ z1Gj-88@GqS8n;JKjAbl)QDHy}@S6d&6$yL-#DM8Oa}7&a-F^dsVK7i06T!0(lyU?ghqJK zAdrO#B#?VR9>%gFuqQk-5i@_!IAS6^8pn9X6CMSOY&QrbqcKLZZk7-ifia>bfec|V zs4qo#(^Zv~m&(g`IorQyt^Mxvp7WhA^UF(B7l@tfUHe(jdiL7;-S6d`JXtiMfd@cS z*ggdVu#d)4vH zWU{!XE&wRoX+hFn7<%wd0jX(TZ3!5H%>{%Ob7u>&XLgvY6=Z|t+#A@lR&USOl;lv8 zXxu0L{YG&o7+c+WJ>%AIn3k`U914jg{H^FX?K-UlTrQ%yC$vRf2YW&UjV%fZD;JuR z#>pd7HT1qFT(=e3SVYl};X`8d1M8H)o&#eH2EYLKwdN(K0x_1bT&3_8?)IdyDMta{ zN;8IxNxJhHX+{n)kW%lVhGb#ZN-l`N5_YI z2YdVbd(uNKSm$h8ML9|AoMX?BQ2?tX04u!1Z_Iu_;f}F0ijig7KiJ#bTOJ5O1y=f>T=?@oqs*MjZ=s z-X!`!$TG%8eqSZ*c(yi^tqlR0$oF)Wbrwo~y)YJYln0nk6d<5k&>9~q)8roBT4Xwl zKsW+VMhI+;v3;OJj>#BeNEf*z2ir%erwr8F1`Z3dhM%%hgl0GptT@4di@r5z9Nx zBj;Fdjax>+btH>H1rIv=pTW~4~$wD3|@VF*f&B7Y@J{|M3 z^x!^U)koN>1QZmlrKGh86pf*9DOfQo0Sfm)L*{aXEqF_}W|WM@9k>AD*gQba0pB=E zg(pbEDeJ&_oUFzlRceYL zHVhs?aBtFWWHM+j4q}PiH=zvaG_@vE_FOkQ(Z~-IX#$B}w4jd=9t#dh5g}T4bkwQa zi?abw0yID&FnX(xv!?X|b1ewi1K+#NYs}CIfVuLJyu$%FHC2E^t9 zW2n=DBBv>+$GQ-AK$g_-X30Y#NmgDUG=+7l?IcgBT;ViXOjRgv280=%ear=k`&z-Z zIRMTe3$Su}ds2laP@|mk#qt0!qz$DBcaYwZ#)Dz1sRKDmT!;i9NqQp81Cud^Et>}u zrpL(R%fO#VV;5?AZze0sU``e$V?kzdg!WB5$OuR^&YvBplPXj)>^bidV~)uzU|1Kh zdmiQkn3@zAp)#I$Q;d>oUV)oZ02Cyh!y@ONL|T)&fUa=)Tzqosb+Su`B9aZ7gAi@P z4!{`X1MJK+ufH>Mzcmuxrs+%yb1jNUkgi{7E_-F{E5W6fuR%rlQ3F7z63o0vWY|*< z+aiBXfO$Nt3FkG6;RD^%ObN)ciJ0|s-HbjLyw6x3I7+lSdC=P08h+wX-sicJI)})v z`&?F3TPQN6c6@xq&l9RBC6DBC(%mEHDKGGGr`kQs{n);OCowVGwtr#Y|KrE`ALi7o z6fPr-+Ddc+h2E-GGu4?!ROGn_D!_{vHo_6dFq5p;9b6%Mf-*8PfrBVyA2c{+3#XJG zG>lv*@aidJj$uyKF%xt`LY8kDzP?Hsh0uk10~dlRtI(be@hS7%f;!=DIy$TV9faYM z%4@3)=@!2o`t>@r9nhIxOCi<)h!_JfcY(D}lrFb{x41v_sfRIwzg61z!#a*i`PAVn z0C;@kR2zW9Oyw$Q{Jl3%z7hLCP$h^b3~!@?y0(&Dc!}lQAc=<6z!AQ+fCbJc%mt2H z$C)8WkWP7u>50pvB8fz+5(L9ca+FHF8(DyQ>##aJMkc*ot`Nc%h|3)NAewcCU8d@5 zSs7@%)!6du9MfSLZ>N%6yXGm@;U@Cfa|pHv)p|Wx!M6zRl*B1(_6}QwyI9X30(TPR zXG3nu%Z#MV(_u|yl&wJe5=0P03PMw-Y&{-06cI!|==u%c5_%1TFJ|&*&{O(!zcnDA z`&8xZiPH6%PvIn3Q1#spaREF=j>!NR00UqEQUE*{fB`T729FIe$B-DzeQXk}Pi-b1 zDt`ScL*P5%f zhJu&w{MXgyDH{^2{nms4BK10)Bsyh?uv7FWfMDf(8r#lV>ugbo9eFd|a|#%H(s{T< zRGT2Z4ca7XBQqR8eAya|1c4&0gH(gd7RvwC&J>gjIu5LWdNoZg z3rs;c3xiFRphD+q570c~b*Z`S8&9$LmjQ0d3O!--6TsbI#&JEsi6%#?1ZXGD{Rk~E zLGNxHXA8PA1?jvB#&sUlt+9Ipc2G-f8Q~d&Cn^spBV^0Q%8fGtpohl_;D7A#1!{Gp$KgSJ|o@Ynd0)vD!5b5CNdVOQ-2zaIJk#Dv%bME6hgPqpE%Jj}ae=3d=j z8#q5Y_G5K&a?-RqIC%8`m7H7>GnQqv!;yu>r{RdsVFVc4Z#3gvcV591jUqx8~|Ka3?73i z4=5wVz~u{U;R^8>0_-#>5pAL_4U}2XWW;10fo9!+ zrhS;$K57$T=YkmqV&pfb?Nq0G)H{=J`H?%?XPx6tX=C-8+D;|O!4CjgR@Z&-19e8=QY34Y2Q$#3s4WE;9yi40Fv?=!>eJ*>br%`54 zkyG*^`uXgIx2h(&@S+oq(sj*>+rZP6=*m=7&5f`AoPb%H2|fHPUkP(F;+yJhbEKtD`{x39J~ zg)IYM-nGVF<${|%q&rQdXqlkjVe8bcfea`?dBV9tHm$f~bMi59)})5}XscT{ZoK-+ z$6tHx_1kxko0cS`2rZc)#~o8Td%$PD!(bMcw>^L3MR1>y$xCft7-oHs+-;?qu>u8aH0#lBn8vj z@$u1KHp0iSEK7Mx9N+$hfBg4;@caMjfBD0I@A{Drr4@WT)SZw1+<*VG-}giR=vO}U z@#BC*x?wB|D{25jO5>#yQN-QOCzugw?e^<0|I*+1Yv2EuzxRDV{qw(i$FnoN3ruy4 zAM&6wBPf6Yw70k1+h4MEt*u()U1gGkG*YZE{)rn?jGBdOI>-WZa^L}wMK~%k;oNqT zbHPsRayt``O4c&UZx)AJ8+UnT2g7`GOnBNDft8GG0sO##vLXwg&*#S8Px?SX4(7bF z?~dhS-1PV|@U*zR_h6^EkIAmMREQzT*}*5tFo()jK~{h?7eJObNYY(k90~+j7*KVP za}3E0LBT9V|JEAwGoj~ar6A>EC#(*l*c7jEke&p2;+$Agn=VIfQs;=O_&J1K@<9E4 zmN8GwaWDOrbYors<~ivwquk}4IJ2|&YF((@4D=WRZm<;{MPkPlB8z2y=BR+pi2Fch z!8Qds*mV%&^TY{IzE z#T_zXAl7OBLv;WuLDjxbgrdmv_>`tQkNTXN^VQ=sVO@`Fp8;f9MmwFWquI_)71n&; zkGi=!J#jsJ$j(#e5I|o-738ZM*VQ;brVO}{Scc;=<=7pr1Qgwo+eMXrSB5FmcIWQP z)}m7~AQKHd-^VpMpA8n|P)HV=!XV7ODn$aGMG@+_dU*%f*ESs+;{05->j zWpi?lD~m63?jg(O|!W=PZ8=XsL06vm4m)!yVKc z0|sW=fk*Z?B^Wo@1R^-OI+X+yzux6aCT}eOOD!6DlV~9E#DJzEiHgHxZMqu)gk*UH z7t8F4pOjILQf+nP`gMLlIXpbPbNB9@d&kYc;PA%q{UMb|62B!KA06I%{o3o-u3dZW z+UvI0UjO(j*RQ>PbA`OticlWIFigrXD0CFVr_F>J54UPZclj~rjXQ@&E6CtRXXij~ zBZ~;mwJ#{#b7|ahrqv-xz(aSuI^OqxV?vx#`bV^B`0*S6f}e7}@B6>^zxeC_@MnJh zuH=ns_jLOsKligg`@SFgv0whsEBwB*wZrppj;EqjIeP8oU-?^q^Kbp)|M<~k|1S>D zSILOU+MU;b{g?j9PyfWv{OtSx)^+CN&V{Qo(sd24`oYEhqm!et zv82n^qKe;qKV}?YYtF%UzzI!?&d860cDJq`%AqQzJmdgij1Vh;FDqu?3h|hyi2yj; z8UO>s1F+iad`24>0Er+C6<4|Cc;h6`>2~UOl2vdvEpryf{&`U~ssx2e7nqY^&Y<`q z0ANYxY49P14vN>)dLGXrW(y8Y4RV50PaVwT+(}td)f#)}j3VO_00#i4nc%=Ov>SK; zv$JFH1I&_d6|56GJ=@?Da1Dl}*;g3A={3j2t@~kO%aB3}=}qEZX*(2><{P07*naROB|zTF8H>nfk~K8uzZ~!+7&3LFO9cdy;7w zj}e3M-D0gtCS(GyS{B_ddjMDCcZyoFCE#P*XP3-yC8%(Yi+MsmILoOx7^86d0CbxK zJ$zs{*B71@^XMcOr%!n!%0-j`hMbP=w84JR^NdZ5RLFN>WZ2=pBu8LI!#m1{|vNe0KJRjT}Erbm@3-zmu}MSdw6UkWm+`&xp4^y;SqC_(TxsR?s_#1?QwK21GE1=O&Ud1nUpI9^g2x1craDS$!p@7A=4--|$d)CPOi1=kaz{3MWrIw@850Ct6FIEZ+^ZT? zg4XyYg#j5no@;rZFf*TL(N;J49p~Eh!=u&~dzYTNeC5)?LjK!)i^-?>&cjNVI_YRL&;r})V71o-6VyKZ3UUoE}W*%Dw-Apxbi! z)YWHSdgnWzx%|{J_;6a_dg|@bc|Bfn;~ds2;%s|RJYGCs&26>6$Eo!6ljz#v;oZZ# zH*Vdy_P+1?FMs3pe005}lcU3XckbLhIpIyXJ&*J1d#|1C@Xjy(lb`r&f9dZXgy*C1FUo6TqZgiBgYnq7L7E0w?;pSftd?@OaXnCpigsx!(7Nd zSp}VU*qh4~OzFyyEBELu@QxNtQeeKqbc~i!GKqFga!*PM{)pB9SSq0c>a8;th1Glo zYW~9T01SW?I4vMmwk=>ce0MpSqbkoyn&BWW1E&#XpN?Qy5^D!ffX52d_9d?E1^VKY zz=5M!&plBMDlhM>LgqGI6FQvl2<>R3cCa(*J_4s=CIv!a1$+Za?4_A$KQ%2k7et0U z+}s*>B4xcDoFL}^P{Snrrf#aWX0vLBZI%SXr7r>HrCJiufN8wZ@+c^Jhp2ND;VR!{ zL>S?lWqs}}A8v_eZbLBR3(gleFaTp920#hGg8>)-3o)P1npALjE8Gn{fZ044RlVQu zQ;^IKSHmkY$Hm~2cS%5x$H3~fHceu|te3Uc<&0~-Q| zkxMb+sGQJqql`f72A6t|YREE^H&i$Z;TL#1(U65257sDulXgYLC#Sj&H6f;BFCpI>P_*r5=z%}fVnOFfifo&Tgq!J z-}7KfH037_h`#`UdHm%DVS(YsVUjVNbMtw&jifhZ2*?=I&8(NrVYsnJ1Iz`C8$7_* z)JM*npeir~+ZHgGMW)Xbqv-K|q9PJ!78jAB9Rj+b!3*f4M=(u=ogmcI8$a~Xa&&v> zac}zpoD!DHT!L0|ztc9uzWzT)Z*xdqz&6lCcUYdO0TkaD*sTPq% zDc4pvu3vwh-*FCCC$aa`<*Uy>|J;TBW%zd((iqFZmwA*A#bR&&!sV-1u3mZmxhog; z7yOEF`}UpYf6ptW8n0{BqdTv_Nv6P6$S#~~oN0q?^s(5#aPi8OD;E#;NJGjjJp;NG z5hS4f%)>LXxuZAP?D_#+*5fD8@#5hs_PMfNFhv5~1gl@IR!{DK-iYez(?)yuyFdHG zzxJy?{6jx{%<0BbG;a#`iML|mD|oE7g2s^e$2lYaPy@~c;*+j9Illht$A9DFuiie6 zqwp_z3_(5_XOk8eFTC(+-|#2@#JBzFf9=xIE5G)OKleTV`49Z#fBI__&4QEs;d&}> z4_GcaBbH}=q}gU;ABxD%`Nusdg!L-Tl_N~}NEU!4RPd*e)+n@Y5$mWUYOeE&=rmjq zNs%T2fQm>jHxLHGbKgbKE4b~OuX2!>3_Jw#)7K(fEy$sVX(Pijpu@nTkC_YYMpeo zjLE8THqDXPJ@=3x3?dEE5sM?0fz%vjmTgR~Y8a9VdODem45~uWH3U4sCT1EB+$5>B zCda@55Wf}1xnMQZ0E7brFc@rrIo?TjL7w4`WLK010LBU~^3dq25Bl1K7B=0G*q6mNUhin&V7G`Z-;= zk8Mo|n(#Jd3(4~aO|(dbNdhSp;e%T-B8ctg72p(dg{J5qznpthw(3I4su~SOitfWG zB>5;;z67c+lbW?ocacj6+;*Wki<45mC_*cP)D zBHLoN!V;V&;fImMG}{YJEqQO&08_>!xcE6x|E>nNZFR|tUE>fl_Yh2k4-KY3dK@1- zBB^RMJ-1PXQgF}7jl0?%&m`R>nC@38Dxuz{kWqoy??NAB=@^B&@oc*@hYTKsC15}iC((QkTwqQUU)l0(PJy{Ulbj}73qk`ML@#4p zFf1S}Q-)-MotGd5QnnCbONfgU0EUq=*);q}6=>=yd`FWy-LpB>!v?s#JMJlA`ZMSE=$9N+J|3IHXVyl`ZUH=y^lqZ5&d%-dRA5 zCE>pIMUU59=)M&u!H(_CCv?YPFDxP!!oWd^GKC_7%iQQakbt^)0(iX0WZh0qINVg4 zm`F(-tGC?(srUv+)JF}h-tI3zzEe2>F52qW_19l}?e%*{tCPjvR{Lxolz4qakKlYK2T{}8D*2(cJAAjXTANcSGKJcLre(2@j zc;)(?yN9p7^3e}`=!37{y1i<_)@gO}kzarL10Q<%wb!oSdi~XxKlGv3Zrob6RkY)y zyLUeJ>mOzK2S4!P4}I{%AN!40?jD_lbbRNHkN)~cKKP+uzk77F3N2R0H?F<*fe(H7 z+Uu`}+VSDNS3dsn4}Rc7ANZFa`j;Pg`IT3$i?!y#SUpl}ToDFFWF-QK;hpfKL~o8K z3{xHXt3)QAkXuFETU`9AKlXKB`Z+KD)ZcvH&;G&(PV|&!U&h#h(4FHOANzm*KmO9c z{cnBOU-;jA*MIPT|Bv7Qf!FRH-Tk{i_?Q2}U;Oue=IP_Rl|jFVD`WoZ#Fpztv^ERsXslsFkaX&sJiD5=Pc4U%EMSrq zkSb4N%cc~)d^k;y8F2(ZGl@C@o(zn2eXIq6fQdt_h)01ALWC^c9%w?DPQetq4+kn$wPz`G8OI=lERn69S4EU2dQum8zBLMqg!?oU8pxi9fv|T(IUX~8y3#S2KAN& zZ0^pv20sAzL33b7Keu%XmSDrIhsZ7+!OVa)D06m%bF+Y$3*NkWK&;lxE!YIf;{ZVv z;d?-h$Oc0}b9B@(m)#_QAajsJBT z%Wji^Sz8|q)tcYntu?TXtoNgjg>feM0M369&6uJ{B3R!l?=2hxMmE7&lUo5jVHbgG z#QqOa8P1YCfJBn?m#q2}?rQ=`5eX5fnvsunROoy@i*;#Lsnv99-VJGi z@+ByY$6)YjI3iU?bpQr{1>nH|Y>pubi!1=1+aLkhEEN&LAj=}VQ2n8E9CjQLvBmU| zoMzu1GF-d5aupBkHM4UVm(hW*JDL*UG2aK3B9XG-k?2BVv*b-SZc5~m1qqabyyu3% zi6D^{;twf;^tdR-UO`j$?h2Dqwl#=I0v9wo3=j&yC(t}SyHhJ@=UYuH^|o)j_%q2# zycTek=j0sMR4G7T#$^JKvCmX7gq)P$M;uMT#l`1!MqFlrrc??TrKvRufh5LCDy+>` z_f-I|ZL`aBV@$Nk(FvMLozG@9tKYZtYZXe@Q-Vr^1d|?)YfmQAW0Pou9a0-o-67V=R%E>MOmXrnarT$ zF5p%&YP>-5b|GlUpxHQSdladfLT*H-1!kP|K`Dn*@x09Q31_Rm!qYyY@{uY1c02bDG4}$OsXTyNrYZP~MC%$lWHAX0B(~pV zUQdyd;57qV0#Y!gu@6PWVzGdKQg-|H8`rPDespxq?U zMRnb`h1w$GWYsV&;^1HztCOR9M|bbuyK&>z8@KNs9Uh+?oqYT^e&fdV>&N-S0L=C4 zH*Vgz$-u*V$2V`?IqWBL$p8Ql07*naR6aRT==k{f?(I7#D_y*JadmWb@7}#b|E0Fw z<@cJ8{l?8(w~vmFTWd#$_ikLj@yaXLj_w`u>(9~Q(cOE;C*FU5-E7Av_wF7YADyg@ z4`07_4dt;{7AGg|&b@o$H(xQ;=1J(G8{@-G3Sjw|uxJFFU8r+Qx5v6_I@OxuI1ZkD z;ibR$o!_#$^|9}J-w)in%Qh~XJQ3Gqq2pV>@zMX&|Nh_q(I5RspY+L}^5P56{ga=4 z|NrMd{V#s`S3mf>zVP$3I{N?r^&hzQ>MLyf_xzRbyLRLDSANx3e)1=O>eJ6WABq>A zedg0X{WA|PUTU#DF*}`9XmR1<(=UAeH-F>Tz30o~@YXN=;xGQ--}sv!`1KpDwTM&0 z^eAn)Tr3vcja0+LL1Fx()Oz?a5$mZ23a_HqiikpVYfCZ$LJ{e+2Rcv&Tb{6+CEPjE zS_ZW?s?1W7LZ-q%vx z)lMlW>UfiW$XV20G)39HoNkl7qB}uu{VV%A9fq%Nd$hLkyV)fe{^ap_!ix zX7pPEotkHf}8< zTv^#d;MN2u;du}cfYjSez(tH+L4sFr!6zss@~VXeov*G*k%Dl_#bGpSgs~}@B@L+^ zeJsl}>W^qLZ@5X$#z{V*p`mz*bSb)h^*7N zU@}YqzuP>_%8e`}#skUN1UMTZW|Tt)n3Hpifbc$cAHim-PHk(E{x4L{F7B@m6v4a; zbjs~eZ-XQT=bl*rSVV##<7-8Sz-JuhEA)cuwpPH{!YI%+Muk=mx!z9IkvU2+HhdE! zLoL7LGvy6$oDhTXs0b!+u9IRA89D&Gcf|ox6Na#e6TQhUcFn`toO4=~;e*|BA>$eu z8rUF;U6Tr#PkI2NHGYu5%3y@e*u9T|4I*bLuNh9p0+SBFToZd3ts7?*T$SdrP4;Ls zHK!6YmL36q%jV=9BlD;&3U<>rrenU$nw(>KVG6+yQ-+dYr1Z%UmMKF?gi`us2t)qn z9!cVPpd<^N3IoxCV}=Ps4X;inBoM6zs#976J+a0VyK9XdW_GMZbCS!@2N&DCyiN|B z!4`F@xL+(71hSec8MMorb6^pOI;3QE9G7$-z+_kNP1}A1OWA=wM60bx}4zNc=Q`fa`#VhJhadvQpiX5SP;z9B5@;MBh=w-Jr{Q zJnznfFZq8L=gQvR9*a4;clWi|uJO}H6A`1`vno&-uZ;rTvlM=RxpT-5EBqc4`v+I9 zTnzdDb<)YnYI$(!Q$G1!pYqAiAKv5lqPrI^JoQP$?|SD;FTJ?X>Yjgq+27kcIJ$fH z_=KNgbnE7=)k(W>K-*`2UQkV9h8s7o-#I+mzkK;qKjYIr^;0PLjtlz>e)PG`?>=I4 zYN?6<)VDNH6Tk5s9<5^e{0r~+q)+*jPyh5!dH&fe-1$wB|NhuKl+pc6&eM5_=kO@5 zBt{KL#zL#{q&r2ZoTz~D$!c}NZ&W6p*x@O)Y>U0m`uyMdjod*h=-~W-n|KmUN(;v9;6@TizzyA+>>7V@iKlU|W`uY3&dtdp-zwx{Ooj><` z-~BG%78^@uZ~49#=GvhS-}uRY@Du;=r`~_Gcj=Qp_0zuYYrf)B-gzY=vsOIX!Ej9M z<;gMEKll03DxEQkt1~hKb0M+f2T3?ESqugn=vL5Ftz38tX85k4X^01LBCP9Y=08(zSrVvOt_9aTz0%Z1%al;?tA# zDLADT;xi{COrsGX3a3giGRje!r4TZAdU6q(Mp={?M(bt)QDiE8MyRuI5wTc^M1-LaR?O2Dfm-J ziU_@xEw4aLxW3?!Sh8!9a3Tf3V5V!BP;E6>62*yIu_HPj0Ah+FEJH|WPnvFKKs5I5 zQbjN`pfi1nEX)M3lhHTd8l=4DoWY>6&x~?RDxyC3W;;I#f@h>xpqBOhuwZ(Kj5}Q& zg__Bkpc0cmEpP@FGt$EIvdF5C6t49(P~1_gQ{#kq7$G<#P9ISMv|Z4kII!eW&uLpl z=OHOzE{aTy)lQ+p2AdVk!@v`E&rpm}X|9!^3lcNT;>6Zw0KiCL01SZ1*ThnoZF6dy z8?kS~X&WKAf|LT-;2F!=CNRGfSgP%;d@4Be?qtAlWdmRd&9lc~7z}_7FvpN(MS=ks zV5i+DRr&`B76{7N+5rakH=JTQS+)r)fXBEj#Y~#&b2#@yTP)b!;uI_hn0or~4c$~^ zd04DTJ;goa8(K63O*lq*CqYtB8*)J(3eiFl;XZv2SY`kfB(Mko)+S7EO!p=l6P~W# zrZt^TZ8D8>;E*C*h@Dln+JCs*3hzwvx&MXyNF|y8;;EYXs$jHR;8J-Y>EFv{6>>S0 z^H}IyqgP=}fH5o$Xi}WQTHwMSt&x&C)@IuhknB@~(iSKZFn+)y&f{w(j78ir3uDn3 z6nOaDF*IeI41i<_jn6IE7{wG-0v4+xbCR<{P=;ViK@c&o^Erwo!C*xK<_0+rcVlYp zO0ef1UQ_N8m?MiBojN>tBBM4tPovibPuZr3ML!Wn?Gk8BTHVD{fxIK@sc_jC)n?ux@*)c316@Q=B%(YJ`JllO znQ8voOLoitRSwzmar)r?l5AWW4rd_U`RL0pf8^$^yL)^4FTD7|p8v;fyuihB@2M+Sp1OQ-Z@D@;Jmhzb zyZ4Sh^3jid_0?Cx|J8TfKRCE}VW0HTy?ZAojUutwW6=0#Gfw&B`1tVfsKw&h z7hc@k-&^j*#S42^uRNub)zQ(>iKm*cZQzLIa&K>st8(qyYqxG*KR!7=xOlNqaY!B= zRF$A93cJ=~$&MNLC^~38IypHpdUA(nh(+T(_n-R4KlM$&^IeyJ?C<@^&;L&^ua*~= zZMAGiw{Knh7r*$cH}5RI_kG{@fBQ@S;a~cX{-YoNNB{8Ii~fI7ak9MhwO{pRzxQ)q z`a3`J!~fs!`OiP|cmKYx`TFeE*)U)o!r(#B4=6Sc$RTi5^g z-}-OxZ~wF3`qf|hxfjVgPa-5DY<1(0MQ^Da4c%rhCiGbN0!+Ed?R5#A{ND z=xk(Dw&QHts!sxQud!~>W;&(XF;+ZBdjfUOaOFHjy0g$kF40YDbOgJCcLApq;R z0Xb>59RrZZygw;0Nes3Qq^==^R5ma@9xH$^+hVAj6IOC~&$6YI{0-*R{(JVwaisEA zsz4oct5h1=02L_Bp@<`$ml4V5?O?=MFve1N7yz(fd>ML&=o&R#0lrBPe)<~4MaaOW zpu+rZYk_EuW3qw0Ej2R7j{Fcz%#-iO6r3D(dV>Db>*>Ur@$ySn)uIY{Th^jZCNZ!< ziKVF*%{-lCFeRoQHhE>ULct&9fe+DYB~awKQppkdGQePH%19v|9+E5u;F^pSVPU|Q zc`S2G>Y=-fr*(D%Cw*no}WrDdc7xDz5^PL%iIKlLxer^70u= zV9Z>u9?~H(8GIwsyjh@5g4=|ZjS+sf6VDyWc_@jnb`Q{vS{-e4T}J6a&+#B9;JHfB z3uXX|aXWM2Q5v^?8iZvCnG9dy92bKhG(ize?+o8t)M7k%qoq2YGM%+PEed zfqm!0doG!g6ryzu!a{`Xc+4>Y27|>U2r2mE%Mn~9xz&Z6hXVsJL}6f=JNhtw3DNoH*URl?fTL2N?OEbwKgpnn$&W!+&{Q@>C%;_pLy6`}_PVpwKFRzK??o{5Rdy}dZT zbL-Z@2UlNw>Cb)Bm*2Vm;s5Ht{h3?$78hf&*N)rj=-%;i|MCmp{H=fHTfgnk z{+Vxk?|1z9fAcSX_n-SCU-l)J7yB14U;dq+{h4pvy!Ek zx({Ne#7rC>UH|Cc{RF-cwEzGR07*naRNFuDpS|w~K6+>I;%9&1w|?8Vzvs(;&(jBc zd(J+wgP(Gk)?2CULvMEL=aA^V{d9th-+8hPc*ijfPjM3THYZ%ODkOu=9 zUY2~p;YZ%Uhci=e+>fHlC&m0&Lc8&)GDraCoLCm8BSynu$_Bt7i2}sNg_VS5A;Oh^ zV3I)On-F5E77m3A(Q130jif*!VFF2baL@rU5T1~1$So8~Yfu0p$Jxm(Al=i2aB_7*coClR^Tj;pzO4uc>I)NGNA7ZchiA@ zd%AK>z7&mxO6((+c#r{Wao!usHVIq+3>P`PFd?8ZYzIjaL(Y=Q6P`9w6vv-V72{M* zQE~Z}Gm(58aTdy@ToR&}1pL|I|LGw>3JZdTMB3&*2TUD~e_=Xr3RK}%C z0p+>?KHnnr7&Tc}dZGztoNf%Nh>hzY)j`ad#HZa*4scqtn~81O6^b-cPAj(}jW&?t>PI- zICsA4J?6HlYl-(j_7OYl;$^Bvat9UI@Xc$W4#vcI%+wII36W^6r@-paeTF?Y?uR?M zMdoS&U;qZd04O2?pBQ9Jcus3)o%=b)&&RgeCW9X^+RKbQExx1&V)h2VHgoK#3AA)w zz$`WEOi*X{v8bgYl`&oVsBTBMnwh(`P zsgrtuZZ@p+wXAKNRXUkN>a6U2@Id%hNSJ9yJ~~sIW1?rPs|N~AflksvF$53JQA1E` zm@=78K}S=!C79?Z-`9FvcXP@$?_A!EYbtjWo*_j7;07i&j1(9@-Fms#P@9$lPvbgH zLAc{6MDZ!LUE#EVQNuhc6|OKXg4+*6Lk8d!m!ZiRc4keg3ifh?F_oplh$Ey3oICYa zv0yQ{i0oSn8ZmbW{_)IfdAtg5uhDfreV=?gc>6etXRQg+alMGAdjSgToJndVVGY<+ z#_1eEg3DW!M}>GId!5pFo0kD&qhg(3F`iexqsbOOKo_u8GeK#}E8K^ohR|W)wWXj! zQp1uVl1>S99=bX2C4MMs8Yb~f2RD!O} zsiMXuhG$qRL+(6f>=Mk$!sy>3^P-fC@)AW0j1m!vvm)AoyMg-$SI8BWxFVhs$Lt%iqoo43QGw{O=LXDkKDrwSKLc8!C zScJDa5gfN)4?82DaL6Ps99pIp`Dsuw8Ij_!r!%do6_?%=05kGo7!kr0CVVe-V8}yM zcSh!jvd0Y#*fvu+e54~{yQ<67r1Sc7Y(*Y}1YmG@41g7=@?Zc4zyKHkSwyf6;1In4 zm|B5~(4#p=j zg2x8TNe!PwA%e-6h)tQIGyD0tHC`ijay@oNYb54mVJ^CX4}q1fBA{1G_m*3qH`j5_ z$>-WR)Y*k9jI+=*G_@SX2-GP)Tb2L-L_LOCs})q1YiRLN;XKCVU;30 zy(zpL;k&?{53SEM*yEJ=O+9vg?qF=TtNlvm>)n_vc1lo0 zZ3FoNMV227VF~h@M_aXsB1-ZEd=tNz>^=MJ(=R;t^#0!R!U4b1?BBmG9~lvh;j^`i+~{-?(#la=cuIzoYOQm=;aBtgQc#j;fdk`JF={ zEz~$snB>iXH!Qh`#p3Yra3k?Vg4}9XTI}yV_pYz`nm_iLR}Vh+f&b}lYsYNu|ds_3*V1{qW!U(GT8O{K;?rQ{VnA z|ErrXfAGKgq5taj+biuI92{I&wv%7{h4=sDPrm=xUwNHhbEwZ*V9K*3WDEHT?{hx? z_q_XeeaXN1-tYLTKlHn=9_;ODme-SMhxZO6FJ1UGmNg^&6Lh(UKD#GX^VAAw#eHX< zo@WRKD9s1~*cM3$i2?XKTL)Yl$BOVeiUa{L07(Eo6!Na(LG{=%hOk>echeay)CC2k z9%^dv6FhHUt7~E{8p8`T*Dz0?coIY)z>@5rduT97yabs^xlN=o2aoVNM|=+Rn|Q0r z)+n+VWO=|@c81^#`m8Fy3Hb+{;m-89Py=k8I6MZ4#{gx8^HTeXui{BYWRO@u00v+n zK#Is9v48*!psCIA#69_*NwJy>zyyT>7>leABa@tGc95iIVqoK0@M(}xD=@pATYrJ@ zLhwGd6c{D&m^xZ^RX-svW%Owlgi6r-qDgkDo&j@Yzv0>}nq$);xqGaGuTLHycI%_o zxkawiyU;_4cNKU`x%q16cq}5xg?BuW`2h$DZ+h+|GHF3efGZK8+Z0cI(w+z~afBE| zx0ZJ>o)~Wfm2C)36;YmB+LVt@_?9ya1uVCEh{ba6K~gtN=A9b~@I#x+Ja{BCA$;iK zIe=whhRqYz(g{s+K7}0kR8uhnz=lFG1djN^;I7C#`xKzWP_q31B{{DE**d9gRl$%^ z?tBcmu59|PKKkqrGi{wtADE|M48XEZ2@-Zkrpz(O-NrGv0oG~uc?!5g{8uPxhfELG zxI-8~9a{sweatITKgBsNE_z10T9}N;&Tw`>LSt~{0jI4}(e{XsF=8e~0dG+SaoBR7Ld*vdn-MM}H+H0@9_UdcbuiuL0;@Rh} z?)x_#3hOc3Z2uc)!IIYn+kl`Jp~Zs9mq&+3kNY_kQnx_QU`6-(vfhi^Wg= z#83akfA@30`wxEk=Y7GK{NXSC(l7hs&;BR>`0xJskN?!k;;GO0{4aX<=X~Zb{M6t7 z{_lI=uYK?%EA~=8#n7z9!SkQ`Ie+@!_}1_Ij`x1$mww?>2mW73DnUf`Gx4KBw(IEV zcyGCka7`bSnr#8mqggLigCpi)l`rNrW<-$yYztS|sw2%^nEnixy1Duc-2-W_Hc!G} zsI&YO5tKm`zz@vVU&7NS@r;wyS*?a}i(p`6s_L%aeXJyg#6+8sDh&A+ zS>!ymkitpW&B@akMUen(3uicci*7zDnPt!uvnN>S%(ZRp&J&#S{-szDRvO+Wb%VfQ zka&PEP%+Cnp3l>$D|2zmM~K*xP&Guk+s2g6J~aBeJS5>T-!P|+9OBbXI+ z3kUGQK|TBs7!c1bRVEUoBbs{P!x}@ehaFXV24WqzejbEu7JhAwy_q5~5MP#f zKq7AeagNB|9LF3Jmd(jIc9B%f$$<-O`@Foq?h`=31>j*fsrA`uY6vFSdz5o>j=SPv zI%Z$X&sS@%T4T^;^wiw)gcv;gR-n9@yb$o%oE#}gj4X`7bVC?J)$jysm$`H^ZY$2r zR4ju}n47Px4;JK(k0Ff0DrD>$ zgVK7cMrDvLbCa9qrT6C`b+AeTB0M6UB8+9{BY~1@Ghag=*3aK68~9-h{pQho!^dhX zz+;fyU`31l{R{7S=^f8K|IGg0BDAU(5zsI2mk;O07*naRJ`-07v7P>pMUWs^jEK5+}m5W*uQ-F$~)fi z0;6BdvM;{)!aLvj;*~3x_YMx8d+xb+c(NCtf8oU!UwVNbg!a_4+6IiL4!@BPlN|E7Qasi&WN>Zz;$>u>#rfBQSW<+DEhv)Xe1Gk(_>|M~BH@4x%! z|ID}i>)-TgpZ=MP1;rJ1>!WEumRCOQGd}zG{+=(myuY`vZGoOdyLWiV)-D%&5q*B2 zdxuYAf~-;X%0mnQp4;FHlrKSHJO)!9fE6x(Doi?0EfM*?jq|WD9z%gIn`3W_)?*Qf z_Y60jI++5y{E{_DZca?qLg1DHl$eYmNIRn2Y2>i+Qw|zJ{394kV9pxePhzSvBWp?h zBu1Wr3V+c1%vt(m{NS8pd1zBxfwP1z1%cIcP(5R0ND2`?iE>j!>1nb_Ium$7NtgVz zM>}bNmb%NM#0l4KC%I0)^=Q3kn{yAoK>3ms#$zy%T{>;~d599*Vz$D$V59&TDXc&f zb7FnFlk}|tz>qZwfB__9agjM@MiwhU(Z)V1dUJiv!vZkwO+3bw#?7b3xxrxkN@&uE zJTx9bR0RPOg%JT+8Rq#y8aJLv$;j+9QncV$TMaMY*&(0=7$X4|)q+Ez(P9dCA_@b@ z2FGJq#H;`n*$pWo$vky!wVmW#Q-Ul|`#DcOF0SHLWsZy4@(&c;N56Ayl6>p)h4$Fs z_NiVWo21%0hd$&MMdoPY;7~dPke{xCH8{&7C_~UeYZ1VdQmo%<4S`3HY0Wu1Bl5Hwdr{TM@5rzs^R%NV-vNS)(run zNq6Rr-TQ#!2NDWe);ty#j4x|~^oz)&n!Gvo8m&oucXS2k#BG@jB-mDA3PS#~zGa{c(Tdrzk%hX9CsbkSHPUjtJO(Sa$^)7BmiF+UuH7d#?V;w z|46uUPufSev#au%TMtuPn{fVMt|w@ zQw(|f>8npaeT9+x{1C&ZY6PjvSFc=s`pTt?2T}j?ETR327oNU)_0m4&rHH+QgQu=s zz6$j;?((He7xws#fx1nLJ%0Cj3ij&Lm!GshkO zrpIs8X#9XhHTk(41-VEAPk@i$U`v*ZMJx{QJ?{UF6;ooay*T*HFZiNA`kt@&4e=-r&)&qc zS_?j#a%|E#*vUt}k9hhlg|smYQ!;^XqNNj&3%lANLhA5*i5pg=%%ZgMe z*5f8P@}$Co0L+ZDH7h%7{d9%{Hi4R~9v`BmlT#cKfwzf9V9y~_(Skk%jfqCL;P5^u zSoVs<`Ya~A%Gr2M=-3yNjn!%6LTK%5D;T97$D7%wYkf9 z(?wn6*klo7Rkofa^2yN8&D;>o6B91M6wP`rK2eU1*qWY%%_qq1y;UN^dNX)|h%n3h z(eek#+N)M)*PQZ@2I9yYA80y{d|g6d#O1R>!gLu<7m)??>=d5^0*nouz(bOxJO)>` ziHmzg?~@usgC{CRv>VLxg;^ms)I}0P76xEo3_uEi2Lmtw2EYKM0QkZM3d0wG#O9a~ zLx3-v<6?&2nVOSxyg6#Y_3z9yeebiYEYN^1uVL*nmyPRgA`fE&0M;2=w zw(zaoqB8i#K&+ksK|~iAG9bGM?%*b;aYX4MF=dMgRhrINv=Ar&pD<(1W#?D{LaSJE zM~8*f%1ngo-Y9+P)4dq4AD8Udzk3~OD$E;n_osj(i+ zsU~~bYqK?VvILqMbM?f;EKp2%^qr&1pw0lSq%sDRel-D7#p5wOkr;v-zEufsLH6CB{O@hRWsKsL8y9zvvlm&Daq&V?R5ZnjFu?~wzEZ4}5C zOJ=&83xpsiYDm?aF{5~maTe12)SBETfogUNuTng4$Kv=PIkit$1|4HndAtIEm zDZ&sk~12H#$M7}+Su3>8z##y|e}L?D7j*G8$x`+Fvn!Xwi$Tmhk}#YXdAD;enu@QSeUpwAaGjePi? zE52g)nFNzU>&8s$pb(2#M8smTST2``hex~r$B#?0~fKpxW~_4 z2YUy}H!T$h`xh=A@Z;8ngNs1;h~+f4&S9~K;NnI92UbGA+$X$n$zsjVPqPMJHshWo zJU%);Iy~CnKUgl7xnyR0l=^Ib4P!hu;Q{qvfw~xF%y5;$2S-|g?!$dVdU+TKlfdpH z(i53+M~v}N5karuWuk`H)L^j?~L;`1^<>4$}3SjuL5l!&^Azr|EKG$jxVcKJy zD|bFT(EUtFIEF*#K)7`&f;l-b{99msk839OYYS+)2oflwDv!Zwi`7_v+h z6DDWi;2t=XT-QhW%&+xgat^w`3)c}dm0j0)ZolYpKSW^%P+1VG{Q zOw0|;h^*X4nU?eL0!Rv)LM0FlEDqB|QbZnj`6!1ca7u2*^o^db+dKfLc?6&o0Bpho z7I9zS@{*mFz!wR?1_o65ISIx{m4UH2Cd6QdFHp?Dgk{`nTqmAyRtNCq$pri^GIN`b znp-yVTRdT=n8!UKX2jfF_Yo9jGM6xgQ@`*peYG`EfKb0gL7Z4hSY0%(u@ws6F?dyL zH6!;Hv3;|kaL?reoPzZdEofPxi4GMeCL?6QO(}ru`$y-qT??4Pb(GE7oPo$PIvcRL zcfl-G!DD#JmEFGv%iIuf;-S!Fl+fwGH+;r119O~7yE!?>&T)h` z$be$PL5BD)e1Ldqaatc0^<~9 zM$`lp33#BD-m>Up3yaW5C9sE?8A+2$!Hh4GYr+Z(+iwXn^!h_I3*2QX2@YGhgh+L3 z9ZMoBT6WG(*gbbtqqn(2vlt;}N=BEIL?mB1SO>p%ekx=tP6ZV}MEE)EbjZ^C&qb*$;sv#!9kalw}GS^)?ekWPoo{ zLN28UCHqkp27x3r076Ol5)5zP8x#pIrU>SRG9wz0w-FKFGAaanKC~oS{olG6p=2U7 z4{v-`$7&n^1LJL=-{i)Qjxzvb-a z^ENz5EI88q4Z~x#f@(rQ&CCcuNY`e9N)1njS3+YfRC$RWQ??;6pE>n(1rO%npJjJT1qPiGPp*WcTl9XF8KOqw23*x?EL-LWWvl|wypL1ah9I>H{^X>jl58xyuxmPku%Vv`%$yQX zmXB<_GpXo~GBq}$3wmPeM)4BlqNW`E?9@mhX2}vyt9P|li$~bnDkd?2b+l~!>jBbM zsX)l~Gz-+=4`Ux>uu9@7v2v9~^oO&L`YD5CBO;K~$H9z+`K|?bZ|)AWUoaIFpkA1p|Yk z!DJF1*L~6vp|l7CoCQ2-u%T=LR3ubH2Qut9XzEyx-5#zG`;aqo;@RKNd6_*Q!Gals zCDQ=dz!NY(;q2|^b2iHcS1JJ{R|I}CtHJPVZ?2wuv@Fy(IMbFG>10t? zl}@q%uZ>2g$th`gIE_{TV+RAMm28plXIbf;&6OK)Ffj&TkqInI0icW|p!=;9A&L8p zMUZ8^M>E;F;3nC48&hx^RYS*Ehdxj+EWPB-8Kll=DPU4;Tal@4Qu4-n8NA*J*3$`S zo*raRP1m4vBuxu~%)u$6+z^luWRvf=2K221u}aKv`qCp<@hM2IA+CLp@3E|fD;Xt> z=}<}=q}8G|iOSj#czJ6vIa%XUIjU0K%dLt$K)?Wrm8Xn3W8RzzNCcW%ObwzSVB3B> z=F+kM(>}1fnB=|eH^wALKK~ULech|+Bd@Ab#;}qZKovOza$QDC9n{$2CG(oK(epz74S`{f3+Jsv#|lS@f+0R1}#=6lw~IWZ7u@fk`WzLpm4)W$ww^R z7W^=A@SX2A$t2XV#Mt^wk=;-KVZ*PCGSS}U|c5|fJP;7*c12)U{s-YM)hX5)j zzQ`>fa=QDVSG5S^ps55sl$6}$>0xX;1W;=WAnLUz;H^W9Nkr}=KREDmONI>Jx78d- zY%2F&IP3cv5DG`4<12AvED5<)?<@zez;K*-*oDTpu#41mC6Q*G>zdtSbnoMmROxshURL@7knsFwmj(v(Y@f9`~`j3YD1oIwCn z2Bth1Fg(CTYcy#O@>nz&Sv;1Y^NHbX1G|WaZ;)QeL^|=-9x*N(0L$4UCPX+O0E3Yt zCM0RV1QG5c%4ZgsmYk|ZK*^4NGKYdB?q0xQn<J1XhAbN`DMH80^Ippq`3$)q7UlLl(Ds1L8Qt(0bCMacdC>~+|*Jlv{ z7ouG6gT8Dk9%RD}nhviBd}ITMB14=481{AqHigpY6oC(#BoHpDmlPr4=z=E6v4HfU z5RKDN7=>6eQ9zn-4-|AnD8Jk2tcKvM6g*X_0*DB%sEq*g^G1?8!q?Zlqf;1SC!Zvj zl}aA#4r$s>ELOp3BfXdkkrX(~Ghw9w7Bd@h z1-!-hB}gnzG`5blcMxl`7<^KVS3OEr8WAS5Xk@O!kOSt42(2b8H&TubnY$hanc*z` zOwm!FilR|r@<6AU6eCSMrRdoWXN{cWuY+yE6JRz}#Xh#@EU*Wb>2s%U3lp}pOR#NZ zF?I%=1yq2~L&CxUg$6bVa~#HWSZoSl(#|hHndU+OM%z2e$_Y%e^D@JgK)?xxHX5PH z@MQpRxn z;4oDP9iqY8O8~DqH$+p)eN-d_l0wPDfpLq(IogjbWNWclh(@M0;lcEgFa^RxM&5!Qpa97! zk0K|xW+$RSGIov~$^uEo&0ex^=}ji6QEQ*GQyH6HPdN$&r;UqLB@1F zH37@GRxM?)$!FhPjl~l;juZf3FbI6wLRz*Hh~U5?Isl*F7=!K9d(xeWbCa{%#>ISW zj^$oGYxYgyh>-LBRCI%qqfJ7znhg&wLxUNgf8K~b#KZX3(!_7Vp{2&8TnzQbUky8= z8#AY15&q`ASSb^JgRE zWoJtsFT?x(&h5LgioGR2;&Se z+PuPiZ1LsctKf!r5mzbAW(sa2MU0>u<;3Q2M_UtqILPy{(2NnO+9co}Hqllq1Rf$r zdv*&1@DNgblXe{#r9j!5BCk=$G4`qf~z=JTSrf!+CdG(nAu$a5Lh0GO+CI8`#=k?>_? z0IVf*=?FHgNZ+%QxK|)V$nOD-edK1&7{^qN1gIMog8O75Lwr1^AkyPn>w+3FDVY?j zR3NVG%)_;&$l~Bx#&AmY;@bk=P?ZP1ih#KOTD2ZA#)ro+yMS4n_5QUn%K@aKLet+UD&GNWwZ?9H5oA6rnH(5GOQ zxlw!`&hdRxB^v^O6xmcQ1?x@sHOT~^j0k|o0yUk@*P6cex-N`;zsJbfLV3Z%m}#?1 zXK8}GQ;lGdHQ_Md7w$yN6gh815ZQ%j5!pczaBqenA~DFH7LbGyMYe!ez`X6Oc}2Cd z@;-fY+spNZK%64u)F2+%073G`0L1;aBFHC?9+KTDC3vR*0m?K=m8I4cLkq(Lpa6qp z%L~JAS&8uowo-(UqyXgs-7>~exfpPrIKbv(d%H@x?NM@S%#;Z)d*EcMin-ht1WZ&J zlZ?$^U<;B#R-~h8ELn_{jj^eK$yH33!vl;>GLSH3?k51AS14@qEjh-v&u807`ZPFA zjFodfc*fKT^CSac;2|*p3;<6#Ja}%~g3M7NdvC%R#aQD?Fnt1)Ch1^WUD-?!X5U9O z2gdMRfM#VIn3r0T+X57+sVTfvMbM#_f(}ftu4>@~ohlfXZ?(l2Q%DRU=YUYhmxr`0wk%K2#>Jit# zUoCFGap&mp*gLgYE*HxPpYtQHEW*QCjk|D5>_RAr*n`_jS8m}2;i84MXG}8z*ytd=#+w{$Uh7y3*Ue^&LHRz<0~bU9Ap|I(>_GA zQkj*ePHq-Nwke`dl73P)Zr3nLRj@NtN(00|ieL$H3p*bJIC$iP)0)QiyKaONSobrr z$$2<%EsJmfq+l2ffB`T7DF7Y}zyKIbVL%xq3>bg`2n$G|plLKx;PL=$jtNiO0|jHq zOu68;Qe=k91Hg#zSOL5*adurw7lE4?vMzjRO20 zMAEkxcUxKy>FPOYMm{pzBM&g=qf>^Tu)`l9IeBRNqtdBbV(Tdu-^n~B%^JgJ(F9?! zDH{En17Vq%dItl0&!?dJ?&;DHcvT)Gh>p2rtWY8gDQWI?sxhj#k`*3)C+TdnyU*dW z57N}|^%No2+{tjCPHP{sAS6t}PrYd1Zge6kT0(l;7;6B*My0nKx&b81njkPu&E$lg zlN|y~Z(;NHZcmrb^ES!4Fc!(eIbmb@KRN*`*$}O9qzwSg9C!>}ChaCc1Qpsm<1FGD zMKH&NWm{w`cIM{-<0*xbkO;pq1ytG)5S74;A6dR%%B%I82^`^-lLVtptB7H|>=O5! z8NZ54Q6cdP@eaR99FZ$Zxms4R6BL9`}5lZcxlarj6YW-=mcJKqhmY^6smLzUAGM`o`vRHxij(ns5 zKs9`(a8z*Q!%;s7!xzpW`p9p;4yJ>9CItvhfkBvqX(D-4zau9B4~SLN#3r%^@j$_m z#k?wlO6>AzdgYvLm*mVu%+!Uc2EZy)0Ftn9fjQ>kTM-8**(VB#H}5)Niy$x(oKJvk zs>YTY1TN$tq%u__FbH~ER5m*2#U&Omy3~XPJ}SjVJ0R^Y+{+E*E{}nuYm%M0f9A zu#s(Yfi?+XsW24DQx*C?b{~OLP4;JvZ#gxJ0wptU4D(u83}?hD2>=L&I8p+GHmKu| zU!r_eNJ+tKqA6P-0Q3liKKeGs(F-hO-3A;+}M(YxJKR` ziwT(rAc+WkStts;?L6!9z1zH@;AwrcwQIfh6nOLD5~~_G3#^q=RVcAG1x2m}WLd+k zLJ5=&I(yza)xVuQE5HA85MZfUpRZ)hUBbDM<=nO1$Z*2;WKgEZ4I?!S<=_iYwMf2a z0UTCh@{FAzd7HyiE1AnI$OA+j<(~im5CBO;K~xe;_(a`QBh(0aXytO4~dbk@U$mYR;fAWvB8R|BDG1~ zS4Y|)Xuvd}sk|!_B>UTL?7-NR0Z0`dS789(3#8Z2)GRP$Tx$EJGWOB+z)6q{0p@WI z$zn#*L~GuPocoa-Bo!vi-*lI&)neuU0hb|s!hq>^uXTGK3%9v>OdgvvZ+GnF@^Epb zPfqwd+G3%lBGNXO4hdno6rvRbbVCpeewo-??(gmGwUd_r?a5Ky30?CE?sDDdU&DRn z_f77egH1lXcXapmUG`+Tx4*YsE*6WZ-HhEs&SK}AKgZ~+Qjw9xCrr{7c6_Nc9Vtk{ zC=!)VxZ&Wj8MP4+gt!T2dBq4o*a#=E=0MoQ({Dy{txak(5^XR8K$g|FjKWXSpPp%Y zxzc-wPfx~eFe9zmE@DocaPJ%X{+fr%#!NlOGrB{vSPvwA zis3O*wY=vF;w|I;btnI&01(Z$EIA17OP@nCG}8}M9ce40Y~;%_!iA_wmDbl05~geg zBHRapB)PG%gkFPl70moja+W^_9Gj7|pJPBuSR|IvZs0ip*ZK;80T=)SFcN?V126yv zgAGtT3R zo0yJqb$mLfNQe?R8{3;OoRIE$YP#~L0;&IN^8c7a`<$tUA<`U5aA41mO^&0xmob2~@P z$vNIxa$CUpu)rFy)@zDeR;xPJW(Qor5qzXO|B zX-msRSTniZL(av?)QkmI8jv|05CdQUY!0R({#>k~WFgm>IL+k5R$rwiyj*B+wR(vE zHs`({h}6ck)oQLSau$-uOz=U38J#*pY-*gMi(oib_&y#Db|1kLOf`A2ZM9nU-*IB8 zr1U6_S|NVTSuFOK{Ft+Ma@^jydHe32du`PorCuKsdh{jfRNGN)2X$)LPJ)3u`JE)2 zaQDt#e%@*)+FS0iMax)3Of}lhL2n`%F-?8nNgi`uWB35fwi82QWU=OV2L0MtD_IOM z*nt7zkBE>sEBhvU4n1^Z5ca@ftrXd%b36b+6Kl~{sYb#yT|Y+)%$ngyIQKEs6g*JT(dNT25x<`?Fx--9% z?8E3Dkj`(ytUr)G347pl(j@@B z&N&Md0?WGa2OccSFbSl4GmV*;xMuK_g&xXto{chW6OTB>8i)c7NJY$nI8PfSFi8t0 zoM%tqjgYjiFyWm7Nb04SKIaXE+>$hyAC;Oj_s1^Eaeq-}>s%6^?WXC^SJHKS7O0yH za(9`?*hwigaA>=k2}RK{feO<{dYnOQ3IbY#YMRrTdG&Yo;8_Q%K4&_tj+y~aI?IdS;k0mS_;Ivh${OK%ArOFd-*#j4L zmVi2y!h~`tC$m(C@QIKC@s2>4*WQam z^43odi1q(AhhH3IiSFOHXYMa})GX`89(DBFZk(?WkJjqAX%!1CReQVh6uGIS%CFyE zbEO3>Li|3lTrBsN``Gbud*jxfH{Q78q~6wzQ^B7266?hAZ@h6ETb;D!-rhdHFAJmGm zPi6o|8AN{|d&kq~R2@MVB!ZsKe(Dl)!tNtV5c6blUJWR6Gf4xWJT8blm=%VM*JMLt z3SJBhXZhf@fcP!7nlp0F(-^u)uaK1zW2x@^86+wM!w64XWl!^ixxawyPy%vM^k>?Z zey*FR=6J4ov+;ahFt#ycn|&v1)24H4HUFH`0Ck0wodxjxkdwPYw(dBKl?{b^x}fk7 zn9F;U85n{kbK1p3QGo%ix{0Kp1d$7ZDBB8)d=wuK8uUQHSp^t~jcj2&##v$j41lHp z7=Qt!2#|W4LHVmh(t|`lFaRT89)Qg;;SM`PF<-;!QOtXqoG}a5+QYgBW&=E7Q}9;~ zU-(p+;$~BDFHK|$2yBQNcNAUFHFQAx=HABy7{!1oKL`gP{N$(}6n#n9&A5aqM&2LkgHWpJjT#Kqy@W z`TG+5gng}@;@-d{HnvjQ)ku|qqVlmzv|g;U=-u7_pl%AzE}7|>;}j|~$l*+sebSr@ zL7D~Ak|0Ri&jnCh0u*T;i!ue}lFm)bAr)4NZ8S)Vf%Gu_k~<)Be(DkrH_h@;JCIdJ ziL=2}lvSM;b#l^JFvs)dGGCcRdH!S5;RntvgohT1A7lbMW^fFIFzMz*)s5 zvL5ddH2S|z1Z-%}n1~Uhd zBk+-V7)ccd0J0F_8*d2+G0Czy$h!bCB3af#k2Sb1_9nw%$`t@Ssu5XatOBAX zP0vMA)kN=j_c7$V(>dY&QWVEfPzZp5C-d!D44!)pkF{J^$bXupL8C_?MaT^wfh!yl z@}G=C%8;(FE=-6P9Martv$0owj8c|TT$u!!E0REUq$jVb74}6@ibTa}5cqLyUWUD6 zL*@*Xx5CrRTu`_?%CfDn$W0&9Y55isK}h8dw6j&&@+FvKn5__I%jSZ@3u@OT&^O@pZQp38qlMI@b?KP(;}KYWfp`04v6zwFqvX=Ali~UsjsK+$WdK zd=`Le4P+xDH)2A27{*8v>H+~Azk`)ldu z(Nj%~ZL-&9gM`2%0Gu{bkX*n5V2nwr#T@`Hn`evJ?L!`$xejt<$8r{o38mb^jz}Ev zn1S5ZDXH@@0hlyNQ5HfI(jr4;D`xJKP8ar-Qet94e7A}0;W;{npLbAh3ndwX-?pkU zX`JN>x#MW^7(91JdbnW>L}`I6GuCJ%Cz1z`u}RF+O(lp0yI5GgRf>S(F6*%=hDzHl z$W*!zfBL)u<2n)^^H@z}lbQ1Bt!YLwJ?9RCCxHP(%hwdR1iT?Alry&eF68yaEEtay z;>MWAFeZ46(Qo6S-XJfJ?Q@sM8j~%PuZc8yHoh=ffO_L%)L3Y5I2|V82<=-w+vWU?r*%V)t>Y(zICbm^ z6?;p|uxxCavgzbxb#hF%P|F{2*l|B#)28`J8+Za-+}!hCWuiAOf$K=&wzs#pzjv^| zf3S$e<=!H=lll91sUBj^F(9uGJ7BLB~(|5@8h6gQtqXk0Ukp>rMyRk7`%m` zG@oZMx`lmGB2;gXsG~vJoiua_`H$mk)|a)CCKw)IF^F-s0{5$4Wklx@~%c$ zh7{nGyIu!4%qcM+4+6IwG$VQiBOiwZibr_5(Q5L1U1U@)M7;E3NGChSzR==MKQW;9g;5VR8}nJu{;|v#)lj0 z8-&4J;8+`iz8blKhqy2yfE)l124Daz#C$$aQo-R(696MhfkOac*@S(2)yNW8c8*~x zEKi8d@m5%=@}$zj(>*|GEGG5CBO;K~zi9e@$9(?Z|q4dE^a*3$C>Z7Tdsd zHqMkBHxHu_NWopJsimI4WMdSHCT41~AApEaO~`;sJ`~;jeSjdO@|^+o`dvb1tW~Nyt7=*yJ3S`ZtHo;tNsxL_hc8TA2hYoB8sCfG=E z?wm~WX9=ocsu;?n(!H6LaS1>$_SsR*J(Z!bHak9bwZOw%!M%@AND-W>D}V{Opg}X@NKWY&K^K8@97-flQLit*e+h#O-6LAdape>K z7IM>BaRtU%tufg$b`+4FEw+FQD21T7n(8D`n{XqShO!AIqe_M+VTMkbN-v3&WpdjP zWChp~0On?8>qKFE#RYmhY7DHIW^Hh>h1iIg(_4HyL%XlgXM*Ty$kz$2YY*a%f%wXCmfNT z;dzhsfaZORFcD!-2|5gbg#up|(J>viMG{6NO--$bMI9C~iI3UXdFvj4q1daN}l%=zQntLw{fH|5~cvyjlzjcQ< zE@vA+;)<&pBsOpXol}q}&Tvd_>#~|EkQz3TT{d`tr1asxHMB^qYGCfqrXmBuDh2Q< zfFZ|HA{jhbU@QgTBJmLTU4q$@G6tefYf_H#ydJCV2Duh&C&yT(a0QL}08ULwO2MhQ z5J=TvV11_rQlKl)RaOeYk5S6dYK_(uH12Lk1ku6X?1;4v6H z2EYIq00Uria27^}k;MQQ00Uri(7eQRQ zxcBSMf_1bD#V)cqQW#g^^b~n1d-2rNi1HDO2ow@tvTrzoEz+!LWE!0{%tl8Lfw&n5 zE?{hfB-p^jX&dBJAv3BP=MzMv8qd9zP)#C~>`fNy^@^2=C051vO1))&3?20U(Y~BcoJk}S~K?(2#@OTVRWx<#+9YfL*$|O3NCMImf zsw%mQfL?_5FtxqaNgN-Y@Y}@6@rqvuR;&7HCn6So=)c+>&(w;IIbn;Aj}MR8tF{WZ zZs85&uaUXY!gH{(c<|Wu4AW63`*i(kpv+JV?@id_hqDEn z>pFd>90WQ?DhI-<@_A72rl5<6PC@%30K+jTq=VpRn^RRcw=of zFMeQW@?iEs4gq5+f>Cmi8Tw|0VN{N;^>@+&t^DbtRTJNeD1&jHtN~BndT}dOFSne1 z`VvIXgHL3(q8-_kd@orDq zMpBH~5^UyKA?vTP_>F~;tFa7e`GM3{)GH&2F(ad33iG!@z7IO25D8c+*n1%o_gU)# zviw3!N^GfkEij__T-^)j*H@!~<#{tnOm!fF#0iB@I>-0GBxB)o2|$VY#mF>3T8>Gk zqhz~l^57n9b|Lwy*~`Nl-UjbZWEsn105)YKJ4`~L5uOGmP`1h@>_Y|~0L=`$I3eUt zlPuUsg{dHsCMj|7JuX3o1s*aL+&cy|Nd@lH#!>OW=px6&O!2kn6wv2W!g4TQYW5PE2KZDM@|^G>1(0hp z4_r^d3sNmm=2k@@_@PS>vR7{bsewq=P{~H_qEIgn+QhbX9xEa(DPvRZ1{@ zbyEqTe{bJ^0)u-u)!Z4-<+&X@3m_LmP`P#eoRTSO3{KupB@zo@KoTi>>)R_S^B|EF zjnt#pO34iYW~9kW0jp4F+bgZ)@As05uGvbT{40s#ug9M?K8>&ScmH=f<6r(|{LBCS z%I_@x<)8oF{{Q~pzhlM$#z_G%^9i@!48I9fS8JX4Lg;0#avAm~*4ooaBB zC+;l%75Oh;zy6EH-=(h{-ltDFt`a}bV5O3ZZeJB3O-9lpBvsu4b$i7*!zV@_sd5vm z{_^QFzsum48rUzte0h8OJifmDpa1Wl|L6bw-~au;{m=jUpa1)R{!jmf-+=tb|L~vw zy{WgDP0j_m*ar_}i;SC}|u9|TNcp-b>jnYERGe@X>F+doC{Pa*%Q z@qhVG|Mfrrr~mrj{>%UPpa1=T{jdM=zyJCF{IkBkeR})+<@1*>zkK=i%dcGcFTecq z_V!ksqEyTDn;WOQYi!*0o8Kg1sY;6BRQ2oyWqXk_O>w>+1Ye_PUDP}O?kPl(cTE!U&n~XOxbrirL zipg;8i80p1oAf}2$#@pRz_8P&gi|esU6zbjCyRLs18f9=pi9sUo+U8AUtpXC_Ovh$ z#^lIi395{$?ESDXE}LA2=@?d)*;NFpYA-P^3#TgL?Y|)q+HGk41wE>uoDmI(0b;e@ z6rxEpV6vV&c?$H@mOzy$XMUx;y78HlkeghqgLQ8dgsdq@jyV`Gex)4L8`mipb>vYJ z0-h>-0kJB{gBXp|MH|(W3B`^0;F5|zqFto4Fgc76qRLPuT9pTPV(?{xkn$GemA3#F zDN$#6>jWygUbS5AtAwh`d>p{<8ZTCd04NrVw}W{wvmDzJ?QHmL%ZOX!f!+cD*7&}b zr@)iN0Q-FohMR&8@x5}uW2#Bdv1su7JD6?o6yH1B{00a-ulowf26`>Phnq*s&ppE$ zKH)JY6(`O-RmyVsoOp@IWOqnFl}UO85T255OeL^WQGoq~@FCB=@FkI9u(6H<_-)W( zQwT@QRsmE6V8PHH|C-KaabPyK`r#I=bf25&*f?>FGXeM122>+#48S~(%N;UF0Ht81 z)rH>^sG^iC&}LK4d~RSp6M!}TSMNFVbq#&YGur$H@;#B_A(x%Az&>bFnyo`TDV6X; zs+eTpkS7A%e%?mkQD%vdj^}RT8{YvHP+}yFlLh!;fO6PTf;i&VqcJhO69e&t@YU@9 zLWf`Le5xC4;rVh@0{4>|Fb+L|~0T9z@93a>52KT0hD^-tLmdV6Q; z!fWouylLUvtfSfzyqx=qY<_+7R-dIe>628pq1hJjn>bH7nZ?gD59iz50DlQU%gze9 zl_b#Cr?=0aKYjkp?=&!ez47apUw-}N^RK_W{raiCyph(Y@ppcl|5Vz>ZT(auUU-ZY z{_~qKu5 z{~V9NnB`iazrRKE`P17kUq1c%>o0%%^7+?axwK!taH;$r=hG*qyj7LHyY->9-1nuC z&vT-e0!XYCdH))6(fi30T^pxY-9)lvq}YVSt1-$5#Z5W*+!o0otJe@UEZ7pylW4or{;wK zs*?cE?c#prTw-vkNe`Hm?Ms96{t)|moPc4w106~ZoWKS>kWh;Ox$8Mj;lj6I`H1E` zxJ+P5bk3Qhy8?ra6xImPA_JzSP~#RXj;Lt>2FAA?rJK0>Q@S#~+JzabipvGq%5L_? z_y?QmHS8?J!*ZR1$4mlOg3#vrVU z5JiSOF(4?)jUvxiLe9OaJlkvL^qp$o z0xP3{WW;ZV@HA3{?KKAoTkj<3A!F{F-PevNHNoBhm;nQDjbu-sOGe2hAenv%qP4pO zD`j!xpg0b8i9LG%eDq?84mZ`4aq$UVfo;NA;-18Csi0ocaM=B1=a5D>W(mI6`dMoKc$wc@;~!qf z3HKgzuKvL6kh?HJhO%!h-VwtPU^wIB;fNbUfK3e<5a*7xxP3TF2*LOv;YDK@Vj?yq zB1vG>6KghyL-rDafnTOHQYOhs6YJh!<&=&F$1Fh)Am7wg^`?ml-^#zjXdl67JX4)j zG*ZYk&f@`kvrSDR&X0clgB@;0K22AF&> z-rgvy*=mm30HTgy!wr5^fWEEE78}_A>p8#t^5x5~v@gGY0sZo~U%&kAi}A1a4SxCc z%P%H>HTV_J??>=oI{fnMuNe5t-%Nf%4D+`$`z7Sxe*J%%#Ip+GWq?Ib@im_VQ1>yoWQA1j793GH1y+ zovmWTH-Q5x*!X6^9tFgr>{Tws@+IK8I$D>X#0q+BKT|y%l%c!gvOsGzm!161?D#>z z{yTN|{96ha$ZY3Hv2lDa0VctZJ}}rMVF}vU)%@^(7|?b>z9mK$U>YQ5z-$oae;cQW zLXM_`O_FDT#6n&I5abpBP66ScVqSADH19@7o8LgH+CkCOt+`yvTk)A377`0og9s*u z*@gzJnVAF3wv~d=ZUh)%X}X~*8={5G-Qg~@8L~|_ z0|sCK41fWU0WeOPM~YK{#JEe`3mHM9GDK!1V_7jlWBh|{J^X=Z!8^%^o)?7tU5z)q zd=cJhMyeM<$a7D*9FlNt^0S;RaVW{cBbY`&4LmWPKDFf=neL@DD{!B~rw+Y|sn7(hQOV4f?izUpxHLn5i% z8a##w9$$3gCuCeN<)kRM zWss!W;3tR@jO-%iYD$A-W55SNGkA=L1i$T6HrW-jBa$AyEO7873^vvk_~!zyMkay10>-=<()X3QiI=M_={!>Fv{}PyCwW7y9SV{;fwkzyH91U;N7*|2HjPXpHvI zwxm$Sz9fS7=niCR8FNFzo@@#=N;50uFM23=4h< z46WgOp#A7N>MW=r{geR*uODwK22pgIc}7UGJqv#rf*mmlycqxngKhAD2~X<^FdH;x zI@TDEwcsQ--T+x+00u7QE3$|{_`y{($jsm)tK@?+(|wGg(zG=wZQw~=o}k96Pe8^q zJP2L{VdF%*DiDyhP2?eci{*WEAWsH>&VI+y}U!@wg0E`_n!)99GIQ=1ndte?y z1TQVJ((B8HpOb2ib9e|Rdkm-Gz*R?pd|q0q2<{ff&&r+d$nzrT(B72C-T76{#yS^x zP*MkzENP%I0GQrw4>h7=0v2d@V#jpKn&oLFC_eC6$!l>cyfM^#6d?QUM(J-B>9t$N zCI~NFg6Z&u_ui`oRfS-z$qtA!G?_ft3@aZuO6=zaJyW-`dTK18sp$_9eP5$G_C4C( zzz0eMoB;NL<}t;#$J};LqzD>gw#7{uL@#X98*I@tvr{K1bVDox*&e{U+~tuI#KSz= zYj&!rgU#SC8`c)sD%aE7=&J>r`I_q^SR=|r@462JoofGbey7^M6ucx`KUBp-5Cs4W zgzZs7#&|uoCfhr?j>T9?6sLz)+RK2-*)fU+x~dWUfQ^*t2`6smU%ls8`U3gT4=(My zww|%$B9R=?4StYnT?^Vb^WaI<1C{V4>C8&3(VTm(fNI7^f0W%)FOpE0A5?KD?xRYW zq>|EcgYLjo1UlMS7!X6{H+s<@j3~*r2b^}2H+%+jLS=h1SVLdLjB1XzA!j(5yMW6u z-(&}k&8CmAO$N>_G)B@Og83sP$QY2HYO-`K@c)GkIqLPzV51(`n+sbKoJxuD^5M$5$H<@g}&iz?k zB}^(kH@LQ!S@dM_^SLv6-KQ+c6NmU-*V}LZy>q6{liVGST+1-*?$4MNGGfhtlW0|cdR48=;5v6Nh-=KGuAkeNk>w)t6c`d_8=e?NfR^^N(Qr%c=K- zufBq7rD}Md^<+j%Qvi%P;onO#2Xl1m;o@%e6+Gn*f(Memzz+ z$v<|uw({NU?EL|-o(I6X8UPXuzyKH^WO4G~5~D914CI6YOv(p=vq54;92E#l@a*2t zJZpaw^Zr8oDu?9oQ^b`4vrd1y%?r~WwHrtA5^vIgYJAp$P!AX3(M{z6*H)$*8r6ii z!KC{pZ^34N3!q}#Zz&eQFX~T3*;BUg zy^HqcwEDsq;>qr${Xt(Z?Tx%>qchdm-rY|u75kw2Nq6W;w-q73X}RcG@SEZX!4I5O zw*4@Dhi`ls>|g`$jGvLd^7E06E8~Kj%s(c4d(#&0a<9Nk!AYKY7dXii-vw;l1Om2= zIp7ZEa|n`fli+QgDpk=pdxCOMstkC{kX}9~oFNB}fz(RuKvr+55stglmgysQU4 zM{#Kg5nupVfW#g1=uW`Bwn2&(vbEc9K)x{m10%;{02u7VlgtoDUR%IpwMi0SQUDB$ z#|(z2fS+yaNliQlUP3tg!Pq2UuHe&}hcU1acw3CmET?oQ^xPEmy5bd0?}2 zHX9O%9gyh9?dAL?dk2jv+#%q>w%~#PUBVwNKK1YI^}eSmzLOn&P$0ATSCbY#d%rud zyTS&Lu{Q~huM>M+t)Nr~x^haldV(j-Y66aMA)un$7ayBcgV*E1ZM>>mLfrNfuFyuR{K z^V`iNF#V;~(k$cwC-3KQjGak+#o?Gh@#ab7E~!5|D$%OU9xRV45M2dvi-DeeuFIlU?)%bp;=q1DpbY-t6NQ24iPvV%zjPL zdEMDrlg3ixc|*i3LsFcd=d0UPC7{46$ZbW`mYf}-hjj2Z6GJ7hVf?a>u=wvcv95FA}=9Q)knp+UmnF~BsR8;f5Y2un8O6oe?0 z0n=sg7R-1LnaNgqw2yS>0VWx2zOf#^)tQ2!Y7h8++dJRjVeaNPcoeXzb0fDK@4%Q5 zYjp!W*Mv9ep`t57cR3R63P2dtN*Q*C?{hEp*z{X5x(io!^h3}T_dtTJ02P0Xh6F0P z8GFp5QqW5f@=tWVk-D!4i8a@t1oXYmi1&_*X`yFIGV+njvrorMPApA8;+=ED>x zNft}Uhy@-F3Ok5z!Fo^dV`bi}vU$p3D?A_+r+9mt$@(LRt%1nfM*b6+!5Q#0`8#;X zU*ThZoAZ%$2!tk2AHXm}9J3fl2G-1YDV?G-r4wMJ!C4Yy<5eUh-U1KlCl2v@J2rcj zC}rq&djVIgcv;Awz&Cx~#(4 zqXFBOtiltw2Vk&x3=#uin*{$=#=B5^?S0kF5Mmo|&}922@jT!U45Uvt!`<;xZsNjB z$C9|nqk_q`N(;?IV2~65<6!+T!ARHDX*T9UZV$^84A9o8#_xG5yqC%s@k&x_!4F2S zzLaaUeDYifY005HAvut z?+_kqygl{bBb!Ir*5L=9R2%vR?Pti72*R3`dTG&24%w?J1Ej#3t;y+|iwtM7rqo!C zt4g#uMm3mZf;jUVpnDdWq{~W4Qy{mVD07B0WvDp&4J17aB)t&mMQd3nHr@cfivzID zZ(#BW4oK$P#^X3f)irI*r;d@?@nhs#7@8S!jF+{Z3#LMQ4d6jmmE~xKz%w$Kt18p< zQqiP}Ne0rR?<`)lS|hk^5*>Wxw{U|G)LXLw;+k6nUZ@<+u*y*-DtWM{2TQ7Q;0``a zQt=1>B#@H8R~0@{fYAbsDw+jK%MFo8#Q5vjAP?4cH~QX0lkY^bnD{88$MTJ6j&AJ7 zq3@)QM$$zN=7hs(eIR&0#d4UaKn>Q#lm@^8Wl)bbm^QfHB>Cad8ixFg1?EyLU_L14 z;n4ynkimyt0s;#>-KkW7GY*H&qxq?G5z;-t8+!&aFGJsCr(6O-rWWEDu-9?<q;z4j(iKV`qLvxHny1f|&$fyXG7N4h}9O1n_P z?{T%R%3|K1;UlO@B}3Eh8#ie0L~b_#25W#%0Y+Q%M(GbB+yirljoUvfH-iA%Apm=3 zHVMGE-rFY))UtCf7$eiZFRd};X(6kk2tJd>A^BAfw~&?1FyzdQize=swC0DIvSzLF;ifYXfXgbloSJZ zRPQ#PfahE$`QAUL9++mw(xMVH`J{1Ko{gr(geo0&jF^8*(Kp?#^n z0z@mi2t_NAW%R4XP;@gMOXWx{2$Y)At^G_u9gLan0c{UqNN-^CIl9oN8?p$`9gRPe z%;jF@2UE*}ul&%Bq>csJjl8i*3MpdICeIt>RIlqFj<)~}pC*KSDB%6ju!pZ-!KHGR zPL;VLgM{m9N<(!BxWowMp|P7@hNwz6HLB z7Xp72L}<72Yh8{!Plj{pkAfyQ>y3p19OR^44^^z<6hotU;==PHfA6>hOu^IV}-1CYM7}jPsjlro`?xCROg9pj2a``25#%{c1I@ldgxhS zcipupYEt;NorlCGc`S1YK)ygrfF9B}X1a~eT2XdtddO*3G@0|jSq(eQkx9z8%un2$ z3wKXN3_Itta~?De?q|8RWZ|pHO)>6fMI@gQeQ#Poe(}%#pVPZP9>g^4{LXHdGR)se$sj9>udp7ry^#;Vg=ZvJ;4(DMh%?E6l}a|zs=$mGXk)@Z+~(8L z>u`tlh^^3mZpWhdSfL!y~}#eB{;KS3p})-XMr(r7c@rZ zG8ruIz+2*=Z-SZeQ2m^9%f~=wiq3Q_l^~fLPvX%~CFQx`$F$4pwVcJhR6kgddHknI6ji zC6!=HX;l*l^1}KH8hifkRR^bum<K~j9H7~Cd{DWtl{hj$88dvyzvw~rCNX=QtP{TV@ZUVj`rp!?uY}oKG8>x zoy;`*XVnB>7a+1ADL~skCBh#SJkI?}f$LNq46!=vU&Z}4xBg^TltjRG{+?7s{3YcW4yvb5I zQ68$$Hz{2hRQ%9b=5Q+7!lEVg=&BKnwH)lfTTXz3&u9nEYr#vzNtvNT;@gaeILeWj zuzY767<0PJAA&TM@XbGgfzHQGR6u~tvl8Hj%tKlVE`hf|)IcE>AYKvzK3!oX;gb&- zA|=@m$=|2on53e@&|5zGwhU5|!?I`H$|lMk3I7P5Q+Mpd=NMKcF+lAJ&vl2qDl zX+vzjHj-{wv)#y3JoC3%i+efxLnaCCmoWo(oR9UBl(L3%JhSB=vxCQI>_D?2c;hFi zel9f%yz2@fKf~KwUEFvJ%7HteqQ?_&Z(h9zHL0|XTM+JdaJwwEsEo%pFs>OfU@%yz z@NHES7iaOd@FLMvEmEG=L6yg?>vrK*xHPte94s{%U3VZY54!=NY4ojL?nPWf&m zTinpE124@AMH7uX1s@VY6;$;Nf|Elt0&!cFl)^GGqqvbzvJ7&2QpnuH{P?DvIPMj2|V+U z?^QmGxz2_gh{N1L(UcZ2`CzjEeye3fpGgoE?A;;TG)bmN6RT707kLSq$7?oH9ISr= zoP=O7qKd5gIS2C?^u1_2P@=-~tA|k`ogY##zX&!-lnPC%TZt6wR#N54otWM=AO~e< zahRFQFveqr&~Za5(W;6k77v~VKg*gRl|2|UiOoA-Sy3X3MF7pCOy2t;0V#9j5laNs zv8sxWl(Bio1Q>}Y4~I>SN@-OFZ!dXPZd|s*C_@GrVy722269HNrLOb7pWV$ z`3jRbb2BRbh(=AU1@=n-CX129I^@n=nB21Bt_4p4!wMIiH*bg3 zL9#>e$JYARoS4gCb@(RjOZaU{_;Z4u>uWCxsQkL9NeJ#TzJKH^ko1ON2#iT8xlLRS z8^Z$n+Do3*7=9aqjSYs~Lw}yt0`n!Wr_~4-yv8O=UMu(gN(nLvUR0$aqHYDVnFf4H zm`s2(-U4D##RZrvf#*XY9+%+|K+3aPOdKP+$m|SRGSd;hCtxn37XsMWgCKR-q~BKZ z83@@PeweZ2(~FD^OY4s`nG(&o z!f^kklIW1RU7{IFc#NB2LBc606}Llf8*~Z}+f(ou6<{z@U_2ND<1L^RL;M@RDuM;e zOQ->xTmqK++Bm5#_1H-)g)Rgsk=T>-={%QZN_`fLlNv{-Oj<)serK!3~oh zBg8$}l_J5^r?3zpt)NWciR+0(YRq!l}ZwWUBd*X67mxl z7r8ht)B7WFH7bE>Vqhb| zPEvn*^NIDMTq+iPk$$M4AO?qz^*{_e%@l+O1UAodEgmXsfZLo3$BczNXJLnESSdpE8_!!A6Jivo`82=sxTb1V=epn#<7*#5Y3~r6F#;|^j zW(kvY*0_`pABX97UKKs*2k$M?M++>qz=za~XAp^{vISzoqN8J$gsw@s?FtTFcF$c2 zN@6Qwq$0**U>jM?NG6%fvM`v^01pQJ!0b@sB-O3Sm$*rMi9Z;_X)xHyfT@fz3H;i~ zm0qVx#gBzgmsVBk#^`I;oUXKxL8>Yt;I5^Iu_u>Hr@cm#sCZko1lPx`8;rBYl-6Pc9#v` z#krNJd+zj^3C04wWu_LhB(9*bjz&tQoq8>h1romW)E=l_nu1Tl*F@_(cVe#bB%R8E z0NM}$(6DEFhW7-dI01YFOvHLFV9xcxaoT_w0$&=lnEMri;mSJh6g3IjBMAv%8*&As zZ*y$XywM(4~)UT_jLl?t_6MDuW(GdnfCsT8BZpu7$k=bL~5M73dT%ES&OtF z_me3t03d4t9&$3E*bEuO4HYerQ4N^Y1~nNFR+qq0;TEF{NMgD)y&{uj63oseen})+ z(QQs?3MQ6BmY}Nq6Qd-M+~73|Kdn@fdr}m~ClE6^0VyLjPz_xtFp?0h#N(213^30=zDUFXRX9~0 zo=9>mvsH#w_AXRqq(7-uU8_}1%z*U{sy0;dCv3^6icwXEC+d{0R&@$Q5W}hJ<_Rvl zrzls*rHVXLBs3w|qU=Rk#z3^uvA;qQAY!g^8 z=g!0)R;nL~O3L3;qkRB3|&xm_gDA_ZuZszB2VxJ|QFK`BlGZX*KQd$53U8{kTHK&);>p?pMD6-=Dq zuo6*89ys`_VBf+aAg0-hH)V|Y$yfj^)ha%iR8WrwmlVJ55%@8kS+51CS8--l5is7Y z3ep>ctpZC$vr{*A4k&7={HGEXP$sLJ$~1*Aqe^UF`MN9wMFPv4xgD$wI>_nD6qh}#9Z=}1tY_z z^1UI-H$Tw6tf)d&PNd2MokDoh?Y*-9S!ghcl)qL|f~{bXKA?FT&NGobv&b$BH}GxA z2ZGQ9QldwEXvQBgmtQ;ncpg{tvB0I4;>3%)jjV}gFqCqH$(DUDbdkCQCZmxqQo8U> zpw;Rw*mP}VLCt2eNR>*l9yA*fJKuh?$8e^=N9KZ5xPk+1zJa&FGjRyM6ZS-lOB-(h z-`KvSQUiNOq8Tq<4J4DNhbL@XSei2F0@B1?K@m%uq0-7ePAdM0b`ubPpZ(~psqaHy zOF&{P%E%jL3LOTse1RptnJmz)k=i74hxq=v1Vf5o{$Ec7hfz0(ghOR0+^*INJSmgp z6oFq`R6)iu_NboUcjp2wsG5oq+H?lMZD_a56udniv z+LGXP2pYFX1K7p}nmIjB!x=u};fDc@i+~vhJ)}pTlB^xlf4^Zj!6bWRQKsWNY#xk( zAIwjn)zEyA#sYC!iM28>E~MQp6+-h=(94YjWndHdHY%`HFaY1yg65mSPcrN&Ce_x0 ziF;VicMF=Ur&>|p|iO-MS=KfOh99bp)E2XBnJ3hERW)>1h%o` zNqB(qkiOU50Gh`a-?sS)av56yiM7%P!$P^JCh^MLf?9J&euB z06B-==P)$^|=m z-w%Y&vQ^Del7YX(8fdnXdC?G;iw|*u1uSXX03{Tyim24yLqSRx5B5TUwk0sx7#`p$JkH`o{h&c&1sjXNQ^p|> zIA6>|vjK)lDlpX~!|(`$IU2&dlos0c*kg>og31-vB|0n1-me43z+wLrXI5y&lRgROADOTL z-mr3l#@8IDx^!pS!#0>dcM<;vo8QRZ&8$*s4w^hY>_Z6C29Gs<>B(XbsR!mEMEtfU5iJ^uqASx@vVj+e`5GP8I}7~!UGMDTP1;o>MV#|&|v z=g#3d2HJWdkh$E%0NmVCr*^>(Ngw7Kn;*W2Bl(BGK9lb%Jy7ip8W8&kfLx(Xw;fxb zlWl=$ApEix5J5L?4})FgaM=NsY8mY;2+PvO=5F2ODd6Z6B4P^G0sywLv-GUhq`j&b z!nY&rS%hG`EO1vNLoexZeqmRd(tsJi?L1lj)RUIizvafc`tp2kxeE>!2-$aW$_TKP z2O_~U2@m!oI($b4RAi77_pnIvox*Pnz!09~#-tvM)PoqoGYJE41GNzVwwL!TsSdKC zia#Xc8A~*rjZW~6k;KHj45D-cpAmEdNJ)XBHJD@vuzD0It!07V7PJhXS6Gw=BRVF@|U1_p=_xUa*Hvp+79;E^1D z*GD2ep8@zSh9=|(E&RfK=QwhQ!fMJZ7L^xe zViD2$8lWx=iuIfpsO55N-YDItX)tL9%!GSj#XEE-XmikIrvTcq2j?<6#TJ51Mqm=A zXez+%$3|lAmQNJK6#JWCa@-Wq@>WTiSTsYOjXe-<-v9<{e0oS*Q$|;R;;L8P{07&Y zpv@cfoZkDy@--UsWHW&)u@J;X`7n%lZZpggL7RFGxp_08380sUz+B#pyD?N?zcNH7 z&4@*fq2zWG^kRj?`P-7O;6)@gMa&DPl&Wavc$?IPd+8424{qUgj}X+!CRn(d_k60N;Bjf`qPXT2JJ zyI@u2B8S&=MIMv^&o+2eq>M@7MN{c& zk9h6}4abgId1@S!oD@S5O)|qD;N~_SDvu*R@unZhS_uHwSpYN`fB`T-lXx%;2Ebsj z4H}beu=x$dd0zo4TkDOucRk$wHwAZ7k#tf301yC4L_t*f$I`!9(`R zt}sG87S12A!O$@tMaD%{7lE1PL{-?uus^di%y8y=nb5zNqdfL=)tHF&T)q<~kbnNt z(VXh58Z+gS9M{Ddu0m_PALeF{vcQYJP~R((wu=T~=H3xp+p&NhBIo7+*q(9be(Vr` zEcnSRJHWnUGW*=B6LU#t*x25E&Nv|QNqSg`H7+h6u{`4#6u$S!p%FgVjjUC_9#jtD zFc2OC{L%L6uJxrnth~2#UQNizt1kR7(@!&0@{A8=Iu#!HIjh;fR>11qZg#?9ahVvH z{Q*cdw!eC4J9l0#{+)&jzEo?PH2UuDkC7$b7=SJM-}<;t@4C)r@L00}+$BeiK>!ZF z4;{?yfW(3sPeTQbZxZ|fNNtkTi3zbwkX#(}dh4_L1IZLClG?Z#{K;%=Kp&LlYZH|L zPg!3(fF*b~Y&@vLrNKgFb7*WHp=KilwQq3ZX0`{M*2>fG>`6A>sRm8Xgk)-!Gf|3d=wzmw&1PZM?Q6&$fM2wVO)lnk754<3B&pbKu2=iGo>ei;M` zYBj)PgmtXe3?3tee_`(?UTA-msvn(j==Z)hAbA$t{00cNg^cUhVkZ{pQYacUUB~HF zsQDfS<0?PyF)Mi9j$R>3?j7WKz`22wMBG^bMPTvo80%pEkM<$}XS6%9<5#^763i3~ z4vfbdoaBiuu!1cP6%AteKSY)Kf;8J06Zn!g_Eh+u2e6rQH(vb~JD``(aS0eH3WI^g z>MBIKw+H4STv}*sMQeOPt<*o<$XUGH)8-qTm(&ciHUOWt`3=r2xcRf@14b~oD`5u{ zBp?rZKO4ck7$)VX1b4&4%)(GM#$zyDp)vjsHI}3P+{5s@4jycHtlbU*<>{OIngXUF z&l5VF=MBMN@klV49!ew3x4ACqMFFJkbxtc!(X=o;g4T#hWg%{R-eUFsZasW&E?fT)F!nW*#-Zx#_!qK z(wvueVY1k_u4*92QzdQ?xUHGshZ-{+d>k)RfbK22ap%4noq90#%_-j&WG5fX`p}l< zVM6a>_#&6$aa=RTV?vy&Xb8yhDuD0CN&Bk^!6Uz7?h6y21S{>4A|7_Zgp4ygl#4oBY=bay;Jr22!7yKldaZ zyjFX~%^WEn2KP!DRV*n;VwFzo)R-D2vj9x58iHq<8`vbz_U#{X z`E2Y&e2FKZfOHJ-VDBx8Z0k2TN$_v6z3v87dx@LuJv?L2;=W5QP+DWe4Z{6^%dEKf zCsF+U!@POG)O|1pN zobSc}suicVtNgXs z@@;x0dFFo8icjV0U`~9{f#li}skhq?CL3zg(Q34WN04vr*v|F?wgsC9@Hl!NOA$QS zaD2<~0uGnvnRZUWa%-9WAz)q1Y42(@_yfI{|FHZiU_02ee3JmIrvOlb0T=)SU;t78 zJQ#q1u??Ds!5}ffpJ1%}v#aM#a$0^h>=HVD7 zN^Z5FS1mK?7G6=PXBR=-bMB94Sh%>5*mtkSB(8tS?>~E)9m%$LoL6s!jN#%|utt+7 zcAOqEj&ObFtymoNg%Myw*(J!UBQTNxn^zjeM!>T}+~j)#J=8+|%s{riTcy)Ce`?v` z%x!jkL^W}F5H{7m@P-!$y3d^=_(=V34%4FM?#JQ&c%ez1_m%nA#GQ2{eSpsM8JOJzFUpArcHavi6P zll@Ug0j3PsPB@GRmD=Bc>(6;lP|pcu^V{`6|@^K5JuQa zz@rV%p{@muH9xbYq+WTg=2^PQwAu%$mbBm*H-nELw@!Ug5Ez-ZCc!2D0oY*6qx%K~ zCnjwBCi!!ME`IoNVBfG6_to8!4mv%mSiT=65SXc>1V&&3LB%{RV31#B2W-(}04y2> zaM!8k93cj34|vbMDR^(4vfbPs!r0_EJ<5nK6rz~#RS;7%dH~t_1RG;?Kic7**~ZIT(i;!i7vPK+DKIw)`BN@O$RN(RGt^v zDLi&6H*Wq6&*@+U7ywP%118H|X)@UN27sZ52Vi{@0TvH$H5kdn!_YY6AL7m>z-$2P zl^Q@2g86&}1CHGi@iBtOP;r?643coLb?y+Ci6>?vHYntw{HCD2{oY>J7q-$Y2oS|Y zYr=kY$h$cKGX}0P9wTgPoL6I3ZT@%gUQ@GZW8K?Hp7^es(KiKC#~E_9R`QclrVg^P~q)1PLkf8XI1M*CReH$cL{vOo#<0AE&o0s{HB3|;8 z@k4X5rDaq(vm0|(gR4MRzRqAL(L-Pa!PQur0P@5Y{(=0KV2sR?o6AxJh-dRs>1tpL z7C|_I+XvoU3#fl%SHP?mG(m_p=AHwt@C=yaGlKdqn;RZ7U@k|kV9nM%8BE0=^JRD7 z60(9Um8MAsbTjTiQ$W#rXumd0k)3&y_2ehX4kc3(9)5ZWpxts)h!9`~y62nKNA2Yu zxybLRFsq+RE@Mb|Oly})YZ<-;aMmy^BL#$H6L{lwWMFIyj1$BWO`EgA#<7K&>fu?? zeEV}_;3l`HAmpxKymRbxh|~y!H)cqPy$BAO0FQUI6^B+Bng<|B^As#Ro)9j=`h{39>D4#7m~Z9>^w?9PKipL%Fz9=pl2v zP?=Gh$pE{E0WAjDP$VOFzL<^UU z+8cTaGvfYKl-y5mH$i@O5;^x$goeJ^#TAwcuhrN9CP(03_o*iy9v89g^Z(1Hh297imhwAYWJn z&2PAY`6JkHf;m|A(63A`%Ik;XM0!gGTwzF6F;<46kh|300|;vrrK3aOzhP9piCo#G ziw1$WfyyHth-Yo7_#+x;1zRAjLiV;BvwHvrK=2nB8|+mZRD#Ap0G2B{+_71*7)mT4 zZV3pmhZG?OzpcYHsTZ<;5b&a)+}7C+JJr4!JObs!sk{!|Wwjat?1&5x#^Qu=jx2c9 zEqGY{lzot5ZzvxGlpDhz%vsZW_s8l$7`X{B4;Fbo1W1(CgVz z0e9HGr-L!JhygGFDF7Y}zyMNJsWcm)jToS00GM)@02mmL0iNxFzl9~1dzfObCbz~J z_K2O#uFBW9Q#HcS$|^verCeY(>vwvFj-)HBN}b)XgtlBVOPM7{*q7zkqwR zW)(mGP0X*xNTj$+(SzZDcdJ|-du3{ScCyVRg29z+?h$y_At1y~(L*>>!{h6eGmm{A zj=`F1yoAQ<()e(4nCm5f;RgXB>6U?Gb8h3LSZ!7yY=dIrxQ=DOyTjV1o+3o;18~z2 z2c0Ky;v{d5n%Ir{AfOiO_A1~**{}As^&@52YYg(-coQ5*2Ch)*$30T>&=YYjqgxQ2-UAIAhP<-V8m4U=|$gL9!&FsL?FUz&WbDm}R&I>H-B!ilUg;mD0%tt8(og14@n=kqVG3Zjamc}>svkE( zq*%ZtBbzup`GOP+tXn;THQSIw(T2emL$twQ;O(go#$J*qe+o7RJR3DlGP&k92&=mX zRe7kghZbY0s=y^qgwYm4_;Ms8>F(u58UrDH^u%q$!zpkqF%gpta<-yP8A#2GHp!?b zhK+^OBpqZirzSABUV49{O>rY5QFqHCl2Bnppc8a-@swM-B zNrKU8RgT`=K3jZ4y9={)3_)E z(8(j@%50$U$apsKA<;QO*d!A8#*i)zCHBogL{aN4U_^>{2EqeVP+&+WjsV7n-h=xg zU=L>8w*Y{d`b&DPRX2dx7=XcG6Xaqi7RO~%TF8o@Bp4$Z->G@AFx&2e+uYVX3z}b^ zBc^z{<@PksENtRYfDX9=us_(DCocyc5x|SPOJA00al$ioC9V6rkEC(lS#h>5@U-|<2-$Kxu}_&567mOrdD4(Z$+JHfbiQrOGsC62{&1Hi2Ul>Ch< zS)eqNunT9jgZH2)p9K|OZdR57-IxKZM?qDYwo9t)!;N?q*EQm0uhoVea(j?XuUkVv zJW~nc;HGtm0GpIVHEiEsWp(_wtvt77R8TdPal|{qG#&;CEXgt_)Qu2;H&-gjm_crggcEuAuFe$fl2YXgo)G&hFX{x?!|YXM z1er0Iz$3RpCI^0uulU6zONtwr=~Y}jGAKnBx5<`~f8)TWfLC1+)Fh7zl2S<#*h}`V zquE{yr0}Jp@fqY%!h>PpMe~rz1=qU9P3u4_HrY1886b$H^GU?RqBlrEbfSnWx*CG3aYCkPoWV=JpTUEpRZCz%7B zBoDHxazL9-adq36EcQSWo&v(y+!&b4dL`gxBspyfJZmjsJkxA=p`~_3;8!APKdh`(Eve`*6{zsVUy|pC%4M$%=974 zEYfa8=suhpvbSTDn^PJ^1$#3Oy_oM5t6Qd?m`hd_M(6zTl1kkevBr>dF7l>IHJb{i z@S}?pVGz@hIj&m1WL#n}@F2xkygWd}L@T;f#owM~3}WOULc(B@Ov|lQQqd)b9z`n^ z9xIV809G}DPEwGV{|=1-*J> zFS-RR74{PBRDf3_7X#0^UWS=mlxlxQQHNvhSyY8$6)BR8@3IrK1sGO)OAVcTuM`$=-G(aiRf= zL6*FgpW0T1kQ-?ph~gC*s#8F+R8mNL3D2|Whr0}`C@JzKd61@;R4PnqZ~b>XDmJQ=2jA>-_}N^zo^rRWKTEXu~5bfoH(4_jeMHL%lD%K^qe4`>eOS~V63=_zDxeR zsJ^X)h?ZF?%@hGxw-)Xr!CMqm!1hd*#;Tl)bA_G#2=J0|0Z~waqX_i=8^FM04IquV zC}w3YVOtAKyQjh{!CAo*`TT?Gf)Ww4``3@o5+sWwY;TUrnoIbaNnj&aJwWf>Qg(Y!_GrUH0x(%5MT;5nG2D!aTgr)e34;GD3VHOaeM4R84 z!Sehd0J#TGrfsFFh~-(*^wI=LRYjn*4G*$vv(kn)GCxoHEZ!BU8`H6gH8@GZY zU+T6-qJ9|xwpF33R3_+E3pt?2ZsZ|I@}(O*fjo}Mp0i#@#Y;M%}2Y)BCd0@JC=bV#`&AjL|TM`=Mg z0JD~N2JC?>#%vc!-#F>vg`!B(?i7$Q#gKI;7R3#_g3(QY^b(M1!Jp&%a=cbanB1xs zBHC~Rsp^?C(&3wg9Br$|U!&R^x`%%*~-(foFqXyR@Ht58U0mpy|uIV9mL(i1A_# zOhi3wL8<(hR9ZF``BA|Fi98*FJv{<8qpMkhfO_Ui{sXFttF%B|l7$CXsR0Afn8M`| zMrqbS)En;WC^#4nO2js$m8u|zN*GSh4Z$3{iQvp?i~Oyqwd4se(aKnZ#)dZB^t2r7|b@#ZQ~70-ijtu zKIEVa5L(QDeIQ5*Wt$RuSH(0U@3&J!4(Ws~n2fH*B$K}57x{pu;DJr(+s=JOfe-WG zSoeW>FJzOQGGJQ?jHSz$vBLmK{r8;B0B$z)hDdYPnNo>RviJ52WUREEB4P>dxbt-4 z*cO;8m8R)zu6xE$_%{k(-nEltTlY1q-l|YYc$M(OuBx;fnA?Vj!5hmW6@NsVWCf-g z2pf79n1Po9hL|hayR0i{H=<1)>8pk<9})Wu|ZB!@n;MK5=d?(qhSGeUPbI_N*g(wN?8+QRLVBL zJR=8xcuUjG1^fZ7B#e(pt+p}CVoh(7uraA+jE_5qYO_8kF=q{E#|*ZxaW5(`Hz()R zb$Xudk6xxL$0$T&90CZYM7PeIC0dYK5im=`*DiD1wMsPy&NmyufTQEflah^N8xd#} zZ*!=-K$+7r{8ZcrraD!=54BQ&O_Bho5^yRGL75%nYteuR#Zacl;3o!21YCdzm1e6d zv@GGG4l^iDVN)9(b%Lpirf_=!1U0?tEILP4;6m{4QfsIL`LMn1? z>aGaL#Y_U6vd%q%a3B*GCdzC!1)QFB6O2-o3&B&?#x6<0;=!h#I;kg4q7WuEm~)#^ z8W>|T9t+pvn};X+fg!+J0KgtF4E8|ou)%wNPka`v6n`iZ{72q#4FYird3mXuT;0*e80K>GMxEXv%4iBhcgLIRW zJxMU{1mqR~AbI^3$+DgZzsW7gT(WIewru+pA?r_o;q45GgSOXWYZ6bQJ>bEzvf95+ zB^T#BYrR%G`Ko88H=Lxw+Dea?U)R2`+Ml`{5ffL6>C+%P6%WZQ41oCugw&0Lj%Yeg z&XbWb;HRbsC@grUSUMBoFp__g?Zt9{bJ3Gzf6e-qG|EPS$RP2J@okjqS$GSEZ{=VX z7l|n$ahQB@CeUmInZ@WsG@cob_#h1Gh$AD3zyFt3UM|Vhf=;-ba zWusG&kPelQ4yBaXq&oxz=?0}iLh9M~Jm>fC&gYMvvvcphKd<}szOHnW&JdhVEQ)6w zVz=K%@k37{@Sx*@`tTw`@<>(;l5W<{Ww)qmlBrc?dv(==OUq5oT^!FHlewzMu&vGr(xkB2q zTXbn*tYQcw$IzK*Nh^N=Z$ifa>uec#ws2=HpeG$a+50LDJ|`PSwJw{xloU&1^QUp z3hEPj9p~i1$Ts<9Fc3>~B3+<_{mdrA8YZEJi8pkn-|O{x2uS{%+hox_RLz9`MdXW` z^RHbm=K8=3n!6w7+1Z+f3afPmqQr5)#&a9bliFR@fz`iH(|-^&V`4jNZI9@#RHL|+ z0MG1(jw^2AWhS8jikJ5wX9WuLwz2iFP`~vQm1q}gD*t_5%n!kb;TSrqPAAzk>?Fw- zl4qQ*V$Fv^Y8Zj_FHUWMdKm%^xmVV>I*{RAPO$T2I@#K#E-{UelqJu81xZ62hcIe% zFLznUD0Puoljt300#P~}DS^upB-tA1JQMD!PHH@(A3r)zUB;-o%`@v(C%%R3F${3@T1RvxufNY3C+aLpiSwhQHYlEku)`2ARfq?AV}Uh0jPKZ<{jsAc^?tI5Ix5>7y(X<=Unk-R#sNP!;Sg7irJEkr>(9Jw}dPLiMO+TY2 zhGrOEPY^>4i$8h848VRiM=>DSOkD)rdu*H-C~^1qT@ZQ7$kTcZdN1S~Knb!XEQ|2? ztww?O;$w8`s|g<1~}l3>7#V5oe>`+wy!L}=I z_LSF+t0#h$0tD^~&q$>ER985Y1a0_@H#* z3$FsYH!lK0Qu;Vw)#W+}Vgx-c)YOX;?xichdhVR0Hm2jsF-oN zFZOuhXUM*sCE;z>@fSq{4Jjfkwyo%%{p@EY}k?o34DTuhIQb*xf&~ z!w_hsL|vWlOpznSe7mO7VPA}pJbN9h3an>|=U6`_FqqIwd2$7aH7uIYM(c+IsSpJW z@T3ImN|w|pm)~a8w1*(F(eTR*)`!Lml(_8H=n01)0gSTgc>6?Yc|Q1Q0sk4Jza}At za!!*-m|lQSKj;(_4}a^@+QoApj;q#c`R)%vQU9cR2ad2h%;Vt#E56UvR}cA#AKywW6CYi3i$k_>t4M1z2Qk0a6<~E+` z1o5;L)Y`A&lR-Pm@0hr-P#8hYN`**=t*F=bq4IsNLq`fEpcnkE<|G3<_Au*8)-p@; zQwJf$Ge!*lzgmJl*?9}NfI$1tN~Z?|!^ab`pn;Bx8=i3alX&cY@?Ou?>*wbxC<60vV->& zYz4jKxL`5a)9tinx)NOsl={cfjpNiw)(&;Dn40-E|zuZlrppddXM>RTaYv-`rW#DFeV^ku{t(K7Z}lm2k;*P{xGJ0M(F*#i7#Am z{vLbQ`tJ??1UD`HnVc3n23~z%icB9Wd(h!PkV+&_EMOFGyUI8UqY)(g`9YEd2@LDd z9MBCD&gi`e7jwy|*4{r5(0t)Q8mzbID!KIq==|33a@V>LWM76?W74(fjPzb22+&$F zd}S<08hw+eF;%qrk2hrs&%o&~=9gE)NPHGzQlEXYh<~5aQWJJT1n2*?eE153Fv@5# z%GA3XwG}IpVd>oO581y?+BwR4`g;6nTTK=)pGF99KfL@s)JT4|8f=_zwWHi%`tIyI zrD5-t%j#$CMq=1s!Clx{PjXSYo7ZIQ=tLLN^5^vTiJ9khz10%xgg{aA%&!8rEkWN@ zF+64Jq$qz4^?new@+VNpo$k68KXqtg75SwYf12j9?)iMv_H+qb)^qR=)%wOS^j{3$ z*`H<;`EAEZhZG6xia$pGS%=`Oykg|dLR-?D=hsRiO`5W>4Os6rJg>Yzj zZXY6oGOOTao=2(XBp0iknEhWX*HG8Df3jksb23NhNL{pvMHvjJbM@IO$f9=m>Q0XI8A~$!NoVN~@I@`2OoYqoLi>5| z)3@)CgbK046=E3HKVMBnX4#o0C4_VDKP~{f>5)jE)G7iFF>u|r!1$r6m0E)}K5sid z)SF2Ev{UqFAsl$}pkRlZT*FF9Ph{c+XI*{8zlZjW;k=@%2hO-AhS*;18UbE5ZBc zpR=S6Oe2F0&bPRTFz+e*Wt<9$cXAvp!HBdUX}#9^(gNSrCAoKqIaOey{a_y0y&#&! zX~hdMR_?NIQ+?t34w|Z$A55x!yM$RY0vycy23hzWe|r~1{>3ou15vAAJ?=rej?jtFCg(OYaEftuHdmI$;mHrVtnH* zvkFSSvIaOMsfH!&WemwU@X0ZjP`|96i>mzSj$dyw*57vWJt$8m@j{6Tc z9Sg|Y{rlRkzA)4Tyd)A67wuPVXz>KH_tAoFAvC=S8Cl(Py5j@15fGVV zh}MlOie{h4=i-w=>o2yB{m(7eIohE#Khn{#1;a&!^&*VIau> zyXIzRWZM-^DfLlr5*mF70(rMN>X8{$RG!#&ti$q}@oCt7}f=D>%F+{M-E{ zxfO69!JK|Fer$2#*b`quF8MPt*8zjMeo?>2UVE`-wfoCn;P*@K&c#77HkZjQS6m^+ zvczzWSna9p11lfl;N>SQ)1Q_+GWGa%-^5IhX#_?RjC**&~SwtQtg+w>`OU5<~^zD=+N%UVOOuIbtMT}z@SpI%ED1T;Z{1DVrw@o7U{A~O zj46tO;_d%#zR-5Y6}7_SSVWFRKv21+95&z%AcAR4f*Qfx*^Q^CSzv(HRQ;X0o;$4j ztRfGrH&g$O&*4gaGP_s);kLil(TMZ~g6AM9_;K@K$P) zG3T#R!u0a-SUy#CX&isVu=3j)2kIY^*Dx_G!NAvruyW*v;_UibxT zq9Q&Ra)(^i^c!gqDc*b(wpyL>uPCkx&I@+$k=Y8?x_KbKTcce^`tA=-Tk`|GY>PQ@ z;AzwzKk$DJ2?YCR=p6scBck`p=K*;skd28}lAjhbfEk@sRRC@_&)1mu~|D+!>Dtj0rL`6O} zy`ycVIh|o>k|_V09wTPW)MQA`e(jk31O+@smXz z;@!9SAwbWQ!G#fTz0xogFJufq#QH0EjlV&z{9Oj22gGHk>BXF?j~%%Ck&8?VeV zgiMnVjI8s4h=Ii+oK&Os)7}6&I`uRKYepDiFitctCEw4&1Rty-GQD$tb;Txr-}srk#O!;%H(-koRXxF&i63laT={d{3OE2-dkHi<%F}^Ha5c9yBg+ky;jNJZcKStyIpRVfD?gQnX%!ohj#&?Y z^(WQ8GYfw!-r(lGH%=S9;#Fvincm@mOE_ zdX;hH*kIl@Ml0mI-D@b<-*NQM3zT_l$LHI*8DO$Rl;$1xN28HN=JQa}YnC%g%d)`ObEaI?dE<);nwnf4~%9Ql0Tl5w`BaDYI zs2un%{W(it690z(=k`P@;E|fv#2*i44l4%jU!PL~#lG|0u;>e<8-2~*ODfhxY8|$W zM->ZL4o8Nls?Pf+D>gMZMA1p0iI(BBR<mv1onGQ3`` zYTOfyt~Lws9!q}^w9ER;p?Ictgi|uKN~LEiY`V=@j?dIJU&^qd06p6$V%N?u$MS!} z31VIZ#~}VZr7|jlH4S;utXHQh-&G~+2=<42@k|-bW@6( z#l{cF^!{Ot5gDc=LYFbB;N$}bFS0PI??i5i>CQO+K;z0i=vvl!TQ1Et$ncmxQU7VF zhIX3ACiS-8fdzxpfA2e?|jbv2-Z}Q zoL0!GB4yC>aw!taLRpg(tE&~H7E*l6M_d#UCHpVxaT5RXi$i~;qGo1cMZe*>>w-|{ z%?`!1D>%$9um4XY({C!@6s%m*e$w}Rx*2FJty4yAOobLFwxHKftE2(c#X;4@M)Su0 z#oxBD)+zN*a5#_2tkTAe-V3q>x5{DCHyQQi%JX%8VP@4QFSMeOz~^%IRJ^E2ox;N`$V|Rh zNuwu2%~9emk%KLEyFL-cCHp+LNwm zmzJ+MLN`8sS8ZPBr-d7#8H>CD_|PQZ*(RlktYYRy5v#2yJDS=9s-8-^f(_E?27QB& zkdvp8stdF%2dQW0rfo$TeDZ;mpTDOS)v+mCxH zxDv%sl~|PRws=)F}%?k zbwV%#{!?Dc74iemu~*@Sghutk%(T8Re;PgStY$KXV#FgUdQ|Zr^D9d6csH6JT#a83 zDbq*qU3h%hw}grsQS{oU7dG8IJ`f!{X$r}(7Go39rhI&(sjs)1NSevrKy8t+E!=3@ zXA9aL`xvO`qaQZ2A5NAm@dm`;zyAg|;8R6#e2Ukg`eKGTvmwAl16? z`u>4uJi_*6WocgI-p`3urx=tBSz!~J0Qy{~{5I-Crj=Cf2W{gV${QqW%*>@$P}nel zGIk{oQ-+O(OPpdYj0%0?DqVB&0@6pM;|jn7MKRnlQ5jZlSIWe^1_-dY!5>s#CPe9` z>iABR){#Y4*&!Vca$Wewh)-^)#@=)(hsmicgZWZzW>kaRidS(6N<2sGAJyJ~{`@cJ3tve@H5TTK~)4~^p`&*nLcOBc%c zl&%iDaERn~u3B{^X{`f9IDLrY|;1Ro@xDH5V1eI+(~Fni2v; zZKP6a_7UAbW%)|nKj#?$cDj5`OD%#j-Z-CYAUYYTz*Hdg0OUXjc&7Nbaw<;Ke-6o3 zWa4u}N-g!+uReH(IS5Ih!jexlYnt7iqM&7+a+dBH!jby@jJ~D9puY#>BT^_x#NcRX z@)1`~AzV6JT>O(1!dx?3*0z8|3uT_ieFMRufMk^W75NW0`g|j`YAf?t6 zcO48dNMo}XjDwO>9+El{n~brSr90w{;*ZaKgH<|XlW_yliL|1QKARAsgTTQ1H~8-c zv(&>SxWTFT2qlklT2!Vv(R@EXL8h`(l~~I^%0usrGuLV7>l}UuHy!Z_5wcmnV8dMhvQ8ZE`&FS!kQHHNo3K8C5_jRvx(-hpHbREW)nUh$r7;p+3M#$py~N{Wqk>#8yMy9O8tPya;NZrFU&Be8&IRU3K(6tQY@{ zl{@^e2iXc^v(39O+Hkkc1@=Vo*Ia@f6k~j)-r-cS4m>g~UAN0cXws(#{@)8XH6dk& zQJR^m>X8?<7}a&YXRp2_+n^T3m>NxVtVlhc@Hf`CyL`)2jgZrNbRg9F%E1X`Scym&QzP)jZ#m)ImD!a#arBa~i}hX^*vG3&vnh(wIy(5sptq}FlU8ZG}uDhO^n zI!)lkIL~^^F^qlBxnQ9fIBHdr);WkW(Gn%JxRH;NTA@bVQSZI7n*wq2iy2H-FnEJ1 zzJ^nX3OFS;)wi|Xe&Y*qI-rs=F3u^Xbkc+QR(1=4zQlfD*xujy!B(n%SmdX!x2O6w z8R54N?W>Am8BpI@Ro*uV1NpR zFn-^zP71`tRoMREsB_~oRh9*k#P{+UCSTSrGWms0aLpN_YMSj>mc#=Jal|fqo$VJp zL&n5?u((dpJX4`_J>R@bQQ>WOdx-gM+>64IlSBH|RLHJ+ToaW__-pv4QC6?WeK$G8 ztb@j6kO<|O+w2vm9=4fgEqXyht>apRJBzwLbCi$RlcyV}QX~6m`WcJA1x8`Y&akmgu=?pXs#}IOTErJ;7x1C+)Ahry7EP2! z?NjuTrcyFWoE21dlSos-i}`9aRr%THoi88N*L}*N<}?f>X=uN0Vv`NWzr?QrmaoPj zhkQV=Py~AJ+BM<-vH(HQ0H6{HEf8`drvE&J?!H&fW{lT*=eXblDCh*80&>z^#~c>&df!6+HYNV!9(G6AnF@D@M+Y;(Xe2`e zN5@(Ef=7y_vbXoW3!CMS5JAnmTUPkyZF&@z@2k; zTyJlJRwz&!2kxNfaG`ow0MrucU!$zK`RJ9xJ?t=eq~4VkL%h+c21a$a@R> zv2Pq03M6jPls3|eKHz1-sK?dfD@IY?Z85a08duxVMNrsJIHr{=thMb)Kt@}E1RdJ) zHVAX2-Kx}U@Kdz_hU_NGq_a+?BxoRj&YnQ)Gjt;6DhXTvCS>}(fNpI`577uWUQ*g~ zUC3;1i8qj?fXDF@v9SN~P&_eP2%<2h zRO4IBqdub0VQP9^p3U85gL)t*wl+$C?lK^UFN4Hnio2Y}bR(&V@uMDFu8n}nTf~eR zMo7W}Q}WqaCeh!Pr_8rvujiFG2WWE6NQiE}Mb#VCt1&SIXoK6=2SS`#%|Dpsqft8C z;>8?T^KnV0*hevDd7@qK@a{k`xq<~t@P_QZ0ekJZti+x^i-lUCd%bh07BXU29sT0Z ziRr27IBU&K&myFeVz7W&SOG+hh1dIU%)$f5TVS#y_idO7PjHjD;+-fTa}pCgO>aE2 z>_#lbxuvCKy`kzP{SWf^&#Ji17pDdMLnuEPY4I>a1;Pio<))xX@4nFI77fbmI~$OQ z7irJ~<=x(vlLYQual(>eb~3T8OqzTwxKb~bx3Ygfq5=~~PZG?vwY3@|n$N;$O}bWs z$u+c<4aWW2SitctZKE|3zZ%zC7YAx&nK))`mS8sF4xaQdU*Gus-J$6XT5enOR!A86;0)>cf$9ryb#zwTnX86i|JFHMDmQVapm z?@z?NyjK8|7%bekX{Xj~zqTa^VCqUE-)MKg<1k{zE>C_g6fE5n`uiy{G>8eu(6tf( zWEg;Q;jG;!OBA{X`9c_h73uh9;f!y5$`tTdhwU(KdaYeT$eh7K8%(3IYm6()t!eKr zrUHoQa9-#F)MotgH#Ug%2SGx@KtgveTOgfNhI{7w3h?<4GE4CAEJtog8XJChy=qsTn={;1U(vWiD=Em-hO!fu>Q4zC@O2E3HX zij3JTBTP{l7%EW@TtF_b!RS17oUG>(?0@)ju;R=$6yF#$OjjJdpu z<$q;3+oxfGr5CjsvV|>PYH7-Je-BQl?G<9Fw`*xe=&ooH{T|p(ajd81!ee6VqG+r* zdt7CVPT6iUnZC2DD-Wy5pn|-b$89ASZN(@ako+oMn&|G>OYs=l*U21i=dBopA2NfCUcsQV2?(l!`4eR0)11+S3#EJV^b3Aj zBN3dMu~t5`@8Mz?-NonD0#NI>-XAzvH$qf;$P+XQAeirUCJg(QN2cllwzSjh13D(e zlKwAtTi11X@AIJT(7z+oX~7owQs5AI@T-w_S|-g9!2!-R7(Mn7SgF}DH&S^XFmvsc zA^KJp90kvn?o?dGs=r1iObDDna#`(Z*43lXp27Fr(Rw@_gqw4jZAQ)AYGY@8Dxw8s zd3uk9xqa|5S&{<*2pVs~3usXoQ}BXCga`oDR#{4l^=UX(XwCbYSXr>otW-o2P1^LB2m(tscn za)yarShTUpxzHwoLg%w+e|_xR6m~w7>}Q;%xc68oi`~^x818eDCB)h;f0jQxBgHwY zAsJSFQC2oEMpZUqL0X*zhe~3Fbc_XDi+%*-u!m%(o&mh(L z8GUecVD+p0fruthHB$?}tyWmp)3Wy0fmh1(lluXzX9d{;4Ws5RNcf)F`a z>l!N@sbThxmU=9q>EwU~J88-Fnc)!7hw$B9$olby#qZ+K6hn6bVHrP7e!0RLuMza; zmrV!#Nm##t!W0fv&mRa@95i7k1~k~FO58?E02{hgfU!@4+-YnnwchKIp~HiVfl_+4SqetfgH2~_l|I~S$_*EI3T6U}F;VkUn+e&8)yfe701XP+#@V5Jx` z1cwhrBXC?Zc0L(r2uSO=qOhK4UmZt@jWw&2uy`|3m0(dLwqY{}qDD*W3PRQa7pl7H zRR)_vz`H5SNqeyf!lCTajPf22_GjM~(D{&xd<#`q$>07Kxs~)vy*DG$ zrR{^7my2Hp>0~#ZqLMDBK3m?N0}>tAR&HDCGj5lcXu_38qu7--D;Uqc6{Yy|&bo(Uipl%$t8NWO4Dk6NHDI7)_&Xcc37Tb9u5{27e zR4@!{Joi!%^nFytJRuZP1KQ__Gcdv1#^_~Pi=jNoctv}xvq5HwW3 zB|v%-b0v}x8@>P~qE=|wxBlT4)5frAe(?8FhdNUcGgn*e8eY!Dz26)kKEIXiB@M2A z7=FUO_9+3y1p;p3ihiX^lq%TYjf`jS`;c_GP!f!Yglchtqezz6s_eRqpyhun?ai>6 z|6I;q0fZejUBez4|JrqnagP4ecpAE3HP7@;n@qjFw;s45W}27&SE9}7*|#MQJ)}w# zV_{O(!;B;&szoUac~TUvzDi&i{U&S)*PTzZ73e1%r-1#LWaGwo$%bvPSwzDiQ?`T; zmSSr|(p^UX5sbeV6Yp`oozJRMk_2suS22ncI%Q`ioSepsJ#OuEeCrrVl}ML(F%v;E zz7?9a>PPa7Mwvn(sVJiqq3pFY6y-36VNBF*65`Wd819(0tTEk!1x>AzLNj*zdfj$j zt8l}#PqZoyi7h{OJy?vd5850TPaG6p#Y{2q88t>CGC$lQO519MY^~yt3J&tv=Tq7v z>stG1(_IxC;u}42zw0h1?&zKO@tn}UPNWNFhy%#!qUj2P{&5J^~K9Q8L=6eW&OWR2=q&Ly>jQNYucLcVJQ633o4;q1(rXo zzj+%-fPqZP#wtvP9rn*8Z+qs4IJzQVY`e(hc=~1V`0XK@M5J)OzC-iiA2)1f9sDCa zDU*SV)a6ys1A5QY?7#lUjjMY}=Tvp8zQIyUP3+=ube1Eu@|7n}DL#eZLxEw!er#ZMm)lkR8x~b# zZb@BLAtlZSK^e{wSQIl&3#4%SoaPdU1y+A#eoxeRMlD>UGf>TcmDs_D>;O z+ZgWETl1K-!2yPWzt7?<2co7ROS{C!9+@1<)ta%MbQ%>ME!nnK>(=$VH(<@n_u*83 zYwyevR?eY#!bQE+9pX`&mRNXl(*gd*WTca0ViClQe@YJkymbt8Xls9u-3 z$T!*j?Y)(ZCKM>!{)HZ31)G>}ss7Nl%yk=B80H>gf@2h$dm(3=U{pF}RU0mIeOA8C zo|ZqdkoxqjeK@)QhF}?|(uzmcKzix%o#b$82RcT{PX+%UC+lVkUfX6MVRk&*y3ieq zptT!2vowJ6YYRi_KwpmE_sm1~+P8Tl&4kNS7a{bsNiYT;LKTGy?4Pt@s1DxD3!ID_ ztcm2!hY6ijIDUI{&JCQk&k`(oc;&vqgM4q3Ue!eY@b=O4gaVTN1WCTvM$7MUD9*Rf zdj)o4xDN0kCH83rnLYK7eUM7Z{e1dp0qfHUkscB$8&XAc2lM-)Z3P8EC|d>23)|Mc8!|hDyb#5G!Nq+k zux(`^3wE$J6MT3f{1!o*G_MzIP{VP?=zTBPm4nw^mvhvsG)`tqdqTogwHCZq>!Ta8 z;qfXy0aESKeA-vb%1?1!*T7|3!1he+7;$vBRj<|IQ|RkBG;#9}(IVvBNpAO9HN4O-h7cInai9y8$a0YGZ7pN9*=I=4qPdYII?i9e5in=Rc_ z5u1p_KQg*_tZ@Wetl~y?n5q!V%TW)#S2z4kEKLIj!T+14KyAW@7&hg@yJsAl)%dTY zv2<=kXyr8T1RZMAxWFf@a^M=lgYg3@;Dv<)v;K{^qPs+UDkEZa7G-@+lN}}%P?XOn zU%4}i+^j|IEJAdTxo+*B~5wO0K4 zD99$iF%W{X(`V9JXVeGwN0M~q9>?zl$AXR~X(q?AA9%0BeoPQUYum7<9BDmBV1d<0 zlG6kshNjGdfOPksE?Mqn^<&zMw73@#Muu5r>AWAT)wvmS!q>5iJKrGrfx5p7Rm-I0 z{3_na*3Gm$S4ZQJ0;aeb2|fAF@*SAhcsH8)YsATxK_UL>;kCDa^wplHw^Ovp9sQU> zZ8j~DI0GFC4rCj&p6kPa9rbW8E~zOPl+sL6Q5Sj&TJLd??N3%EIL6CgD-;$tzK!M@x&VOX>-y>n&9gQ!Bwa>Jh{~lSLp3mo}lvYPGkfyow13#c( zVU&r_-y@`#VLqGpSf(*T>~7k9w1o^KSidM6jhz&M)Yr)dkK?h?f|GeOOh2Aj%;fXp z@tx~B-MUl7Nc?`b`wX{xcLd3?5<^%)^Q?>5u6EvZ7T_IJXTH7%LyP4@+cn#_r1&F_ z-dru8;Jj^J;<;D6V*-o3FJ2Nl1@Z|il)N2i5PNTfvUq_fFc}!vYSc_TTtYy#^E|94J8yACL0epg~gjQ%pJ3KA8MXicvWvWuA1_?n5g}rVW5%-wKV4GC655@QPJ0g$Qk)HLO;M zmCBun5sRE`@ifP63rbSg0l!C<2__q$4-U^Td#M@ct1(gUoQlTv9?1Qu0 zg4%pzE)x{3TWc3>O2u*?Hhyu>Yzzvs@h7s0w#z8~IR-jFjI_?!-6Y_75=fpy_{r7I|F^l|mx6w_lk zDQ{_=Vxk;Tp0q!i_h(<8v)P7uZRPz-&$GmBLW-={3p{MzU!{%@&CNp7Bo1p(KbR31T$ z>hf48e@+Ruh%yykK5}uh^6HVNN%1kD6Y0gQwJV4Jc`#9>PzEF#v^EWINT*Xl7-;ji zxd6%Uj>#G)s;h##eZ)1S)juf;ecz=6%VJUJGz?xUo}EF+OKLSW0P-6?5zF9v0KyLpSjX{t8VqC8CSr!GqyeZN5P!O zGR3>5?iwX|OZFSjPspn|*(qS~SJY3w@NG`{e?Ky@X5!Cf!Q9Dgys3V6c8020O%|2 z@Gl*ru_BF@vZ$bQAo$G9B9h_wL)5E_R21IP)IEIr zw0=(EL<6AsgpVz8wUw(lhq2w(UM=1YNZL#iOHg;`Ua(W30CCY0;_7HjucSflD8ae=U?626;61m6%5}hfQ-U#X)0QN!l@& z3f3rrYHyeHTq=P>#(1aW3iPEP558q`kpCl(l9!;6!fY9E1D0E)la)Tl(WJ=1s3Lh? zfW2cH6lI2!#)Sx2B%a9&t^_%FSPP@$T>jAGOw|7pFac74#$4nkw_$Eh6G061&gy-f z*ey7&(Y){(WY}JFvYEoh{R~~j0jyk`KS)~@i-B9ZE)i<|_{FcZB~)>?;i zqB1W#xhVHgve24 z&R-eT$BzTei{Y{Z5O_xiH)`@=iE>3$qZLi58O9fHVD~MfmzWVwX8mC!&OvXllC*a5 zdno1(W24SjNnvFRZV88e!-Isl6ts-dk@1i3pt(Lc2rh+GFp2WaDih}$gF>N**J-Z% z&6=&r>Km-NNrq3VjnpHyyF1@De@Zmw1rW!hFy_UQi-QJhWDdNRhk>!!$5k&v({e{Y zbE`B^%kEx}+*yoIQ`nV8Jf*h%wk!_yRp91juJB3ohwb>)r-ExvLice#u`yr1k0p+kDf?6e9lis8UE1!$DMFlfjLky3SHYecf4`Cuh6wO-wKuKCsktLlmpPDp-y>996j10SXaB z#+oXAHKOV!XU_-Pc!E*kAG@W=2I>}KbP>0z8V6%`;NMTrS{#XWp*^PYm{9)W=)_~m zV1o7xTMT`u{=fh+9q2w0F*j8rE+1ZK+uI3hE?%G%Y5vHbH`I5C%az_oC4g~_>oSN8 zsfh9IEUlXAKVeX$Z0o6{3*GT^Ymds?va99wkv}x|@^Cc|Pm4W$yr41PH59w=fsT#* zPJQ`W{XKNLKRMnZB?|e#^0yzndyu&QN7Gq_wGpmeJHg#0xVt;WtrYhF zg#y7T?!^i2?plfyT#6L8AjP4$Ly;DzrO+aO_Wu5Tl7l(RHS^9j&wAEccdaNRITsi_ zC$_1+hnR>~0#z^0VxX3fLG%(HCrhCMdn!LjBZAX0w&T$P|1xD#yN?v+n95ftmTRIF zAC4fZHzz{0@3Vg7-a#ARWI3_`Lj1clL1c@URG^JjC^ZS2BQQF5=Wt&Pkyz@J#-PRv zS*8mL2mK*Qrmt*Po7}+X3m!MG^%-APV5ow4yV+;~C&-WypfE%P5`^TZGZbV~|3UO8 zy3Q4&#n$?EMfRFKcgZ>NVBUWAybx2Lz%I#@L41S&wlNWgHO~EbJ~rkq@70cgqt%XX z>1k5Y-+$E4Blf;3QVVyR`1gYWQpKJ;-OATbBOA12VQ&1Zlb^mH%kokYAxEj~3mrbu z3>`PxN>C#FWWEPHuO^5)N`9xvydrB#ki{;v@{jn=PymHkm~T7Hdl+WT9|1F zUP`j^vgU&B_fAsOt~GFl%qhKy>Rln8c`n*w&d0cl!?in^CaAO{mLMMOdoDt6#{i<{ zr7{=*^n!3K&pH)7C;lO3WA2zAw zanhbulgBmBYUuZ5F=x^v==#Da6-wd%oKWV;xyH1jTelVKD% zI0nItqhw~v`v>w!1{+F<4U1)u5cr}N?<0voaiU;<<)0L(>~Mr(HM>nVOZj`}g&G-f6FxQUFJxPNWZ`N&1ba8x1OR|g@Qid|=r zUcPY$+)_A|803D!L`iJH$Ar8KOs_M=p=pM&7Qt$`W# z1R7Jw$WpkU*`i&Q1O$m+Zh1{F--@NW##r7`6(XrHa6ghA#q@z=s-%ccUVtPd~QEhNu{GF zytl^@3rQp-TKQXIuNom<7im&wdMu;H_tiNG`3;wGCY~%YD0Tm5WJhkU>|jM z9)nck#a=>VnU&Gr0yd}V1=yt!9xK!b2`b;}_+U`A)dzn;nV)Z?$%jlOlE&YRGIizP z*o8u-3HtCu#tQB$0MlaAVB<-#r65h|TB)FBy1lIa-`f;Nw%YM7`5fcv{kjzi2AJmW zsR$4nGXi;{g%dXjp(6=aLRHHUNI;7e8#hn|Cf$9?PuE9C4=|q z5#^p45Vf{#@v|A$zf%HDi)c<9@C;JF0yT(W4!+`QWn?3&)z0|W$=&R0@?4gTbU=DL zprlekO^}HLF>`TG81FbxY)C{ylK4U~cm?q@-GBU1R*b8u1);{}L>>cki4Lf5^op4| zu*W6n!ZP`!dK@rNY;eMX`#f$Ik3v|gHqo0nXw1E!?=8{s2~b5*rFcL;YNQL>1C(w^ z+Lw$k$K_^TeRT4=I2gdR%T#^+cz!nXylPyB@bnw) z8QDK~ANZ+xAzk39yQiglaC|h;n_!Uc79cwUs&dXp|6*qcW2>OjgA{XCoXY~2#^EFb zxDCe0aMt~}^?_+*{uX28Kwj7=P7M1F(l%%AAj`*W3RY#g6b@v}iFM*=)b8V(dB#`M z0V+21;y+D**nTlbpo5hKhB9SLs!(D%tH60e145zr{6oMs!|^IXF%mIu_0O zB87AIrArVyncCxbhb2nV-h>sDg&ua@u%D9D~0>qeBbG(QJ@|bD>AjH_5A`zgJPk z+G_?F>eT_Hjw-W>C`ed@p62M0qtZq_Y@T=WbX!l|r31YO{K!WBe3 zR3%c0&p82kzw*b3BBzxP)6l@ze<3?QZjS6Ls2*V0RC9H|K2m4YiW)JpW$skGni z${V1Tu%T(5-T%w^8l?E7{`tce?N;$h)dQY%D1m7+0<~tDCUzm@cSdfCrl4Cw-ROEnu`@ z_01(Dvpj=>;cCp&^HwUTD7IksT=+Z46u~uTABCTDG(F1Y1%w|<0xC5ry7o4N+Yxx! z;VR*Cl$x{kCj6?m7yp1)kkZg9Y{mYBc2onG;&!62w<$SLKcn<+E1ykq(&BnH3>J#<8dkRQbf2>6KwmFDPFRdYFGsOw#-fiWf|K&<8!EdzeiIpFr1 zIb=1uv(|{UW-CzqkgQKp`geKq(&4na;*af2k-f|K3Okj$!>>J;Brxtx?8jVgHT^~{ z;gEv+lZb{iZBd%tJeFU44$^F%7)Eq+zB33yAaj*V4T(Dz@;=t3uQDl5||d<)6vXZRqP z>7)rmo}Wc6yNA35$&C2JF2i(x`>S$(;L57A|K4 zFpl|YyHKJrFU6ruf|GQVHbDa&Sm}ih);$7COeTP7veMbvzvipeoRJFIT!T8}H+)3; zI-fWx>!V9PJ#c1~{g}DJe+TvfbBHNO1Z}`in$XjmmIKtVf$`&wJt*(F&E)j5CQ8FP zzA;x6$h|-OvDpmA$jBQ1S+D919ukHT>nRk{X_5*j`aw$c!bn=|P>F-nB7`dwJfuvV zJ5F+1WgOrCgWo28!IPH8$t|G*8Bz1jv2Y|~2#4Zb>q91MC&fE?A^;m+0y!~rpIjodG2ixuV#;@|#Zg3wbOS%Jm6sV9 zIRs@z1?w`v`Y#@Z1JXBFB6pQ1;heZcPJXxaQwmC-%k)~F~`)l(-6-t!vZBi32&M}gYM z=06F0pzI?kxol2UfXfq;*rBkg@M%tN}3ZdJNYdcOTdfz{!?5080xNLjZYYMR)ZmVa9WbxHQu_co-Jj1uyDS5 zH`y}tHsu$N-8 zClIp13fveMHHZ90G`QuB4(1u>9)!L6`pqUxigODXYf5mj?%7_j)S}o@z4pN@oKQIG z!cTDx>2Z$AXN_oCY3(b-zo4#&hJ(`*sM=JwR)B|p-`w2U&iBT=l}4}ck8j(x_2Ay6 zw(Hs?{B6%~U(b8T9hR}EGmXVR zY`kM!x~Sy{EK!ws>q=dMuYhM`l&_B76~7V{Xa|*l zm8`^GS&EsK7AgWABp1de4vm-L*gB2_{o}1*N~Tj zmjU^k$||%8<3&ZogSdx@*>S@EX#tUTExR|953Ke@WvGX*srXl`Tf!yW346T$p&6w9 zD@~e53Q8&%*k|7$Z1IWMZzz%!yZelC5hpO8OU;rkpxMr+ot#^P&9MB4HZ6!g^`U;O zZC$_Wu;}ct>`laAJG!$IT8ex-x)ez2PQx{tTX_}nT*0j+QJgm((NwSJT0&dcNV&on ztT!|woF_DIn{;^`nn#p!zho&E=aseGeg+Pz2c)yK?{1T-& zu06!K)Ot-k-5f7#&S9++Y7%I>+vK%uv~=-6`Y0HjS-sZUQ3^@qwh`!}m=K$oAz%`)5G zHkz{udcjxYpw=DzxdT1^E0U=}-J2RYEVPeUa`NE<(d+nT+x`}c?c-QVBqvTsU{KaVxySM^BrWl^EwnC(t0;7y#0rQASWZ0t><$F) z$0KuqN(B;a#Gu>Ht2HM6Q|uFoi)4w&q98;!OCS#hmHjyy-Vtg{+=0NooM7gPE-4-N z`Yxl}?6;4G_vyBsVgzP^KD9rteoe?h22K|>1?t`j6^51PVUe<#L@6?`lEpW(b~j4vQ&-9hvzef(S-VV z#F6PSF;xIsjmjk3PgQuuvob1(EF~O`F^qi3TRhhVGj1td?=(d;yZdJmsKwr~1;%vZ zgsS;lOfibL%ZZO7A-g#>S`ZU{nEfoTgPOqdaXS)yh`<{6N=;30?6YR~Yd|Pryh+~2RRURWht!%iioffYMuM1Vdf8g$kWbMcFwQw{)99uq0od2u^N&X`WBFrR%2Lf^%a6sKe$|KRc z4qx^)Ri3a@Vo4d^WiO?jn5my{?*KBTqR+gmUy%w$$7cW9u+DE0gcfl=bB;X_&SZ$G z-46v92Mg?8>ae^>ZMrSys4H-rgqW7RNvXM4^rrZR5${B?%Ir8N&)dmKz%&4mQ1P)2 zia5>D=~04Lq$hnXIeE>68CDLBUY|~JME`Kb-fJI9*6e%sRe)O{{~Mb)diEt!d#5+V zO2f6*!fiA8=bV$(`>-iJ%xkv=Q&3TT+fpgvUdPsXyU%;Jenar|)!Qp`EUT=V;#ZVRNROSK&q z>>#Poj-w6T0YR^kAPB%O)pq&AQ!wPtd8Pv67uU4K9=DX(d+IB$sAuG{o}QfRJq4aW zq(FeReJmw4@>3=er4p1GWl%!p3xESfiu>2Di<%SBsuZArnM6JtI6}1Mvbp=K_$v|q zM((1Zhq@`j#MHQL7VKIWQpCn*9vz);qo^>S zSpU%(jDF7YCrg_qXB^b)Sj5r_yq6uk3lP16bvk|ML!92VcZj6fDqwS2BQO_t0K~8i zNFlU>iXtLr)_^k#gLay}M{%|5?=gD$N#qNLs!8{|dFC{E&G9@l!D|mlSJtt*yhFcI zk{MGBCif*o4r#WBsc_)J3h3E}<*sDxvTNw7lK7Z#=CJSCIW$;I&iJcn2d@btuBu!R zP8IAs*9BENj1qx)JM;yPXt+`V&B@Nj=2!}w4Ecxs946n-xb2CJ0#`?3P$`#ND(`Fp zOov7sA9~mM zFoNiQ?}Zv^)n<`CrmEzp+z6ik!*Nf|%%G%o4Us8KRY4;?DXz2qWF|oGI?{oCbnZ?P zglyh{Is2vQ;9xxh?*eL3Zq^1f-;t;BLGU2Sod=5>hPj?%TbOjmrrXv=JTe}mF8uFe z!mD;i0vmD;XOK*;bPSm*eL_$>ROnLj|Eh=mTGL4ie4Xo}RkR}^wfPWoT1Q}r ziq{?)L~$eD&@g*66Ahd^&%2DL)~ z@Gp6n+9!*janTkN0k?V1Z>}EvoizAy!qcJw=>8`ofq@(HP7y?i@DIq~pyP>+3Vo`w{VE@Y=Q@{>V zo$xjA*ITEq-bQvYm8A>PmAw0M599rhuaqriX)?N>tO)Yk?P;W#V@C8p$kla)rj}EC zujOeJj(E}^mBzz`+qf0*t5EvL}yh+jd=Y!C=3R^+4~RtdWf-JEGj3Y1`V zM3l|BLF+!0jz(7XGHVa^5B4VB{h`?7J#c33rYI#QmZ6di`<&>E9Ay32&idgVcTVzO z+?BdKyy2f3y;fZkdAv`Ds^uY?7bqB&_9PL2+M!Te8Es3&u{iKV^vR) z+K7{$cbcm|c96xJ6;wJ!L zHiT9ohx`~OMy586_U|yuHlFLd=mi%1aIVs>31rozug)}toW@-k5}Z|ow57nU8JBg$ zUnocN`iX+a^k$PZTupxh(*1fh?e1Q~JWz1mLa-s)8mr5P!FMwbl|)72ku=N&R(#S% z4$Ao)(?=`u1xJl;;_@+e&QejbCr5z=gksc3p}hxtchYCWq35LCvogMa0k}eQCIB*? zz!XX%E9(dWIuaPeXQP!*l8KpR4Don{F5j%2ENL-78z&FtTLVESO_C?Hyp91!|nsr;pvk`;HLh2HUIt0 zzdPDbLsOjj=EL|dhoOI_YQQa11jZzDx~gD4$+j=Un|I`UX*VG0HcQ+!&5wQ=p`>RN zVt%=CcM8D0}*sUXiNQs12xK|(sGzVmBh}6-07=Zuz*f(E2JZ9u^ zS3{xcv=G(V@y6Z%?Hf4Loc4Onj$g#FTAgi%DO}YijHbOrU=ocDb9yXhjT4%@k#({}45<6Dmc~z`g?Q2{KMed_dp0VlH^!|A3qS zQq|{n=07=&eudL+vwy{k%zA3<)w(P2K04qVVll+L`iS<)43>9?pqUP^X2Y;f*yK}i z_dEx2tEjzjY|>*26fNr#P|V>a4gR{J=v(A)&sLb_EaOBwg;)(t=gEsc!85lT&_PP+ zEUdo0TyuwUXts*vAneBnt;L~hAk$fTB-24l91Oo+jHjTyOHIe@2{3%Mq-~lK`pQvT zaaoq@gGSRCvsTYd$FusNW-#igOMNpW@m&zGl4lU7|E&1;8-WxVR5srk@_&05mYFp^ zzuAlF*<3t2`cTCjQ9ouD5s?_9Ll=W6CuOq@7Nj-*5xhEnRD4Ex?y(FjYS<+G_>J~K z=5Zzay8;h8n$iHW0P7=-S6uO3Ehl$1%Xo9#+8U_#{n5M-u*0ztrsr=lCw!O{2^@wH zm;a4YhvSzkaDG!8GRHP9lnTN=G<;pxch#;|Ezg?89oVM=J~|`m9K6FAI0w!m{<`GX z@_n4ENU`5E{D)!OR>m$Gp<~S8M+T33J2jooQ<~ql_?O|Y_1g9qqA)v}J)0byMbZ4; z6Ye!}g`#MDP|7(Z9!b@1;nQ~-H`0H2Yr}PXj=Lkp$0S?iv&9Rg(<2{^@DWMZ(uL_K zlak|N1nbG^w+h*qq#^C|AgfwnwV8bSzVD9%4l_`tP*4N2JZlu53Y&h9&7ez{HUrHE zX`EL6W+N0+k@EYXqwlT*h`4=WsIZw5pZ)Yv)X`GfF#_*JU8+06LrBq?F8FeBWW;8J zIpFk0(UU+_OL!da=Z+1ak@5TGVmimrhZwpUc7H{>%ra|iv;t^bf_FF=2C%WI>|M>{ z4(=Gd?cA-I2Ht#aWEnds;#0$t&uDqLxzyE|6NPM>VE{(Bwa~pR=Q1?q{p==6P?o%O zP_c^(*-*3=kQg^0r|lg4qt)}hPtjBZcV`$$T~>`KeLF0o$pkBWT)S;lU9~Py?;OFS zzf+)?te{yy9Sj7a&$`!@dvAx`#+$a_>^|E1t4IB)D7+Zy!wmgRRgx50U6}xbB)u!31}O^s$q}uL9q;`ecaotm0Q78^F^oaKL~gW!{9i4`_#V#oaRFzV14-$t zM+G{^pD^P8rv+f|f;P~KS(u=agKkWR?Hw`b2hC{r1<(peE4x`F$)7U3JAiCIN-tv% zPojQW+d-8@HX;b)+}hZ~#Z4=<7sYzLDve3MY*2_&>NJAKn!80pg6%Ty!85mtLZ_Hy z=|VkX>g+RkU)rjqQ7qGNg$mX?oy-h~=|%MA%2hpTx0kgJNPa0XKx(C}9rQ$2B>Nnz z7G?2f2GsY9UG6p|@tdXe+X%He5XJz&ID!tt(?U9aZ_}~o3sSBDmAG=IOftk2gBoSK zTk8!}&@}X$Rf&Bzhe6`CNc|9O$@rKd zs2?7rr^@~b;#Vh6Hd2KYi2GrEm${`JI94!27=nzeLgl_@T=FlnCO?+|dkU%LeP?Rs z$~(O{(!@+!PpU!sVvO%-<43W30%Jc-9!Ov8EXM9VCHDsk=%-F+zClfK5H<^d^na(R zy4ASf;t9XLd_(LoCYjI4j$T>W$#j9bTiHTX`$(L>8$px)somthKol;TaG%iF@Frea z9!DFdU34J$E2dE#`7ndbK^Op}1I7k?zGAGuKTjxKb<3uZrJj90%b61&7Nh^--fyo% z-EW<*&#xX#-{gratjyXR1xMF5e!?70449v5(ao+HYAr>*%AW6S5%bh5^etn}T|4mD z5y7`v9#2Acr=oI~oCmdfx(lJ_avE`-)hxci$E>O7kq!dZ9SQhzoD-_inXtZ-HU=APlOLE4o1zAc7Z(MjD1PL4N{jwofh>@Mfu{1b6O4D#*Wa7#t}$c zpe&@Nlr}$=K-IEYH^SUzMV^o60=ZKP@10_9XoP24Zv0%%jqnT5;f@Fw9^*ue8*+b) z0dRX&w}mkzgLVsIe)6Mh335Z9Z2b;c#HKs45+CXno$1WF+U+=Uj2p!<1Ur_TmRls3 zyoe*lNAPaKm*9*Z+M)ulwi1)C^K-Xco(z822-+Q99kePrtqqLDac?XIroUJD^-o#a zd6^=wLL(EVD!~nMRCM7D{Ep-6x*h@MBER1C2MhN)_Gx|%o(@tBY~U3a(l)~m zBC>ZxQ6#3y;rvgR5(MB}e$O&axd*2{OxwIm#2wvgI ziK@Ku7X78Mgi&XuW%tG*8QW$%R>E6gIiL1V6o4ffZv*himl!x0P>C>8qCxoo6GIw7 zxBysZlIU#QXjG{lMXj2SwmDa6=U88joNLq5@Er2W+;_K2tHC&3A8@O-?&@LRta7$@(H zBN#KXD)Q4NfD`fTKK>DB{ewxB9Mts#k6C$FtqqnwovLoTLc1>iVOp|yMHSl2<$-$Z zQqur>JsP?~Q)@R)9hlDNk#SBDEdqCokivb=NF_nSnL}g*3lHNi!~Mw--(&yhsG{uH zVb~qK2!GbJya?gSfwtQ8kvFRdvDuAB0PNPtc=yi&SM7@1sH+&d{bp zAcX^$cR!}ixS=Boow9D`{p;^e7Mpo?>jR4$Cddj!>gr%(mb(gsRGeVa6bdCa#t?$m z91;aR@Q;0#a1M5{&y~ff`R87PsUWU3uXnt4Yck|Ij};KS?08wvpZh_N1b!-CDAI57 z$ z)rQtle^uY9-A0%KFgX}|1lX4;rG(P4j)(Yn_5HC_7zWy*&87ft%s_AIRC*MpMMWYA zf`kj<2S|Jr^^S-TkZokpba%0~Fh(l2JogeeW1u{t6_L$X9nhytsh_(VD&{5p%ziZ~ zG?1rtttURNWCwCOP_PRnmur7zD;@F2_`n92d)zqO_$!pEM7qgHi%fDn5Y@9;k$;8Y zZ$X2D28{^+Y)Q5lK{Cgc!%#zwmErvggosxc{PpgEx3{%dnYlM8U|Yq1gSmVLO7liA~w`5vX; zjsUDhOA4tmnp?DirvirRU1WEex63>CmqMp)PtCfA9G?lKRVDX6f`i@BW51wQN~c&@ zzq#;GXFZ>roH}bHBErVNgDg|MZ6O+#Z>?^GY<Rzr~D?8%cDQ-v-Wa z%%J(O^oswqE)b0dsdnm12v;ne!NGHYa(>b0EqT81rZ7sed!k>>uQ|Am9--7>oBq>E zOO1>$RckT_lw!Dl7H5(WV&l()W-GlsA~zkF6-u9Zg3f|{n!jFB6nAJH17bUgLR`UAT*=GzS5J(LDs`S}t86Z(JDpriSJz+R3z=P( z(xT(tmvYU|MkdyeTd{=~$v*%%0PKN?|1Ca2QxPsiP?|Lu5gJF9As5&~6#$3RZwyZCsUM>API2^L_}?wyTo}7ek5EUm78f&&8LsA77x*8|B#GL0C6v(i zd%fjTpa8s1>Mg(WqzrSw%aEr{5vAZ-c$#*>@6lp$k!M_m7Ln(a%MjlogW7O zt~l4qzsC)pe@7dUTg(Az#gZD~xTm2IxfUGi=s6)ur!~_BOa!6j3t31`BK&dboS~Zu zXfZJ+M{W7NLGuRrtTh-0&*~R((*tXrtZ#iRfdZ;xf=f0k6FipR@?fsV#<@IX>+ikw zqytsDSiq!V)|$=Uz+wH8wPane1;&h{*S!%99sR#H(c-FA^eu{UPP%1l*V|W3!$N;! zkI~sf!t9q;_3x?^3rGj5c>v%&c7ACyLekPO=s<9Wd@GFZNs1 zPq5Qd7a|W*EpQCmk4%leq8iTXuhcbI`!^^#G#nMA3N_9ldSE%yStn|Xpcz``PpF*W zQ%6WLia;L$^kO+&E9_ErCMI56CF#4{!(MkB~t493~|s|1L5@tZUUO)&Q#n)EXW$W9*X}l^7=k~?IkQJpnC4UPq;OQerJ03LVESjEmy04ii zzTKLjegBc|`G~DZ!*xVTcbs_m$>+f7hkx=vY3XA=G?ouvS+6=8o8aEY@2w-kTPV77 z)TrF(&C2_T{0wReJeUwy)mHoTlMZe%{YS7s{rkcqR@c z@LNLuEqpIZbNd={GjcOje&6C27MyWzghi{bpb9@9CLpskttsyynhvT#fX&{ukBUzX z#AHszwS)fjm9%;OjYx{>ZD{|HyVgur#GGP@=j!X{pRw5)6StIl719w%vTfCs_LJkW z7(XpMio#o9fO)Mm45|&-LSZm#LY)#4)T^Z`6%WPi_~}h4tE483@+L|oeOQ9KQ_l-a z+4#U#W3Y*=$X?9XFETm^Ysh54T}Jul8ud{&a5F4KXWBe>3qE9C{uos5*CH|)0c9%{ zmb)f^%ke9Zq*HW>G-<<7hbfBl>BMo+JZ?vp5`lcuY$EdSqRYaRQ2cIKqsgr~XZ{d51`}S48uHCquEWcso|BS&ZOzcPmX#x_}M%8QA>;TMs()YAbX^>LDm>F zgBs7>`FbyI%1hjtP~k1V$A{3NkF!3ZAVK2g?_#Q*0&j89HV)$^toThA2ByBR=UyV8V4MWV$nMhfAX>lp2;#vSwp_q{rKWhf@CXgP&^yIbA ziS7@=CRa6W!t~3|8Vx+c%WoVdqf+V3Uo%bg=79BT%m1eZ9MSP7HW)H~Pnd-@(C3AH zkcEv{pya^RIQO`44KOW%i!n8A7;@=p!qR316-8RGrTWSD2e1X)1Vg(*heWqp7$)Ot zC$P^EYv5(*FQ!eUPo*DkbE*UidGrWlr?P+px=k}1kW}0V1X-sPi4k-x(C4*$8uD6N z1{8Y6;B;fAbAEiFW+#t`_n?=K?MP@?G=(UYVXf*TpxzM^6r(7a=(-LY>(z8@=qFCY+CpU#cQQJ4wfr`g-xCl z76zI%^>kYOh$QRlFTEnlzeI0asTXyQ>5GIiXk~`o<=PT#krJ4fL3Kthc!7DP3+u`^ z;MW|`dKA`_m#Iv$YnF(gZ}$fO8!X3x`hQOw`oDq3*@+0TJLRj_KbIx!(GYp?F>W|joGIg`Y(W3k65ysF0NJ!| z%_Ox%Y_%+e@v8dWQs?OFLa%fnR>}x2%3GL~m5OE(vF_H#4M06GItW z270*#_qic)ffA5X0-$&WHmd@#<*>X3?`wn63b9q1TWR*Wdn(7rLfevW1{5_)q zB;GKrE`4PAxN$j_3BT%l>v!U+sYJyDjeQ45h6kL;p(J>*FRf1Ke_wgy6w?`=5y`K9 zlXTD!lutHx6A5YBunT%zbw>0x_IsMphAAn(hcbMhSfwK7bjf89v7uiRl2puG2F!-1 z4es%vjjGHaFzlQ#Q-k;nxjvECAKZ(x$Nf=$?*!#y#+46mRw{^GJ0f|dfs{a2cMfzh ziZ^x?A;>Vy-PMqXERe9DlSDQZ*eoSkBHj_As!jK$gz-0{6>UTWRSRlg&(B{1y;h8T z*qGPr$<$Ls`c;RLJ|H5&L0G#MZ`H+#5J(5{qdfTqu{>*7oFrtRP4`&@;F5AE6yYV- zw(?5(x<+N8%0Z=KjdC}pay1t_VI&yblaj24r{<_{LaLiO^%MWIL_8R5R58qI&TRRu z{FEP5=cou?cGEN3f+^CYkK`)t_8~ByU(3mnDg;XWsL%ZExMeg3#xq8%@}_mlYUTpYsX zF<1T{DyrtlZ#A~$K4O4EFrc&~p5;Vy*d~5hQer}0P6@e4ZO$mCevYqS<2Z|;?y3Ay z@s;6_yuBd&>*i-Vu!>n?ovkxkgr&_Rg%$^FLUl#D549}znmKTJj}hmxDF@4UuHdL= zJ>IQfW@BcyOV&MImzT*UklXu?wppoaD6d)PN{~yxm9;}+4gDf-J#0gK$Df|*5srCp20c?<^{wto~AS#FkTECu2cB&Q=(TQIHQ~*+n z01!xfwL~Col|qK+ zt;R6v?S$W(rGF(+>ro3G3795uJ}BOn**mn`*c~z?6ffbtsC869l7ez%X0OwOGLz<8 z8k9M(#laUxA`?o^W&zDKqFppdE@6Xebu#;0?4(m)nDO^^;RcMQPu~a#0mhV1+Z>r2-bYJe!))$FQ9{|_wYuOb7QvLFdji3lEO>Lv_F_Ho3K2e&( zG_i1JMWNwsgc2>?C-TC%nZc#hNenk?j;nSp9}K%W4!|sV3F+6ecUM0G|1{hq3)^Ns z%U!9IjX>TO%H@t=@%Ja$(dda$6eS(9T3|<;>^fp!VwK-j6U$8Z6rkt}_7#~w|I0O~4k;*u(?55}36L5E%Ge?_0BnQ39C%3##o^2lXv$GRJO^l{5LT_`6)l1~#!5 zqXK@C6G5*duR%zYHY87NSHz8Ys)}-C#~5c94-!OEDK2r^D&d+)P43)Zv4707VHPvT zns!_g-YHf5!O52Xg9vgvP#7|1s=e>+wNnH48MMU7Ia-`@rXjLT6ZM9(2ZWu7Ft?fW z0Tk;)IqEhufY`;iB-CxK^3^$6`8C zFMH4MX!t_WFTc2e?7!0+=30+;JY(cqZKKnsqM9Rr8&8fLS;px?sm8sQ?B;0qCj1qW zb&@@egc%cD2vqlclSok%dd>lB2`@IDb-~LMDZZr>Y6$pxq36}YHdx_$N+#^EQwl$~ z6a|D@>YG?4d|mIvReNq#jOc@P-xDiJMY8F`IAhUkIl-NGVbfD%U+&kuP*y)vw3)O@ zP7u$weX0A>OX59Q+?J$H+a3y>_Vj1}byQ^knkhJM!Zu8t4ITomuGAFQ1!Qk>pYip+xn4#)pHE3Zt@0;E(_tGF_P(`!7{wGna}vxg`fbloio3$v4Su2V*G}Fn;evl4tx*OaLVfVm(Q(%uF|M}3a`-)XpKg6fx ztIiaFVOgH<6D+cZc~Lr#uy!wsBFsbS)MM0V{gcEg-JXehXOaYK?=}9QIRLNjR6+1zxu7rKD{aKqyHtF7>|^+CET z0_rPPP)B-s(>D8nfJ0wYs_`vV5TVS8$y3ej!CwOp)~+c0%KMU;UAvniN5J-I-?KMW z$N4%kA3xH@&n&-+U%G)D;u9fKIOq^So%~ly#o}d-Tzt{*LH4GB&M?^{DeujfKDU9> zZ<;^;xlk_#g)W7r-0a<9rkE9Jx5#cI@^OF*x`8#^k>qGp`Gx88-%EkZ^B&I zYf3;7Fyo#({!WxgotSmP5qrjABhxxmw?4~E9$#I#OID!R?KKCs(vyv zG&CE_p#@b1=&+Y&Ms|m#{fk}Nv++&Tlg*Ou?lFJk&yU>2-}>IYX*O*n3cSNL`K$;) zWC2~%`$Z6Qq_z`w{4p^yHS>JX%2&Q}0XbN^i5y+~LIqG=XvtBt;RO9D)eVC0#;>2jyP`%%g86hDf`;pLM`VBFu(`rvk$ev2fGhfzYI9mmGzJbvUv>K4W=Xnp^7iAsB|c^h*Q5!WZ(hu ziY*RH|13KoMt^}!XkUy}dSavXdra?;)2jWJ2sOC-G?W7GBYC+FKjyZ-CU(=zSiA1X z=_VZ9>~%6&r9sjQdyZ+30j{$H{ASaf6Z;e61U%q6ZuC<^c|D zukigo{c9GOn9E^$L-%kA4y{&>^><+1|4e}=_}+E6nv@xFCNdbOrfcYF+(!u<(sKYr ziW81NIt)9GF0))+)_*pElmF8Kf?UM83Nl1%Lzi4zL)~WjieB+!i}H$SC*cmbuzZd~ z8`^R4qI&0lmq(9DyBs*A)YR`j8Kb+gj(Hd%n^}`;Z;k%^A&Z+PSv#5V8 z@c5q_qDL!NQnbU!NyyZXVrE@6UD|_Z1(zu_!-+w_-im0U{x54xDmPIDH6(7Ew5MqJ zxlQL40Kw76lfl_ZyQ}ebXzFKAQJl`dzW_2~YV;0#Sg~-+0V(N0jJ09{?7Nym`O%tY^*&sKB`1wb1-rz~G(?rTDf+ z{=Yw1Dp-jKpPAqN;jDi|``~^q_D8aELY+$Zx6^v0R&&o=nA`XWOR&(xL;9>@b?n8A z5Q@Sa4LF<+mU7Y>SD1KRw^)W9|B2e%l00= z_axf%-!r+N2lp zrc#aHc)m3OQQ+Ho|IFs~xI2~m;YE$d7wogWPQo0JM3sq>cMSAA4YXU&kDgl5) zOu<5UpO<}GYuq^vpOwwYqU0L`Q7MJ}Z#oS5NHiV6%ryDyzE*WKCiXj|=h_o7VxTSB zcXr(h!L@T0?YwugczxQ}J%mh-`Jst*M?mXc>{V?G7c1m0DXi~27kwGXqG$?Zw$mBj7Eu{Z5EsSIj-y-q* za3s?xW(%3D^O>-3!YOJp} zYXId`ahD4=Yw0!|#K5-a*OUB&z?JsoD$LMV1IfLIN@<;pb{E!T$fCfy9bKIk8<^<3 ztC*2jxRoQW!RH5#)s7vlz(AYdOn=W)hCG?6oqT`yD`2lZwlEFkt<%{sOsdaM#N=9z zv_Vj5kT$JFGD|_Uf7v&L%OSiEmugwG{&_p-8fv+*@$%AAiSrS|fT#^jIq+%NsEqul zSIoI%zlVAczd&Y_jW0Z1zOm5mkcdTr#+cXSBcu(Hsz|%7u8ZkNPG6r$&twO>YohSB zfF9&uxkL;MtwI;|F>PM2)Qak>Ib`F(E+z9k$8ETQ0SZmZvXr`TyHGf z^7HVsK^j<=Sm;h-=}Oo%+16M2@T8llj2M6=20U&N0qG)IY9OV_W!?8-kOenHhHf|r z?iVm<1qs;jJv3MkDwUY&s}rz%UigHoY7Ox4c*d@LM=_l?lM0o^=_Gd>(VdTYyOBLL zZqc*qVoQB8Tzr9`vyeeOzLQmr?Igu+9*IZ!2^>d8+CkhbYB&Cq;X=*jB% z0W74qPYl^5QHF^Yq(vDAJk(w9Y1IG$M4HM_tGVMM)VNa|VQ-$7HsK-!Sp9X}DB8w$lG_7Ns78SDJM zLRWq>)!uCOJ%$&Pfo$qvk&Tii>@*crPvDb{AW{X5duJeAs5|^_^Jn;llU%7mi@z-= z==&tIPFzL~e^ANE@9G$-U2HW^%f78M#T(MZQbSVL>CIQisl&-%ttAUw3 z^!L}dMAR;oZgCpGtC|pW0SFZ9a7d41qB>f=JjSa5pkBeSQ)x@IkoT6wmUBe232g0mV)D{qY!IL+H^A=5LoA7mXlap=+t_z`ticT=n!pU$W6nROHTL-TeUn<>!M= zW3xYU#;cpEMs79a*V#YgS|1UtIDW0Iiu7?^{hH%SAmtAziAT+l9Nt9cR5+{fH|>8Z zmu&*`t4()tX|ZOTz9raNr2OG6tnmZ!7f~*0zS_IsX4`fl*BVCz;bpT3( zFvQZkU%gFD&edX+zR+iqRxE0d;I6_4G(123Alc;_pA8?;gFL$6pGUF5T_;Q*Q0;u6 z4crw!>D{lz0^}=67UhM$Vd2RTuc8+W79`9s58(IjGToB;yxWBSAn@~>b|I{U zdtFp`P?Ai?e+nk05c@O@^F}QKd-w;KECxC$;&{+~58+L%o1ppwtZS~agZb10yWO5~ z#@nyDSY8~VjK8v}L3yqayaql1k~Ki*f34ambjYwsVL%_A5Wt$1r5|r&Sz~4V?q#;n z-ynbIzav4_y}(_nHB^(bI>t&Sf~VBh|^#T1jaCpIY<#{c-6mOBFT8u-}`f}Zrt5*I=3gcIRv=el+^spz+tTdc9Q z(#dpo##9J~H#S)!DsLy(Ovp4A0u>FGeetQ>bNDx}*uoW~02|F=ns-1@l2nRpdfPGf zG}-k8an2=)G-PmHSDeen5Q%AU_{#4a%L9M&8v>cYPyYlp@M2}L(qYP%*xa-@=!e%c ztpcZCe{FZStZuSgE1oEHV6WX2rpWMv7)48+lF|xM2ub}81|F(nr0y6@S10|0gBg4=MqL+xg*}9AmQQN;&?=qiDBe|WQ;vjI zNfLGi83X;)c!b^sKMeAUv}zM_K?q6GFTi4I8cg-f znF{GD(ZxsT)@D`@k3tbO*O~v!R6(vxk4g{lLJa`$;;{p|_)J_nmg5IdlRKVM4~m_? zX8OOokO>Da-<4G8`7PL7ry3W-U*A!7!c*z|98qR~f`#(KYS=t?93}1}v|b!ccJSFz z#eh)xjh2G7o*~*#mZXviRIC8KN#t+P<{~nUQ7?TuLt0EH&k<*c{k5=XV>`w=2F_QF z@Gi>W3GZC7Eg8-6`M^}=?rIe`h6wF}8Noe4_K)RxmZTxGPp?lPgfOp*Aw-0Aw&K48 zZ*0WJGXkUD<2sOq1K&@x;3NLAE{2!+;k1dP7VQe(WoTSZ-QIC^k$7nl6rt;Lt4&mv z-fkO5fqPEL7H*gBDSFl=UZsi-by*pf;R(CaXbN-D{o%c6IdiXx8Y?mVpk5h(%M+O$ z7m3%xPT#hdG-a8P2V7;eR$T&Qqi?62k3Ds(BM8$eDfniJ#6&O*%Kt_LM;a3P}qk`?%BSr&@y?*|qp z$R?WNG_UQG7_Ci4u66L`-87_5m{HY zu6V*`9x{j$Nec!7Vbvw!9pixoC7)Rk49fszmm_!V>DxOpD3g8r?&=dCeb-+JjFBZL z{^A$z4BFV=dpdE=`edC$IL*<_kCl-V5McJpWGOvZ`q9)};(Vzk*iqymVc#Q}s4kR$* z-E?;E6dxV>19-b9^*Jd+Cp6Y&DXjr9V!i45r>%7^`KxQ~tGEPfyD;*gh^vQTCZ?WM zRF;G#xqE}WY)_v#!FXym9RCZs2u<8kVa6>pjA8FWW|HN-4$yy?Z`eRM`^c%CqK$m> zlMZF#K`%W}LHqx*04y!%h|OAj9e4lu3lI{^J1qUUZda^{y*G3Ypt*=C%~WKyi|oL@A4@zRl4eIk_#g@Ia;v@7I%3&3!Y@h3 z)qsYHh#Hr39Cw#h3`y>Eim!>i_h)!>3S}XRnwar?V}Zj zc)I@TpsILfiCwYl@yExqf2iLPcQ`}E_uO`-As_tsukmT2hvJb)-#ot#+mi^_Z$sH? zfOwl!u~v?F77tMcf)B8!aCkBDraRiXvAIX!=dcWlBi9`y$-cDxOfCQk#q&qiFMLpS z?(b^h7;UrUQ{HkSw2#%99=71n%=$TwVaMPA*Gc%W;fdyd>4!y5nAm^pIi z!3|n*k!b8bZoF7M4mu?hyHzl6YWf=%GOiLQ5?^8?N?~4ajQ6V|Ko}qNiLm-9w9VcE zP5mVqG*2<@KHWD2k#vs=HeQ@#v4j=klOa`Y+YOfEz7jqiNS=Jrd{=@%wSH5mKk4zn zJ24aQC~owDe8nx9C=r;_1oOj@=MB!G^_?ZyrWXCfuv1D{$HuysY8KB{WzDU^3!4(k zc*8@F;QRgr_KO7}n_b(;v=3|~p)z=iR9iQ)+xc&%iLsbcSafWT-m*Z`GgEGZCVA`>PD{u`t2v# z0H}Ag7x9VlHYjPq{sXl?2Oo^IS-5JAS1?;#B#COEx8UJ^5s^pQo-aM+cuQEhFbTT> zs7hG|MULW=JbMA8(|=i8IZ+e5vzf}rIS-;UZq~(%mUdKd@>asI3K03`K<(|Q)5dcV z8TBw4xIbyPk7DXfgj5ytSsq}2Tr4fSKsLQM9p{7dksarI!YUv+tZqQs^i5luEPzW%z3xWXMG1 z@D}QW)=%$G@}zEdEzV0})K~+YvmrBIolZMl=eHUMvk+T~vX)z2668NF*Bs5>++?6u z1~b#CmvJz0ynX|_nd;M;lI8A(yWqJ*QG#EcQV2ITgpmfBXx+_)`Fiio0Q)WEQiAEB z>H638CUty&#oxYzmqf>RzN6$Xne*3LujtGUM~tID@O~&SiEl8VD>cni#YM&3-yB8R z5F{$o(lX~<646C-4I}b+_?T+Nr+9^>980 zdJC8pD5H;(Aop+u`ZGaj`k9EL3d49HRr)&z zTrAfrF3@pGmxXoIAg?kj9kdk?&YKBUY1qd%ASYDfz`x*O=LonUZ-KchmB8g&s9;tz zaWQ_DKn}SNzu5|YYW>VRE9SabCs;)okx(u6eA5^_!9_{m%d*(yFKj~L?(twtRT3{* z5Kg2qR; zXgh{<@@zGyzlPsebMFMb&OaG>KJi6D+Pmi(ys$w zPgA45G!2&4Vs?%+y}KVp{-c7Qxg7U5V^izt{q5`D6lg@{Ru;h&^a;VLQclD)x-V-Q z(*R5Js=WO{Cxi$`mwgZjBbCD{g6c_ArdB}pu;jQ!A)REB{Z<+$KMN4*jcRl<@2BLC z=l#nKj+aAr`%Imt;{cdbWut}s+&o;pcM35Oo+?$d*1*uX?*w8Zw<=R_W5YhA#ZRn~ zU;hO^+RY!4tmv$!dPcSwDREq6i{n`t~)2Q`4vNJ?R-b)5u2|My{YBjPGe7jM3nE8f9VHy4kw&qz# zNor`S2n6+B`e3e;`6U$r&q%NzS>3I#abf?grB-4O}hN>a@g zd(FH>CQbQFl|*&MDTxG+zOQ>}4_l=(-lK$)>2Xqf!2!_hfz&Z_vkrn>ebafO$7B4u z4^bg<)s3BIM(OB;E5q?Rn8;M&fA+GagX%pZH?|Sva@WUuINj#y0@W%q7v^X<%U=;_ zWpxjhcHSgwhK&aZ9$1FEB6TWz5|G{DS0!pBY16*6n5U8V6)<@r>)1AIP~lE>0XA5hiv2n%0(KTu_TiU*6rq0YQ!2k{~Dh7U=nQEu>22z;6923D0XG* zV)qhMD0xU$Zv_5RNHDi7i)OeaWA2mZi`zcSrFr0j|*RHzZ zTQ@`X2H~`mR&%lxAe`j8#r7=9GFCA;LsRTe^=WpS2$ndd2|QzmuC5~@nDVcDOtjgE zcQVosC2N`2u}`9BGyWdAmPj%VR3#&po2^j%9uS4fUVGd;V8Kgi@U@CVXJ+s|RW4p& zo-V-$RKx)s9xI2k)} z46#=VbnS4XQp{@p2^kDmfFPOF?+ZxY^n*(mJ zFLo}O_%LD&KgoyV8Dh_p5r*a>)qGlrrhok{n9ik`pOg>DeVt)u3H=Av?-7y*M_0fH z>jQ=7YV8f9Y&qH}B8@q<7waT9^yAEiyKi#~H{-gMo18HLI=1DCm?DoTkPT9WPsUMb z8!bH`YIw+(RX{>^=oY+2z(mGjZn$Q<>%;!J-UFRq3WtLh*s<`95PHGw^XA=UUNApV zh06C=SWl>+pU@qtLT<_2#bs*zaO=avoCt3mY{U`V59XCy5kq^BgH^Cyhsq2w{CpqdIPX@+Zt8sPpQ(0Zjl*8qFv zza5HYZXFhP7ZI?r{=(O&>`@nbFFP2WM)s&M%`U$5u8`LwaW+*<=^e6hF*0>N;ysHd zF8mD%o9|AUK1J#xQBW{{%47FW1VM=PWq|%9h=g4P+lg&f8b~1PsPP%q{2a@O!BH>_ zEZo38VQl-93wFb+G>EJfGu(CJM0Zui8^Q?>3qbqWau1CL{qK^ZWV|=L)$J1EmvME# z2W|@8$rU+w?gIB-VJlt7fGW$ccVsP!sd7qGKy&UTiCcebdsS~gWlBS~xBO}sKY-As z)XDWTMQyhEU9V^__5Xy3>&F=Ortuf?%Po<-C~J}2jQoLez5#wJ!k8>!RSL*J*C&?A z?6jGR_9$^|2$Rqk2>?Ug<#xjr)lOF0p;H~BQO^%r8%0msnac4B__J8?d}0TuWR}m!1Tk#2Ho{~`z*$pD@9KuK^pC&OOF)=I{6`ArT zeIaUn4Dw3nz?sVkrXpVP4npg}F+bgu^ZcSF{YCGgII-6N1+W&X&R+*Rg)#*=7z>E) z9=1E`7RNWW3A(7fjw?;M3a+=~EX*U$2Y*s8*c{wVtVNlCuWA9{JFVXTKjzFH1PdvV z@dA+Wgz!G@jR;c`MH$sTCW#n<#(!KBbo4VB`*1i|sh|R*j0!l2`=zmeI ziC3HpXe7&FZT?F2@ zhx6^4p#!e}(o386+u?)A$1C*;oAe9mI3p}~lOd3~Opqs^bA5~(1Ewd0NeH0MMg*|Bc#g91VlEN z<23UGsdxJ&$wa9aRZCVnE@iOR#lAc$SDcUIM3lKD_fa_8^roNmwEiy(n6S`6m6jNM ziW8<9B)`8Besj$`q8)gJZC{5G+-~>6nOsX+#ff0J{Tdlcokh`qXEGPM<{8Hu%N6d` z!J9My-idZWCJVO-kJ!SXl0zP3CGd}AxlHx<2cWRUa$xXU~2t!d8uc{0;Y*jF^n zznsO{udQFy(t7BSMmT#?6vgQ~IP*Q2T!-E0Ih#b$MXx2ANZHNJ#SijhU3YJCwi?(D z74VM)VpfPP$Cjjeb)}DfRL6?LMV|8-D>F+0ic%QHx9RIs?|MTK^76V^ z8&GySxzpps(d`rQkSinfdg{ruKHI$e;B7~nb_NBxot ztFLc-HVI~>ei)T-hD}l+)eZWeU}=8In0lm}c!+>32+G`+f+&<+6QG*>z=uGOV*&>$T;fZU!i;RG3V zuW1`e>dX38JkarzwRDexC_bHeT@rJVc+6^ty|}h!FqB15-|Oh)CiseFRH(-Nf#7!9jFhP9WJ(P4Y*H5Co);mV}D zAq(r!%m!S&1iolq4Lx_QlOS@nUC(i=&F#|;^j+S*8I0X<8W6=s8=w7x_3vAy>}}9- z9pMy6I zeeGL%z6&ott07Wv>~Z71FV&39I!+Jz%tT*cx_e@8@;haRtek6(En#)(Xu9um6e6S*l)~*D|oEwW~=L(A$NdK7i9B0g0D7(w3ku z&^&z6cz1Aj(e%`bbDRHTszBHS!8>+$BgJsO%P0BwfqRX|xo?WG|MeUDFx4v1&a%r{ zOgB-YhQDCCel*~>jLr+^`*4z>adoRqvEh#xdTC6`NQLjBSvFgm{9|9m5B?s)Z!;;K zKZ-^Oi*XmJgi-k3bmX9F%H z9XY?k$3CuPu0s&8=F$8OYif|s`~CKDYQp7x)Vbf9Tpe{$oL`9|#` zU;V=y|4BdL7sRm{xqw!uo>cyfuBVI3!8fhCSY%!FgB@619~QTB-AS=ZX--&knu26$+_wYyw=Ab@ZE z5a$=dGmQrP0H)gL@|%pE=8=5&`}j~!_6O>MYxuM*NTbvAN62PD|5{&;ziL6m;QHUY zEQx>d^{TN%%qQECQJ<)JJ$~Lf@1KnMxw)JB09hpuFeQ;!a4Cc9SS)Ly@cqcK3QPEr z$hQnw=v1!w@~$RXv;_MxHC1}+)k&%l_K>0RMTJIouk{Q66jRTOzYrx(HjbG*5Z)Oj z1BfB4f_RU3b;x$2c7J{kZ zh0Mr~wcdo=08tnpN8#k=+e?BFb%Lv^9Kx zbGA(D5PB{ik6a@~>|i9qAAoj$iY>#!9kf+kQ|x;q zgG12f>Kf&&V~*AR7WzVosFuRe&dgjd^tW~0x4yrgnPv@M2c(}r8eUKMd~Qi(VSRwv zqzOL2QVo^X@bxeXXrtl;l{0?#KMD`Eoy8e>og;uRt+P@Z*F!x&@0poS(IXPj3kDvq z?5CY)yyEmpp~!FGVhFmhxlni9*OS$DT!rFxa%Cwi!*~$v4ufvZ2N!>Qju-CQ3@4ixDqu6pgLnG3%8*HoC4V=MTm6 z=Y3}szt2HrZz<_0$UfWY9t;9Rc>O{^g&0h}sb_WlZpf*_L86c3v!-}zDtFp<7ek+L zI%5r(E7G4-d>!{D7Y>r1xi`4K(C~xqB#%IiUE@I{BjZ^Dx(VwWqpbSLryO64O?~d0 zEWH@TlZ#AsHWpCgcD}6PX1LTIhKSWxOms*bDgX964#mBgiQ6I&W8=6BQNh{X6q@4` zdWbCYQQVBlcjz7=tmEvh1)2-DiA2r3>o>u}`SRdNMKuvno7({JLA{LI^2ZGv)E&g# z;+wwi^H0>2jNdKZG8oBtCZ2CPeN}l5v%xMq4)L)2qUjMMDO{MbXqr0ikA;U++Kb?? zA>-iy&%L|KYL?8&iBphL5e>&V-MqWCqNGv!#Sksmejexc_ies0B;91`nLdSE?ofjM z_P9mE+u6xkj)@7I6Gt$fiU5l|HH;SJIaW2sz3FkkkOh&l$6QOzOAiep`}HJ>7R6tn zM>UUX=5FbQmF1=H>0J=M4aBLe7#QjqI;3KZg0SFovu-CcWsx%i01k*|N!b9~Xjo%r zvc>?lf}cVbkfs}cuS5gOqi*A!VdPbe9+jPq6y=O;|GvFPk)t^^6GVT}0&DJ~{~8ju@&PryWM7ZsDj(-D2Qpt1P_^;`R}@4J3# zL;l2umd(Qa-vdlyb=3`vqKa90sZj9xK2=ml-U@V=q8)6uaS#OC=@O)oDM?=dh{J+Q zNqub^5TyZYHF-rvE-Z)lib;a?<_$8;_E=x&PAFGeqR)u%Viea&whp_Ln{I*-jBHL3 zjNs#;M3>F2 z-G*mTj^NRjGj{LkDsJB7F3nGnNbnfjZ(JhtqsQ@vbPs4Fb@pZKHKR`@tJ=)}%-qF8oGn$LMO2N1 zKlYfRuIwN3BBJXc=1L=Vn(Q1|3e9U|HKJpfR?SU&Q(KrliLuKklEQxsXS2I`tgfj7 zT{fHl3`;FU=X@ZX%;RLrCXB&>{JJIu4Ee5_HLct#1W$A5-siI+#~*ZsUZHtAzYX23 z&U*B?=bTh`#wES)lhUJGft-T#@vw7ThL_&PSE-D1AK_215Z@7`X%E5kakx(tj_j`> zx5aXRyzChndKG(K4Q zk4_q{WS)kiAFVCuC!AqrsEOv1_I`AF3euP22TS$|1I??2oVvm#G4Ul<}i+#b549gIyids>Z>%!$T> z5;>-rHJO{(kxp`G_<78_99jM<4w^e7eXee!-iRLk)d8h?fFM&U;V=icZi)dd2};N^ z0|L;7b{D~IJ7>s{i|n^D0U!8!m7s>7D?n5w^;h6HJ}Hr&W&cNBwmK!#q#`*Te2$9u zFbABFiPVuMwR#WD=$}8Y9@Vu!3EHvG`LzNEM-b|av&qM)r6X#4akd_!(_O|ATT88mQsRzUj1M!@{VLh7CVRUy8E zJ|AOhM0Opz{)?Q}RXN8ZOsxV}rmA7Nt5|Dn*H?!zo;9H+Nd$4PSqGt&SK4HIktxGX zVB@^qb;<1B-h+-6=@rc)r<(`wZlz@bH(M+5$`pJzciikIzkSP#y+qixl;gM(%Dzv3 zM{-ud?f_xE4|J_IL{v;l3cbAQg*$2o6Z`9dB(Ez~l)05Kv02n`g zSsa|S0cyR41;8F!KRYIpTlK z1_OQ=C*9fFrkj1T(1q_v)_dJ_2OR9w_Nb0r3QDrqAwAC4F79(TGV}o5rljee)Xozh zT1NVmGUPZ{S4;};WcfqE^*ybRLj9yQJ4;NgO1u4@B#G$X#YdBsOyS?YIHN>%5J%d; ztTcae?d^BSt6=?GRK$zJj}dWEv+T&K46`%|EBz_pD~mUy_0y>YPkk(HZzr$NBs`K% z2&R_9ry@LdfYOV9{jFz0(q@?+aI%|N`~u671z!u(7-y(7kk4@5532ED{vO|Pr#-+M zH;j{d>kXxfWbV&~7m;XwBfdB?-G3DY;3z7cLC?+jspiNo$a5BEHYg)<-%kLO`HNaTD)1m2F+_#QY%h$uR2wm9zi zP#&~>W)%x^uLRbBMTn#m^)T1`J!A6`HB!~GD9Q96SUTv*uyBG>_nsL@honE(Rp&`v zh=q$J37=+Rjz$1koP+l;o*H6JLF6ems194it_a>sRAtac+ zL8o3l+gSQYaoNmLwbu(lL?LWBBW|NgH#f4d46e6alp_1gy-dXtZMTi`#x?P^Eb;qK z{Q}&CY>=^yZy`X&?&n>^$%?~dB_At-E5`H=jwSccxzjx^)ISOXOf!~Sm7m3VM2s(2 zHNY?u1j{MjFC1%XcZX4hL{zWi^qAnzW`BD!4;^u@Yjb%GL9LkcMlQBsGER5pydHHe0YY z^Gn7>vuS{OJpG{3iijy5}WEA(tqCpdQ%~KhpJkAN>xqh?LrXJhhF(9p% zU|cko?=rIt!zmCcKC!KjDyyE@AhX!CqK+(G{pe#ymU{&BiC<{z8r3iDThGjnX$bPw&QS=E&h@Ni0qp;QpGj(t zhM1^r-2IgjIjZaHENUf*ft)$A>OATf9McpZp>1Nijq;wvukHy|P~Cr86TFbz9$`;c z0=ZZ>q-&fA1phV6?wMd5!_U@im%lMJjmH=8*nzY!-KM5k8dW=dI~h^?6SSG>EJYRk z3~YmnZ6YgSF~^ktC%bP(@-@j@2C$iV1GZAB3Lij`w8+|9Tz0)Qsuv#A9LYXl`;^{w z#DfI5${cT*reU6fTER{tA~VMe6OCiS0=Y!8mth#ovY7Q>IX|hN$$WfmO_qt%S4tFw zr2|~>&tOMtlocH+EMdYIP8s3EcpX|aLMwq_5-Ki&6>RwGu@DpNuH%yU?cbC@o+`;T z#q|~&r+Y&y?(Mari%{k4n1xgDm6`r-8etC%sV;$PX+fM+zg_7uAJG=;nTd=C@pRLr zwwd)-*D^M=wX1--y-QCg(+x^S5KjBqV}j@l7@A@Q?G@!l9udAz3;T8y=2pXi^smKv zcAevOiffPk@1PJ}$Hj%R=e=RN|0IE%!d2Q$`uk5JFO)K67Z4|1zHk$n$NIdqlWqdG zNQmmR(l^m%MrI*KL0FzmL=P^#^=GVpC4hq=hvw2(l?_NIk;QGQ6_J7LC1weq!QWlw zTuI$|0H3mentNaFwt~W39JUGX$N;}JE+mx)j~4Szv+kr4hf_*;aq~~}_WkPD=?`q- zKNNQRM2b1P@#2ajg*r!c0WV82=dPvC69V)W;x<$}E`P^VPu8zCQ3{}P)Qit5yhep`3|w^%P-YHdI`4{(HC9Rx0dmoL5Uha#!ABMOgm%5f{4l4 zBDqM)w=@|mY#|(_iRuLEYMMsHiOSq7O=AL;$TNh>b=jH~+4@6=>_{Zbh+WH+#cBlv z`UTno_w4S07e7?|!UyaySQRq+ant$qBsToj^$Pw`M2^>i`$Y&e<{gK}v{?#Bnb-}W zPN+X2|5&Ym^L!mIKtxNlr8klO3YEO_lpXaj&bkBeYn#32UoVFeQe#h`Nl$}WMCFg6V>?N0C~-k4v;Uegb?RS_%~bI77S5QK zEfS@x#}U%P^xRI(7I#F5h_h_2s4Rs$@ao`5E%hL#F_qOisHBu)w6n5)MR{)y+xAz8 zI{Eieu}Idz8Fl77ew6{K3@tqg|K!aqN}V>O;|4tQ6q!EejW#I=Pg4^Ru;eIIm6hM8 zb#m93irCp+wpau+1ZtsEgUfQh`C@@9peXvx9y6I=2^yK~EY#x0)GUs)OTHhCG?GPK z;VY-(vQ20=fQw4DQp`~Xc)pyJ-VHlDeb?reeYaJQ*HuhkP+4rbj|nEf^t=i^p(DaUL;?X$)_gAp zP?bNQ0#N)ARK!<@)r{=u0m6&sG##5dm#u@apqAjiV=@govGrSI>A+O7SrDB^`qc&(h!-^h zYb{xz_uUHkfAVmb>FhdnX6bb2L9!UbJ#3pp`E)~#9r5zVZVh} zTcU7VQ=YjB(#L4F`gA*N=q6KMkDD%fVtH7hFb+~(hzO>1okWqkcHpbLd8+t(EI@cq z#4;htDw@rACNkwR>48EA<37aN`mOmk^9r%+PP#?mq2&~Qqw~XG4fm@A(L2urDcV@8 zN|I^NAFzFHDB6&WhH0j(@}#B?i|`zkFa*k+?XX&ThM24R=D%*Icj{28E~Ik=t^Zh( z$S~)z^uoIIDKmq&Mmb*6A&tlM(n9Ykj2u-WOimT|eaT7K^Hva&lLR1WVB%^0@_UG> zIGb`-?FK|qoLz$o7pcdg@;w?XZ{-}Z;~wX;N@9(p=BGBM2=r{U*n>!COd)&7G$Kp? z<*6EuoXucNS8o7iYT?tT?-(3;HVWZuhrmI65!n;=+SGa^%#C5 zp&7__bor-K;*sT@EDhUlmW;KgXqVvOCBu1<6TMv(r(f&1EyS{aNr}~SQrxx!oUMhx z@LS5;E?j`+2#9YA(~cIh3V3vIQh?OjiPyloXJ!UsB1*4b;`0> zAs=X_4}N=-CzwVcMEd*=BJ(c74aic?%m~bAQCyaZ3u>_mWN}nZ+DhjRCN(Q~DY1`3 z#kA2?h%SMmjZyQ5v8PHZ>a!!V=x26Ra7;lufD0w!m=-$0wqzvSrpnSmEaUN_GVhGB z^*Oj|7NUBf)f{rVba`@i6WYFykUqdMbcnUS#3 z@J720MD;qN@8#pXX==IdSBnw0k$-di{`8xt%W|RJ@{-bSBCB5YEIDyAk>&B1g0c}} z^Rjt`@=&F8aK5vr&QjQlySEzjRJmMMW^uJ%evdF?@fo&Ar1-K{@|N7z+l6j&LSlr% z_C0J{xz5x9lS58I<$VmZCHxAfv&m-*sFOzUXM-RwF`gv*qdrGSL;EXvI^4zC=5ZW5 zM<9h9ZrV!Qn?$`NdPbX=U-i5jVDGJM@vJ=y?pCQKZ^Re}x^*u!j#;dkW2kBlXq<16 z6Gsw}?Y=mWY6&J>^HNh-r z5fm82uw-v}vuF4Yqj%gxqc!ED#p;6OVdl|BwdSAYai%aLwbhU#4)GMwIoXN{(p!g~ zu}Ic|zP=fP^=txKB@N4T)eT{+#9z~)Z2Hz#95Mvz#_eKJe6@+xI9+JBgM&m^>@JtC zjqdB|b}mp~6$~B}lXH$J=(~{Kt5o_5)*6Dai^uc(T|&5(IxPh}_Rq4ag`uMSDPS}4 z4P0(CB&N)PGDWXOdjFMa+&Y%BK^mSdXpMPa_t(EU;4&2;tSV}pNuT*;N+a;+@fM=Y zJ0~Kkt%I%)PM1?B3G zAHWCfU?@kXI6w_o6YBCE`sw>=oU>_yo&qM=h8NI0LU>+v5QsUuT@HN*%n!N5mG5p= ze;n)QvFWb%AFuz3Qe!9g4Kd}flcU9xv6NumM4s8#JaCy)qTt|mauOYwZa{Q??$`%7m zh|?}e*cW^P`^Q6h3jlcj5l=51yb6m#z+gq}_{aPa!tS>ndh%XLSA=EIR*hns(FS&r zbaS4F-t+e){F`IPK3;)u!|?#@rJg2rcW!T#OT+y&?4MX8M$EQ=%N9&XVg|!(S{V=25vYmfNHZAd$(` z&g?AYyKWe%Kx6Sq`DR8NB#>ld!&;x(#hioBahCXI#1X}-sI@jl(I z*XEgwVW7C@*k=b`AUa_VnKgEwYK$0ZYQL1*sQqL8mtH$k8KqU9b3{s0Gh7_H@-3c% zo6=dojjGmEiz1yLpQQ8)F9KU8qv-4|CYr5DxgOdM!f9M3uuF}DavjiV&3CB{)*D1Q zi09m?RQ%6I)UR6-k{mzV&>xIEYmE_p!E1)Q!H_0g+0^3IsonG84Ozd4Nw zonm|BnbH!d9(}!y+3?ylGc_6&mq#A-paR%ZKyTaT=>82KY)hdzg)|%RD*ueP(y`8_ zV*C*=l!}2CckNdAIFDkonb~5y={8pn8RKsr>k?exRtxxPHjE88u(N1&kWOb*iI{#P zRCS?%KwJW{g@Le1>6WMgWfOYe<-`|R#^mHQ7XSHrC#!!TEocJ)$4?O~7Uf`(H&Ba; zzD6s%pO{%uBgG?QS&6C~f_1DMe-9+GtI%$?HtClsvdBaVNX@(GoL4{cH|=>kn)eKg z|I57*{8QDQ-5q7P#WUL$Ka@JsU41F8vNkP$C4?o=p2D75E~rrIG~LgX9))x)X_x7R zUv**#%c1Y0j^A}eMl8llonQn^hkBI`M>AxA9>@fz{GFyA|UPis_ z_S3V@2AIc)6{uX#z1|9Tzti#C!h6l5{@B&LJ|tc|;YQa4qw&mzFO6m#$%Xo2W!S{)S-j1L-LIje2ZYekUKglI`H-J8_9hH{b2&nCY3tRjct7 zIx`efO6w&B!xvoN4oaqqRq_{38WA@(ys@OO_S8@GrMJ3(QKvkZrcc-Uq1DY*6nvIR112JADmYu% z-qDi(kEXMZYw~^n_BKY3?jGIU5`uI~H;k4pX@t>@NSCz4K)OX3(%nc&N(o9z2;#HP z_j&#P+y1|I?Y_?Q{XULVCh}>i=_KH&b?$u_jr0#6p&V%(tkgr!-=)l{WbUX43_Yc5WL4>DObzyX zMpzhYUzM!yhiwA!PoKrkX0B|1TrAxxrMqtyEsCuJ)3i{t&)9&P<&kcepOWdA zup}0cnt&}X=yo*>W8%j)Nf`l%PqN<#}?p1EZ02^7HV$yC>D5L8|TKnq}K`>CgQSQC zV_1{Wiz3;2&p%PaFHj!Fn`oHy83j~1Q@kQjskC-bJ+y^jcbIS}k3yR8f^rE!@TELP zlXtLWxq{M=u>O?6QQ-MHEM;Y8{$mNo27`>8c}7Z3+?B?uOtY};^p)dXJTjD;`rMqx|^5MAy9zaHCQA$fHO`}E|7f*jjQ$Sj;|I-}CijA$8 zZ)N>9Tjup=5{e~eyI-Gb3$H&5^PloY=jX2+c_sg#@HX*p3)7~WwHGRbX^~_hyy!_2H%Z)Q*^b*I=E-ILR#ZpDKY?8l zfKjOI!k-MQdg=eFf9{+u-ZmLg_eme3;hPpGguCM!wUmQ_?8OdNJAO#Da?9O zkm+F(Qi4%zrC&oYHFW=dvy^=#nuy}MVzJ=#}}S^zfVEbzbePrAgDF;1KShaSZHbWtEfzCvo!9I66Rfi zlg5~R^D(D*^6;}3uZ2cp-h=30v7#qr8O^rYHli0%>x{I66?mcK1P)%qtzS3|?y(P8WWc9=`WHWdPo%e<9=gxO z=}({8=L+@k$QKmieJhTPcg9K_tIs2&9gB6NFQ6e|t z6WlNQ)?iABO%Ho5W)s%g0zvXPVsoMvon9&tN`o&Fw^8SdO;JIg2{Vcpyygb^GhB80 z)0P?mLFaE(dq~*m`tj|+Vf&i*yM~dX$5^kDX3rYKGsE-Mh@C(eqy~EBiIX|6!Hl5+44k|NNs8G0m$L(vJd^ZdfD;E{UoCU+Z$9wb& zaaa!6iO2y75MmHK;vyOk>512WKrs0%Lsqp<%t?am-=qO5!y4{Qmfu>6c`mz3LMsNt zR)gr!axa8g-v1K$se_i5{9HhjP5Qp|8=bQFd5JP>OCix>SliH8@K3!(qs3+UlxD5dflgM&+cded^Ywr&ayf-ZHD;%uXwVmbQ`SaL z+5uK@Ls`Sb5-}o{);%DPmCT6-N6+{43NHFe6&Az0p0b(1Bk=sRlhE$!7%bl$vzsyW zo+MhaDDUo1?lTjLHytqVoODt;vA%w`aMG8}L)-2JkCkXO%bpihf6#WhH!KB}_dju- zBJJLJJ7ND!W>lMVIBhElTL`S_j-;oce>!k}3hy|qU&hmvU|)#|rWfdmys?nA3$z+O zXNiYiZ1bc0G;^Ql299;@*0^Jo9rdWbNG4?|!MgzCn$BkSjF+XT9dCYYnF?^(!#4+b z>@7oJg0m&Oo<{kX^+6qvRnIqZLXwz|DA?%Hvo3m4%W=1Y@;gd_gELzikvk^mxP4^P z9jB%RnpK;3r=ymgop{oJg39qj{Y;rfh_;K!`&o3PYwE7a`&hU9SH{u2#<@YZ^B0?5 zHY%&sYOFutC1!U#DTiy727Ze5 zht=)$SX6JJi_;g6S<;Z`D^sRY>*cOS-C-1A5Nb74nqwU1$(!*AFDo_k0_7+yXmT0R&} zKyGyRHEuX)5hT)MS)T;&uwz5X1*^y>x4&JNBiGlMkTy}C=D}iUlszX+ZOmA* z=)Gu!Aj@!>OUCnideV&CUc%0j68JAsT&?e19bRPNJCF<4Y0GfE=1dwD3@9Y?;ty2p z>e}#>oGR3C=azjAC`dv#FBp^x&Su&wLzNwXI9-j~jDkp}8T|bIeBB@4u(r(Bdh~k^ zO~^xvKeg1}zn5VG)8hJjJ(q8n@#s({aoLD=w~0DRaSx8-4R-MV0S-g;Y_@FQYd7)f z1bqizXl*`*_^Tg9O>Kv}nVG|CO+3rbmMMP--yXuOyhz>%zG1#&Tbc?ZZ9T=c9y;Wb z1dwycZS4cZehelt6m(4x54rb)l_s#|9VC3@4fVO&_TdtiS_r6Y~^dFjXlCEtGNA>ma{$eAlH(Pa`407g(2o_bfCp8%h72 zX!=Ky1R)@Hd!6gD&&G+{i{>{#dU@L-U=J_t^Dc_>N)AAYWP97J=X!WgtrvsWbt1Mr z#czJ6>lZbCSMyY+_^t8C_PILS@Aa-@*hF7n0)tth67#K4J&x7(({`iqt4T?a4(i^M z8V+_o;gY+kyb<2M>ej|BQr*NCP`?n^X2Y=gK&;=BK&VTE z@<~cDZVI#G{8yhQG-QkpOyl((_d}26Z^}n@hA=rlc!NqCIKoE>)6_m*P*Hafa)TaedNr`<6eItY00k@G37B%cW@|cjcSL5mP2%=+pcM^iVn6C2yqyA+p3?5IjeP8N9=ose ziX{e|2JjxH^JIC2Zyxu58+oO(Z(5@CpnaUMlll_0hap-ol6xSA^QabQM~y2Bx~bt^ zQr}A|BX%ND0nA;8BM7W7R5T+mY{Vh_GKcZgPrg3=r#^*s@%!$tQ{tUly)$(5uJlm( z;2S06yH)6rK+Up8AMpO)688Vi0)hmH9}}<{ZBS3nT6&UiD|(M>0Sk}~MV0~P_UAq@ zvcv$_s6!4@VB!GJsN@vKJ4@Em2N3jUoB}TaGEnNho?bwMcsbXPPVP6c?3;;fI(_!Ep>(^E*$PHj0TpG-!Qqw~Lvn{21mRGNw?1{?tM(jx}Dq&FF$r8%*Ie$YJ)4jj>)y1EW`h`Bz#ZhImc zt}qYO9tKh@FYbTtr+P={nZaWTup%9A-#J2%+SH-(Z}z= zFs)rUXxp@SO1tol`=hbkpXay*r*tC9bBxD zLi$~_0e{x$d&{(8=!^NwtpGpkNJ8O}_QCcRefY}z=S`Cfu`6w7z!K3&truY7fK@fC z+@VGee!aDo5`#;D<-u|I2U({V`*m{6cXZSs;v|}!y5N-m6J{ry z-{uh?q(3Ddb%qFApU3dvO4;;#^~An4h3KKrt&zAl0FIYf7R8hauTtpbzE^^ViXRy~ zsHMw|@Y(bSx<#`52`ng$P%K_SoV zpOS;#Oldjesn(TaWR;-keG)Q^?RjC?Bw{Si|GQyDSM_4Gi(Z|-f0M?|^XogISA`;X zmm|k%JcPh8E{R+Cte!P62lqAwS)*dd!4uPo_H5UxzJrZFyDu_uqW)_Ctg#xyNp92n zkHWCsq#wWzH~PROp16#6WeS_wsW%gxHrR?&`4-zNyJAf&$3C284F%+SetIa@eX=2k zIZ^yQ!FcoP0GR8kEIT}$-qh(#C6a&v2Ud(}P^2ZdVW=l#y#-cq5mw&rO=dnGmew-M zUdW>z+M)lox4ymWZub1A)mtDV&FJXot*}Ur0<%HWMt+Fn;>*k1?B41^?6se)S+1Em z1ru-S(DKUKh^i)V3wj26$Nyb>9{(n-a+mK} zXVVBeIDRG>_5AspdxPeN{)x2kUP*B=@Wjvf{;BhBBz*mq>Zr;)QpgkAcCNq&v~Jo( zE$Ca*HuQtgxeXFSJO2`L$18X#_tG1d{vL-n;sbisFeXFT7}=-7~LmT<(44cmo$`7w211 zV+diSwT%5bbDR0QZ#8V55L7Dh`omZ1Pdy2%*)@3NC95isxbi()>X+@cI+6w>KhX_A zIw3fSaf1zXHYzdgK*-Q_UL{0~d|JIM4~L9`&#kaBE}IaR9#Mh%$}Y`Dg(}5%zttA~ z%9_#<&MlGUiT>$P1xZ7NM-bQ06KH#|PZZeYn9uUd>-%!-BBbwir^?6Ke@Dn0_55VY z>I*MJ2{Hwcdj_q#y7Caixy_%b@?|qXUHN!6`L7_otfRlv8A%Hv@?Xc(Sp}4mBP#i4 zmV_iZoT*w8ZH9Bth${yk`z{pdmA^lJ9FS&L)qCvqfaPN%^p*^Sl5l}K%Y~wcO7oE! z&l!E{z?ZrIQE0|}Hc(|hDi4uLB%Ctb1*0~>M!!-uUjpp|rACiKBCM0$z0 zZ_+`l8N&ITlm)J7d8f`9u1YzQe!O4>p|E!zkkq*(w%BhQ@ffPqbWfzT*9;NAJ;+q+ zglP!HhV7j0B5Pk}7U$b@)O?TFQif!Qk#Y!yAf4xxd{*A;DGSUXr~19DaYxf`GvpIk zhjmZbPouBiy5i8E;@|(4^TGT~)w28$ay*SuO;>Ly&_KEU%5ePbv*G^oUB5+gkz)5V zR<@_*s4aV^@46LECaKtYU+OwDUvdQv4lE|OIRQSsqK~L=Dw`|*8`SsF&G7fNRBvak zLh(oi;lQZMC`cb-=n>1)u7GSm*ouAXJr{l3 zoaOmf?dGHCg1b0=bs|&lV}8Wb+GXaW#p1=pQY8DEX3wT@)r85;kH=zZ>dNDT+~0Mg zgvu%%Ng3jF(8OFO?fnu{n4!h<<8euQxLyS3*7sF~tFq>+zj(V^2$1+IhkqI_gs~I+ z8i6~*7`{|g83RAQu;Gq7o|o_qA>JmyI|Qd@61^>CEsQiCoMmGa zfxYj$K=}@H7$^!Aw0JP2ds6}&C4S$J&0sL}4eir5Z(%MF11rqikqkCDakCjE`OhV-OMy;svsLnMnM(anl(mQD5I!U{iDN znb1iu3jl>{ziYFMtR1qPeRgYh6hZOXoEOERNW?s0(Z5&2h&$CX$l{cwus0Smhg^L~ z)@!2KZz2zbgx*-6qYoI@Gw4Y2(08Fr+JmM9d)yGCU}616-bnHeNHRX!BXj%ud+YG78JBw%Ek&Yr(IT@Q#F4boH|vOyt-t9TSfK{ z$XiR7jJ{&w_y{~65oLnEMvA|Q- zX!twGQ%@!~32w;Jna&j-Cu$gF`mmq3;TY-E^jr)Icc zn}`jFFuVvD;0hugXi0pIzVTp|j#2i+UMcT_CYdvawXKZtRi0`Pz18 zZkypooYc)=(N_QBb0#HkhLNI=q!IOJRsXI#SRp z?b1R|FpvsiVB5(8sN)(y6fi_B!qu~!E*ZT3C3ihE_}g-i)`n7V^P$0L#F1O7<0U>K zdGdeX`PuL5fIK!uiNo`}@hAu+4Ode$XC+vsRhB9;el(&FzlLu`mgX_B57ms!LaO9^ z32lW(2WS3FiU+iJvs!_Q6*5*02XwMMGr!%qm${v!N$*_Ou(~~%&bnVb#*FdSAHLwN zZIS(02)y|I>3J}Rw7sKy5aP*mgWAJvZA2TMlzBoz&O>t5*{b{IQ5e0_laR@@7Luz&S}Pg8Dob z@Z|acRxS>=6(}a#el!kwxfws{k0l|O+MI+XX)G<-6GR*}0m7_2MtdcUt(PT35)EI-tq}eIc?DVF1T0hP;6(Lf zUAWU^486!c8?Qzjys%{>EdK#z4f`D1nq_Hi*ioWprU~8VoTc@w9d-Z73IDhD$eMAw zZMdT*47@WVNO0}|`JF4$Pt6VwqTV!E$(X*NKL`+Y4XM8!O zw{dHmpXOFn|8Ex1Bl1SDR^`8RMn?FSvE|hGM7P80RPB#MF~kQ&1Jq_pBI#`mg>#sV zk9$E~oq{Uud$UWE1evM6Q0%RbT zN4Ut8=y68X96?z>*oyPnFQb(0m=he&&%N2qkjmq9s!GdsGE}Nz%NN#^m<>h~J&|8) z0N{GtDRPk-)>p(cjN3J(mLj%DyCx|V#GVx z#b<$@V5;i}d@`IM{rX*w?`jZzl}%L;5zkKURgejx$Iw1XB*YmFAN>&WHoZ6|q*zQ7Ms~p&MEz5%kfz&)#-lgy|a1U)3Vr ztiOX0i8)lo9Q7=kb=(*=9{B!qUOwr>fF!7BZxBurxI&%yelrL-bbhMQieRo!ETIG$ zy6Z$|A;v3$!8z)bod|nwDk z@VNegZ9(J!R8SSQ*aNHpCF~g_KM9**b8Oa%vylFtK&uICYq;YuJ^Z~40fBJEy1re`#tM@yi&_azt+JTCHnBC%-u8ylTtR zZv-RTNyMY9E542=0Xse-f^*6_U;HrwRbymm!arfhD`Cne1`6^xCYnm3huY`BJ}cXA z;^?^?8rc~-oCs*wC7rL@RDs%|LSn}{+(T#Y8f3KG6aefIcGknS)kRn0(PkdjT zAK^dgFr7NTL`9cHgYuxUo$*?+4Q2H+Sz&UZNY(jHl9mL?qFtFsabUZs> zR)U2gNsb(u_E531p5bx$t8?witS&>Iex=K&+~{py=(Z`zRkPyP={yZMC|`oUsa6wY z=Y+V((;`b%Nuc(WMvss{ARcw-VO6=awuMYZ=p%9hNQI$d0k`fzehim2E6|9=xk4Wl z1sSY8C)e-z*n`7Tvr6me1dMj$Y|{taH@eN!@rAwK3j8#4X_@OVJSaZwrJ!ED*ofS$ zFd?mjg-q9a16b1*j+AQ8rS<%6i(CVF#6COYaEVteEO;I}gteCA^oVc9L z@$l)(;2D*dL1a~ORIH=W8n;3pwBJ~gHe{U7xp#LHfsJy_Vgiu=&LwR6+{TX%Dc|CA zSrdQ^(jQ*|NrlocTnqZJA-K`+lx=}s6m)RbeGu71I7ZB(P( z>>X&KWH1zfYsj!^EzWxTNtscsc0ORYm@S(kSaWit?785$mx49^Fle`$yvW{#UHKsc zz#7|l=e_jK?8;$jq*5S`pY7)nf{7}D}iopXve7%=#dfD%t-;tup_w2(L=nc-Q zepj7xZ~U=x+|6#zg0s=>*FV6t{Bw;7cN_ukA73ZpQt@`%qXl|ZMLID`RCs!%LD251g}=kdj+Qu;rj{c|wG&-M7=`AkV;h^di50DwoR{dP zm##+X?*XyZBd8KVC*h7NLEIVJsX!B+X+Ex)cXHV$0KZz5(cur0&qV)z z7a16(u5Ai78hv{=%=A1(&6jkGY^24RT(7*eTLJS^{aCh$vK%=YtU&r=y6AgCA8|>S zdH6A-6E4h3VPBW{MOn78uSsUpQ6H5u-SP$0oPd>0p~?V|kbNmwg7lC)kwo{5~b^x6axgQdpQ@F4Uhcq+= z3lSbg+XCB`a;@X6ks5MHV_ZSU9@MS9b~3M`qUwGyX>KOTjy<8?AiZJtRvcc85K1!u zctpPZyDs*9D*aL@OSZ!T1fCS1!9BovwZ3MeG3ga0XxFO1JVoS{b2A1?<$I~hxOVj; zig8^5|7j|23&$ko#X7vT#8_}kbHpAi3C`*0*zTvPO3aKLIZ|~}SPL3&Lr*i2XkQxd zdXW*nne%m~8Bn(aQhbi{h+jHT?SeYs6LYscE~|aGv_T%sp!JYHx&p5Iy5OLc+Qb!O zo&D(dim`G3;rt&Zas{U3E75PJ{K)(ArIc0(8bvP-ViWmwLUZFD^yEOO|JaR)+dWea zmt=&(%j9_T@ospc+y{)ClnDh`Fhxq^=*cf`VhJFNVFFPfErhKqw>FyuV8l3he$kwt zIrumz;=w<)_>_F)nT&W%XNR2;mX@yRqoBgjjw&p*brX(#+ zVt{GBZYYxsDUbcBT^<>0+Q{}w?v>D0u(xzPo3|0A3cEcqM;eEVz>c+Og;zD76X&N| zeI-dJ2oSm&7`o{*?%dKV4D{|;y+!ivs2gfF!L5#%{IE5ZnVqL>bDh#5Mz&LpJNq^f zPS!f|zfEfNIF~aHprD;D73n)0t)eGJXa)H{mjch1$MbiFk9Zl~-!;BP!_e&bSPeBv zS^+PfQSPd*uvpQP4`?h6lS1=!-=>jZj9?F8tT7uDZsK0o4um`ye)Q81fBs5!^7ze# zyig2&lx45@)W{6zZa}s4%Yd$w!4lA07N8i#pr=XfQG&%!5U)hdce?2J&YLWQX_nS* z+IC2TaCQ7Nv(3J}4!yD9H5W}ejj7&^oj(@+g}=qztd zA2qCPbEjK{w>>^@uYVil;kmVqaoMl&XuRq%c>gZ70pR1ybwh+p#pqHd>NDmB)jPw}Vzq@2c&ovE$O z|KJ|A&__nA?(sXFUsk2*=v%}oYAAjfvJ*qdf43lgmWOS=i*^966|*zgwX{!(d80SH zn%qwgCH=bD6}5X*yL***OexZ)v=yhIO0Of2_Sia#v=>A^w>`X%azDL$h1XL4`4>v6 zdI)g4BKa=Xj0OY-#Ss;>mX*;E0Glm7EYEnmWlqM~#Z!@$7|h(SvH@ zN0;_=$O=Sex`@I}EwV%=2 z?dbn+I&EG>Pnn+G15*eSi-M9SxkHGO0XBUNhM`n^7mQF1&gk6g7hkv~Xr~svE`K+N zD&FMdM#215CBDIcU3I|CXCM37?sf3f16(yR_d>Ty@M3Aotzoif$L!MU#W6^sjgB`h@r8pdc3$IhJkr8Q86DuwJdoOX%DbA?=r8wV(BUD#Y zf(>H5iw}=&7#KCpuTuIh8}c!)u#T@_9yZz^sHATY&-3)p6FV+7)g+TEvA(}^ShBEd z>CVK=o7~a!>)})Rff0Z!N8`LXn4Xu@Y#k{us;0A&Xy*s9V^7H?UnQ z`}cX#up80ygWMlcY0|uM-y+gv?-0b~(ZXF%p6-NUuI0U2;TiT-dd3}RZwV>Uq&x@T zk3{~}1;f0II%CF$F>BCt`ah3r^wgHk#@_8;FvYQ*#9kiQ2+)Q@{TF<{>@l;SsS&mYJ&hxz}9^ za3v~~ti+l5H=+1H=sVG~jwArH?B_zFJt$4O0Ego|>PnhRbCP7UK7Xn9f3tuHeFsi} zpPv~eWoowfLDPK ze)$%WVUZhjwVk~y?mS5*h0fUP6H1WwVpK5Q~(tlUX@Vpq#M0&%KH1<>!k6IJoagxSQmd0`cH zsrkG3k8TYlGAfnHRPqQ?;gmJESKo%$|1N}?O`9E_?}Z$uj`(O~lhw^GcQUu+ONtgu6$(=p0EoDtMoZ#-ZOa|E ztLz3qD3BO%d$4vA^7YfE=Np?dU&IZDDyrPPm((D4dc<}}WD>W#rZfWEwq0jFttPZz zTIguyvfdrdwh{M=@N{FX;?eNcOxg$Z$~kC|a}SWuzVy9vNh&0uD|725mK+&orTNCy zTsn4inInt)*jfiPlf}7veD7ZPKFtW6d$-LZ01<*r^L7zbVJT)R7)ba`3zp{XWCj$N zi51l*cZ3GHWD>d}Oj4)cRW0gnRAqN@O_PedCeT)g&;pY90RMqKQLVLmoY>aHsD9%yF196y&jAe@%WAZBZb~zt0imigsCp6#W@{rYsex|UbF<2Q-xl{TXetsj0;F~lDzfiZG87H1&L?2 zb91sSsWA0ZaFlTK!1r7Z?`{XPP$PO$J{G0LPY!j3uS(nZTVD|#{3vTHNt_^JT&12L zcQ`l4z=+D*D*O7FPmsauoFi)QC$K{63#81XM%e#$;VFaE3NH21uwux(d z=TJ&)u;@hzrbnZ7Kk-{yx%g!>acp3`S21B|-r3TEyHcpVX?H>nA_)0Jz+QcW*!4-~ zG9CH=1#rsZ!o-psY+-63)mSrzgLoe|No`>(ZvFmj7aU4g{KLAi+Du9~op#=ysrjju zD_;M06Ab0M zJekW+7S`?WD<1*`nAXuDJ2z+?H>$^esW#RSCdPmS=u2Da(ui{4UVNHdZuI@qH7;AZ zs)n?tp;>jddN%U01eMo@&56$oOHTb*rNRqfC2q-dJ{&;=+6k>>*O~NmqBkSa|P{gN^ z1@AGs(MkBpytHio_v`19#pY1_IjWsvlTZFAV0zkKS++eO5dND*YhfL=O~Q{aL)H<>1@4RcWMi2SH77)M){|T=2oNNZ@q2nh1}deRAsrFVzQx8-xlBMAd0WmPGvm1pa*rqO>U zFyY7({dUoXy{iFvkp5B#RD~b~Y$ArxEby;>>TmqH-tix)-PKISr=&xgFaq-7JlVw0 z7de#qKPIA2Pg-5TX?*VDvaYQbhiIpFEXD~$Dqlr4(+Dt4>TqEePR->%GAa@haS3c1 zvw^t%!Bn5@bAw>0RyqF`5DI|0{u63dz?Ul37aoub}h|BicDbsbKPWx z(8RB-&LQ=hWP2)~rRIch`~Jd)!Ac!mj6=Fc9PvixOHoZmzXr-y3hzTYToEMpIFz3= zc+=YlUeFY|pN$eL;}om zVkP5RvomV{gRkqIv_FK7^?*?dTw0eN@j;>+UCFUN8)RbNCbWlK)E6X&OJ=5`MF{?M z<|}#Uf6@8LG)VCUuPrA&*)IU=?jV3p*|07uS>W0p&0q}4Fr+Wmoda)V#}_&v)ZiA7 znLLe)QBB)b**-c_^!&qk41o9$q#oJWZ>mhqxKJK2AL1$+YUPW82W0IZ-4ArEAtG#7j=#qzx zb_@f&DI@fna`B$~M+JD6ukx)xPNS1QVWEDH3r){%TvIsdG_YtD^t6r*+XxNvn3Ji* zxU%5_UX!d|I?a}_7t_!=J3~#0oH^I}#nN+!TVh)E25l|Z`tki=lhZ`u6-1w0Tw-c= zaek&1H&+P0jb6tkjPr{j0??Q!8Qg1!e%xKE65z_$DT9#BAyX1bA}g=3h;+6rDF!x!7FcP zE&Ivk=cuiRmM0`!O?wplSu}i@zf`t1-n|=ia+XNQ1j&shF<4-L@ulc?OAd%tRd^S_ zLF`uw4Vm0~Gcy6%RJ&6!-13;?>%m<1R|C>tR_WJFPnlOE-QO(jAG7ah?*`z1`Ek^~ z*}2ixLRR9K>XV`NCvv-y80>7*Skm=z;~xUtEc(HvjBci?6r6!?_agVV!wU}y%AR-a zww~Onq-5v)jQB7AuppYWw8AVyOu}oT8lod0>Ss22EIe`e-QP)0 z&ke~FzAuP??tLaQZ!*lN03o2FtuA3MsY;q6*9`#@V)U`C1q?RSq%>mHumFkt??bIb z^XJgIveCPrNAd~J(6hA=25-%=!LeH7wm)S{R3i87cG#3Li~o@k;}t1C0$_&ebMKq# zS>?=!qD=%00Z&K%v(3I(>T8bl3oqT@^+)rs0#2zzx94-e!<;&;|9sq}$E!JQ z89|g6XtH~qvGQyg=*28viaY=$e_L9F5*X^jph^U+y_Vou=r^M3hB0!;M;jJ@y3-U+ zHCJK@mIn!N-a!oBUl;A#R-_Ze`75k_bS~Vh-tOAI6c_&F)a0CD+{}@eM8CtR-a-pZ z36erEXna?9A*?TkMJOyLj$v*qE1?~lJbk+|%pHNA)$)DMCs4V~{=RiBO@xp$(6|^lzP6$4YP)c_e;qr#UzdJF(OZ$flkO*pp zNI^5S6=|&jHPZ*riM+&DR@}qfiU!6snnQmrSScAyWZaAYHNu6==Fz zBYCH~kvG;$qp`&ws2&O}yF-SO9)0$A9$OgJIr`V-SZGs;*fY#)9Qna$lkJs9tN~0r z(?16F>4H~9bzd&kAhTcD?N&^r@M;}|1+-fSYSRo=$;gB^N8>5CMTWIYbmey9E6+J8 z3BKJ+(KYeuN{0Vd)=oJzxL_8iGUsG;X0z?(wZ^Ns?I%0dZXJy>;y`C@^w~IJYNs?A z(W51llh#*(<-#i)<5dN*rA6okp>?E$=|Wp!B=+-uRLlqyHihjT1r;jO8!GqqBb@_9Q{?i-l z)T=1EDQ;M}fl0-icwqWl!rV9r38Q9U6B<5`NUjO@u51?pk1g=)mvz#jSXT;@(-OFE zswE^c0yCG4L$&8!;WWwoE@LBc4x~gW7(PH~_a2@rx#FL8eWp6{$fFik<(>2nYxEgU zUMIKS$)V{B4UDXhn;I|QHU6+ng90}z5ClaAa2GDr(?b|}q-PW#`70^8BL)hp9AR^$ z)ygR;c{4^oJ7Ml?=+;zh*gW{LOF)seTJCJ)pmoKKOm_(Ty&)R>gFTtz_f6V81R}nA z(v11b@79S^VBaimoQ;wVIb(}1%@<063MwoT)p494rrzi0?cB@A{yj@Val%NkfINN21)QAORMiaKAFx9w zN6kn}aW82jFA4+s_lQ3D(ETJGD`K0(A~Qy; z5LtB!ZA>HZ7^@B*U&rKkEa+oY0Ovwl{%;nbx)xg<3xMG8j6eSZ#MUEhF?Pl-ybpXo zHKYP5iPeWe0e0eO!j=F>mXs00(`eSn!5n3rc7Y#rE=Q=_X#l9tmB_E@xs&Y90 zqpHRu64hk^HiLi*2!LdZ6o4^o2XE{WSang)M5~`#T$z035h5c0=C%ByB+Cqpa{e5T z2%eXSSShu=rJD{I5nnu7K0b~%OA!XHlmxQ(gcB|@|K?(f#NaGd-L5EO3QMG8QyrIw zAI2^hRxr>?O6MsvUq#0`8X=wD?+=>b2aAY#kyi^)QeI^Ra{GTLs8cYRgl>^;Za)JH zc<@Y`a~tmxH}--alFL=oO;<9LXkJ@@{CIsG$ak&?Hz^aKO~gq=CJSLN^zax&0JyZW zU(Wk;bq=1X?FAP@h_KO=tOxp=S<{B*?_81$s?G=rg99=mzWHn+t(I|ojhf;(^1^}c zaUZo!8)unu@sJt6gtEk!Ys6?Zm-K0Cg|2LhO_!s%^&TYUu}mi;s%@v)*al((o+WtY zV4V%e61D%fSgfc0+fDG9;R9VPoR%Kp|mhr5wwebQ6}drsA5Ob{EN&ngjxbDp`^P z7>u%%$YtdMaOj02#QDxqR*7fvIwgZQabm=Aw*n?0P=lPS(WSfnSUyX!47#CB0W{#p zs+S$c4A-625bl=eM)$NC)`@t*|6}Yuqnc{kw&5fMNa!sgASLt`AXMqndnbX=lhC9} zQ3M1{fY3|mp(q`x3J8jV5PA_6P!JH6qKJx$VgcLr#p`+RweIzN?~nK2Bx~>4vuEa< z*>jx7d7S;NhRg*RxY>Hv6!Z~b9LJ0hlj^MY8Z#Y+jXIBY)S_I65q*`(DD(@&X{ zC)%51y0GV*z>n1Bq+rjPiJ6n_FtWb@asIO;fKu8-zHQiKP^_r=9KloJ+?k2tYSg{G zeZ*EP5!m!=cP6lZk$6_Mpxrw55U;H^GTmek?55URyO683(}xbv>g=WjQ0 zi80|xPE)u@4j&NjQ;$zfd~xzZN5UF#sSbqX*b>v&945k)x@EzL9(R`RP8>t?vd5%L zW&mLUxs^B8N6#sOx2Q>hy@=j4vUrXKAgmCGU^-7d?I zE?tsmUgkg;DgcZ;kz?QqZsNP}pzIUt_~LR-aw6Ni_-T1P{h6Z`=d73S_$gPaSpFF=gywLX%D<}13j84H$msP zrxNF;dvnXy8IlLqunHvcU{a`WG5E~Pj}2g>yxE?hU*I3dkG!~#yt;QUxKs$-}bl4|zn6wbo``|~F} zNCl}}w8EQnt*0dbcnMJJsuPBnKTF(l48H0ecd(MB(1F`_-qFDD+V9Jkp=Gq|mbxuB zZhIVx$$oE$x7o-|RNz{vc0(ybw=qo(`P6#>3fvnOOUdaFbnb8SyjQuq_FC^IL>wcz ziW*Z-8>@*pbMj}50((DNC(0`lWZgz9WW{o_)W*d0oI|r(vubxeks#jD09O(6CyA*O zEiu3@3h{2>AEr==Zk00U_JM`Ib!p|4utg;HBlL}OUW$6>mi@)*?XBQRa0Yb7lV(0N z7#8D{l{LEo94HS`lzH{4E$j8bEMTPr$;nRqls4R#t`MXifV-7ryv#I|t=#ctRwAEA zE#wssjH_8f-m=e6Mpn6LF;`E)e)%>2yZj6LD94r@58hYeni&2&GZ8}#u^bK;2Fels zaaR=|JccfIPbZ3Y3LMs1zl;-+}DrB!S__ed1>wDD&eycft z%)v})_Vd}*w*xJ&HAOWq{m8speq1{5?WDKJtATeg_1{DxISw)K?lkIyh2Z8APdw@n zPVi>NPln#-JK5X%gQe`OBEv(H=~>HWgUgvEqRUl_nvOOI@XQZTco_|D7IcrZ(HO~tkL8Fh8#H?9?+6ai#HnLZu57&R7m~p?OoriYI5`%$dObwAJQo`6PS0>R} z+D`ribcs-t3~Lb+w!5gNU8sX3z~Xk_xV_1k__;@Pwjy90h&J0`W|l-r0MdHGamX>g z@;aW@ALs23EE}RUPF#*4z^n2GXiVLG-%7LZl`@^U9~Go8`ludJ@Dr7NGsV?_9r|98 z%^mDm_8?YUM(J|#kKQ?HWHwf!!zex8cf52Ryrg2xXolr%t{e|c@$~o?_2EulwK=38Aj)lf?0bpQ?yD3Qe}+qb z6r(t9L(P!h;i2b>174xf${@(RUY73ok{%CFwC9>)JSBqA7dUS$8r%uHaYG7L&pvOF zb<6lMH{Jwb0YQIaB4xi!iMw{c&1zOJrd@uw6oBrIm3^=TL7NU$LUEl!(&aW$ymm4! z9};=L{+#hb-qOA0MI;)qh(wOZ^#*>fBHne*i*f#{UG<|9S#~rmi+2CVR0F zp(j=ordfO*&T)FX(zFq7BaQ(3+u0>ohXQoma$X7maqC>KcllT2bD{E*lcUkJ_OJ0F zsgk;9-i1S%VRvo`uncRKZtmYzCE(n9C9)rVAE`iox8PgzglH&9^0^p{oG??cTeq=J zJ6SMXoY}2aLPu>$C#aac?|q)=3Q2mM7xZP-k6ke&x5<>k`nkTL!k0Tdc_}^s;ZW`n zSIc8urgLa7D-_Z}%yVb9)j0$5poZ}$l-r-MQI+3Cnp#1rHYe`N$WGIuZEC>0j9A;N z5+u(}d$Pi{u~Y4SB2L1!N2c|Q$vSP4f6TI3(tT?q{p|ZMKUZ>P+?|ZOCq#P3lZB{l-6nPKw2uu)m?%hk!EmR@(|U}3be1*R zF_xK|@qMds+JJG0t6Eb?oyHp2ue2iQf*^(NPbOon(MJw)ko57TZbcG=xpk~ah_`UU z49nf_C+)h0^+jGR9RR1cD^im&VEI)WqYJ4#>=uK_fpNZ8ct1w-;=Hqk?v2SzHP$Nr z_OM2sj`rtwln4}zvgecet%!3Q1y_P9)46U3Xf%DQF7*an{u%f}nWA%yZgG{Z0IUe+ zkzC;y0whlL@}hf6F)**a?W>=Ex|;~Y`A<7mT9;XGJKx9s?(Ty)7i=uL=Nm_wV-MA` za^eA|%f-^Zo2e*fg(9uAQOu3ri8%>bXBTD~6Oi3WDJHP^J@!8BI*^A2B5}(Nf>{>2 z=}`)T;=6t{kB(=D;LCDN>)t-_A86&v5(hL_K%UP}pg6p8q}qyPyB8z1XWh0amX|Rl z65j$RC6L?S*vX;USW(=PBl}+XBaJM29!HZjOZ^C%^^b@E_+y%ygb9A6H20BT8LDZO zjO1OvZ*LtqnXh&({e$nOj~%||YqJzwo#~)B0@>uw_J9%d93XIC1eEcX4|#t)QG16f z8YzCS$7KLTlZYQQPL~1W(dxI1Ki7x3J{9ts4}C3Sa}Ce2Hin95#zPfZUKTj`fb1wZ z678iKHt}P&9G7q&)+`vt(IljY%HC!^bFz%UO)<+C;6E(_^`T&%n$=i4Qe%(J3@`npum!2_rS8&|CYN_g#R9;^-73uAk#UI6$U*^> z)R3l!iV5~2)STBM0p|1i+%vLEJo>S%El^a!Ebsa}*4EM-X#sXLkH`wtu|}ZKe#!@( zw2E=PrP0TS?7IVDU52-2`#I~^otvv6ewc&Vns(bnk^(t%^aPyWrhc}G(vE3NUoDch zQx63NY+8s&A4;m%B9koE=*8TU)g1YKSn76bIYp!AlGwh7+dt({6UQ|VT(7|kF>90E zL-CF=lLdvmJnj>|pTr*=y`?v(0@#xq62CFUHjVxV3t&6M_Ppx5JUnAL7ym>kP$=%V zMV?z|(Szt&e0oQT`6o$UTm1J;YhW>r)Vr;~Kx&c9^j01OH+LEk0{k`fDqI>ZCZ-N} z9{pKj=;GK@8?&hoVpWLCdV!LfvaCE=%8=rpe9hG*pDcxNRYxBV+z>m@Rs6Nx6g1tr z137)vplN>E#;WAF78Bx)H|~eN@T;V_J%=>G zg?3Q~js!y`*!$Bj&-NsF7P_Uq`|w1;^+QYqZgP4IaEvRCvq#b#+=oH2BPIo6g zy8L^TUyi28J-e_VU{R(OICPRzsGd}FbLs=<)#4u^>pCTg?+TXQ20hbXezRvQ>fVrA zqO;ze#N5-#Simh*`^|e#5&K=I*zyQ1*V-jhZ%`JqC`MMVc#3j7KoAaT(Z;FnSC1D?DTC411?=&`JR{M`oQ7WW`Wc8M?>$x&*P7FbJ&zk z#6YR!`8c)rhe1PMNg&y&234@1kl^E}=qtU$o8Ow0tx|SBD6EuQ`G0XJrwav{dGCev z7LufYCeGy{0||6hd33%W*KB zMzjyE^O3${tt$;!sG zA}l*3X-ACwi4SbxpgS4P_H4P?fv94WG7RVg@X-G9!(3_k>uKyaE?QQR&NkTd=^u5C zSN)2-f7d$0HUVn##Z}52`&)IO?VN(+D;3)&VV?Fbw)AaNtut=wl%C9Fujwm9zC2+K za7C43l$_@P?|YC`$plJ<3%oDWlqm}^{=CM{XHZCY`@$BGy4dzgwCGhhU~e*=lWpEv z6b`ZmA4Qn~gv6ZtksZ%_CusF%`o0nT@w$MxneEQ}?8=b$`^7Q3%f~8Elh7G@!bhT( z!WPTTLEe1@X_oikDv3HWdPmyW6Obz+)ySEK0v_$4r*a9&Oib$cIgpk9V4pvLqdiLI zLB8a@uuWdQqIc!Yg*`g+FMJQ((QX~9W~lp-2+O-6!hG6U*oGfu&{-X~(YNG= zZ^{xB9B(@)E-Vn}RMX@bUEO0g-DAJHKGx9CPE;9+Ze?+I;eAE@q4P!5dOy+qXBXb1 zY=FYcF2nGcC%#SgOZP2mLda3mxwA6 zAFf!p#NjUo8;@pB#C?;gFgWqNY~#_&ojHqQvx`Rv8;7l1 zLTw`2YKkL(9@Xg zoYEZI@YE%Gq|V%+>~Tybwz)n(Tmr zx#3<4+GTLw*Bo%-S!l{GW(7|`}6Z0ggZuSu~_k)*AktjX?;8Bc$i?qSVzWuR2j+y!3h zStfO1(E6_e)YSi_*y|C?_@`7^d{OIPwp)p z2tVAG+=`|$6Z;fPg?k^7SZeP!TcoqxU_r$r!v}jjvliovdw0jLD0;nrTYE|_f`#jj z@6VMOi+NLc+W{JQfRHd_D6z260Zo9v2~`=iBnEN?=w!3?c{Pe_Vte5w+=l+98I$BZ zV<7KCwRpVppoGm=0>44z7&*^2+#gzB`|!2VMem9`6I?J8m^Z<7B{P?{54vjlTG>V_ zMSHh&Mj%GrvsOK=N4H$?6@Lh}q+RgfV+e)Agzd_QV5pVqnGMf}d$O}XLW;jnR{oyJ z$2LPW3V7*Jm8@xKlJz2+6?+<5Ue|!Ux}~H|eb`XkT9thP9SQ?(S}@a$QAY;f9mYaMo;3PhL5h_!x#soCm-lA-u7|)s$Cs1tw$L~WDgDL&Zh30e~R@Fy_=(t^?cS!8FPdhsSH|DD=II8P9;uUE=qd#D! zw?sibwyt6;cIrW^kNdW*Sd6a8Amfd?7e>_3WRecQGv$($-j`zF9SUF*l^c z32&h7QaoBt>X;&Y!y#5Oz(Y9Rd2om+LV1_`@mgcMQg5^bnmb!aW}AL3olW6sY}pC{ zYGae;8okNz-ZBO~Ze_*{8gvBXq}Yct&j zgZAO;@&EN(I9djphFQ{;I-V(&IcjTQ_@3S{adFd$x6+^=rB%Fbc8{bqmt75G^w)B1 zF`#OTSMiF+e8?HQIJQjP?45${8OIk6@@P2yt_7y9t?KGtfys_OC(x3Moy46sTIz5A zrircXqKgR44lb)jR><3)Z<(}@L&e85|F%w#zuCM8d8RJNen1O$icOoeqxd5@Hn>@p;sDP1sL(K`2iX);Nxs5wNN zk9veg@6zBJv=eD7_q+j`!7fo87f~VYc}x5rvpF}Jl|WHDV#yZtAT#=Tw&&4JyPpi* zs0f(@9F%UD|CBUpT_1P}h(IvmsheoD{pQ$HQ9$-6l77ou^_oKrkIA-JbV?ih=5rrD zw@oz$t`O6)Q_{778(&$Uy#<$W3mH^v+&?t}sOW^pY&V8f%s!`PU8-am*qHl9=22fu|I|Yso&8r0wijBu?D(*-NDp(2Ob0DO zi$lbyC@yz_;Pga0)0Gh6*%0`eS(NEq`q}q*Ne(A?$2KGGV5^5gyK5Rt-Nyl?wF{B1 zkwz5o~!+Q&Tc_A2oa8VQ&b64R|gN}yTp!#s$;d}&+c-lw+YYAvX0d~ z3;z;N9+Lpb4X^M!PHLfp%{8%>=Is2u>Pf4Yl&p4jXzcHJRl`<`y33{c(m?3xd94x& zo*pVHqYhbFCy*dUE>x1udiIHJ+v?ipk(s_MMb!5Dap0>?+h}>%V%_U+b!Ur*M2yOr zWmP56kK<(}^_BgN*UJ-^Oqt?^Kj?Iv#ao*3BNiUb5aYFSH0#gVZ?q;FrQ?cDsVn~s zxV4h0Qoc9agfw-4oEjGQkRcNFt`(j$n=W(4&``Pwpb5+L=OCMS2vM2Sb(e^FZUJOWsS`;y zKY>CMKA?NWjZkjtHNCP@Okt|3Rhul66ttvQvFFGIlxq+j;!>kKpC2Q`L1q0$_tmv# z?>lz`SzG@Q=H;_s`j4@S^H?%3Hpgs7uAjZhLNIh4sSh?Oo_w5kCDr~8K*pVH{>)PB z#vm?2FYLuTc-yLpAz=5Nv9st?aE#6kA7c7>${vYV<0C>6b=;~_2d}i z=&$uTCz~sGPw>R5viYRQdyhVP0;=~&v4E;hS~7M1D%u7y;~9AL{Xyuo@#VYH>~qg$ zT00-&XHV402lp43(oIhh#&SL`z0}0=oj;{BeVca`v{YzNPX3+nDkSPTPU<%JN)(|- z!5I)<6xNiEAT#B(q1jJY72c1qKe5cRKh+I$O<7kP&3nqs`87mnh3y65S(EMKlG_Do zYTlmFAycn!0;;pM{-y!stXs_(uY(o18`&PmR_3VKv!0iQ4;E8jnVZ(6_*{{F`5zCE8XVI(6eUq^Q0C@ z!0n(VT;Vh9XEE^tr5`sv3~Ja8Pv>sO+3vztPtb0Id$|27Dg(HFbI}u3qxh`tVoG$( z60$OCKIZT+sC+q4C+m&~<)_Y`4Us_}S<(rB*+6l+j|6Y-qzpA#U|sjrZ)thcQygk= zLkSHYCDcXZo8Sl3w9y=SuR}u{yXdFp8Wkamz6v|rj|ZOZUlmu}N%zEsU!8E_65Api zZCAJLnYy4F!j>O=EOIVgf^cuU1gI#kiH;uB~cj(*X^OFUHAeNd*) zBA-jTCnm#%7ha~vr%V`?Q4y!WdoaNV%n^E?9C{pO$b&x_X_udRXvwGmf49@R!;C13 z1e)#=v(z3BW|mLGGg=<_g^hh)c{UdBgTMFc>Fftru@+RwyS@q)`FS6FU2Kw*65rE6 z!x?o41AkhR=+gu|ZOq`GwrHQU*vnXhQ=Y+30Y9_)T{1MIa;{|zIMjHui!lw#2(HRK$=M{Y@d{W6-|mApnFmypqr(*4xvLwSu90{2OK}H zx8}?|Xu?j;p12HQ_^n)rYWqZ=kL1sqG}K%I$BN{a7~i1)@?=h=-Mr6}#Tn5Qz?69& zuC%wPq$`*@@l3d)s*R+5z1+85SBV-WGCKRQQBR?vpcJGtbv6GLH&G?r{4&u z*Wx9|+;tL{zRE+?)tPVc%Dkqn_e5jYAz9usyR-uSyA#50Evc9Rv|+e&0{S-XoLv-F z9iOybK!h^+Sl>XFL~oY1+)JYRVuo}3w9Gv!r7Tw;;MBBEKA9y(IE6Ylt@P!k$K-;J zq&)%U*Q90+L~UjoRJ)}Z4@w){*19YqWPU$4s0j% zUaLyrb}%hvl8sTy{mkvNz1}X|?WFj=9+A@RT>h_df$fMtCs=^RM~;){n-8~HJckO0l7Pc<84qzN_n5qX9y7s4* zpvz}D1%lI^WlOfLQlm+BHEXss6U`6Lf;=Cx02>LUayrw<#du)qdB@a8>CYgiQYNoodnf$S}~BI7b!uTPvO47h{G zQo9mf|5_o+;zDv5nl}2m7<@8qan{|<$8Vha3$6C>7k{Mo9ZUnfvgqaTHY@QAgMMae z|KWTp*-WoL5_d=b^@jU>xXy>ojjPCJ>=RjVezrJE#Lbm;M;Rq!>aSDr5c;YfuO2A! z5eAbNMv&AhzI>)AhWGNx+iBXs{pmn$g&ruI#;a0o)LmAw$%-XZdIoCv?Aa&<~ za;u+mS&yI4jy1*8Sy$rqwT{TcnY&5Fx*po@D`|WQXZtn`8cW*-#E-f1JL<>cHCeS#hHc8zA@k{4ztEf#d>Zat8jT3ISU7>p$u%^c&8fn9-aeQW@t) zMwW$z^<@-@<_s!m5_MGGP1cF+n|m9&s{zlVG_Z+;A8bL#a(JNW7AvhsKe^Zs#h4`4 zEP^zk^LtXfy~0|jNBTXdKDt}?#gEP?^j+dO-6fr(#_l7#WwB7U%j+04?4cXGkVfw2 z5^BUC?meANXFt?-(u&?IA{6AVq{3MUQ=Vte-2dd#pWzy)#+~Di8-W&24DqS+VxJoB zG*6RR)P}7dv?aP;IXMl{d^}nK7scksdjxZVBH9<%Ue_)sYm_xHollJ8$OM27j2K^+ ztVL{2ASRC?hf?0l96oIYD%B27`_DD=b198rvNCH!&Cl_e%pQ-)I>W(%fhC`T zU-G+c;4%>{)Uo$VURtT{exFS!$WIV;Z%xbf-{m{5&Z*yIbMNJ&BaRDNlbRj3kA&I% zUpev27pwVmcuaYpXRiF%vsp9IGbziWTbR);U2i9HjOzCG7!Z-=VUko9Z_2{?51nW_ za``67#zE)d0Uh9taoNBofNw7*Hw?fbj)IE?OqhmhGP6E+_Uh+Pe3=`qf!16ReKiH?0X9 zg?AM#+mt3l?OmXX)cK96`#4#*x()Nq4pu!OqR|UXrabx8a!ZJ`NjB%g>}kiZ)m1|_ zP=hZk7e6DrF;NqmlFi(e(HQD@xl|%}{vGUGahFR9+$&m!1t10@o=}YI>$-U-qAMUFtIe3 zr-$M~n+^85f}DXSH-~cEdkyhLE%-p7O$2UiqOBpp`_4(O&5pn+%`jpw%EW<7KpqX@ zKP7@rzcqXJw@s*_F=daQuv3#;A+p#X-v+5=&)HE$@o0QCYzCEB@Kq|BpVqCVOS>?2yG z%pZ-KueyU=CVdvNLeSG?H6|nc(*DJMpr89$^HK+AG%A0#!Z}5rUqBxQ_Lo>0!7*U2 z=$GgZ`Xj~0J!0EMttpQAJDSQjY=|U-Q=owt5RTk-p@o574_hz1tIH$c<*xfb1Dq|; zJyN%o{<$&D92o)g-Vb4&W$gd9sAf*t7kp$VA*LUAhJ>z) zP#W(>6uy6znR&+d=W4g)yw*Ip%T)1OVM_5#4n&M>Yb4U@D&fhtg3iZ5;>mdNAvX;H`*N0Xw4uL68{KV)2Yoz70Rl=b%;=r5+6JU#z(G*t=0u>Dbi z*vAVsaxY-PS56vN#QVq?#+lw;y^3?iA4Yf*(v#D+7wJ8Q879Ri%c&h?LA4fdK`Lwg6|nm@(jO95Zt6Y0}nDvJOGJWXEf$^TIMYRnlyZp z#=CE4`|W3T$%Bfcm~Eyb=1%4{LxjW&)Aay2~%)8dSpS;{%8N#E--B2*@Xfo_bp~3IX@xhpwFQLVsVY<#{ zEAz@LLopiUTyaUM((orK5 zHG0)(oNPlvwtMj3*Kc@HRyZ2nKW^n6pw z^1t5ybj^poBkwsS`cHU}9o|zZjLpd7J;-i7l(DgudA=I+Wd1>bk&EQ{2Hno~M2#(L zlu@NDb}aolvQA1_s2X6Lq?Tn!kAq01=yv1E$0!raRBx9Y|3>Gz9$=@1sacGHx^zb99q{ZF|E`&fM0oIBhj9PUXzfz1ns#1X z`9fFDhX&8xw!a`lJie>`z*8I+<;l?UDzik)Mp>#&i@w96 zfXKcJ3mQ;hFwJiRe@#tpPD!!6C5%@^BAN*y)4);9=eLcNpnfxf^40R?&6c@8{yflN zLg&2p05HMbo{If_3Ks0vVBTw=y%>T@cI|~)@!4f-B-A_R5*Brpn4#9n`PR9rlalWP z=LmLGMVRXYb>~d_SZP_tWRJ!^FNdY-(-^sBkh$#P6hK7%!mFYPWOwCNDay1k(bG6o z@-l})5nMsC6dS6BFLIY(8fzMhI9m&qK!^wHtfhO~9a1A4@2_itq&8ha)-u+5x0h%j zk{Wn7P2g-4mn1Wad5T9W{>&C?=FVy~UD85ue#WzQsWTK`&@>rs)Np@doDWSU^wL&k z*{#BWe%6`;CyJfyHyu>Ak-CmHWrb)qO*A+;YhLd4k$F2D^uwgsx-QkejBO#f)RxWK zM#mLTgw=T3)umI6(~V*e;@&u05$^i*P(#H;<2gf z`5x(~Az%bez$@9#7-b6QS3^od%$w%2`X~%Kl~kayajrCV!$O+rwX~*CNo=W2^c+Z` zz}i9p2fNI#_^FWDq}>D9(a=vh^x8DSa!Cx-zm}1N4$Bqm%Sh8mV zImxT}FF~+SdEuljiyDDh^@~LL)p_vqdv1z8DOzIAJ<{zedydRIpbsZuJzD#LY$UJ~^!g_hOt)r(umb>GMW_{vF2t8SHHE`B8iUk|wLkW3} zWnPeh2wg!`9vuOrbRHpC-M9_FvLyWMbpD%Mp}< z0dbt(O6_AIR;9)@n0Oq9)2!EmmQ%#}-PX2=*C+{Q1g2c=Y`5l3q6GR)8o;W=ZbD-{ zEw46W4?49eXzRl&eaTJ!ob&3M3Eo;}_@;Tx9RuN885dxJryFe$2zp`n#7bg}slD*E zTMt|Ks<3L__p#$1Hi`)`{3VLYrM&Jj=%c@=cz0|TK!SmabP&f9!4&nCr&S@NH=u^r zVdZvlLC;T4dln+&uOlNNdhU7E61hr&=nW6j>LEQH%kJ8ztEAXNUk#grQC=F^K+6b% ztKUP4r#f5HLy{=SY+pB5LPNgLpFrMYJasi)-76Oy$Z~WypH37lIs(KbfwT}b*utoq$TkY3W-EL# zadfaxvg&Y8RRHtn>A&fnE#}^QiP@wf5E}dZ9T3^8Q;mZ^Keg2e*Va@;vz+oHWzQ-I z)>Uq3W!EApy0V%|J!xW~FRSV2YiZ`_E!vyKXQsWh68N1dR}y2q_NL|9(kj)XO$sVR z*-0&$cW5voy6x>idUMevqyvQD=nXSuuKZGYD?2wE%PjPB!ZxNX&{;zeFvZmU&G+W5 zvt+gBe(ZM-fAj zSv+|^_qGVKDYCLE#*Vzitm&&$axLm_XnuQyO-_9qhz-r=BQb%<)*EJ7aKfen{-Jo0 zf?}cDE|8()No+_V8E``MP2xa1Ag^T{`G!wgC+$-kA1nW`G!VxsL`dkxWixHs@%ea_ zq15VXaCV-RI4ppR)7LA381`g9Iq=DZ06f)quw?;p$_OTAXnzxWuVH>`z}G5j46+!2 zH#m1dzI|?#u(^aco~zNWv3=i$p<%07=+I!5`2aDRX|f#IRx= zBrnCo9yj{QcQ-9voVz%6bwYqZbqBJfiKxn=)nIF`!F7xv!Y`E3B%<6g6308u(#|+W zflj_#RUwTM8If6e+)8S7VY+trKegqt8{@F4gl;~JTHvxZ#iYEB5h&Xa=4Y)otDtLl z(V{U*DJuE|59OUtKDFJYLVJoQKn8F#TEq}`?x;aHHG9@a_d_2~S`i@~JDOk-(FRp| zYWewskhU5OW=+XM&(lz=kzYkaVwaNEN@Y9uCtgM!9KFPRBh8{9vBWWOsi>9z<<;~q z#*d{8yuc&G&1mA7L6gJ0HUCFN>z%v$q{8B35%^umbR+u}C_O}c`;#M3-8+?=uRj#Z?rp_7;0{9s$7B<6+u{n=* zhIV|@`7gvT7*04k+P@d7orr&QuM~p@YJJah+F!E>OGWL11|^x1uV7OWaxP<1je?{P z2#M9#R7R#zhKPkBvvTZ)-kn&`Qp83E)63rUn=00|T@C{&L>2tPvz;zB`=!^>t#;Mx z7AX;9H!D(i-ka^$L_p&u0&1Tn6Ww-7-1Oym5rB%oP00E6D0Q1mHIPp|iEL_);bgoucN3ACM6eoQQl2RJN1uV6W|`V~U|LeY%lV@W%E zD)nmBajXx0H5xKCmBf~Z0vq+Xd_Q~ExuE*qScN<9#DHBuR{ZE{D<>}~C$HR-}CUfsP|Z=#=Qj<^OCOj@Xov)fERf3mS$Kv03O_(YItJBhih}` zKx^yqO|cNk(^Kl91gDLXCd_OFeRgq?cYdxwXeQyYB{Xk3iH*n=*uzCu^8<_JF}y!; z`kls5@d^|i#FVL8*LekWb_1*N zrK#hMe`3VGs%DmpYh8)vxcJ!UBfc~kExIC;1e1B`!afe|^{IN9kFoCca90y=rla+xT0Uai{~t6Hi^W*OHe z!pIb^oTt#p`vV>93HY)Kv@mXNKgT$@TRk-^JZM(!4JEZpzK2p!Fhg_iFRvP z>F*YWi52aLdEDvVMNzXimfENgiCH2Et!ho7Qsg)cCFsc^6-6=ugpDPZ{lTcSfttg; zfJVov45u2xmlh~+Sh9O7M`dQLcl9`IjW3gsXxQG)qOV}+NO%vp-2EmO+Ph}DWQ9?It3g8KvKire@ zcWqP<{T6E1A{AaT*i@Q96#3Jzz0~@Utn&PfUYYJvLGy@&Z0rnuGUGKW9W|sB*(np3m&+mb)D<4C_Phs} z(TdsQsiuGDAr*Bcjdd%&Ng&J?76gfKh>?r(s$b(lGuB()<#HtiOb%4~6rUuk1TiOJ?k%qqfakGF>s=$!g@=V0rJLl=hZDpNMSV(zgT3YC&pG&O;#g_X=*4Qkz{y zdokZoG=broaTD;DvAyBIQ295j!GTth;_EXqu;9nvMy%rd7V_5H1(iL$7Inn5Mon#X zahjR*q#*Je#1OsUgfP70?) z{qE|eCUy>6-gs%Z@I+@Ub=Xqun!0)ThC2JvOzKX|Zc0l2aBz=BN`8j-K92Q+O@qQQ zA7)nZk30j5GgM;4i4ukTd^k2KV?v;0jT+L3x2tT|4%uJBTZub|M&0z!xhmt z*0Q{BEmoYt8!xw}F*DKc#4yAM{#MU7o;iv?+?m;SVMOtgu)u+^KsCf)*=s}{G4fsH z=gC(Yb>2dOvmPedi|PM;rOC;tFDKE}k^X5YOToVhk`?!+&QNB2v2Gs#g78I`B+<%dJ+F}#5kO_5GVv-B|mMnWb*I3fufgZi0HrG z0JQNkz8ep~W!pK+j5cGLW!6}JoY>HoV0VJ^NdMKm0%(j(1JH=NM?9E0OSlYt;0qd; z4&aEm zAqjm`5&C{IFNQnKb1(Jyo)_G6H{1Be{ zaw32*l9>X}pwA3jvP;o_tTUs3PtgWO2+Th>zI)6l7NCZ0-Mg11aI}2T z6vPCi^0Dq&d-bZS{rpaOg?K?uN@9Hh>`5CO7oLs%#GdyNt&)rebjn>TK5eUX%tvh} zGFCm$ZNBuDFEaih*MHSaUXRsJd>6pjXf~H6L#-KdS-3J(4Aj)^N3klfO;MJkqd0EM zd3z8%`zH;MT=Tx+gr%GCHXYD;f;CMp_kUTzUrQVHK?qqg1bi7~zl4{n|G@&VCMPpS zsf7P^1=fUBmg9e!lm(oT|B5kyt->5|4gk}RnsKHHk^0|ubCQe2iSY!iGw}$Gh`1=? zX<+-Wp#nVeQ7mcG3}a)$aI&zokj^odus}72p~_@17<0R$fjv&P=!XMMMx)u23ki9Z z|IW|4-u=vPG%l8Y`9P^l5ciQTH^h{@R4~TTDjY8m_C)5?HPP-D zZ;}cu8giX{4x*MW^}KD!uVV>rH7ZOKZS_+^$BWqCxsWq|;@vLyT=IY)tFkxyThZ3@ zbw)(TvQn=qyV|F>^tGZZNt=IX$c+%Zd>J%d%*mK|Y zj(P4Uw?AM%(yv}*-G0sb$8CiFD@zSTpME*wl)!q$n3KZu_06ZDKYuoga@1q%-UJ;s zCC!F^D0v1{@z4dL-7}{7@y}N?X`eFReU)HoAAGFu{L%O>lT|z`*KOe!am}K!SDi38 z$0vU>qqF_(=SDgYvmHCskK_&&<(x?GXIrC;3Pg`y{$s=?4(u5*Q2pxi_wLLQrf+3! ziiFG;cR#p%r1#up8k$}tIt~ph)L~+5RyHS|0Y9Xo%W>Z<@ zH+5c+Up`Dd3OFY^bowo=>h8@qbxq#OZAZ9mr(G;puIl>$&)us@)PV4g0PWhh?5?WA z&&lI!z@IbGIqk>eZ#=`_iRygT=NU<+{3E~oZt%Eq-|yM?=<{_ePyVO-7*EvDKUln! ztrKSVX(S%`M?Yuq8X4cQQuYrmoAHPT(?c^!14*oZ2YqwkIS_j>O5}-BtK6m3eZWcL zYNo%_+h0F*#D^cdeDJKe{&!yd&$Wz#R3FnD+&@2cIyH{3%g;L7D*RFPWt>x;ed-W~ad*?sq(kWROYjA!_KRhYF8CLmU-`%AK}~JtPRhBjzut)+Y3`HY z(^m;Sj3x6x)cWg%8vb8wPwsX6rxmT|@dcvRaR<|4_w9F16}ep&4%9LzKOhXv>6W+n zJ`DOJs*~|?;8@NtmPZJ50}JW%Rlb2TVYHAy2}glufxWR zg>jG1-x1pk*dYHpu{5niG{oFx`pWg!#^`dlnZB-m<$5VPGqSe3cN9_Z%KzRwMt8k7 z)Oy|Nl+Hb0^Z#}A=J8Oq|NnSJDMAt|TPsPHvhS6UkjkEA$eMlMhM6Q(LZ!0Ph7e=l z&DeK_WM9UWI=;Vt1Z1 zt=Y<{u3EpJ?XTJ=RSljRD`&8}ZcM9F2dDD{W}`-KiVY`>K&m_FPmI2+usK*HJ)>UF zE$T=B+cy%z~TXFAaw{4iseZ7b!`pek;!TP7^||7Wh{ z3^}_JbByxO{NkQ`6F~W?+h{$n{b5iJ`|RUOB+M0bIxfx$6bm5!o$cMf8@KDG!#8dd zDlSO+7Yg_R$NN9i2X^{`e>zNhJ<*B7LrS~;Fe-YS> zOhiKOU6_03laMT@5K!@8@rTK;GfK(t-#m+wJ0kd3vikF(346oV>SgXb+%7Fzr&^k~ zq97$ppDq+NNf@s**fn0a&~LwOivFv0)%Hjr^Nh}AW$)JcqVVCocd+~W;U>Si{-4c+ ze74D$KN;ISLUdn}H@{E4zSM59A6NC3u9rHGbeT{7H;KTQI_dY2*HMFl_yLs>#=WYj zo^O{pWwnrBM_+rJQy>*WceHBHnYk>g%4mPn_Q}gVXJ?c2`(1icxa?4b+8+^L-51a2 zUxQ6ja*l>PpO;j4s|5|Z1XD}$kT)sqfvXbusthf&e%>{D`O?YdT&WoG&}pAQ!^u>G z6dzyghmst(I!jJHOI;=}$vX=}Z`0rLa@(vZX-lM{o_1b(QCMuw`&IvJz_r`8N{3tq zMl)>6Iit?_eNL(wwz;3DG4jgUwBbziTfYw%m>JM6f17n1hfbh;&#ea)TbixhY8uMS zF2BO=b~>{b#P$EOm7qJ*?vvKsP$*18RE=Dkt4Q?1U0)i>c&^g)UyQvsdf15k_?t70 z(bNE8zxC;~=;a(DXUUb9n>+WP{3yOi`||T@XPwW$EUTFb2d~!pa!%1bl6D4nj`4Rc z2Wbx(BgN;&MCZ<_?hmzMZ?l$ezvM32sTDr&YNc)RQRJEB4u?>6l=XL0lH|3b?uti3 zPTq(SnOWC9Q#Q6bn^%SE*k_&3c6JRoub=H;IV{(7)xP1ed{s?nuIf4NI6sW)`?F6| z9$yeT_w~jR&!!LeChUjC@4Nhv`fyZQ3{T77ir4Ixc=zVe)&@5VPPeT)jm7Keu@5Q| zw{IRX+B}l8schNU%wC}X?#h$e-b|LTZulcx*qyZef1_dS6dT`%&XxoWhlu}9bSct5 zuH+4ADtX`NAvQE;^uO8pwfVw%ExY3}|MHxOKy(ASco(-ESu*qa$Nm{Ri@1_)=_@-< z(@(F%KfZ0tNYa?Ja| zoMQ6PzN*MI5--zUD1MaBIP+Zg>21#(St--sADyD^7y577z6o}%aZ7r;!6UWRG9&pt z+!TA&*Wc)a!ag}uLlzpVjmtps$4=o$o6hG?P-~(V`uB?p(?_ecd0((dcWDLs`}>nN zRh0bK6O)sZlafRvI6l6;YLj|vDI(@;r#Ph@bJtA1%s1dY0DV{`R`NUE#w} z{$VB0ZtQK9hF~T|{}+f-w#Bn7Nf%mw?xqJcaikp@l0Q7OwPJpE;#~&PZ&ew4 zI&yiBrxZp;+T<^V6Ho-E@EO79{4p8@JHNp10PQzEdto1xTLP z^a{xnKAd%4*Zop`d}FhN4%ihxHIbt=koTbsPok{T7YLOQD(#dhdO4;`7$26wukaUWc zj#u03O^h0~F_8=!FRAF2}9#39Kj=Wju#WM)et2loSmwL7#NTuO+nST zkbC(aYWq|zcD_X7r&>G_S}_^iCWpl3dxTI^*j2Yq-3m<4-DQ2L76_+REurvfDQ?Ri zA^5rgOy;Rk^@;#Y5UG6J9lrc6N+fe^2paN?LL*~QBpNx(AM5a&e>~u82%So*aG&&V z;}6&mK@z|yqn9+Bz&Ld_&_t*|mO9mhf#V{0va|7b69hLrsfy5FY$GG0aMpI#>0KQo&Q&vXcY);K) zHMtjj!xz+GtCo<%R?z&x4v5(mGPd{={yW4}$Nsgl!!MF{ap~Q|kL$zBJY0kDy-L_g z84jMjOxXU4qu?Hm{V6U=gG}PzZD1FG?#^hHhi=`ewX*(jW_+JE#3T^-e)traLi2K0 zo2U@P$iaoMVU}~8`fAkf0Br4AO@Iw)BB=sbpd}FM>+Rf0iaCGc_T}#-B_$qUJ$%q= z6;P6UQPZ)RNVsj+7bR@<5*R?}PJdflz{V}v;ubcq1Q@+vt6wtA1Oj(UR#JFE(>@%l z{|>w`jf8>}FtJ|i?L zlRG^Hi=;4P-uqm0uKpM9$fx_)qmITUoXD<%%c)p>>61Z&h&}v;Z{VI{mZOROKj@vU zoI&}94U++XO%O7?&>IFNu7~b^(+XVFEh&k9JNJ!Auo{>#X>-z~lli^8K+yaLDw+7r zjVL1spM68#tbsfK5ugX&uEzJ)2!Ls9iRRu;-JMp)Kv#3Jvm70O%?C1aC0Ukw_V@K| zO_C;jFrlQ2iyxlv*YDWIsd$l8NWHrHolh%-|HlPLSXDaVzDM*pK>UJRD)D6=D12{z z#iZ9jfcrT?Y={Nir)yje6QbmiU@CM~bp#pi=QduRKk6!ODqrl`|D9oA07Ivdz;cS2 z-Y<2swmxJg`+2g4q)gc&Sq08SFfg&%J^2a$>M>c(B7s^jo|&-`uHu)B66|=~?AA+& zKkmYN%$dDwyrv>XrTM~}I&Uwp6Uxcxt22K(XbfaQIHkx00*whhdrrWCjWiWN7eyeS z?)+^g3zIXWH5xR8Zzp_Mij!AdF<#$`eNWD7*|`Va$C8wuK2;JRfw-$^M<)631Yl;q zy&avsygrk}btC;&oa+8rkAZaHKXp)I&MxL8$3o}~m84eaL5EpYx{huS#p|npuM+Eq z_Lm<%9BpdSb34h(CT1adOJ2T|K+Q+1kZNClJTGwG*r;%%L8fT<2MD^I0q)fci{>6s z3Qm}6#8PYdau_q>O=n>5?bam`WUPYsGKDjO9Z2aaFt2;RE*1x1VOILJ#IZH?@Nfh0 zZm$sRhk&V|fFauc+vbLHSGsi@aYHFl8xE&~xJue03C!4MIxd+bSz;4YQpZBUvSMIu zm|8MXDSi&fYx*0LHIBe+I5{~z>Ig#{0U;zLSs-;e@Z1v1L16NzS{QOnhdEe(h2y?! zghcU;RL~p9f{E$r0({F5^pfvD`Jl|M*P1+R^tmwZ=}P<>;!@&Bkp~u;ogT8fQGu~U(Z0JBR0ZP~^JG1c z`^h~f9ut)_^)!Y6kcXxUco=`v-btZHLN*p%WFdZ3!f=MqW)-4#o0;A46O_DBfvus_ z!0`_FMVErf+91N}z=7KX)UdpUg_Jn-44OQqn}1AN84aV|N#6msq7AJV+t=NgBF{!6TroxQYQY(4 z3+Hql95~}_N~CTnR@*gY=^#c!1~qu{1<#$c@}VW?A&}ePE;9VboW+2;2}-c?KH=ZL@5jRZE){Ilk>F|J+n*z9eBb?( z`PZI)xIDO{`=ojUOIz4V(m^6#q@+1wl_ z@Q8^zDB3_@ttZ0+5;$}8hpkTJimdeCbr<8d>o?8gTGUZtw`RVMy8c%7Ye@^3R8Un| zc~w<06^u_KO(|@Yem=R1PJxg`w~3pDEc^kdmM!)L#XPq z3hjcF={IWhXoSjkJ3FlhMXNv&%u#qj`f?n6w}}*Sxnta;4i80W-s!9t&KCW>DuZm-Eyf2^%ZBf}O;&I4VknCysQoDT7887TmPMjLS0AlR zr$kpwc&~v}v!w+F8MGb;w~fu4E>^4F%Q7deKd09HY|98-)u-*~qxQjZj&NeaHJMT0 zoB=nGl?6<~EOewd;IBKR9N-tgWpH^4TGd9or|D*}&^uJUuf)dE{fARb*pnAJMh*RzMGe6UfUlksGE-DEuc?0dQ{FtqNmlMbB;q+fwaa5mZ_knG~sm6 zNt8=iNl#CQ;aU;^)DCW0NXQ6UG-KhpVI319B4$~>Q!BG1n-Ze}C3ypsh*qi1rRAaa z$C@zE`EOBzG!qmF3Zd`IJ<}-fG_(?w|MG6sq=iW^q@KFf$Rg4BEX0gMl{|q5NU*U* zui6of1b~%X0V4+#rnn>RFVS_fo(TR&>)b>!gkU51*QClk<`Zql1N-#06^P>Xw48mwN<(x}GhMyUjh?IXI`Zakddl?xjE`VVz((0H^^XL78$%mcYsoq=@@*;><3H}UHVkQo zZNJ(Bu{puOpeBBqX}laxstLe3PYc7hJ>WAekcr}j9xQP2DHUj&un=%E`qm#E@yzxm zRg%J#V^4Q)Eq)UUr?kNV?Aq~BqvIj_e-hl0D~nMA6oGh~0VE;c1GTqku12&~dq}mc zX@x+kth-Hx^H}IsRDZT*^1YZxbZY0f_MM$D8j_}2g6-FWdy*yt5N0Kj=f-YfLe{cU z+>?@KK5OBlupX0DE~y1r6rFZ}w|3|B*T*X|(&mjr*75_69b>ABcCXtY(r9-St;$!n zQ{1cfT6iF{)FXB2!TY163YcflqKicJ?j<+bpjR;3-qMFq8Ve*fF}Zp!7ByPqD40T* zgzmSKB%Z=?arBWmgk=p8ih;hG2_9nyF%7y|wd9jQrtl!QT0R_&-mG3r2beo$t!zQh z0Y@yQV&hH!b`PM(;IJ_Bf1|qNP0lbTFkI;h<8C=GVtwUC z-Kpam_66Y_KT(LFKiXYiVq*w08wM|>J6*@i-TWPhpW^k6ja1Lnc1?#@xh#oqhDe`H z3wm4`h?_miqIo=}r*(OGd49gRdH$6?U$3qaZ_KgRJlvq-+gTmV;}Ls$|Jv!f_I}mC zy_P}86Kg{SmbHN#nESOgW`)*g(ceuKC6dWZ`w-Y3m(}5=j-REDSR}ykp(}qfvk_K< z7|a=?p{_5*e8jMEZwH6PC@cyc<<$SZMQ&nilqD#l)_((}aS03PMp@PCjk|s^M;{h@ zV2~h9gF#>0%MDS9%9_ca2gQu4>dlU9tQKruD?Mm&6qLcyJOknm+*3pU$t3dJK$rT_ zC>V`bdZ&O3eaEjEWoziH_9Cu7XK-Mfe>&lJXWF765TFj^oUy|K?6G-!y>g?5Ay@h3 zJ*}Ndn-MHLZggvM{cXCDiB-_1f@4~_^FoqiI?{K=3E=XNS9JpUk~`^MkT=+y0$+X! zz}jN@0ns6^56Mm|KkXgtklZ%;{@Y?`-}1++10_VvIeP}%iJVC?5*Oo<=F>YWs&853 zNIHX_Iv@uE=$jaN9EuiKgn-Yb)C$bpeCM2rJ3U`MzBzr97BgHy8O@+Ar6~pA{+c-G z6o$0C%`2#0Eg#2D-#mF3@qQ|Bj#c1DkiOk{hxd*S{Wj^^6osPomb|EQ8Otf46tAa} z@Z2jOqlfdKmTlMKd#hGgMJuoqd%K+a1*S!_#d^HPY319|8FW66=5*MiSv9)*Av-&} zC2Y^$F(Y(;pRm@eLP|}51ScIu()M|=9-(lm#@YxyTEeO#2rr`?t4iCQBNGKHw{u0S zF7a3tI^bnY@XeJz!;BK{fKzCY8MdhN-`M+0r!1)|RomTcVIMS&@eJ+$*#4WEe^z0l ziTJU1%FRJmPalok{iB0c#&-v~^p2xEFnBb|vvZrv1q|TtLiTT~vTb1y6|6!DWdM`7 zG&Dw7@J~tTqJM$}94CHmyef1FibWm?wO{+8mFc-nko7tT1L)qqUs5*1qeD8l{Q8tArv; z{DW%1daK3J=UJ7FIXI2P_OBzJO3t`xT)cWS)cUDma!;1$FK>vLX}#!K)v0FpH*4O9 z?!XwXfKucYS|-3_oheUU?&eJ|d{2dBo*EeqN4if|qb=ant-cEs8(t-;ai47VCvPgM zY?deg#|7xr_;1XLI_+&Q)H2%{=Z-zPiRt^+(7+}7MZ&bunv_0CCJ9b6n<`jc!eY=} zzl$<;n5dYHm#Ny%g*tXzXCtpPn~G@m#Oqs?zxJq(V9__P@*XYD>^|@Wo>)4TKI}pH z0im}6Bk!iI(D50n#1Y#!Xoi(56CQ7P@7~k6S9Y=`wpn=dSdEXdRR}JaZEA7L`PS7T zeZ?HY;lIZJB5yterBiBm8wCwG*A$YP8{#axZ|is9)O)1{0Q^=?@wxFcHi5mnsL+JK zx5^JY^wPhmRXqQ8w>jyvjZH#6~f8kPV<;j?1YLHLiTD*z7;`lyTA(Gxi@<35z z0b7XO78Qrws%B)?%g!+}z^J81l)ICs^B~k!WGEEA?m=~eK;pv!HYN^eTktgdXVe}q zYA+A9oyV@ayQL>Lc@mQUqtWM#zMWJmAkT82_I#-vb#krrWxyTndS+ogx;zl4Q_+ge+XF)>wMqEe~Z z>D70~xYHPjHvQity1s}nsJ3ZpX(cT+?=o77*G?ZPSf8IigI%+lUFcn2-d@N)9_74w zaUJ`Gwwa1A zRejcx*s1L*m>lVC=oJ3u=EuWoM$-43Z9;@bHr5cRO%pi51U4%Sn*{~yZZv8)I^SGv znx)}Pln=7VzKcI#0{2HpqGuQ5ptw_TlT~%9wz0%MSpUBL#}2EUbwE+l!>A7(wS+F) zgf@mnCeiV58X7()2LnGd=%9Ti1+vg+WLi<^D_)xWed$)dc?B_pG63IBp$pRX^kU&e zG;MUO%tg;JsHi&kwrHd4Pe1A8n0S4~Hzp%q;kdj0{<1Op@5W_3jcO)x#s>ctQ$fdv z)-NWAt<7JC={U2k;0zjAEgoP9IY4hl*;5B}$o zs@625HJy%%iaM`n?1&W%Op#TVZYC#3uyCh)cZ$r-&3U*N!J!M?QV-Rz6F%us+TI&n zPAHj_;kB3~CBmPW9<)&=R@)D%$h|cLHGz)L$ku~bdyjCuHZNUcK^}ueXF(N#i;r)Fh z4TbZ$dJ5Ec137r&xQD*p##He_Oi8a|w4X?Ikgk#8L&YEw-fbWt)lydT3?+kZil=lp z(Tg)}6DK8EQFbtmzrIo4xsiq&CKl!<4@yd;TCdKiw1+VaT)xcmj%V=_pLNz_*n>cy zVGKGuU8VHlaY>>-Aey>YcLuX9LkWX5r1c=&RkGaJef}>vp%N4d)$i&oKzRg}u&NF0 zSpFDFX0P3vjUKP?aMbIMe~yPajx&uzpc^vcjB@C{X>0L<#;!Zn8zV)w7#Oq*#8^sZ z#_k(9WsN=;M`@1>DWrxc&BJSim}fp4gji`)tc5|04iXIR6cM)V!U<2k0BdVc>y{i*Az>lmR$aSP6+xt6Q=cZH)wUEOQLQ&#v{aM@OgIVUN()GYm^rVo9ik-AgWwl zSCp`|U3lWC0X1WW%tdkKKz zF2^YsZ-lcCjniu#uDufMsn9HPTz(+-MN&zr>D6f1*AHwvq{4I6F&IQ&ZM$YzITD zLy=riL=1HdL;p;lf$v74wngcaBElIH!>+x$=n)iTjta<5c3pj?)Zwcu0s(e*yUb*| zpj%?aQiygsOiL@lQ!n9$RX6Q2|JmgXz31rkx)LcIHf4lB;c`LQVcB%J3o9LH=s@;6O<;?nkiBgQT3QBqFN4e+n)4fW z_S886ut%=%N*sMR4!+=sqCSuRF&~q^|{I#B#XJ5Q+N zCbZG0y2p;!0h&BVdmJA|3(M4Ld#Jj1MW{pPRnp3ePp?AshjH@2kFpHI>B&>+M!zj9 z{1-Yuv#U|I06C~(%Cv(Y}6@tZcSqmyft2v~mhK+?tTha>>w%JCmx2WSrI z+1LZq=(U`KQt0YhU!sex178h0=L)?kd8G@(&9?YvoXvQRyIb#=6rj~!_;RH`y?Xm^ zUIFqWDL-a$hH6#qy7Fg0-(02I4%a1t3K@5+0Og_-nK(Lr&Vk(RgP!!o=l>(T81<@> ze@8@fKhV9@aT~6Nu$~Gf)sZlmPFF*}{_h$SkE3}cPTM0--+f{lX2yN&Lyzw{=Cr$! zFKd4FJMkr|){k}Qqdj?a+ZH*qM$O8ldzkk>IaIifN5UFja#%5Zl(}rv@?Zsien;8bzXa*d}hFU?TfDa&(%Tx|ACyVMJq*r@LXG6$rN=lTZdP%Dxv zyDW8is4XQqQzt=XZ(a%z9#ds0a`Z{az7lGu3r@<0FLs$vO*EEVW7h$&{)O&((p7jS zu6cLE10JQ;L|c!MyJ1%RiYa|JDSAB>)Oi5>80f3Sz)0zJ$|vGZvg7YlngGh&{f4#l z#%ZL;x|^0dg>i8z1^(jWAmyXs-gZ5{HExQ9;Udzgd3wpwh7Jy`@U&sX2j~*l*;2`#Z{^A26$YHA>$f3ky`QyfgRzQ(RP3B!__oczZKDC!a&^Uc!<=DWx1~UL1&9 zUtb4$iT}2?Fz%&8OHNmIc6LS(aiyr}YEzRs;P*g{`l+MC(!hX|h5N>BWhtqq@m2?N z;5)z8bB?dGDlow=GcO~4MDyT-pE*B!;4tu~|8aUA1WpB1;5x)>tjJba;`rN~(H;2} z_pBAbIe5?$zF$$!0b-|8O>00}>H1F^5;hL*IFLLU07PLNNL=yIL@T3|^z@mSi+R_y zQ@*OLNmxjFw=ARtChT-eq0NR)54Ap@JC?hfZf7E36v1f*yc@9XK=M%7RGC_<18MMv z&q{G7nS_NdjxJ3FllfIs05#yf6w7}gsG|cm#t55A*z}Ojj#~J932{DNpSl&L_HzzE z_n;V!mC?~1pq3XOpF((LT2Gwi`BAQAS#TvVsjIG8tIUp#L zZcR7U1Yl=+N2^?h5A;Zn&06Tv?ryG8wq@|j)pa+sc)3UbBWQpV269^K|{ae#+f z06f7ssLDdfZWZvY2Bud!ZC|#}l-e%Ef)Ca}14ZqgP&FXt^DA(USY-Go)hn1I&Zv;+D#%pRucHmz-INT5H z*o^ym!tNCzB5_awu6O?@BzPrr+`T4TV=@GvPnrnD{-mN(lRgq=8g_H@3PPwca_%#g zdtc1mkrBd_mS`S`H*Oz?OB-6qGI!ta?E!(j?=U?s^p~U-mxypbohbi$*+Tgi5<3NSJ`>bv-nWb z=SFU|_d*T`tYcL^*;3u|xS{7E!?8eBDk5(}4?(BHm_Wv8CB8|%XKx%NdVyQvq9v2G zP?l%r{il_l^PQpvfpn@{z+@=smY5=go~os^fL>5MzSDn)@oM9r;2L{m-0&8*wajih z2Ws=?wYV~uVKz2aSYaqx4n^1iy(Q1F$WTBdQ!E28O}{tmut=VCcvwwrjZUa^M-#5 z8Rn~Q{9P-U46&vol{R-%QrwFrxK;1OfnJMT0UC1(^aDXcGK(_@- zbLXba|22s37AnjM5q3ju_xkHTjV zxwYD(g)_4;M3OzX-1#2OAME3$UIPdGUtq^2Mt&B7^8)+kYWqJNQ@u1xMzO)^ACvXm za<9Q1Xe|;UFd%vMX!^`FYM5BSMw4ZhWX{JJe33wHR=WVUw2>}Vr?)D{OJ%M8wH>tq zWLzK6_d=8*C)^OAevqIYkK0KLzh36Xy?3Sin%tSaMjll(?_mM@FWAhOjM`piM(s2O z|5<&$)(2g+xSF?T>(8aI@-tIyFJ7%-&V5tlmaJ?r=qyMJUVW<>9-{479~}uQR|o1o zAv|1N&tH?ANU5*y17xVI`@{&gEs~YDppH0pl!fQx`Sa(^s=STha7@)w8Z`+Wav+)A zWjlHDw>io^(5~`ZC-m)scY4;-xKGaAtl)L8wDEP_`DE}=f$(?WdErSt%C_HCWE)`Qjt(7+I`-b7_!;FWXV?L^ad22CuJ zgeM0jAMpe*zHSJkbxDi^T_A$hjjZx&X#-%ywe2ohaejUm>0|~f75GKv@^?ayL;Pb< zzzieI1LjyW%!0-`0Wmf_96&HKnG9@VbxiXUGP7z=^WD}?u=F22=a}B`XBoCFB5Irl z3;r=`Q5QVe%F0_A+g=zJM$?g~vb$_zV|}~qrnGWnnw0V_>3VmBIdn8D<}wSn(~pMM zsohatM2))?B1#c<*#bHfF;UPhI9fm5mn`EVUgJ79do?;9JA4hB8mI`VTrT}As-(ET z%)l#a(dqI?(t}leymWgHWGr(y8eG9==yrSO?Pv;*}cz;l8XG;CvMC2)Ai>ZQ(=Tb6Tl}gN(!_D+5Z@`6^)FH zbg#ro0m}TGi4~OUSkTm~f?cPDsXmB_6-Uy7FC*%R$)Kqt8->z01Vzlxo)kpYOe;`) zy9t0A+#n2lOx5nK0!S9cl#6r_L_992o%L>CD;N(MdoH@azY#_+^!IDo=Bg#1?CZR2Oq)@ZW0_{9F=EcS`o}E1m$Jw)IE2kUrh#JtAg}{Vtl%<&DKh>~F z|23Q%AnRtVZD~ zk+koAf7`AF?ynB6GF2=e<@t@<z;xO)%EF!ZU=ypd<1AFA6gfwAO}ktFKrzUl+YS+N7S~R=x99 zRF;ix$14M&>NW_h-*3-8MZ9MHiR)aePHStc;TbOwPJ&i*05H8c@X!Y({`^->_&OLo4D>X7xKQYj?GRcs5_$C0@7lN5}XE zq<`3{(WlGOhwwSiB!3mVrnJ^Q7-Dq_%tO;ZeG8t4H4;bKo?BFCMDw_h1cGLfcAmXg zY+H2~8y$(&YqIopG_89f!R_g->a#J|^28Tgj84xyG)K;U>Oze80;{g0Nu?B_Lusu> zc_ul|z&oMdGZ9Om$8U7xstz|Kl<>KI#5oxEq1LzQYA7|-IJWeD38Dz_zW~egaW!aa z@j(0*xa2|>r9fvzq+8W~uBb_Rb#4FqFeFkGQTc2#g2&q+ba5Y~3)+|uTGhqrJ?YK= z>pLi62th>fOG)h)a`v;2;{sQP<*kJFMG}QGlJpy{tMTjnHrZR5I4p2TRf9#Ja1-#5Mf;aq~a zDJlOo=Jl)W5L$PJ$syero60q_OdQv^benb}BbhGV%;h)_w!`5ATj@p$IE00Vhj$xP zTQSaGzY_ba$RKfl;Fiv*GB4}Oj7~4perqpD^%)0I@1KccI>%qGPfy<_5DtqB*}@Ue z-d~1vIyBLIgxg&Umqp6)*9w8Cg;cdVax1#ow^I52S%wzR+$zDh%aa()e6^%v=;N10 z>f!e?VEfNETR{de9qeE{NA1pAt)KoHU_&4dy-@se?I9=NikWY#Z$~&>cvmF(h4ZPA z>IKjSMLTwXQOWdmTzg2PZZ}m^<~Im-TvLlul9G>lg=OQtqAu{Vu3er`QsQ^fRC0do;rbS=m`} zUdLTzt2kW+P0x#-PRO~gbFY5!^~hC*U)jaC8M9DvXoRQqUxK>-BRfy)7sa(le{_NQ z0N7-D`odsj)G_i~@txfK|GJhP{J(Cr4c(N=Yf3zh=^L@}l~>IqGGKR8_fE*H?UHgI z{<=CCof9x^P|lDMDR|Z`!BE2}reUD^YLbl5Lor5<>ZOHP#p5O|4b%P8(DUkq`HRpm zFV*g)prDSjxUp{pb2d)n{@$=eQR6}<=5|reOKVeuZC6G7@V;9XHKMDIb#lf$MxA1w z;yzXA8uQfHAxv9Gd=W?d%(D||BeO#*Po|bi&x+r^y8N<8c8$YQBbPyYDeO4sH(ntX zwiHh}J>de~aY8U*a2T{r(RXryA_P(jx7gD}a<`1)(c(t;oRj0cyoVwqd71j$Z%TAp z+nseRIJz4f!93G&W3`js(wiiv<=*t@Q(|tnODgH7^R`+NshdvMN@TgiQs!G@FP6XX z>jE?5om0vm%}-C3bM_awU(6Ykez0Aa`;&=5a}JsLMW^)EcSD(VIVmyO=b1u5xlLE> z@gn7hMkX1?#Tf>1@pYa)d4UTHb%Nz@jQjjbIl8`<5L&ez!Y-VyV z_c!+Q@tLWYQxl<Ly*AetqhGe6MEdhQZgCMDxZ! zrb%Fro-6rOa%k$jrJojRn5*KL^t0R3j~IWCRY%d(uU0&~RgH+!jdD?Ko;Cfvk=*DT z*LyvXtGf4A-_xi-@cs%)Uv^HEz5$f_YqUe*fk;`R*{zjgouAU%+v~|}KCz4A(frCa ze+EA)CPa<~Ka{OOn<$y8d@{>dJ}JHOUU-7*{`X_pn+sos5*i|Ar`*L!uMJ=&!X0`~ zlr*59%Cw`f7!*8<hVl^PusV-wHhKy}I8)G@KWqXNyBT{?@8|yYu3N!OFKTmE2IZ ztJi%nLQUffGo98~C<~OV>NQ<$EA|{Mq-Xk|X!WDJz-Ub0yil!FKZX;EVaNzK?)sZ4 zDBZ>S=b4Bj!!N13Q>)KX8jhMAuhpE^vua^47}ZPf$j~!TPF~z}8d}asy9y^fd5xa< zK8eu?9Y&1QsD7(cv|W8vbUuhy!76xTLgE$VIdPh$-QE!_O|O8p1F zCBJy?@|61P;YT~GKq{`lbn2Sc8<)8{=f3-T(W|EsewuRE;(MoiCJPqth;M&F6<~XF z5FL=Z{qif(cGe+f``Y?Csy{QYXcMw-xacJXBb|K^t(Byr_BP$BcdZh9nr`Y%_uzgB zC;0`3xbAEhj-nQSYI?=rzjNWx;p6MKZwtzQ^!|FM%vCYFK;H^4_F3+???OywYDJnQ z)mw9Td^{3GsMi%Z5`DZB^>b+B+2gMRzC(^i?M?3zl-cApBj9JDBd2IqM04)>uQTfV z90s|Xds*!trOQ4OpJZ(3yXjB-HHVNgBAtqzNhw=JwQYEZj_O8XYHOzJrnoJ-wxuQHi-IOg3kL@ox6E@IJidns)~Wp zhsRHH>MjWvF@LBt`g!@(i$jdESKp^BXI`@WQ))5u3q6?F+Oo(MpM1@%GwH>4eQCj- zxXDQM-`B^&E}xRbn@1!iXthW20oM{czN|Xg$&F(_ZQw)k7Sh>=1@##OoVnSNlYM&| z#3F?g%OzUgy%U%OLW7or$P%mYYwTR@VMX=3)<#Dhe$V}8{$zb{`GfhtJ$;&yP5DIr z;(fN%3pqU(>!0-UJzd+~#+R^ZeZM_z$=Hp$LN91I$8#j_bbH5L4l10CdZLe@~Ve#y#g0}#PNE8 zH|N{Q2csYIIKaQ7q;maIsmE-u9KUVNaO8{bN7wMaSFh@O8H?e9TDGg+?ixn(LX3$* z{|@!gk!&F_KKE=1tn6uqJBN;#pOTbw#C^8m2m_Clbg%^A#B@y?YUE#L1LKtrFcN<^FcKf~m&AGMhk%^*=!`%FDpr&UZmo(9kL;gGH^e? z#dCgDC7%Y0Om*;U_W7pGVgH`u#+CPGZD#l1ZysFw3&&SE#&nK$YD@ARf|>r<;;BBD z>gPIH8vGD}lmXIfjP~%;p-fHDH$HGXb`m#gXp^=V;$A3S#tuLO}digBlg+iXg zt>E07cdZLU28^+{=#z`*>zDr@m8BPH literal 1037441 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

    )=%ND}31~tt?RB(kN?5E|exxWy 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

    f2!%YK@y7XzU*Ia*Ee_dMXxW<#~i~>`i|~%H)3Z za(A#NH3Qx_yR(}zRuV*hLa9Xde%@=|>E%(tygo)*o_qLyQ_6PBc0=UVNua95rQ~7C zOJxRGMU8R<)@ycIeyKIWw``-VS1AO@>Zs?Gx@?PAgUKFhIr}8kZ=N;JN)($^Jiw09 z?S6)qL)NVYSls&*>(G5!^-1^5hB>5?E`Rpu z@Px9t&CR0H!xE^I+0Z5h`j;bXgLG@EQE5WmEeyS+hSgO1m$N{AP5*5HxEeTmzx?@3 zEQ%Bo9Wd|9?rcfJ{n0`-!f-7iO=q{>lg_kuy&lMr^~~hbea^;Pp?ke9gd;l7{x|(! zY~w7-1Nx8HeHJI#vKMQk%vsJu+(Xxo_LY|tF7GE?$f!=;vPB15nwAn)jnRbyjWL=y zA;(21bee$_cWS)c_q-3hN4TSJu*}SJ{qobLLc;RlkmI2V0M|qzyJqSKoK9|)1ua9s zUZiRjpTyDoEOJrzuhc4?-#qNK7$bdN{$WZFG1-&jt^G0fwsWTJz~#FyC#oWEn;m$d z=eVFMi{GIs5zw-Lgzpw|&!PatrRQP+fDK!@LVXC66IzRA@bkC`xK+u&&$hF$�H8hx(Rcg+EYWW6AeHjvzC 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. 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%0AU58nzb5iUD?J3P^@1$Te4}TM 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 tnK^%~m- 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

    G0Ln~hxP8P2eEYb` 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 z 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 z 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 Nrkc*p0+svE{}1rz6x;v+ diff --git a/samples/aspire-shop/ts/apphost.ts b/samples/aspire-shop/ts/apphost.ts index 5647b8a4..81df39e2 100644 --- a/samples/aspire-shop/ts/apphost.ts +++ b/samples/aspire-shop/ts/apphost.ts @@ -1,40 +1,47 @@ -import { createBuilder } from './.modules/aspire.js'; +import { ContainerLifetime, createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); -const postgres = builder.addPostgres("postgres") +const postgres = await builder.addPostgres("postgres") .withPgAdmin() - .withLifetime("persistent"); + .withLifetime(ContainerLifetime.Persistent); -if (builder.executionContext.isRunMode) { +const context = await builder.executionContext.get(); +if (context.isRunMode && await context.isRunMode.get()) { await postgres.withDataVolume(); } -const catalogDb = postgres.addDatabase("catalogdb"); +const catalogDb = await postgres.addDatabase("catalogdb"); -const basketCache = builder.addRedis("basketcache") +const basketCache = await builder.addRedis("basketcache") .withDataVolume() .withRedisCommander(); -const catalogDbManager = builder.addProject("catalogdbmanager", "../AspireShop.CatalogDbManager/AspireShop.CatalogDbManager.csproj", "https") +const catalogDbManager = await builder.addProject("catalogdbmanager", "../AspireShop.CatalogDbManager/AspireShop.CatalogDbManager.csproj", "https") .withReference(catalogDb) .waitFor(catalogDb) - .withHttpHealthCheck("/health"); + .withHttpHealthCheck({ + path: "/health" + }); -const catalogService = builder.addProject("catalogservice", "../AspireShop.CatalogService/AspireShop.CatalogService.csproj", "https") +const catalogService = await builder.addProject("catalogservice", "../AspireShop.CatalogService/AspireShop.CatalogService.csproj", "https") .withReference(catalogDb) .waitFor(catalogDbManager) - .withHttpHealthCheck("/health"); + .withHttpHealthCheck({ + path: "/health" + }); -const basketService = builder.addProject("basketservice", "../AspireShop.BasketService/AspireShop.BasketService.csproj", "https") +const basketService = await builder.addProject("basketservice", "../AspireShop.BasketService/AspireShop.BasketService.csproj", "https") .withReference(basketCache) .waitFor(basketCache); -builder.addProject("frontend", "../AspireShop.Frontend/AspireShop.Frontend.csproj", "https") +const frontend = await builder.addProject("frontend", "../AspireShop.Frontend/AspireShop.Frontend.csproj", "https") .withExternalHttpEndpoints() - .withHttpHealthCheck("/health") - .withReference(basketService) - .withReference(catalogService) + .withHttpHealthCheck({ + path: "/health" + }) + .withServiceReference(basketService) + .withServiceReference(catalogService) .waitFor(catalogService); await builder.build().run(); diff --git a/samples/aspire-with-javascript/AspireJavaScript.Vue/package-lock.json b/samples/aspire-with-javascript/AspireJavaScript.Vue/package-lock.json index ed633d5b..18e78092 100644 --- a/samples/aspire-with-javascript/AspireJavaScript.Vue/package-lock.json +++ b/samples/aspire-with-javascript/AspireJavaScript.Vue/package-lock.json @@ -1081,7 +1081,6 @@ "integrity": "sha512-aPTXCrfwnDLj4VvXrm+UUCQjNEvJgNA8s5F1cvwQU+3KNltTOkBm1j30uNLyqqPNe7gE3KFzImYoZEfLhp4Yow==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "undici-types": "~7.10.0" } @@ -1132,7 +1131,6 @@ "integrity": "sha512-pUXGCuHnnKw6PyYq93lLRiZm3vjuslIy7tus1lIQTYVK9bL8XBgJnCWm8a0KcTtHC84Yya1Q6rtll+duSMj0dg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.39.1", "@typescript-eslint/types": "8.39.1", @@ -1619,7 +1617,6 @@ "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", "dev": true, "license": "MIT", - "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -1904,7 +1901,6 @@ "integrity": "sha512-ug92j0LepKlbbEv6hD911THhoRHmbdXt2gX+VDABAW/Ir7D3nqKdv5Pf5vtlyY6HQMTEP2skXY43ueqTCWssEA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.12.1", @@ -1965,7 +1961,6 @@ "integrity": "sha512-lZBts941cyJyeaooiKxAtzoPHTN+GbQTJFAIdQbRhA4/8whaAraEh47Whw/ZFfrjNSnlAxqfm9i0XVAEkULjCw==", "dev": true, "license": "MIT", - "peer": true, "bin": { "eslint-config-prettier": "build/bin/cli.js" }, @@ -2010,7 +2005,6 @@ "integrity": "sha512-K6tP0dW8FJVZLQxa2S7LcE1lLw3X8VvB3t887Q6CLrFVxHYBXGANbXvwNzYIu6Ughx1bSJ5BDT0YB3ybPT39lw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "natural-compare": "^1.4.0", @@ -2863,7 +2857,6 @@ "integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==", "dev": true, "license": "MIT", - "peer": true, "bin": { "prettier": "bin/prettier.cjs" }, @@ -3151,7 +3144,6 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=12" }, @@ -3210,7 +3202,6 @@ "integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==", "devOptional": true, "license": "Apache-2.0", - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -3272,7 +3263,6 @@ "integrity": "sha512-tI2l/nFHC5rLh7+5+o7QjKjSR04ivXDF4jcgV0f/bTQ+OJiITy5S6gaynVsEM+7RqzufMnVbIon6Sr5x1SDYaQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.5.0", @@ -3366,7 +3356,6 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=12" }, @@ -3386,7 +3375,6 @@ "resolved": "https://registry.npmjs.org/vue/-/vue-3.5.18.tgz", "integrity": "sha512-7W4Y4ZbMiQ3SEo+m9lnoNpV9xG7QVMLa+/0RFwwiAVkeYoyGXqWE85jabU4pllJNUzqfLShJ5YLptewhCWUgNA==", "license": "MIT", - "peer": true, "dependencies": { "@vue/compiler-dom": "3.5.18", "@vue/compiler-sfc": "3.5.18", diff --git a/samples/aspire-with-javascript/ts/apphost.ts b/samples/aspire-with-javascript/ts/apphost.ts index c2cf9b7b..7805e25f 100644 --- a/samples/aspire-with-javascript/ts/apphost.ts +++ b/samples/aspire-with-javascript/ts/apphost.ts @@ -20,9 +20,7 @@ await builder.addJavaScriptApp("react", "../AspireJavaScript.React", { runScript .withExternalHttpEndpoints() .publishAsDockerFile(); -await builder.addJavaScriptApp("vue", "../AspireJavaScript.Vue") - .withRunScript("start") - .withNpm({ installCommand: "ci" }) +await builder.addJavaScriptApp("vue", "../AspireJavaScript.Vue", { runScriptName: "start" }) .withServiceReference(weatherApi) .waitFor(weatherApi) .withHttpEndpoint({ env: "PORT" }) diff --git a/samples/aspire-with-node/NodeFrontend/package-lock.json b/samples/aspire-with-node/NodeFrontend/package-lock.json index 4529a52a..4fc7276d 100644 --- a/samples/aspire-with-node/NodeFrontend/package-lock.json +++ b/samples/aspire-with-node/NodeFrontend/package-lock.json @@ -134,7 +134,6 @@ "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz", "integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==", "license": "Apache-2.0", - "peer": true, "engines": { "node": ">=8.0.0" } @@ -1094,7 +1093,6 @@ "resolved": "https://registry.npmjs.org/@redis/client/-/client-1.6.1.tgz", "integrity": "sha512-/KCsg3xSlR+nCK8/8ZYSknYxvXHwubJrU82F3Lm1Fp6789VQ0/3RJKfsmRXjqfaTA++23CvC3hqmqe/2GEt6Kw==", "license": "MIT", - "peer": true, "dependencies": { "cluster-key-slot": "1.1.2", "generic-pool": "3.9.0", @@ -1182,7 +1180,6 @@ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", "license": "MIT", - "peer": true, "bin": { "acorn": "bin/acorn" }, From 1122ecec06bdc9408107496ada1727e947421440 Mon Sep 17 00:00:00 2001 From: David Pine Date: Tue, 10 Mar 2026 10:27:41 -0500 Subject: [PATCH 18/25] Fix container-build and orleans-voting TS apphosts from aspire run testing - container-build: withDeveloperCertificateTrust() requires boolean arg (true) - orleans-voting: Use addCSharpAppWithOptions for withReplicas support, and withOrleansReference instead of withReference for OrleansService All 14 samples tested with aspire run in both cs/ and ts/ directories. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- samples/container-build/ts/apphost.ts | 2 +- samples/orleans-voting/ts/apphost.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/container-build/ts/apphost.ts b/samples/container-build/ts/apphost.ts index 37ea1d6f..c13b9f19 100644 --- a/samples/container-build/ts/apphost.ts +++ b/samples/container-build/ts/apphost.ts @@ -25,7 +25,7 @@ await ginapp }) .withExternalHttpEndpoints() .withOtlpExporter() - .withDeveloperCertificateTrust(); + .withDeveloperCertificateTrust(true); if (isPublish) { await ginapp diff --git a/samples/orleans-voting/ts/apphost.ts b/samples/orleans-voting/ts/apphost.ts index c61325dd..a15cee05 100644 --- a/samples/orleans-voting/ts/apphost.ts +++ b/samples/orleans-voting/ts/apphost.ts @@ -8,10 +8,10 @@ const orleans = await builder.addOrleans("voting-cluster") .withClustering(redis) .withGrainStorage("votes", redis); -await builder.addProject("voting-fe", "../OrleansVoting.Service/OrleansVoting.Service.csproj", "https") - .withReference(orleans) - .waitFor(redis) +const votingFe = await builder.addCSharpAppWithOptions("voting-fe", "../OrleansVoting.Service/OrleansVoting.Service.csproj", async (opts) => {}) .withReplicas(3) + .withOrleansReference(orleans) + .waitFor(redis) .withExternalHttpEndpoints(); await builder.build().run(); From 2fc9565412d3101c582aec4774d3e3484c79bf3d Mon Sep 17 00:00:00 2001 From: David Pine Date: Tue, 10 Mar 2026 10:49:22 -0500 Subject: [PATCH 19/25] Remove POLYGLOT_NOTES.md Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .aspire/settings.json | 3 + samples/Metrics/ts/.aspire/settings.json | 1 + samples/Metrics/ts/.modules/.codegen-hash | 1 + samples/POLYGLOT_NOTES.md | 413 ------------------ .../ts/.aspire/settings.json | 1 + .../ts/.modules/.codegen-hash | 1 + .../container-build/ts/.aspire/settings.json | 1 + .../container-build/ts/.modules/.codegen-hash | 1 + .../custom-resources/ts/.aspire/settings.json | 1 + .../ts/.modules/.codegen-hash | 1 + 10 files changed, 11 insertions(+), 413 deletions(-) create mode 100644 .aspire/settings.json create mode 100644 samples/Metrics/ts/.modules/.codegen-hash delete mode 100644 samples/POLYGLOT_NOTES.md create mode 100644 samples/client-apps-integration/ts/.modules/.codegen-hash create mode 100644 samples/container-build/ts/.modules/.codegen-hash create mode 100644 samples/custom-resources/ts/.modules/.codegen-hash diff --git a/.aspire/settings.json b/.aspire/settings.json new file mode 100644 index 00000000..3f790204 --- /dev/null +++ b/.aspire/settings.json @@ -0,0 +1,3 @@ +{ + "language": "typescript/nodejs" +} \ No newline at end of file diff --git a/samples/Metrics/ts/.aspire/settings.json b/samples/Metrics/ts/.aspire/settings.json index 25c983c9..3c03a3b9 100644 --- a/samples/Metrics/ts/.aspire/settings.json +++ b/samples/Metrics/ts/.aspire/settings.json @@ -1,4 +1,5 @@ { + "appHostPath": "../apphost.ts", "language": "typescript/nodejs", "channel": "staging", "sdkVersion": "13.2.0-preview.1.26159.1" diff --git a/samples/Metrics/ts/.modules/.codegen-hash b/samples/Metrics/ts/.modules/.codegen-hash new file mode 100644 index 00000000..1369f62c --- /dev/null +++ b/samples/Metrics/ts/.modules/.codegen-hash @@ -0,0 +1 @@ +385A37965F5742D9B7F75074E7065C879412F46A58CE04016D535C18DA21950E \ No newline at end of file diff --git a/samples/POLYGLOT_NOTES.md b/samples/POLYGLOT_NOTES.md deleted file mode 100644 index 18877856..00000000 --- a/samples/POLYGLOT_NOTES.md +++ /dev/null @@ -1,413 +0,0 @@ -# Polyglot AppHost TypeScript Conversion Notes - -This document describes the conversion of each sample's `AppHost.cs` to a polyglot `apphost.ts` -using the Aspire TypeScript SDK, and documents expected gaps based on the -[Aspire Type System (ATS) spec](https://github.com/dotnet/aspire/blob/main/docs/specs/polyglot-apphost.md). - -> **⚠️ Validation Status:** These conversions have **not yet been validated** with `aspire run`. -> The gap analysis below is based on the ATS specification and the `[AspireExport]` attribute -> model. Actual API availability must be confirmed by running `aspire run` with the staging CLI, -> which generates the `.modules/aspire.js` SDK from the installed NuGet packages. Some APIs -> listed as available may not be exported yet, and some listed as gaps may already be supported. - -## Overview - -Each sample directory now contains a `cs/` and `ts/` subdirectory to isolate the C# and TypeScript -AppHosts respectively. The `cs/` folder contains the C# AppHost (either a `.csproj` project or -file-based `apphost.cs`), while `ts/` contains the TypeScript `apphost.ts`. Shared service projects -remain at the sample root. - -The TypeScript versions use the Aspire polyglot apphost SDK (`createBuilder()` from `.modules/aspire.js`) -which communicates with a .NET AppHost Server via JSON-RPC. - -### Prerequisites - -To run the polyglot TypeScript apphosts: - -1. **Install the staging Aspire CLI** (the stable NuGet CLI does not include TypeScript polyglot support): - ```bash - # Linux/macOS: - curl -sSL https://aspire.dev/install.sh | bash -s -- -q staging - ``` - ```powershell - # Windows (PowerShell): - iex "& { $(irm https://aspire.dev/install.ps1) } -Quality staging" - ``` - > The stable CLI (`dotnet tool install -g Aspire.Cli`) does **not** detect `apphost.ts` files. - > You must use the native staging binary from aspire.dev. - > See [Polyglot AppHost docs](https://aspiredev.netlify.app/app-host/polyglot-apphost/) for details. -2. Node.js (v18+) or Bun must be installed -3. A container runtime (Docker or Podman) must be running — Aspire handles all container orchestration automatically -4. **Add integration packages** using `aspire add {package}` for each sample (see per-sample setup below) -5. Run `aspire run` from the sample directory containing `apphost.ts` - -### Adding Integrations with `aspire add` - -The `aspire add` command adds NuGet hosting packages to the backing .NET AppHost server project. -This triggers code generation that makes the integration APIs available in the TypeScript SDK -(`.modules/aspire.js`). **You must run `aspire add` for each integration before the TypeScript -APIs become available.** - -For example: -```bash -aspire add redis # Makes builder.addRedis() available -aspire add postgres # Makes builder.addPostgres() available -aspire add javascript # Makes builder.addJavaScriptApp(), addNodeApp(), addViteApp() available -aspire add orleans # Makes builder.addOrleans() available -``` - -The CLI will: -- Scaffold an AppHost server project (if not already present) -- Add the NuGet package to the server project -- Regenerate the TypeScript SDK in `.modules/` with the new capabilities -- Start the .NET AppHost server + Node.js/Bun guest runtime on `aspire run` - -### How to Validate - -To confirm which APIs are actually available after `aspire add`, inspect the generated -`.modules/aspire.ts` file. It contains all exported builder classes, methods, enums, and DTOs. -Compare against the `apphost.ts` to identify any remaining gaps. - -```bash -cd samples//ts -# After aspire add and aspire run, check: -cat .modules/aspire.ts | grep -E "add(Redis|Postgres|MySql|SqlServer|Orleans|Container)" -``` - -### Skipped Sample - -- **standalone-dashboard**: This is a standalone console application, not an Aspire AppHost sample. It - configures OpenTelemetry directly and does not use `DistributedApplication.CreateBuilder()`. - ---- - -## Per-Sample Setup and Gap Analysis - -> **Note:** The per-sample gap analysis below is based on the ATS specification and has not been -> validated by running `aspire run` with the staging CLI. After validation with `aspire run`, -> the actual generated `.modules/aspire.ts` should be inspected to confirm which APIs are available. - -Each sample requires specific `aspire add` commands to install its integration packages. Run these -commands from the sample directory before using `aspire run`. - -### 1. Metrics (`samples/Metrics/ts/apphost.ts`) - -**Setup:** No additional packages required (uses core container and project APIs). - -**Convertible:** Partially -**Remaining Gaps:** -- `AddOpenTelemetryCollector(...)` — Custom C# extension method from `MetricsApp.AppHost.OpenTelemetryCollector`. Would need `[AspireExport]` and NuGet packaging. -- `.WithUrlForEndpoint` lambda callbacks — URL display text/location customization not available. - ---- - -### 2. aspire-shop (`samples/aspire-shop/ts/apphost.ts`) - -**Setup:** -```bash -aspire add postgres -aspire add redis -``` - -**Convertible:** Mostly -**Remaining Gaps:** -- `.WithHttpCommand("/reset-db", ...)` — Custom dashboard commands not available. -- `.WithUrlForEndpoint` lambda callbacks — URL display text customization not available. - ---- - -### 3. aspire-with-javascript (`samples/aspire-with-javascript/ts/apphost.ts`) - -**Setup:** -```bash -aspire add javascript -``` - -**Convertible:** Mostly (after `aspire add javascript`) -**Remaining Gaps:** -- `.PublishAsDockerFile()` — Publish-time Dockerfile generation may not be available. -- `publishWithContainerFiles(reactVite, "./wwwroot")` — Bundling Vite output into a project's wwwroot may not be available. - ---- - -### 4. aspire-with-node (`samples/aspire-with-node/ts/apphost.ts`) - -**Setup:** -```bash -aspire add javascript -aspire add redis -``` - -**Convertible:** Fully (after `aspire add javascript` + `aspire add redis`) -**Remaining Gaps:** None expected. - ---- - -### 5. aspire-with-python (`samples/aspire-with-python/ts/apphost.ts`) - -**Setup:** -```bash -aspire add javascript -aspire add python -aspire add redis -``` - -**Convertible:** Mostly (after adding packages) -**Remaining Gaps:** -- `publishWithContainerFiles(frontend, "./static")` — May not be available. - ---- - -### 6. client-apps-integration (`samples/client-apps-integration/ts/apphost.ts`) - -**Setup:** No additional packages required. - -**Convertible:** Mostly -**Notes:** Uses `process.platform === "win32"` instead of `OperatingSystem.IsWindows()`. -**Remaining Gaps:** -- `.withExplicitStart()` / `.excludeFromManifest()` — May not be available as capabilities. - ---- - -### 7. container-build (`samples/container-build/ts/apphost.ts`) - -**Setup:** No additional packages required (uses core Dockerfile and parameter APIs). - -**Convertible:** Mostly -**Remaining Gaps:** -- `.withDeveloperCertificateTrust(true)` — Developer certificate trust may not be available. - ---- - -### 8. custom-resources (`samples/custom-resources/ts/apphost.ts`) - -**Setup:** N/A — This sample uses custom C# resource extensions (`AddTalkingClock`, `AddTestResource`). - -**Convertible:** Not convertible -**Remaining Gaps:** -- Custom resource types (`AddTalkingClock`, `AddTestResource`) are C# classes defined in the project. They would need `[AspireExport]` attributes and NuGet distribution to be accessible from TypeScript. - ---- - -### 9. database-containers (`samples/database-containers/ts/apphost.ts`) - -**Setup:** -```bash -aspire add postgres -aspire add mysql -aspire add sqlserver -``` - -**Convertible:** Fully (after adding packages) -**Notes:** Uses Node.js `readFileSync` to read `init.sql` and pass it to `withCreationScript()`. -**Remaining Gaps:** None expected. - ---- - -### 10. database-migrations (`samples/database-migrations/ts/apphost.ts`) - -**Setup:** -```bash -aspire add sqlserver -``` - -**Convertible:** Fully (after adding package) -**Notes:** Uses `waitForCompletion()` which should be available via core capabilities. -**Remaining Gaps:** None expected. - ---- - -### 11. health-checks-ui (`samples/health-checks-ui/ts/apphost.ts`) - -**Setup:** -```bash -aspire add redis -aspire add docker -``` - -**Convertible:** Mostly (after adding packages) -**Remaining Gaps:** -- `.WithFriendlyUrls(...)` — Custom C# extension method defined in the AppHost project. Needs `[AspireExport]` and NuGet packaging. - ---- - -### 12. orleans-voting (`samples/orleans-voting/ts/apphost.ts`) - -**Setup:** -```bash -aspire add redis -aspire add orleans -``` - -**Convertible:** Mostly (after adding packages) -**Remaining Gaps:** -- `.WithUrlForEndpoint` lambda callbacks — URL display text/location customization not available. - ---- - -### 13. volume-mount (`samples/volume-mount/ts/apphost.ts`) - -**Setup:** -```bash -aspire add sqlserver -aspire add azure-storage -``` - -**Convertible:** Fully (after adding packages) -**Remaining Gaps:** None expected. - ---- - -### 14. aspire-with-azure-functions (`samples/aspire-with-azure-functions/ts/apphost.ts`) - -**Setup:** -```bash -aspire add azure-appcontainers -aspire add azure-storage -aspire add azure-functions -``` - -**Convertible:** Mostly (after adding packages) -**Remaining Gaps:** -- `.ConfigureInfrastructure(...)` — Bicep infrastructure configuration using C# lambdas is not directly available. Default settings will be used. -- `.WithUrlForEndpoint` lambda callbacks — URL display text customization not available. - ---- - -## Cross-Cutting Issues Summary - -### Features Available After `aspire add` (Expected) ✅ -These features are expected to work after adding the appropriate integration packages. -**This list has not been validated with `aspire run` — actual availability depends on which -C# APIs have `[AspireExport]` attributes in their NuGet packages.** -- `createBuilder()` — Create the distributed application builder (core) -- `addRedis("name")` — `aspire add redis` -- `addPostgres("name")` / `.withPgAdmin()` / `.withPgWeb()` — `aspire add postgres` -- `addMySql("name")` — `aspire add mysql` -- `addSqlServer("name")` — `aspire add sqlserver` -- `addJavaScriptApp()` / `addNodeApp()` / `addViteApp()` — `aspire add javascript` -- `addUvicornApp()` / `.withUv()` — `aspire add python` -- `addOrleans()` / `.withClustering()` / `.withGrainStorage()` — `aspire add orleans` -- `addDockerComposeEnvironment()` — `aspire add docker` -- `addHealthChecksUI()` / `.withHttpProbe()` — `aspire add docker` (or dedicated package) -- `addAzureStorage()` / `.addBlobs()` / `.addQueues()` — `aspire add azure-storage` -- `addAzureContainerAppEnvironment()` — `aspire add azure-appcontainers` -- `addAzureFunctionsProject()` — `aspire add azure-functions` -- Core capabilities (always available): - - `addContainer()`, `addProject()`, `addDockerfile()`, `addParameter()` - - `.withBindMount()`, `.withEnvironment()`, `.withArgs()` - - `.withHttpEndpoint()`, `.withHttpHealthCheck()`, `.withExternalHttpEndpoints()` - - `.withReference()`, `.waitFor()`, `.waitForCompletion()`, `.withReplicas()` - - `.withDataVolume()`, `.withLifetime()`, `.withOtlpExporter()`, `.withBuildArg()` - - `getEndpoint()`, `builder.executionContext`, `builder.build().run()` - -### Expected Remaining Gaps ❌ -These features are expected to have no polyglot equivalent regardless of packages -(based on the ATS spec — lambda callbacks and custom C# extensions cannot cross the JSON-RPC boundary): -1. **`.WithUrlForEndpoint` with lambda callback** — URL display customization (display text, display location) requires C# callbacks that can't be expressed in TypeScript. -2. **`.ConfigureInfrastructure` with lambda** — Bicep infrastructure configuration requires C# lambdas for accessing provisioning types. -3. **Custom C# extension methods** — Any extension method defined in the sample's AppHost project (e.g., `AddOpenTelemetryCollector`, `AddTalkingClock`, `WithFriendlyUrls`) requires `[AspireExport]` annotation and NuGet packaging. -4. **`.WithHttpCommand`** — Custom dashboard commands are not exposed through ATS capabilities. -5. **`.PublishAsDockerFile` / `.publishWithContainerFiles`** — Publish-time behaviors may not be available. - -### Sample Conversion Feasibility Matrix (Expected, with `aspire add`) - -> **Note:** These feasibility ratings are based on the ATS specification and have not been -> validated by running `aspire run`. After validation, some entries may change. - -| Sample | `aspire add` Commands | Feasibility | Remaining Gaps | -|--------|----------------------|-------------|----------------| -| Metrics | (none) | ⚠️ Partial | Custom OTel collector extension, URL callbacks | -| aspire-shop | `postgres`, `redis` | ✅ Mostly | HTTP commands, URL callbacks | -| aspire-with-javascript | `javascript` | ✅ Mostly | `PublishAsDockerFile`, `publishWithContainerFiles` | -| aspire-with-node | `javascript`, `redis` | ✅ Full | — | -| aspire-with-python | `javascript`, `python`, `redis` | ✅ Mostly | `publishWithContainerFiles` | -| client-apps-integration | (none) | ✅ Mostly | `withExplicitStart`, `excludeFromManifest` | -| container-build | (none) | ✅ Mostly | `withDeveloperCertificateTrust` | -| custom-resources | N/A | ❌ None | Custom C# resource types | -| database-containers | `postgres`, `mysql`, `sqlserver` | ✅ Full | — | -| database-migrations | `sqlserver` | ✅ Full | — | -| health-checks-ui | `redis`, `docker` | ✅ Mostly | Custom `WithFriendlyUrls` extension | -| orleans-voting | `redis`, `orleans` | ✅ Mostly | URL callbacks | -| volume-mount | `sqlserver`, `azure-storage` | ✅ Full | — | -| aspire-with-azure-functions | `azure-appcontainers`, `azure-storage`, `azure-functions` | ✅ Mostly | `ConfigureInfrastructure` lambda, URL callbacks | - -### Recommendations - -1. **Add `[AspireExport]` to `WithUrlForEndpoint`** — Provide a non-lambda overload (e.g., `withUrlForEndpoint("http", { displayText: "My App" })`) for display customization. -2. **Add `[AspireExport]` to `WithHttpCommand`** — Dashboard commands are useful for operations like database resets. -3. **Document `addProject` behavior** — Clarify how TypeScript apphosts discover and reference .NET projects without generic type parameters. -4. **Consider custom resource extensibility** — Provide a mechanism for TypeScript apphosts to interact with custom C# extensions that have `[AspireExport]` attributes. - ---- - -## Environment and Testing Notes - -### Running Polyglot AppHosts - -To test any of these TypeScript apphosts: - -```bash -# Install the STAGING Aspire CLI (required for TypeScript polyglot support) -# The stable CLI from NuGet (dotnet tool install -g Aspire.Cli) does NOT support apphost.ts. - -# On Linux/macOS: -curl -sSL https://aspire.dev/install.sh | bash -s -- -q staging - -# On Windows (PowerShell): -iex "& { $(irm https://aspire.dev/install.ps1) } -Quality staging" - -# Ensure Docker (or Podman) is running — Aspire handles all container orchestration - -# Navigate to sample's ts directory -cd samples//ts - -# Add required integration packages (see per-sample setup above) -aspire add redis -aspire add postgres -# ... etc. - -# Run the polyglot apphost -aspire run -``` - -### Expected Behavior - -When running `aspire run` with an `apphost.ts` present (staging CLI required): -1. The CLI detects the TypeScript apphost via its `apphost.ts` detection pattern -2. It scaffolds a .NET AppHost server project in a temp directory -3. `aspire add` installs NuGet packages and triggers SDK regeneration -4. It generates the TypeScript SDK in `.modules/` with all available capabilities -5. It starts both the .NET server and Node.js guest (connected via JSON-RPC over Unix socket) -6. The Aspire dashboard shows all declared resources -7. Resources start in dependency order (via `waitFor`) -8. Containers are automatically pulled and started by the .NET AppHost server - -### Validation Checklist - -After running `aspire run` for each sample, update this section with results: - -- [ ] Verify `.modules/aspire.ts` is generated with expected builder classes -- [ ] Confirm each `aspire add` package produces the expected API methods -- [ ] Update per-sample gap analysis with actual findings -- [ ] Remove or update any `// POLYGLOT GAP:` comments that are resolved -- [ ] Note any new gaps discovered in the generated SDK - -### Known Runtime Issues - -1. **Staging CLI required**: The stable Aspire CLI (`dotnet tool install -g Aspire.Cli@13.1.2`) - does **not** detect `apphost.ts` files. You must install the native staging binary: - `curl -sSL https://aspire.dev/install.sh | bash -s -- -q staging` -2. **`.modules/` not pre-generated**: The TypeScript SDK is generated at runtime by the CLI. The - `import ... from "./.modules/aspire.js"` will fail if run directly with `node` or `ts-node`. - Always use `aspire run`. -3. **Must run `aspire add` first**: Integration APIs (like `addRedis`, `addPostgres`) are only - available after adding the corresponding packages with `aspire add`. Without them, the generated - SDK won't include those capabilities. -4. **Container runtime required**: Docker or Podman must be running. Aspire handles all container - orchestration automatically — no need to manually pull or start containers. -5. **Project discovery**: `addProject("name")` discovers .NET projects via the Aspire CLI's - project detection. Ensure project files are in the expected directory structure. -6. **Async chaining**: The TypeScript SDK uses `Thenable` wrappers for fluent async chaining. - Single `await` at the end of a chain is the expected pattern, but complex branching (like - conditional `withDataVolume`) may require intermediate `await` calls. diff --git a/samples/client-apps-integration/ts/.aspire/settings.json b/samples/client-apps-integration/ts/.aspire/settings.json index 25c983c9..3c03a3b9 100644 --- a/samples/client-apps-integration/ts/.aspire/settings.json +++ b/samples/client-apps-integration/ts/.aspire/settings.json @@ -1,4 +1,5 @@ { + "appHostPath": "../apphost.ts", "language": "typescript/nodejs", "channel": "staging", "sdkVersion": "13.2.0-preview.1.26159.1" diff --git a/samples/client-apps-integration/ts/.modules/.codegen-hash b/samples/client-apps-integration/ts/.modules/.codegen-hash new file mode 100644 index 00000000..1369f62c --- /dev/null +++ b/samples/client-apps-integration/ts/.modules/.codegen-hash @@ -0,0 +1 @@ +385A37965F5742D9B7F75074E7065C879412F46A58CE04016D535C18DA21950E \ No newline at end of file diff --git a/samples/container-build/ts/.aspire/settings.json b/samples/container-build/ts/.aspire/settings.json index 25c983c9..3c03a3b9 100644 --- a/samples/container-build/ts/.aspire/settings.json +++ b/samples/container-build/ts/.aspire/settings.json @@ -1,4 +1,5 @@ { + "appHostPath": "../apphost.ts", "language": "typescript/nodejs", "channel": "staging", "sdkVersion": "13.2.0-preview.1.26159.1" diff --git a/samples/container-build/ts/.modules/.codegen-hash b/samples/container-build/ts/.modules/.codegen-hash new file mode 100644 index 00000000..1369f62c --- /dev/null +++ b/samples/container-build/ts/.modules/.codegen-hash @@ -0,0 +1 @@ +385A37965F5742D9B7F75074E7065C879412F46A58CE04016D535C18DA21950E \ No newline at end of file diff --git a/samples/custom-resources/ts/.aspire/settings.json b/samples/custom-resources/ts/.aspire/settings.json index 25c983c9..3c03a3b9 100644 --- a/samples/custom-resources/ts/.aspire/settings.json +++ b/samples/custom-resources/ts/.aspire/settings.json @@ -1,4 +1,5 @@ { + "appHostPath": "../apphost.ts", "language": "typescript/nodejs", "channel": "staging", "sdkVersion": "13.2.0-preview.1.26159.1" diff --git a/samples/custom-resources/ts/.modules/.codegen-hash b/samples/custom-resources/ts/.modules/.codegen-hash new file mode 100644 index 00000000..1369f62c --- /dev/null +++ b/samples/custom-resources/ts/.modules/.codegen-hash @@ -0,0 +1 @@ +385A37965F5742D9B7F75074E7065C879412F46A58CE04016D535C18DA21950E \ No newline at end of file From 12cae7ce5b97cc3cb43eb02a653d8524f9fde0dc Mon Sep 17 00:00:00 2001 From: David Pine Date: Tue, 10 Mar 2026 10:59:49 -0500 Subject: [PATCH 20/25] Fix container-build Go sample: remove unused import, fix parameter - Remove unused Microsoft.Extensions.Hosting import from apphost.cs - Change goversion parameter to secret in apphost.ts Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- samples/container-build/cs/apphost.cs | 2 -- samples/container-build/ts/apphost.ts | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/samples/container-build/cs/apphost.cs b/samples/container-build/cs/apphost.cs index 9df0d93d..88b055e0 100644 --- a/samples/container-build/cs/apphost.cs +++ b/samples/container-build/cs/apphost.cs @@ -1,7 +1,5 @@ #:sdk Aspire.AppHost.Sdk@13.1.0 -using Microsoft.Extensions.Hosting; - var builder = DistributedApplication.CreateBuilder(args); var goVersion = builder.AddParameter("goversion", "1.25.4", publishValueAsDefault: true); diff --git a/samples/container-build/ts/apphost.ts b/samples/container-build/ts/apphost.ts index c13b9f19..1e658b97 100644 --- a/samples/container-build/ts/apphost.ts +++ b/samples/container-build/ts/apphost.ts @@ -2,7 +2,8 @@ import { createBuilder } from './.modules/aspire.js'; const builder = await createBuilder(); -const goVersion = await builder.addParameter("goversion", { default: "1.25.4" }); +// Enter '1.25.4' when prompted for the Go version. +const goVersion = await builder.addParameter("goversion", { secret: true }); const context = await builder.executionContext.get(); const isPublish = await context.isPublishMode.get(); From 38715353c5d5d75118491b705d5534607b3438b9 Mon Sep 17 00:00:00 2001 From: David Pine Date: Tue, 10 Mar 2026 11:01:28 -0500 Subject: [PATCH 21/25] Remove root-level .aspire/settings.json Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .aspire/settings.json | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .aspire/settings.json diff --git a/.aspire/settings.json b/.aspire/settings.json deleted file mode 100644 index 3f790204..00000000 --- a/.aspire/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "language": "typescript/nodejs" -} \ No newline at end of file From c5270be3c4fe55fe9970c9e63e8ed8a43ad2bd40 Mon Sep 17 00:00:00 2001 From: David Pine Date: Tue, 10 Mar 2026 12:56:45 -0500 Subject: [PATCH 22/25] Revert standalone-dashboard: remove cs subfolder --- samples/standalone-dashboard/{cs => }/ConsoleApp.cs | 0 samples/standalone-dashboard/{cs => }/ConsoleApp.run.json | 0 .../{cs => }/ConsoleApp.settings.Development.json | 0 samples/standalone-dashboard/{cs => }/ConsoleApp.settings.json | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename samples/standalone-dashboard/{cs => }/ConsoleApp.cs (100%) rename samples/standalone-dashboard/{cs => }/ConsoleApp.run.json (100%) rename samples/standalone-dashboard/{cs => }/ConsoleApp.settings.Development.json (100%) rename samples/standalone-dashboard/{cs => }/ConsoleApp.settings.json (100%) diff --git a/samples/standalone-dashboard/cs/ConsoleApp.cs b/samples/standalone-dashboard/ConsoleApp.cs similarity index 100% rename from samples/standalone-dashboard/cs/ConsoleApp.cs rename to samples/standalone-dashboard/ConsoleApp.cs diff --git a/samples/standalone-dashboard/cs/ConsoleApp.run.json b/samples/standalone-dashboard/ConsoleApp.run.json similarity index 100% rename from samples/standalone-dashboard/cs/ConsoleApp.run.json rename to samples/standalone-dashboard/ConsoleApp.run.json diff --git a/samples/standalone-dashboard/cs/ConsoleApp.settings.Development.json b/samples/standalone-dashboard/ConsoleApp.settings.Development.json similarity index 100% rename from samples/standalone-dashboard/cs/ConsoleApp.settings.Development.json rename to samples/standalone-dashboard/ConsoleApp.settings.Development.json diff --git a/samples/standalone-dashboard/cs/ConsoleApp.settings.json b/samples/standalone-dashboard/ConsoleApp.settings.json similarity index 100% rename from samples/standalone-dashboard/cs/ConsoleApp.settings.json rename to samples/standalone-dashboard/ConsoleApp.settings.json From f66a3052d1103b06d6cf8209ccce983e58d54eba Mon Sep 17 00:00:00 2001 From: David Pine Date: Tue, 10 Mar 2026 21:15:10 -0500 Subject: [PATCH 23/25] Add WinForms and WPF client projects to TypeScript apphost and update aspire module with TlsEnabled support --- .../ts/.modules/aspire.ts | 25 ++++++++++++++ samples/client-apps-integration/ts/apphost.ts | 33 +++++++++++++++++-- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/samples/client-apps-integration/ts/.modules/aspire.ts b/samples/client-apps-integration/ts/.modules/aspire.ts index 73dc52d2..f930fdcc 100644 --- a/samples/client-apps-integration/ts/.modules/aspire.ts +++ b/samples/client-apps-integration/ts/.modules/aspire.ts @@ -191,6 +191,7 @@ export enum EndpointProperty { Scheme = "Scheme", TargetPort = "TargetPort", HostAndPort = "HostAndPort", + TlsEnabled = "TlsEnabled", } /** Enum type for IconVariant */ @@ -717,6 +718,16 @@ export class EndpointReference { }, }; + /** Gets the TlsEnabled property */ + tlsEnabled = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.tlsEnabled', + { context: this._handle } + ); + }, + }; + /** Gets the Port property */ port = { get: async (): Promise => { @@ -778,6 +789,15 @@ export class EndpointReference { ); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + async getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + const rpcArgs: Record = { context: this._handle, enabledValue, disabledValue }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.getTlsValue', + rpcArgs + ); + } + } /** @@ -798,6 +818,11 @@ export class EndpointReferencePromise implements PromiseLike return this._promise.then(obj => obj.getValueAsync(options)); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + return this._promise.then(obj => obj.getTlsValue(enabledValue, disabledValue)); + } + } // ============================================================================ diff --git a/samples/client-apps-integration/ts/apphost.ts b/samples/client-apps-integration/ts/apphost.ts index 39d98ce9..4928644d 100644 --- a/samples/client-apps-integration/ts/apphost.ts +++ b/samples/client-apps-integration/ts/apphost.ts @@ -1,7 +1,36 @@ -import { createBuilder } from './.modules/aspire.js'; +import { createBuilder } from "./.modules/aspire.js"; +import os from "os"; const builder = await createBuilder(); -const apiService = await builder.addProject("apiservice", "../ClientAppsIntegration.ApiService/ClientAppsIntegration.ApiService.csproj", "https"); +const apiService = await builder.addProject( + "apiservice", + "../ClientAppsIntegration.ApiService/ClientAppsIntegration.ApiService.csproj", + "https", +); + +if (os.platform() === "win32") { + builder + .addProject( + "winformsclient", + "../ClientAppsIntegration.WinForms/ClientAppsIntegration.WinForms.csproj", + "ClientAppsIntegration.WinForms" + ) + .withServiceReference(apiService) + .waitFor(apiService) + .withExplicitStart() + .excludeFromManifest(); + + builder + .addProject( + "wpfclient", + "../ClientAppsIntegration.WPF/ClientAppsIntegration.WPF.csproj", + "ClientAppsIntegration.WPF" + ) + .withServiceReference(apiService) + .waitFor(apiService) + .withExplicitStart() + .excludeFromManifest(); +} await builder.build().run(); From de6ac73a6f0f9e33c4813f9ba75352b115b07410 Mon Sep 17 00:00:00 2001 From: David Pine Date: Thu, 12 Mar 2026 19:49:16 -0500 Subject: [PATCH 24/25] Update samples/container-build/ts/apphost.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- samples/container-build/ts/apphost.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/samples/container-build/ts/apphost.ts b/samples/container-build/ts/apphost.ts index 1e658b97..81341610 100644 --- a/samples/container-build/ts/apphost.ts +++ b/samples/container-build/ts/apphost.ts @@ -8,16 +8,12 @@ const goVersion = await builder.addParameter("goversion", { secret: true }); const context = await builder.executionContext.get(); const isPublish = await context.isPublishMode.get(); -let ginapp; - -if (isPublish) { - ginapp = await builder.addDockerfile("ginapp", "../ginapp") - .withBuildArg("GO_VERSION", goVersion); -} else { - ginapp = await builder.addDockerfile("ginapp", "../ginapp", { dockerfilePath: "Dockerfile.dev" }) +const ginapp = builder.executionContext.isPublishMode + ? builder.addDockerfile("ginapp", "../ginapp") + .withBuildArg("GO_VERSION", goVersion) + : builder.addDockerfile("ginapp", "../ginapp", { dockerfilePath: "Dockerfile.dev" }) .withBuildArg("GO_VERSION", goVersion) .withBindMount("../ginapp", "/app"); -} await ginapp .withHttpEndpoint({ targetPort: 5555, env: "PORT" }) From 0f682be6a54a2a6de53fc565e6cb16b739474848 Mon Sep 17 00:00:00 2001 From: David Pine Date: Fri, 27 Mar 2026 12:46:18 -0500 Subject: [PATCH 25/25] Refresh TS apphosts for Aspire 13.2 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- samples/Metrics/ts/.aspire/settings.json | 6 - samples/Metrics/ts/.modules/.codegen-hash | 2 +- samples/Metrics/ts/.modules/aspire.ts | 19116 ++++++-- samples/Metrics/ts/.modules/base.ts | 145 +- samples/Metrics/ts/.modules/transport.ts | 579 +- .../{apphost.run.json => aspire.config.json} | 9 +- samples/aspire-shop/ts/.aspire/settings.json | 10 - samples/aspire-shop/ts/.modules/.codegen-hash | 2 +- samples/aspire-shop/ts/.modules/aspire.ts | 36566 ++++++++------ samples/aspire-shop/ts/.modules/base.ts | 145 +- samples/aspire-shop/ts/.modules/transport.ts | 579 +- samples/aspire-shop/ts/apphost.ts | 4 +- .../{apphost.run.json => aspire.config.json} | 11 +- .../ts/.aspire/settings.json | 11 - .../ts/.modules/.codegen-hash | 2 +- .../ts/.modules/aspire.ts | 40546 ++++++++++------ .../ts/.modules/base.ts | 145 +- .../ts/.modules/transport.ts | 579 +- .../{apphost.run.json => aspire.config.json} | 12 +- .../ts/.aspire/settings.json | 9 - .../ts/.modules/.codegen-hash | 2 +- .../ts/.modules/aspire.ts | 6965 ++- .../ts/.modules/base.ts | 145 +- .../ts/.modules/transport.ts | 579 +- samples/aspire-with-javascript/ts/apphost.ts | 8 +- .../{apphost.run.json => aspire.config.json} | 9 +- .../aspire-with-node/ts/.aspire/settings.json | 10 - .../ts/.modules/.codegen-hash | 2 +- .../aspire-with-node/ts/.modules/aspire.ts | 8489 +++- samples/aspire-with-node/ts/.modules/base.ts | 145 +- .../aspire-with-node/ts/.modules/transport.ts | 579 +- samples/aspire-with-node/ts/apphost.ts | 2 +- .../{apphost.run.json => aspire.config.json} | 10 +- .../ts/.aspire/settings.json | 11 - .../ts/.modules/.codegen-hash | 2 +- .../aspire-with-python/ts/.modules/aspire.ts | 9153 +++- .../aspire-with-python/ts/.modules/base.ts | 145 +- .../ts/.modules/transport.ts | 579 +- samples/aspire-with-python/ts/apphost.ts | 2 +- .../{apphost.run.json => aspire.config.json} | 11 +- .../ts/.aspire/settings.json | 6 - .../ts/.modules/.codegen-hash | 2 +- .../ts/.modules/aspire.ts | 19105 +++++--- .../ts/.modules/base.ts | 145 +- .../ts/.modules/transport.ts | 579 +- samples/client-apps-integration/ts/apphost.ts | 4 +- .../{apphost.run.json => aspire.config.json} | 9 +- .../container-build/ts/.aspire/settings.json | 6 - .../container-build/ts/.modules/.codegen-hash | 2 +- samples/container-build/ts/.modules/aspire.ts | 19116 ++++++-- samples/container-build/ts/.modules/base.ts | 145 +- .../container-build/ts/.modules/transport.ts | 579 +- samples/container-build/ts/apphost.ts | 2 +- .../{apphost.run.json => aspire.config.json} | 9 +- .../custom-resources/ts/.aspire/settings.json | 6 - .../ts/.modules/.codegen-hash | 2 +- .../custom-resources/ts/.modules/aspire.ts | 19116 ++++++-- samples/custom-resources/ts/.modules/base.ts | 145 +- .../custom-resources/ts/.modules/transport.ts | 579 +- .../{apphost.run.json => aspire.config.json} | 9 +- .../ts/.aspire/settings.json | 11 - .../ts/.modules/.codegen-hash | 2 +- .../database-containers/ts/.modules/aspire.ts | 39956 +++++++++------ .../database-containers/ts/.modules/base.ts | 145 +- .../ts/.modules/transport.ts | 579 +- .../{apphost.run.json => aspire.config.json} | 12 +- .../ts/.aspire/settings.json | 9 - .../ts/.modules/.codegen-hash | 2 +- .../database-migrations/ts/.modules/aspire.ts | 24043 ++++++--- .../database-migrations/ts/.modules/base.ts | 145 +- .../ts/.modules/transport.ts | 579 +- .../{apphost.run.json => aspire.config.json} | 10 +- .../health-checks-ui/ts/.aspire/settings.json | 10 - .../ts/.modules/.codegen-hash | 2 +- .../health-checks-ui/ts/.modules/aspire.ts | 29887 ++++++++---- samples/health-checks-ui/ts/.modules/base.ts | 145 +- .../health-checks-ui/ts/.modules/transport.ts | 579 +- samples/health-checks-ui/ts/apphost.ts | 2 +- .../{apphost.run.json => aspire.config.json} | 11 +- .../orleans-voting/ts/.aspire/settings.json | 10 - .../orleans-voting/ts/.modules/.codegen-hash | 2 +- samples/orleans-voting/ts/.modules/aspire.ts | 27092 +++++++---- samples/orleans-voting/ts/.modules/base.ts | 145 +- .../orleans-voting/ts/.modules/transport.ts | 579 +- .../{apphost.run.json => aspire.config.json} | 11 +- samples/volume-mount/ts/.aspire/settings.json | 10 - .../volume-mount/ts/.modules/.codegen-hash | 2 +- samples/volume-mount/ts/.modules/aspire.ts | 37476 ++++++++------ samples/volume-mount/ts/.modules/base.ts | 145 +- samples/volume-mount/ts/.modules/transport.ts | 579 +- .../{apphost.run.json => aspire.config.json} | 11 +- 91 files changed, 232930 insertions(+), 114153 deletions(-) delete mode 100644 samples/Metrics/ts/.aspire/settings.json rename samples/Metrics/ts/{apphost.run.json => aspire.config.json} (67%) delete mode 100644 samples/aspire-shop/ts/.aspire/settings.json rename samples/aspire-shop/ts/{apphost.run.json => aspire.config.json} (57%) delete mode 100644 samples/aspire-with-azure-functions/ts/.aspire/settings.json rename samples/aspire-with-azure-functions/ts/{apphost.run.json => aspire.config.json} (50%) delete mode 100644 samples/aspire-with-javascript/ts/.aspire/settings.json rename samples/aspire-with-javascript/ts/{apphost.run.json => aspire.config.json} (67%) delete mode 100644 samples/aspire-with-node/ts/.aspire/settings.json rename samples/aspire-with-node/ts/{apphost.run.json => aspire.config.json} (62%) delete mode 100644 samples/aspire-with-python/ts/.aspire/settings.json rename samples/aspire-with-python/ts/{apphost.run.json => aspire.config.json} (57%) delete mode 100644 samples/client-apps-integration/ts/.aspire/settings.json rename samples/client-apps-integration/ts/{apphost.run.json => aspire.config.json} (67%) delete mode 100644 samples/container-build/ts/.aspire/settings.json rename samples/container-build/ts/{apphost.run.json => aspire.config.json} (67%) delete mode 100644 samples/custom-resources/ts/.aspire/settings.json rename samples/custom-resources/ts/{apphost.run.json => aspire.config.json} (67%) delete mode 100644 samples/database-containers/ts/.aspire/settings.json rename samples/database-containers/ts/{apphost.run.json => aspire.config.json} (52%) delete mode 100644 samples/database-migrations/ts/.aspire/settings.json rename samples/database-migrations/ts/{apphost.run.json => aspire.config.json} (61%) delete mode 100644 samples/health-checks-ui/ts/.aspire/settings.json rename samples/health-checks-ui/ts/{apphost.run.json => aspire.config.json} (57%) delete mode 100644 samples/orleans-voting/ts/.aspire/settings.json rename samples/orleans-voting/ts/{apphost.run.json => aspire.config.json} (57%) delete mode 100644 samples/volume-mount/ts/.aspire/settings.json rename samples/volume-mount/ts/{apphost.run.json => aspire.config.json} (56%) diff --git a/samples/Metrics/ts/.aspire/settings.json b/samples/Metrics/ts/.aspire/settings.json deleted file mode 100644 index 3c03a3b9..00000000 --- a/samples/Metrics/ts/.aspire/settings.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "appHostPath": "../apphost.ts", - "language": "typescript/nodejs", - "channel": "staging", - "sdkVersion": "13.2.0-preview.1.26159.1" -} \ No newline at end of file diff --git a/samples/Metrics/ts/.modules/.codegen-hash b/samples/Metrics/ts/.modules/.codegen-hash index 1369f62c..d112ad8d 100644 --- a/samples/Metrics/ts/.modules/.codegen-hash +++ b/samples/Metrics/ts/.modules/.codegen-hash @@ -1 +1 @@ -385A37965F5742D9B7F75074E7065C879412F46A58CE04016D535C18DA21950E \ No newline at end of file +54ABC5F6F3238E45FD69B96BCCB0C6A5BB14B11F3C267B90DC987EFF3E1B7E45 \ No newline at end of file diff --git a/samples/Metrics/ts/.modules/aspire.ts b/samples/Metrics/ts/.modules/aspire.ts index 73dc52d2..802979fb 100644 --- a/samples/Metrics/ts/.modules/aspire.ts +++ b/samples/Metrics/ts/.modules/aspire.ts @@ -8,6 +8,8 @@ import { AspireClient as AspireClientRpc, Handle, MarshalledHandle, + AppHostUsageError, + CancellationToken, CapabilityError, registerCallback, wrapIfHandle, @@ -26,9 +28,30 @@ import { // Handle Type Aliases (Internal - not exported to users) // ============================================================================ +/** Handle to JavaScriptAppResource */ +type JavaScriptAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource'>; + +/** Handle to NodeAppResource */ +type NodeAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource'>; + +/** Handle to ViteAppResource */ +type ViteAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource'>; + +/** Handle to AfterResourcesCreatedEvent */ +type AfterResourcesCreatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent'>; + +/** Handle to BeforeResourceStartedEvent */ +type BeforeResourceStartedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent'>; + +/** Handle to BeforeStartEvent */ +type BeforeStartEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent'>; + /** Handle to CommandLineArgsCallbackContext */ type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; +/** Handle to ConnectionStringAvailableEvent */ +type ConnectionStringAvailableEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent'>; + /** Handle to ContainerRegistryResource */ type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; @@ -38,6 +61,9 @@ type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Application /** Handle to CSharpAppResource */ type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; +/** Handle to DistributedApplicationModel */ +type DistributedApplicationModelHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel'>; + /** Handle to DotnetToolResource */ type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; @@ -56,9 +82,15 @@ type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicatio /** Handle to ExecuteCommandContext */ type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; +/** Handle to IComputeResource */ +type IComputeResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource'>; + /** Handle to IContainerFilesDestinationResource */ type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; +/** Handle to InitializeResourceEvent */ +type InitializeResourceEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent'>; + /** Handle to IResource */ type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; @@ -89,15 +121,27 @@ type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicati /** Handle to ReferenceExpressionBuilder */ type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; +/** Handle to ResourceEndpointsAllocatedEvent */ +type ResourceEndpointsAllocatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent'>; + /** Handle to ResourceLoggerService */ type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; /** Handle to ResourceNotificationService */ type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; +/** Handle to ResourceReadyEvent */ +type ResourceReadyEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent'>; + +/** Handle to ResourceStoppedEvent */ +type ResourceStoppedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent'>; + /** Handle to ResourceUrlsCallbackContext */ type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; +/** Handle to UpdateCommandStateContext */ +type UpdateCommandStateContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext'>; + /** Handle to ConnectionStringResource */ type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; @@ -122,18 +166,33 @@ type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hostin /** Handle to IResourceWithContainerFiles */ type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; -/** Handle to IResourceWithServiceDiscovery */ -type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; +/** Handle to IUserSecretsManager */ +type IUserSecretsManagerHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IUserSecretsManager'>; + +/** Handle to IReportingStep */ +type IReportingStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep'>; + +/** Handle to IReportingTask */ +type IReportingTaskHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask'>; /** Handle to PipelineConfigurationContext */ type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; +/** Handle to PipelineContext */ +type PipelineContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext'>; + /** Handle to PipelineStep */ type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; /** Handle to PipelineStepContext */ type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; +/** Handle to PipelineStepFactoryContext */ +type PipelineStepFactoryContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext'>; + +/** Handle to PipelineSummary */ +type PipelineSummaryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary'>; + /** Handle to ProjectResourceOptions */ type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; @@ -146,12 +205,18 @@ type ListanyHandle = Handle<'Aspire.Hosting/List'>; /** Handle to IConfiguration */ type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; +/** Handle to IConfigurationSection */ +type IConfigurationSectionHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfigurationSection'>; + /** Handle to IHostEnvironment */ type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; /** Handle to ILogger */ type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; +/** Handle to ILoggerFactory */ +type ILoggerFactoryHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory'>; + /** Handle to string[] */ type stringArrayHandle = Handle<'string[]'>; @@ -191,6 +256,7 @@ export enum EndpointProperty { Scheme = "Scheme", TargetPort = "TargetPort", HostAndPort = "HostAndPort", + TlsEnabled = "TlsEnabled", } /** Enum type for IconVariant */ @@ -322,6 +388,10 @@ export interface AddConnectionStringOptions { environmentVariableName?: string; } +export interface AddContainerRegistryFromStringOptions { + repository?: string; +} + export interface AddContainerRegistryOptions { repository?: ParameterResource; } @@ -331,6 +401,10 @@ export interface AddDockerfileOptions { stage?: string; } +export interface AddJavaScriptAppOptions { + runScriptName?: string; +} + export interface AddParameterFromConfigurationOptions { secret?: boolean; } @@ -339,6 +413,15 @@ export interface AddParameterOptions { secret?: boolean; } +export interface AddParameterWithValueOptions { + publishValueAsDefault?: boolean; + secret?: boolean; +} + +export interface AddViteAppOptions { + runScriptName?: string; +} + export interface AppendFormattedOptions { format?: string; } @@ -347,22 +430,89 @@ export interface AppendValueProviderOptions { format?: string; } +export interface CompleteStepMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteStepOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskOptions { + completionMessage?: string; + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateMarkdownTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + export interface GetValueAsyncOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface PublishAsDockerFileOptions { + configure?: (obj: ContainerResource) => Promise; +} + +export interface PublishResourceUpdateOptions { + state?: string; + stateStyle?: string; } export interface RunOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface SaveStateJsonOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskMarkdownOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; } export interface WaitForCompletionOptions { exitCode?: number; } +export interface WaitForResourceStateOptions { + targetState?: string; +} + export interface WithBindMountOptions { isReadOnly?: boolean; } +export interface WithBrowserDebuggerOptions { + browser?: string; +} + +export interface WithBuildScriptOptions { + args?: string[]; +} + +export interface WithBunOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithCommandOptions { commandOptions?: CommandOptions; } @@ -446,6 +596,12 @@ export interface WithMcpServerOptions { endpointName?: string; } +export interface WithNpmOptions { + install?: boolean; + installCommand?: string; + installArgs?: string[]; +} + export interface WithPipelineStepFactoryOptions { dependsOn?: string[]; requiredBy?: string[]; @@ -453,15 +609,25 @@ export interface WithPipelineStepFactoryOptions { description?: string; } +export interface WithPnpmOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithReferenceOptions { connectionName?: string; optional?: boolean; + name?: string; } export interface WithRequiredCommandOptions { helpLink?: string; } +export interface WithRunScriptOptions { + args?: string[]; +} + export interface WithUrlExpressionOptions { displayText?: string; } @@ -475,6 +641,122 @@ export interface WithVolumeOptions { isReadOnly?: boolean; } +export interface WithYarnOptions { + install?: boolean; + installArgs?: string[]; +} + +// ============================================================================ +// AfterResourcesCreatedEvent +// ============================================================================ + +/** + * Type class for AfterResourcesCreatedEvent. + */ +export class AfterResourcesCreatedEvent { + constructor(private _handle: AfterResourcesCreatedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeResourceStartedEvent +// ============================================================================ + +/** + * Type class for BeforeResourceStartedEvent. + */ +export class BeforeResourceStartedEvent { + constructor(private _handle: BeforeResourceStartedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeStartEvent +// ============================================================================ + +/** + * Type class for BeforeStartEvent. + */ +export class BeforeStartEvent { + constructor(private _handle: BeforeStartEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + // ============================================================================ // CommandLineArgsCallbackContext // ============================================================================ @@ -504,11 +786,12 @@ export class CommandLineArgsCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, }; @@ -523,6 +806,65 @@ export class CommandLineArgsCallbackContext { }, }; + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ConnectionStringAvailableEvent +// ============================================================================ + +/** + * Type class for ConnectionStringAvailableEvent. + */ +export class ConnectionStringAvailableEvent { + constructor(private _handle: ConnectionStringAvailableEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + } // ============================================================================ @@ -540,9 +882,9 @@ export class DistributedApplication { /** Runs the distributed application */ /** @internal */ - async _runInternal(cancellationToken?: AbortSignal): Promise { + async _runInternal(cancellationToken?: AbortSignal | CancellationToken): Promise { const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); await this._client.invokeCapability( 'Aspire.Hosting/run', rpcArgs @@ -616,6 +958,17 @@ export class DistributedApplicationExecutionContext { }, }; + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the IsPublishMode property */ isPublishMode = { get: async (): Promise => { @@ -638,6 +991,70 @@ export class DistributedApplicationExecutionContext { } +// ============================================================================ +// DistributedApplicationModel +// ============================================================================ + +/** + * Type class for DistributedApplicationModel. + */ +export class DistributedApplicationModel { + constructor(private _handle: DistributedApplicationModelHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets resources from the distributed application model */ + async getResources(): Promise { + const rpcArgs: Record = { model: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResources', + rpcArgs + ); + } + + /** Finds a resource by name */ + /** @internal */ + async _findResourceByNameInternal(name: string): Promise { + const rpcArgs: Record = { model: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/findResourceByName', + rpcArgs + ); + return new Resource(result, this._client); + } + + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._findResourceByNameInternal(name)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationModel that enables fluent chaining. + */ +export class DistributedApplicationModelPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationModel) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets resources from the distributed application model */ + getResources(): Promise { + return this._promise.then(obj => obj.getResources()); + } + + /** Finds a resource by name */ + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.findResourceByName(name))); + } + +} + // ============================================================================ // EndpointReference // ============================================================================ @@ -651,6 +1068,17 @@ export class EndpointReference { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.resource', + { context: this._handle } + ); + return new ResourceWithEndpoints(handle, this._client); + }, + }; + /** Gets the EndpointName property */ endpointName = { get: async (): Promise => { @@ -717,6 +1145,16 @@ export class EndpointReference { }, }; + /** Gets the TlsEnabled property */ + tlsEnabled = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.tlsEnabled', + { context: this._handle } + ); + }, + }; + /** Gets the Port property */ port = { get: async (): Promise => { @@ -771,13 +1209,22 @@ export class EndpointReference { async getValueAsync(options?: GetValueAsyncOptions): Promise { const cancellationToken = options?.cancellationToken; const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); return await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/getValueAsync', rpcArgs ); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + async getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + const rpcArgs: Record = { context: this._handle, enabledValue, disabledValue }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.getTlsValue', + rpcArgs + ); + } + } /** @@ -798,6 +1245,11 @@ export class EndpointReferencePromise implements PromiseLike return this._promise.then(obj => obj.getValueAsync(options)); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + return this._promise.then(obj => obj.getTlsValue(enabledValue, disabledValue)); + } + } // ============================================================================ @@ -875,11 +1327,34 @@ export class EnvironmentCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; @@ -909,6 +1384,17 @@ export class ExecuteCommandContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the ResourceName property */ resourceName = { get: async (): Promise => { @@ -927,16 +1413,17 @@ export class ExecuteCommandContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, - set: async (value: AbortSignal): Promise => { + set: async (value: AbortSignal | CancellationToken): Promise => { await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', - { context: this._handle, value } + { context: this._handle, value: CancellationToken.fromValue(value) } ); } }; @@ -944,34 +1431,126 @@ export class ExecuteCommandContext { } // ============================================================================ -// PipelineConfigurationContext +// InitializeResourceEvent // ============================================================================ /** - * Type class for PipelineConfigurationContext. + * Type class for InitializeResourceEvent. */ -export class PipelineConfigurationContext { - constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} +export class InitializeResourceEvent { + constructor(private _handle: InitializeResourceEventHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the Steps property */ - steps = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.resource', { context: this._handle } ); + return new Resource(handle, this._client); }, - set: async (value: PipelineStep[]): Promise => { - await this._client.invokeCapability( + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Notifications property */ + notifications = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.notifications', + { context: this._handle } + ); + return new ResourceNotificationService(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + { context: this._handle } + ); + }, + set: async (value: PipelineStep[]): Promise => { + await this._client.invokeCapability( 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', { context: this._handle, value } ); } }; + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + /** Gets pipeline steps with the specified tag */ async getStepsByTag(tag: string): Promise { const rpcArgs: Record = { context: this._handle, tag }; @@ -1003,6 +1582,93 @@ export class PipelineConfigurationContextPromise implements PromiseLike => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + set: async (value: AbortSignal | CancellationToken): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.setCancellationToken', + { context: this._handle, value: CancellationToken.fromValue(value) } + ); + } + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + // ============================================================================ // PipelineStep // ============================================================================ @@ -1090,6 +1756,17 @@ export class PipelineStep { return this._tags; } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + /** Adds a dependency on another step by name */ /** @internal */ async _dependsOnInternal(stepName: string): Promise { @@ -1160,6 +1837,39 @@ export class PipelineStepContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the ReportingStep property */ + reportingStep = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.reportingStep', + { context: this._handle } + ); + return new ReportingStep(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + /** Gets the ExecutionContext property */ executionContext = { get: async (): Promise => { @@ -1171,18 +1881,159 @@ export class PipelineStepContext { }, }; + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineStepFactoryContext +// ============================================================================ + +/** + * Type class for PipelineStepFactoryContext. + */ +export class PipelineStepFactoryContext { + constructor(private _handle: PipelineStepFactoryContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; } +// ============================================================================ +// PipelineSummary +// ============================================================================ + +/** + * Type class for PipelineSummary. + */ +export class PipelineSummary { + constructor(private _handle: PipelineSummaryHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Add method */ + /** @internal */ + async _addInternal(key: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, key, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineSummary.add', + rpcArgs + ); + return this; + } + + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addInternal(key, value)); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + /** @internal */ + async _addMarkdownInternal(key: string, markdownString: string): Promise { + const rpcArgs: Record = { summary: this._handle, key, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/addMarkdown', + rpcArgs + ); + return this; + } + + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addMarkdownInternal(key, markdownString)); + } + +} + +/** + * Thenable wrapper for PipelineSummary that enables fluent chaining. + */ +export class PipelineSummaryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineSummary) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Add method */ + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.add(key, value))); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.addMarkdown(key, markdownString))); + } + +} + // ============================================================================ // ProjectResourceOptions // ============================================================================ @@ -1365,3794 +2216,3932 @@ export class ReferenceExpressionBuilderPromise implements PromiseLike; - get urls(): AspireList { - if (!this._urls) { - this._urls = new AspireList( - this._handle, - this._client, - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' - ); - } - return this._urls; - } - - /** Gets the CancellationToken property */ - cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.resource', { context: this._handle } ); + return new Resource(handle, this._client); }, }; - /** Gets the ExecutionContext property */ - executionContext = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.services', { context: this._handle } ); - return new DistributedApplicationExecutionContext(handle, this._client); + return new ServiceProvider(handle, this._client); }, }; } // ============================================================================ -// DistributedApplicationBuilder +// ResourceLoggerService // ============================================================================ /** - * Type class for DistributedApplicationBuilder. + * Type class for ResourceLoggerService. */ -export class DistributedApplicationBuilder { - constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} +export class ResourceLoggerService { + constructor(private _handle: ResourceLoggerServiceHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the AppHostDirectory property */ - appHostDirectory = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', - { context: this._handle } - ); - }, - }; - - /** Gets the Eventing property */ - eventing = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', - { context: this._handle } - ); - return new DistributedApplicationEventing(handle, this._client); - }, - }; - - /** Gets the ExecutionContext property */ - executionContext = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', - { context: this._handle } - ); - return new DistributedApplicationExecutionContext(handle, this._client); - }, - }; - - /** Builds the distributed application */ - /** @internal */ - async _buildInternal(): Promise { - const rpcArgs: Record = { context: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/build', - rpcArgs - ); - return new DistributedApplication(result, this._client); - } - - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._buildInternal()); - } - - /** Adds a connection string with a builder callback */ - /** @internal */ - async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { - const connectionStringBuilderId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; - const obj = new ReferenceExpressionBuilder(objHandle, this._client); - await connectionStringBuilder(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionStringBuilder', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } - - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); - } - - /** Adds a container registry resource */ + /** Completes the log stream for a resource */ /** @internal */ - async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpoint }; - if (repository !== undefined) rpcArgs.repository = repository; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainerRegistry', + async _completeLogInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { loggerService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLog', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - const repository = options?.repository; - return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogInternal(resource)); } - /** Adds a container resource */ + /** Completes the log stream by resource name */ /** @internal */ - async _addContainerInternal(name: string, image: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, image }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainer', + async _completeLogByNameInternal(resourceName: string): Promise { + const rpcArgs: Record = { loggerService: this._handle, resourceName }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLogByName', rpcArgs ); - return new ContainerResource(result, this._client); - } - - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._addContainerInternal(name, image)); + return this; } - /** Adds a container resource built from a Dockerfile */ - /** @internal */ - async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDockerfile', - rpcArgs - ); - return new ContainerResource(result, this._client); + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogByNameInternal(resourceName)); } - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); - } +} - /** Adds a .NET tool resource */ - /** @internal */ - async _addDotnetToolInternal(name: string, packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDotnetTool', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } +/** + * Thenable wrapper for ResourceLoggerService that enables fluent chaining. + */ +export class ResourceLoggerServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + then( + onfulfilled?: ((value: ResourceLoggerService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds an executable resource */ - /** @internal */ - async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExecutable', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Completes the log stream for a resource */ + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLog(resource))); } - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + /** Completes the log stream by resource name */ + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLogByName(resourceName))); } - /** Adds an external service resource */ - /** @internal */ - async _addExternalServiceInternal(name: string, url: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, url }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExternalService', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } +} - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); - } +// ============================================================================ +// ResourceNotificationService +// ============================================================================ - /** Adds a parameter resource */ - /** @internal */ - async _addParameterInternal(name: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameter', - rpcArgs - ); - return new ParameterResource(result, this._client); - } +/** + * Type class for ResourceNotificationService. + */ +export class ResourceNotificationService { + constructor(private _handle: ResourceNotificationServiceHandle, private _client: AspireClientRpc) {} - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterInternal(name, secret)); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Adds a parameter sourced from configuration */ + /** Waits for a resource to reach a specified state */ /** @internal */ - async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name, configurationKey }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameterFromConfiguration', + async _waitForResourceStateInternal(resourceName: string, targetState?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + if (targetState !== undefined) rpcArgs.targetState = targetState; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceState', rpcArgs ); - return new ParameterResource(result, this._client); + return this; } - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + const targetState = options?.targetState; + return new ResourceNotificationServicePromise(this._waitForResourceStateInternal(resourceName, targetState)); } - /** Adds a connection string resource */ - /** @internal */ - async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionString', + /** Waits for a resource to reach one of the specified states */ + async waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName, targetStates }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStates', rpcArgs ); - return new ResourceWithConnectionString(result, this._client); - } - - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - const environmentVariableName = options?.environmentVariableName; - return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); } - /** Adds a .NET project resource */ - /** @internal */ - async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProject', + /** Waits for a resource to become healthy */ + async waitForResourceHealthy(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceHealthy', rpcArgs ); - return new ProjectResource(result, this._client); - } - - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); } - /** Adds a project resource with configuration options */ + /** Waits for all dependencies of a resource to be ready */ /** @internal */ - async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProjectWithOptions', + async _waitForDependenciesInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForDependencies', rpcArgs ); - return new ProjectResource(result, this._client); + return this; } - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._waitForDependenciesInternal(resource)); } - /** Adds a C# application resource */ - /** @internal */ - async _addCSharpAppInternal(name: string, path: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, path }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpApp', + /** Tries to get the current state of a resource */ + async tryGetResourceState(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/tryGetResourceState', rpcArgs ); - return new ProjectResource(result, this._client); - } - - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); } - /** Adds a C# application resource with configuration options */ + /** Publishes an update for a resource's state */ /** @internal */ - async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpAppWithOptions', + async _publishResourceUpdateInternal(resource: ResourceBuilderBase, state?: string, stateStyle?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + if (state !== undefined) rpcArgs.state = state; + if (stateStyle !== undefined) rpcArgs.stateStyle = stateStyle; + await this._client.invokeCapability( + 'Aspire.Hosting/publishResourceUpdate', rpcArgs ); - return new CSharpAppResource(result, this._client); + return this; } - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + const state = options?.state; + const stateStyle = options?.stateStyle; + return new ResourceNotificationServicePromise(this._publishResourceUpdateInternal(resource, state, stateStyle)); } } /** - * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + * Thenable wrapper for ResourceNotificationService that enables fluent chaining. */ -export class DistributedApplicationBuilderPromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ResourceNotificationServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ResourceNotificationService) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Builds the distributed application */ - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); + /** Waits for a resource to reach a specified state */ + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForResourceState(resourceName, options))); } - /** Adds a connection string with a builder callback */ - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + /** Waits for a resource to reach one of the specified states */ + waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + return this._promise.then(obj => obj.waitForResourceStates(resourceName, targetStates)); } - /** Adds a container registry resource */ - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + /** Waits for a resource to become healthy */ + waitForResourceHealthy(resourceName: string): Promise { + return this._promise.then(obj => obj.waitForResourceHealthy(resourceName)); } - /** Adds a container resource */ - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + /** Waits for all dependencies of a resource to be ready */ + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForDependencies(resource))); } - /** Adds a container resource built from a Dockerfile */ - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + /** Tries to get the current state of a resource */ + tryGetResourceState(resourceName: string): Promise { + return this._promise.then(obj => obj.tryGetResourceState(resourceName)); } - /** Adds a .NET tool resource */ - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + /** Publishes an update for a resource's state */ + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.publishResourceUpdate(resource, options))); } - /** Adds an executable resource */ - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); - } +} - /** Adds an external service resource */ - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); - } +// ============================================================================ +// ResourceReadyEvent +// ============================================================================ - /** Adds a parameter resource */ - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); - } +/** + * Type class for ResourceReadyEvent. + */ +export class ResourceReadyEvent { + constructor(private _handle: ResourceReadyEventHandle, private _client: AspireClientRpc) {} - /** Adds a parameter sourced from configuration */ - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Adds a connection string resource */ - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); - } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; - /** Adds a .NET project resource */ - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); - } + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; - /** Adds a project resource with configuration options */ - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); - } +} - /** Adds a C# application resource */ - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); - } +// ============================================================================ +// ResourceStoppedEvent +// ============================================================================ - /** Adds a C# application resource with configuration options */ - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); - } +/** + * Type class for ResourceStoppedEvent. + */ +export class ResourceStoppedEvent { + constructor(private _handle: ResourceStoppedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; } // ============================================================================ -// DistributedApplicationEventing +// ResourceUrlsCallbackContext // ============================================================================ /** - * Type class for DistributedApplicationEventing. + * Type class for ResourceUrlsCallbackContext. */ -export class DistributedApplicationEventing { - constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Invokes the Unsubscribe method */ - /** @internal */ - async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { - const rpcArgs: Record = { context: this._handle, subscription }; - await this._client.invokeCapability( - 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', - rpcArgs - ); - return this; - } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; } + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + } +// ============================================================================ +// UpdateCommandStateContext +// ============================================================================ + /** - * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + * Type class for UpdateCommandStateContext. */ -export class DistributedApplicationEventingPromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class UpdateCommandStateContext { + constructor(private _handle: UpdateCommandStateContextHandle, private _client: AspireClientRpc) {} - then( - onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Invokes the Unsubscribe method */ - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); - } + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/UpdateCommandStateContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; } // ============================================================================ -// ConnectionStringResource +// Configuration // ============================================================================ -export class ConnectionStringResource extends ResourceBuilderBase { - constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { - super(handle, client); - } +/** + * Type class for Configuration. + */ +export class Configuration { + constructor(private _handle: IConfigurationHandle, private _client: AspireClientRpc) {} - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets a configuration value by key */ + async getConfigValue(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConfigValue', rpcArgs ); - return new ConnectionStringResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + /** Gets a connection string by name */ + async getConnectionString(name: string): Promise { + const rpcArgs: Record = { configuration: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionString', + rpcArgs + ); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + /** Gets a configuration section by key */ + async getSection(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getSection', rpcArgs ); - return new ConnectionStringResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Gets child configuration sections */ + async getChildren(): Promise { + const rpcArgs: Record = { configuration: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getChildren', + rpcArgs + ); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + /** Checks whether a configuration section exists */ + async exists(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/exists', rpcArgs ); - return new ConnectionStringResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { - const helpLink = options?.helpLink; - return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } +} - /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); +/** + * Thenable wrapper for Configuration that enables fluent chaining. + */ +export class ConfigurationPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Configuration) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Gets a configuration value by key */ + getConfigValue(key: string): Promise { + return this._promise.then(obj => obj.getConfigValue(key)); } - /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); + /** Gets a connection string by name */ + getConnectionString(name: string): Promise { + return this._promise.then(obj => obj.getConnectionString(name)); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Gets a configuration section by key */ + getSection(key: string): Promise { + return this._promise.then(obj => obj.getSection(key)); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); + /** Gets child configuration sections */ + getChildren(): Promise { + return this._promise.then(obj => obj.getChildren()); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Checks whether a configuration section exists */ + exists(key: string): Promise { + return this._promise.then(obj => obj.exists(key)); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } +} - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); - } +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Environment property */ + environment = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.environment', + { context: this._handle } + ); + return new HostEnvironment(handle, this._client); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the UserSecretsManager property */ + userSecretsManager = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.userSecretsManager', + { context: this._handle } + ); + return new UserSecretsManager(handle, this._client); + }, + }; + /** Builds the distributed application */ /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DistributedApplication(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { - const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); } + /** Adds a connection string with a reference expression */ /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; + async _addConnectionStringExpressionInternal(name: string, connectionStringExpression: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, connectionStringExpression }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + 'Aspire.Hosting/addConnectionStringExpression', rpcArgs ); return new ConnectionStringResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { - const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringExpressionInternal(name, connectionStringExpression)); } + /** Adds a connection string with a builder callback */ /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + 'Aspire.Hosting/addConnectionStringBuilder', rpcArgs ); return new ConnectionStringResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); } + /** Adds a container registry resource */ /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); } + /** Adds a container registry with string endpoint */ /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + async _addContainerRegistryFromStringInternal(name: string, endpoint: string, repository?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistryFromString', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryFromStringInternal(name, endpoint, repository)); } + /** Adds a container resource */ /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); } + /** Adds a container resource built from a Dockerfile */ /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); } + /** Adds a .NET tool resource */ /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); } + /** Adds an executable resource */ /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); } + /** Adds an external service resource */ /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - const exitCode = options?.exitCode; - return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); } + /** Adds an external service with a URI */ /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + async _addExternalServiceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceUri', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceUriInternal(name, uri)); } + /** Adds an external service with a parameter URL */ /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + async _addExternalServiceParameterInternal(name: string, urlParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, urlParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceParameter', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { - const commandOptions = options?.commandOptions; - return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceParameterInternal(name, urlParameter)); } + /** Adds a parameter resource */ /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); } + /** Adds a parameter with a default value */ /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + async _addParameterWithValueInternal(name: string, value: string, publishValueAsDefault?: boolean, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + if (publishValueAsDefault !== undefined) rpcArgs.publishValueAsDefault = publishValueAsDefault; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterWithValue', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + const publishValueAsDefault = options?.publishValueAsDefault; + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterWithValueInternal(name, value, publishValueAsDefault, secret)); } + /** Adds a parameter sourced from configuration */ /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { - const iconVariant = options?.iconVariant; - return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); } + /** Adds a connection string resource */ /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ResourceWithConnectionString(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); } + /** Adds a .NET project resource */ /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); } + /** Adds a project resource with configuration options */ /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + } + + /** Adds a C# application resource */ + /** @internal */ + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); } + /** Adds a C# application resource with configuration options */ /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); } + /** Gets the application configuration */ /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + async _getConfigurationInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getConfiguration', + rpcArgs + ); + return new Configuration(result, this._client); + } + + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._getConfigurationInternal()); + } + + /** Subscribes to the BeforeStart event */ + async subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as BeforeStartEventHandle; + const arg = new BeforeStartEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeBeforeStart', rpcArgs ); - return new ConnectionStringResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Subscribes to the AfterResourcesCreated event */ + async subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as AfterResourcesCreatedEventHandle; + const arg = new AfterResourcesCreatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeAfterResourcesCreated', + rpcArgs + ); } + /** Adds a Node.js application resource */ /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + async _addNodeAppInternal(name: string, appDirectory: string, scriptPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory, scriptPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addNodeApp', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._addNodeAppInternal(name, appDirectory, scriptPath)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** Adds a JavaScript application resource */ + /** @internal */ + async _addJavaScriptAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addJavaScriptApp', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + const runScriptName = options?.runScriptName; + return new JavaScriptAppResourcePromise(this._addJavaScriptAppInternal(name, appDirectory, runScriptName)); + } + + /** Adds a Vite application resource */ + /** @internal */ + async _addViteAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addViteApp', rpcArgs ); + return new ViteAppResource(result, this._client); + } + + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + const runScriptName = options?.runScriptName; + return new ViteAppResourcePromise(this._addViteAppInternal(name, appDirectory, runScriptName)); } } /** - * Thenable wrapper for ConnectionStringResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. */ -export class ConnectionStringResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds a connection string with a reference expression */ + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringExpression(name, connectionStringExpression))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + /** Adds a container registry with string endpoint */ + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistryFromString(name, endpoint, options))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Adds an external service with a URI */ + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceUri(name, uri))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Adds an external service with a parameter URL */ + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceParameter(name, urlParameter))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Adds a parameter with a default value */ + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterWithValue(name, value, options))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Gets the application configuration */ + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._promise.then(obj => obj.getConfiguration())); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Subscribes to the BeforeStart event */ + subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeBeforeStart(callback)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Subscribes to the AfterResourcesCreated event */ + subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeAfterResourcesCreated(callback)); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds a Node.js application resource */ + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.addNodeApp(name, appDirectory, scriptPath))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Adds a JavaScript application resource */ + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.addJavaScriptApp(name, appDirectory, options))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds a Vite application resource */ + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.addViteApp(name, appDirectory, options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); +} + +// ============================================================================ +// DistributedApplicationEventing +// ============================================================================ + +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Unsubscribe method */ + /** @internal */ + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + rpcArgs + ); + return this; } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); } } // ============================================================================ -// ContainerRegistryResource +// HostEnvironment // ============================================================================ -export class ContainerRegistryResource extends ResourceBuilderBase { - constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { - super(handle, client); +/** + * Type class for HostEnvironment. + */ +export class HostEnvironment { + constructor(private _handle: IHostEnvironmentHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Checks if running in Development environment */ + async isDevelopment(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isDevelopment', + rpcArgs + ); } - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + /** Checks if running in Production environment */ + async isProduction(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isProduction', rpcArgs ); - return new ContainerRegistryResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + /** Checks if running in Staging environment */ + async isStaging(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isStaging', + rpcArgs + ); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + /** Checks if the environment matches the specified name */ + async isEnvironment(environmentName: string): Promise { + const rpcArgs: Record = { environment: this._handle, environmentName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isEnvironment', rpcArgs ); - return new ContainerRegistryResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); +} + +/** + * Thenable wrapper for HostEnvironment that enables fluent chaining. + */ +export class HostEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: HostEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Checks if running in Development environment */ + isDevelopment(): Promise { + return this._promise.then(obj => obj.isDevelopment()); } + /** Checks if running in Production environment */ + isProduction(): Promise { + return this._promise.then(obj => obj.isProduction()); + } + + /** Checks if running in Staging environment */ + isStaging(): Promise { + return this._promise.then(obj => obj.isStaging()); + } + + /** Checks if the environment matches the specified name */ + isEnvironment(environmentName: string): Promise { + return this._promise.then(obj => obj.isEnvironment(environmentName)); + } + +} + +// ============================================================================ +// Logger +// ============================================================================ + +/** + * Type class for Logger. + */ +export class Logger { + constructor(private _handle: ILoggerHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Logs an information message */ /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + async _logInformationInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logInformation', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { - const helpLink = options?.helpLink; - return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._logInformationInternal(message)); } + /** Logs a warning message */ /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + async _logWarningInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logWarning', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._logWarningInternal(message)); } + /** Logs an error message */ /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + async _logErrorInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logError', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + logError(message: string): LoggerPromise { + return new LoggerPromise(this._logErrorInternal(message)); } + /** Logs a debug message */ /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + async _logDebugInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logDebug', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { - const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._logDebugInternal(message)); } + /** Logs a message with specified level */ /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + async _logInternal(level: string, message: string): Promise { + const rpcArgs: Record = { logger: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/log', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { - const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._logInternal(level, message)); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } +} - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); - } +/** + * Thenable wrapper for Logger that enables fluent chaining. + */ +export class LoggerPromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + then( + onfulfilled?: ((value: Logger) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + /** Logs an information message */ + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logInformation(message))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Logs a warning message */ + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logWarning(message))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + /** Logs an error message */ + logError(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logError(message))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Logs a debug message */ + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logDebug(message))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + /** Logs a message with specified level */ + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.log(level, message))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } +} - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); - } +// ============================================================================ +// LoggerFactory +// ============================================================================ - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } +/** + * Type class for LoggerFactory. + */ +export class LoggerFactory { + constructor(private _handle: ILoggerFactoryHandle, private _client: AspireClientRpc) {} - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Creates a logger for a category */ /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + async _createLoggerInternal(categoryName: string): Promise { + const rpcArgs: Record = { loggerFactory: this._handle, categoryName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createLogger', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new Logger(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._createLoggerInternal(categoryName)); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); +} + +/** + * Thenable wrapper for LoggerFactory that enables fluent chaining. + */ +export class LoggerFactoryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: LoggerFactory) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Creates a logger for a category */ + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.createLogger(categoryName))); } +} + +// ============================================================================ +// ReportingStep +// ============================================================================ + +/** + * Type class for ReportingStep. + */ +export class ReportingStep { + constructor(private _handle: IReportingStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Creates a reporting task with plain-text status text */ /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + async _createTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createTask', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ReportingTask(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createTaskInternal(statusText, cancellationToken)); } + /** Creates a reporting task with Markdown-formatted status text */ /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + async _createMarkdownTaskInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createMarkdownTask', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ReportingTask(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createMarkdownTaskInternal(markdownString, cancellationToken)); } + /** Logs a plain-text message for the reporting step */ /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + async _logStepInternal(level: string, message: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStep', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepInternal(level, message)); } + /** Logs a Markdown-formatted message for the reporting step */ /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + async _logStepMarkdownInternal(level: string, markdownString: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStepMarkdown', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepMarkdownInternal(level, markdownString)); } + /** Completes the reporting step with plain-text completion text */ /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + async _completeStepInternal(completionText: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, completionText }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStep', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepInternal(completionText, completionState, cancellationToken)); } + /** Completes the reporting step with Markdown-formatted completion text */ /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + async _completeStepMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStepMarkdown', rpcArgs ); - return new ContainerRegistryResource(result, this._client); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + return this; } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepMarkdownInternal(markdownString, completionState, cancellationToken)); } } /** - * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); + * Thenable wrapper for ReportingStep that enables fluent chaining. */ -export class ContainerRegistryResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ReportingStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ReportingStep) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Creates a reporting task with plain-text status text */ + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createTask(statusText, options))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Creates a reporting task with Markdown-formatted status text */ + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createMarkdownTask(markdownString, options))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Logs a plain-text message for the reporting step */ + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStep(level, message))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Logs a Markdown-formatted message for the reporting step */ + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStepMarkdown(level, markdownString))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Completes the reporting step with plain-text completion text */ + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStep(completionText, options))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Completes the reporting step with Markdown-formatted completion text */ + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStepMarkdown(markdownString, options))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } +} - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } +// ============================================================================ +// ReportingTask +// ============================================================================ - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); +/** + * Type class for ReportingTask. + */ +export class ReportingTask { + constructor(private _handle: IReportingTaskHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Updates the reporting task with plain-text status text */ + /** @internal */ + async _updateTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTask', + rpcArgs + ); + return this; } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskInternal(statusText, cancellationToken)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Updates the reporting task with Markdown-formatted status text */ + /** @internal */ + async _updateTaskMarkdownInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTaskMarkdown', + rpcArgs + ); + return this; } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskMarkdownInternal(markdownString, cancellationToken)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Completes the reporting task with plain-text completion text */ + /** @internal */ + async _completeTaskInternal(completionMessage?: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle }; + if (completionMessage !== undefined) rpcArgs.completionMessage = completionMessage; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTask', + rpcArgs + ); + return this; } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + const completionMessage = options?.completionMessage; + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskInternal(completionMessage, completionState, cancellationToken)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Completes the reporting task with Markdown-formatted completion text */ + /** @internal */ + async _completeTaskMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTaskMarkdown', + rpcArgs + ); + return this; } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskMarkdownInternal(markdownString, completionState, cancellationToken)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); +} + +/** + * Thenable wrapper for ReportingTask that enables fluent chaining. + */ +export class ReportingTaskPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReportingTask) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Updates the reporting task with plain-text status text */ + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTask(statusText, options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Updates the reporting task with Markdown-formatted status text */ + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTaskMarkdown(markdownString, options))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Completes the reporting task with plain-text completion text */ + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTask(options))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Completes the reporting task with Markdown-formatted completion text */ + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTaskMarkdown(markdownString, options))); } } // ============================================================================ -// ContainerResource +// ServiceProvider // ============================================================================ -export class ContainerResource extends ResourceBuilderBase { - constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { - super(handle, client); - } +/** + * Type class for ServiceProvider. + */ +export class ServiceProvider { + constructor(private _handle: IServiceProviderHandle, private _client: AspireClientRpc) {} + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the distributed application eventing service from the service provider */ /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + async _getEventingInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getEventing', rpcArgs ); - return new ContainerResource(result, this._client); + return new DistributedApplicationEventing(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._getEventingInternal()); } + /** Gets the logger factory from the service provider */ /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + async _getLoggerFactoryInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getLoggerFactory', rpcArgs ); - return new ContainerResource(result, this._client); + return new LoggerFactory(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._getLoggerFactoryInternal()); } + /** Gets the resource logger service from the service provider */ /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + async _getResourceLoggerServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceLoggerService', rpcArgs ); - return new ContainerResource(result, this._client); + return new ResourceLoggerService(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._getResourceLoggerServiceInternal()); } + /** Gets the distributed application model from the service provider */ /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + async _getDistributedApplicationModelInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getDistributedApplicationModel', rpcArgs ); - return new ContainerResource(result, this._client); + return new DistributedApplicationModel(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageTagInternal(tag)); + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._getDistributedApplicationModelInternal()); } + /** Gets the resource notification service from the service provider */ /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + async _getResourceNotificationServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceNotificationService', rpcArgs ); - return new ContainerResource(result, this._client); + return new ResourceNotificationService(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._getResourceNotificationServiceInternal()); } + /** Gets the user secrets manager from the service provider */ /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + async _getUserSecretsManagerInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getUserSecretsManager', rpcArgs ); - return new ContainerResource(result, this._client); + return new UserSecretsManager(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - const tag = options?.tag; - return new ContainerResourcePromise(this._withImageInternal(image, tag)); + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getUserSecretsManagerInternal()); } - /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', - rpcArgs - ); - return new ContainerResource(result, this._client); - } +} - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); - } +/** + * Thenable wrapper for ServiceProvider that enables fluent chaining. + */ +export class ServiceProviderPromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', - rpcArgs - ); - return new ContainerResource(result, this._client); + then( + onfulfilled?: ((value: ServiceProvider) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Gets the distributed application eventing service from the service provider */ + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.getEventing())); } - /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets the logger factory from the service provider */ + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._promise.then(obj => obj.getLoggerFactory())); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + /** Gets the resource logger service from the service provider */ + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.getResourceLoggerService())); } - /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets the distributed application model from the service provider */ + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._promise.then(obj => obj.getDistributedApplicationModel())); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Gets the resource notification service from the service provider */ + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.getResourceNotificationService())); } - /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets the user secrets manager from the service provider */ + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getUserSecretsManager())); } - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsContainerInternal()); - } +} - /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', +// ============================================================================ +// UserSecretsManager +// ============================================================================ + +/** + * Type class for UserSecretsManager. + */ +export class UserSecretsManager { + constructor(private _handle: IUserSecretsManagerHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the IsAvailable property */ + isAvailable = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.isAvailable', + { context: this._handle } + ); + }, + }; + + /** Gets the FilePath property */ + filePath = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.filePath', + { context: this._handle } + ); + }, + }; + + /** Attempts to set a user secret value */ + async trySetSecret(name: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, name, value }; + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.trySetSecret', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } + /** Saves state to user secrets from a JSON string */ /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', + async _saveStateJsonInternal(json: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, json }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/saveStateJson', rpcArgs ); - return new ContainerResource(result, this._client); + return this; } - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNameInternal(name)); + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + const cancellationToken = options?.cancellationToken; + return new UserSecretsManagerPromise(this._saveStateJsonInternal(json, cancellationToken)); } + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + async _getOrSetSecretInternal(resourceBuilder: ResourceBuilderBase, name: string, value: string): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, resourceBuilder, name, value }; + await this._client.invokeCapability( + 'Aspire.Hosting/getOrSetSecret', rpcArgs ); - return new ContainerResource(result, this._client); + return this; } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getOrSetSecretInternal(resourceBuilder, name, value)); } - /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', - rpcArgs - ); - return new ContainerResource(result, this._client); +} + +/** + * Thenable wrapper for UserSecretsManager that enables fluent chaining. + */ +export class UserSecretsManagerPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: UserSecretsManager) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + /** Attempts to set a user secret value */ + trySetSecret(name: string, value: string): Promise { + return this._promise.then(obj => obj.trySetSecret(name, value)); + } + + /** Saves state to user secrets from a JSON string */ + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.saveStateJson(json, options))); + } + + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getOrSetSecret(resourceBuilder, name, value))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterInternal()); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); } - /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - const helpLink = options?.helpLink; - return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsInternal(args)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); - } - - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onConnectionStringAvailableInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceReadyInternal(callback)); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new ContainerResource(result, this._client); +} + +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromManifestInternal()); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForInternal(dependency)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExplicitStartInternal()); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - const exitCode = options?.exitCode; - return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - const password = options?.password; - return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ContainerResource(result, this._client); - } +} - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ + +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromMcpInternal()); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); + return new ContainerRegistryResource(result, this._client); } -} - -/** - * Thenable wrapper for ContainerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ContainerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); } - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceReadyInternal(callback)); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); - } +} - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); - } +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); - } - - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); - } - - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); - } - - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); - } - - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } - - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } - - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); - } - - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); - } - - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); - } - - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } - - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); - } - - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); - } - - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); - } - - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); - } - - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } } // ============================================================================ -// CSharpAppResource +// ContainerResource // ============================================================================ -export class CSharpAppResource extends ResourceBuilderBase { - constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withReplicasInternal(replicas: number): Promise { - const rpcArgs: Record = { builder: this._handle, replicas }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReplicas', - rpcArgs - ); - return new CSharpAppResource(result, this._client); - } - - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); - } - - /** @internal */ - private async _disableForwardedHeadersInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/disableForwardedHeaders', + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - const helpLink = options?.helpLink; - return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsInternal(args)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -5162,15 +6151,15 @@ export class CSharpAppResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -5179,72 +6168,72 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -5257,293 +6246,278 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); - } - - /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', - rpcArgs - ); - return new CSharpAppResource(result, this._client); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { const exitCode = options?.exitCode; - return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -5551,130 +6525,130 @@ export class CSharpAppResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { const commandOptions = options?.commandOptions; - return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { const password = options?.password; - return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { const iconVariant = options?.iconVariant; - return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -5683,15 +6657,15 @@ export class CSharpAppResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -5699,56 +6673,56 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -5759,60 +6733,79 @@ export class CSharpAppResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); } /** Gets the resource name */ @@ -5824,161 +6817,316 @@ export class CSharpAppResource extends ResourceBuilderBase { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceReadyInternal(callback)); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } +} - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -5987,163 +7135,163 @@ export class CSharpAppResourcePromise implements PromiseLike } /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } /** Gets the resource name */ @@ -6151,538 +7299,397 @@ export class CSharpAppResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ -// DotnetToolResource +// CSharpAppResource // ============================================================================ -export class DotnetToolResource extends ResourceBuilderBase { - constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withToolPackageInternal(packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPackage', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withToolVersionInternal(version: string): Promise { - const rpcArgs: Record = { builder: this._handle, version }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolVersion', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withToolPrereleaseInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPrerelease', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withToolSourceInternal(source: string): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolSource', + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); } /** @internal */ - private async _withToolIgnoreExistingFeedsInternal(): Promise { + private async _disableForwardedHeadersInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreExistingFeeds', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); } /** @internal */ - private async _withToolIgnoreFailedSourcesInternal(): Promise { + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreFailedSources', + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + const configure = options?.configure; + return new CSharpAppResourcePromise(this._publishAsDockerFileInternal(configure)); } /** @internal */ - private async _publishAsDockerFileInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFile', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; - const obj = new ContainerResource(objHandle, this._client); - await configure(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFileWithConfigure', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withExecutableCommandInternal(command: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExecutableCommand', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { - const rpcArgs: Record = { builder: this._handle, workingDirectory }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withWorkingDirectory', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new DotnetToolResource(result, this._client); - } - - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); - } - - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - const helpLink = options?.helpLink; - return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } - - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); - } - - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); - } - - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); - } - - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); - } - - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); - } - - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -6692,15 +7699,15 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -6709,72 +7716,72 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -6787,278 +7794,293 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { const exitCode = options?.exitCode; - return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -7066,130 +8088,130 @@ export class DotnetToolResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { const commandOptions = options?.commandOptions; - return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { const password = options?.password; - return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { const iconVariant = options?.iconVariant; - return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -7198,15 +8220,15 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -7214,56 +8236,56 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -7274,60 +8296,60 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -7339,201 +8361,246 @@ export class DotnetToolResource extends ResourceBuilderBase { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceReadyInternal(callback)); } - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -7542,158 +8609,163 @@ export class DotnetToolResourcePromise implements PromiseLike obj.asHttp2Service())); + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -7701,383 +8773,500 @@ export class DotnetToolResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ -// ExecutableResource +// DotnetToolResource // ============================================================================ -export class ExecutableResource extends ResourceBuilderBase { - constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - const helpLink = options?.helpLink; - return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + const name = options?.name; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); - } - - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); - } - - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -8087,15 +9276,15 @@ export class ExecutableResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -8104,72 +9293,72 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -8182,278 +9371,278 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { const exitCode = options?.exitCode; - return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -8461,130 +9650,130 @@ export class ExecutableResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { const commandOptions = options?.commandOptions; - return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { const password = options?.password; - return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { const iconVariant = options?.iconVariant; - return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -8593,15 +9782,15 @@ export class ExecutableResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -8609,56 +9798,56 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -8669,60 +9858,60 @@ export class ExecutableResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -8734,151 +9923,281 @@ export class ExecutableResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** - * Thenable wrapper for ExecutableResource that enables fluent chaining. + * Thenable wrapper for DotnetToolResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ExecutableResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -8887,158 +10206,158 @@ export class ExecutableResourcePromise implements PromiseLike obj.asHttp2Service())); + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -9046,1081 +10365,7579 @@ export class ExecutableResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ -// ExternalServiceResource +// ExecutableResource // ============================================================================ -export class ExternalServiceResource extends ResourceBuilderBase { - constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceReadyInternal(callback)); + } + +} + +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceReadyInternal(callback)); + } + +} + +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// JavaScriptAppResource +// ============================================================================ + +export class JavaScriptAppResource extends ResourceBuilderBase { + constructor(handle: JavaScriptAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new JavaScriptAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + const helpLink = options?.helpLink; + return new JavaScriptAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new JavaScriptAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new JavaScriptAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new JavaScriptAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new JavaScriptAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + const displayText = options?.displayText; + return new JavaScriptAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + const displayText = options?.displayText; + return new JavaScriptAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + const exitCode = options?.exitCode; + return new JavaScriptAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + const commandOptions = options?.commandOptions; + return new JavaScriptAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + const password = options?.password; + return new JavaScriptAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + const iconVariant = options?.iconVariant; + return new JavaScriptAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new JavaScriptAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withYarnInternal(install, installArgs)); + } + + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withPnpmInternal(install, installArgs)); + } + + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withRunScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + const browser = options?.browser; + return new JavaScriptAppResourcePromise(this._withBrowserDebuggerInternal(browser)); + } + +} + +/** + * Thenable wrapper for JavaScriptAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class JavaScriptAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: JavaScriptAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + +} + +// ============================================================================ +// NodeAppResource +// ============================================================================ + +export class NodeAppResource extends ResourceBuilderBase { + constructor(handle: NodeAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new NodeAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + const helpLink = options?.helpLink; + return new NodeAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new NodeAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new NodeAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + const exitCode = options?.exitCode; + return new NodeAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + const commandOptions = options?.commandOptions; + return new NodeAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + const password = options?.password; + return new NodeAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + const iconVariant = options?.iconVariant; + return new NodeAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new NodeAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withYarnInternal(install, installArgs)); + } + + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withPnpmInternal(install, installArgs)); + } + + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withRunScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + const browser = options?.browser; + return new NodeAppResourcePromise(this._withBrowserDebuggerInternal(browser)); + } + +} + +/** + * Thenable wrapper for NodeAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class NodeAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: NodeAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceReadyInternal(callback)); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + const configure = options?.configure; + return new ProjectResourcePromise(this._publishAsDockerFileInternal(configure)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - const helpLink = options?.helpLink; - return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); - } - - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); - } - - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); - } - - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); - } - - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - const commandOptions = options?.commandOptions; - return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); - } - - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); - } - - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); - } - - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - const iconVariant = options?.iconVariant; - return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); - } - - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); + return new ProjectResource(result, this._client); } -} - -/** - * Thenable wrapper for ExternalServiceResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ExternalServiceResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); } -} + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } -// ============================================================================ -// ParameterResource -// ============================================================================ + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } -export class ParameterResource extends ResourceBuilderBase { - constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, description }; - if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDescription', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - const enableMarkdown = options?.enableMarkdown; - return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - const helpLink = options?.helpLink; - return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new ParameterResource(result, this._client); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromManifestInternal()); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._withExplicitStartInternal()); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - const commandOptions = options?.commandOptions; - return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceReadyInternal(callback)); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ParameterResource(result, this._client); +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - const iconVariant = options?.iconVariant; - return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromMcpInternal()); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } -} + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } -/** - * Thenable wrapper for ParameterResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ParameterResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } - then( - onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -10128,383 +17945,440 @@ export class ParameterResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ -// ProjectResource +// ViteAppResource // ============================================================================ -export class ProjectResource extends ResourceBuilderBase { - constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { +export class ViteAppResource extends ResourceBuilderBase { + constructor(handle: ViteAppResourceHandle, client: AspireClientRpc) { super(handle, client); } + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ViteAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _publishAsDockerFileInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterInternal()); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - const helpLink = options?.helpLink; - return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ViteAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { + const helpLink = options?.helpLink; + return new ViteAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ViteAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -10514,15 +18388,15 @@ export class ProjectResource extends ResourceBuilderBase if (isProxied !== undefined) rpcArgs.isProxied = isProxied; if (isExternal !== undefined) rpcArgs.isExternal = isExternal; if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -10531,72 +18405,72 @@ export class ProjectResource extends ResourceBuilderBase const isProxied = options?.isProxied; const isExternal = options?.isExternal; const protocol = options?.protocol; - return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + return new ViteAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -10609,293 +18483,308 @@ export class ProjectResource extends ResourceBuilderBase } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._clearContainerFilesSourcesInternal()); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { const exitCode = options?.exitCode; - return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ViteAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new ViteAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -10903,130 +18792,130 @@ export class ProjectResource extends ResourceBuilderBase }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { const commandOptions = options?.commandOptions; - return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ViteAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { const password = options?.password; - return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new ViteAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { const iconVariant = options?.iconVariant; - return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ViteAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -11035,15 +18924,15 @@ export class ProjectResource extends ResourceBuilderBase if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -11051,276 +18940,520 @@ export class ProjectResource extends ResourceBuilderBase const failureThreshold = options?.failureThreshold; const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new ViteAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ViteAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withViteConfigInternal(configPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, configPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withViteConfig', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withViteConfigInternal(configPath)); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withYarnInternal(install, installArgs)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withPnpmInternal(install, installArgs)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', rpcArgs ); + return new ViteAppResource(result, this._client); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + const browser = options?.browser; + return new ViteAppResourcePromise(this._withBrowserDebuggerInternal(browser)); } } /** - * Thenable wrapper for ProjectResource that enables fluent chaining. + * Thenable wrapper for ViteAppResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ProjectResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ViteAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ViteAppResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -11329,168 +19462,306 @@ export class ProjectResourcePromise implements PromiseLike { } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withViteConfig(configPath))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + +} + +// ============================================================================ +// ComputeResource +// ============================================================================ + +export class ComputeResource extends ResourceBuilderBase { + constructor(handle: IComputeResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); +} + +/** + * Thenable wrapper for ComputeResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ComputeResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ComputeResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } } @@ -11508,7 +19779,7 @@ export class ContainerFilesDestinationResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); return new ContainerFilesDestinationResource(result, this._client); @@ -11767,7 +20038,7 @@ export class Resource extends ResourceBuilderBase { private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new Resource(result, this._client); @@ -11782,7 +20053,7 @@ export class Resource extends ResourceBuilderBase { private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new Resource(result, this._client); @@ -11825,36 +20096,6 @@ export class Resource extends ResourceBuilderBase { return new ResourcePromise(this._excludeFromMcpInternal()); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -11932,6 +20173,86 @@ export class Resource extends ResourceBuilderBase { ); } + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -12029,16 +20350,6 @@ export class ResourcePromise implements PromiseLike { return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); @@ -12059,6 +20370,26 @@ export class ResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -12198,6 +20529,35 @@ export class ResourceWithConnectionString extends ResourceBuilderBase { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._onConnectionStringAvailableInternal(callback)); + } + } /** @@ -12225,6 +20585,16 @@ export class ResourceWithConnectionStringPromise implements PromiseLike obj.withConnectionPropertyValue(name, value))); } + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + } // ============================================================================ @@ -12513,6 +20883,26 @@ export class ResourceWithEndpoints extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + } /** @@ -12580,6 +20970,11 @@ export class ResourceWithEndpointsPromise implements PromiseLike obj.withHttpProbe(probeType, options))); } + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + } // ============================================================================ @@ -12622,41 +21017,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -12667,43 +21032,38 @@ export class ResourceWithEnvironment extends ResourceBuilderBase Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -12737,10 +21097,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -12752,37 +21113,8 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -12865,7 +21197,7 @@ export class ResourceWithEnvironment extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ResourceWithEnvironment(result, this._client); @@ -12919,31 +21251,21 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withOtlpExporterProtocol(protocol))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -12959,16 +21281,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -13006,34 +21318,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike { - constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { - super(handle, client); - } - -} - -/** - * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ResourceWithServiceDiscoveryPromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - -} - // ============================================================================ // ResourceWithWaitSupport // ============================================================================ @@ -13047,7 +21331,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -13077,7 +21361,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -13108,7 +21392,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -13227,7 +21511,7 @@ export async function createBuilder(options?: CreateBuilderOptions): Promise { const error = reason instanceof Error ? reason : new Error(String(reason)); - if (reason instanceof CapabilityError) { + if (reason instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else if (reason instanceof CapabilityError) { console.error(`\n❌ Capability Error: ${error.message}`); console.error(` Code: ${(reason as CapabilityError).code}`); if ((reason as CapabilityError).capability) { @@ -13258,8 +21544,12 @@ process.on('unhandledRejection', (reason: unknown) => { }); process.on('uncaughtException', (error: Error) => { - console.error(`\n❌ Uncaught Exception: ${error.message}`); - if (error.stack) { + if (error instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + } + if (!(error instanceof AppHostUsageError) && error.stack) { console.error(error.stack); } process.exit(1); @@ -13270,21 +21560,44 @@ process.on('uncaughtException', (error: Error) => { // ============================================================================ // Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent', (handle, client) => new AfterResourcesCreatedEvent(handle as AfterResourcesCreatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent', (handle, client) => new BeforeResourceStartedEvent(handle as BeforeResourceStartedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent', (handle, client) => new BeforeStartEvent(handle as BeforeStartEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent', (handle, client) => new ConnectionStringAvailableEvent(handle as ConnectionStringAvailableEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel', (handle, client) => new DistributedApplicationModel(handle as DistributedApplicationModelHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent', (handle, client) => new InitializeResourceEvent(handle as InitializeResourceEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext', (handle, client) => new PipelineContext(handle as PipelineContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext', (handle, client) => new PipelineStepFactoryContext(handle as PipelineStepFactoryContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary', (handle, client) => new PipelineSummary(handle as PipelineSummaryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent', (handle, client) => new ResourceEndpointsAllocatedEvent(handle as ResourceEndpointsAllocatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService', (handle, client) => new ResourceLoggerService(handle as ResourceLoggerServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService', (handle, client) => new ResourceNotificationService(handle as ResourceNotificationServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent', (handle, client) => new ResourceReadyEvent(handle as ResourceReadyEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent', (handle, client) => new ResourceStoppedEvent(handle as ResourceStoppedEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext', (handle, client) => new UpdateCommandStateContext(handle as UpdateCommandStateContextHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration', (handle, client) => new Configuration(handle as IConfigurationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment', (handle, client) => new HostEnvironment(handle as IHostEnvironmentHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger', (handle, client) => new Logger(handle as ILoggerHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory', (handle, client) => new LoggerFactory(handle as ILoggerFactoryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep', (handle, client) => new ReportingStep(handle as IReportingStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask', (handle, client) => new ReportingTask(handle as IReportingTaskHandle, client)); +registerHandleWrapper('System.ComponentModel/System.IServiceProvider', (handle, client) => new ServiceProvider(handle as IServiceProviderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IUserSecretsManager', (handle, client) => new UserSecretsManager(handle as IUserSecretsManagerHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); @@ -13292,8 +21605,12 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppR registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource', (handle, client) => new JavaScriptAppResource(handle as JavaScriptAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource', (handle, client) => new NodeAppResource(handle as NodeAppResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource', (handle, client) => new ViteAppResource(handle as ViteAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource', (handle, client) => new ComputeResource(handle as IComputeResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); @@ -13301,6 +21618,5 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceW registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); diff --git a/samples/Metrics/ts/.modules/base.ts b/samples/Metrics/ts/.modules/base.ts index 7778b0f1..b3d8b8be 100644 --- a/samples/Metrics/ts/.modules/base.ts +++ b/samples/Metrics/ts/.modules/base.ts @@ -1,8 +1,8 @@ -// aspire.ts - Core Aspire types: base classes, ReferenceExpression -import { Handle, AspireClient, MarshalledHandle } from './transport.js'; +// base.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle, CancellationToken, registerCancellation, registerHandleWrapper, unregisterCancellation } from './transport.js'; // Re-export transport types for convenience -export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export { Handle, AspireClient, CapabilityError, CancellationToken, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; @@ -43,22 +43,46 @@ export class ReferenceExpression { private readonly _format?: string; private readonly _valueProviders?: unknown[]; + // Conditional mode fields + private readonly _condition?: unknown; + private readonly _whenTrue?: ReferenceExpression; + private readonly _whenFalse?: ReferenceExpression; + private readonly _matchValue?: string; + // Handle mode fields (when wrapping a server-returned handle) private readonly _handle?: Handle; private readonly _client?: AspireClient; constructor(format: string, valueProviders: unknown[]); constructor(handle: Handle, client: AspireClient); - constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { - if (typeof handleOrFormat === 'string') { - this._format = handleOrFormat; - this._valueProviders = clientOrValueProviders as unknown[]; + constructor(condition: unknown, matchValue: string, whenTrue: ReferenceExpression, whenFalse: ReferenceExpression); + constructor( + handleOrFormatOrCondition: Handle | string | unknown, + clientOrValueProvidersOrMatchValue: AspireClient | unknown[] | string, + whenTrueOrWhenFalse?: ReferenceExpression, + whenFalse?: ReferenceExpression + ) { + if (typeof handleOrFormatOrCondition === 'string') { + this._format = handleOrFormatOrCondition; + this._valueProviders = clientOrValueProvidersOrMatchValue as unknown[]; + } else if (handleOrFormatOrCondition instanceof Handle) { + this._handle = handleOrFormatOrCondition; + this._client = clientOrValueProvidersOrMatchValue as AspireClient; } else { - this._handle = handleOrFormat; - this._client = clientOrValueProviders as AspireClient; + this._condition = handleOrFormatOrCondition; + this._matchValue = (clientOrValueProvidersOrMatchValue as string) ?? 'True'; + this._whenTrue = whenTrueOrWhenFalse; + this._whenFalse = whenFalse; } } + /** + * Gets whether this reference expression is conditional. + */ + get isConditional(): boolean { + return this._condition !== undefined; + } + /** * Creates a reference expression from a tagged template literal. * @@ -82,16 +106,46 @@ export class ReferenceExpression { return new ReferenceExpression(format, valueProviders); } + /** + * Creates a conditional reference expression from its constituent parts. + * + * @param condition - A value provider whose result is compared to matchValue + * @param whenTrue - The expression to use when the condition matches + * @param whenFalse - The expression to use when the condition does not match + * @param matchValue - The value to compare the condition against (defaults to "True") + * @returns A ReferenceExpression instance in conditional mode + */ + static createConditional( + condition: unknown, + matchValue: string, + whenTrue: ReferenceExpression, + whenFalse: ReferenceExpression + ): ReferenceExpression { + return new ReferenceExpression(condition, matchValue, whenTrue, whenFalse); + } + /** * Serializes the reference expression for JSON-RPC transport. - * In template-literal mode, uses the $expr format. + * In expression mode, uses the $expr format with format + valueProviders. + * In conditional mode, uses the $expr format with condition + whenTrue + whenFalse. * In handle mode, delegates to the handle's serialization. */ - toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } | { condition: unknown; whenTrue: unknown; whenFalse: unknown; matchValue: string } } | MarshalledHandle { if (this._handle) { return this._handle.toJSON(); } + if (this.isConditional) { + return { + $expr: { + condition: extractHandleForExpr(this._condition), + whenTrue: this._whenTrue!.toJSON(), + whenFalse: this._whenFalse!.toJSON(), + matchValue: this._matchValue! + } + }; + } + return { $expr: { format: this._format!, @@ -100,6 +154,30 @@ export class ReferenceExpression { }; } + /** + * Resolves the expression to its string value on the server. + * Only available on server-returned ReferenceExpression instances (handle mode). + * + * @param cancellationToken - Optional AbortSignal or CancellationToken for cancellation support + * @returns The resolved string value, or null if the expression resolves to null + */ + async getValue(cancellationToken?: AbortSignal | CancellationToken): Promise { + if (!this._handle || !this._client) { + throw new Error('getValue is only available on server-returned ReferenceExpression instances'); + } + const cancellationTokenId = registerCancellation(this._client, cancellationToken); + try { + const rpcArgs: Record = { context: this._handle }; + if (cancellationTokenId !== undefined) rpcArgs.cancellationToken = cancellationTokenId; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValue', + rpcArgs + ); + } finally { + unregisterCancellation(cancellationTokenId); + } + } + /** * String representation for debugging. */ @@ -107,10 +185,17 @@ export class ReferenceExpression { if (this._handle) { return `ReferenceExpression(handle)`; } + if (this.isConditional) { + return `ReferenceExpression(conditional)`; + } return `ReferenceExpression(${this._format})`; } } +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression', (handle, client) => + new ReferenceExpression(handle, client) +); + /** * Extracts a value for use in reference expressions. * Supports handles (objects) and string literals. @@ -136,15 +221,15 @@ function extractHandleForExpr(value: unknown): unknown { return value.toJSON(); } - // Objects with $handle property (already in handle format) - if (typeof value === 'object' && value !== null && '$handle' in value) { + // Objects with marshalled expression/handle payloads + if (typeof value === 'object' && value !== null && ('$handle' in value || '$expr' in value)) { return value; } - // Objects with toJSON that returns a handle + // Objects with toJSON that returns a marshalled expression or handle if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { const json = value.toJSON(); - if (json && typeof json === 'object' && '$handle' in json) { + if (json && typeof json === 'object' && ('$handle' in json || '$expr' in json)) { return json; } } @@ -307,11 +392,20 @@ export class AspireList { }) as T[]; } - toJSON(): MarshalledHandle { - if (this._resolvedHandle) { - return this._resolvedHandle.toJSON(); + async toTransportValue(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireList must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); } - return this._handleOrContext.toJSON(); + + return this._resolvedHandle.toJSON(); } } @@ -466,8 +560,19 @@ export class AspireDict { }) as Record; } - async toJSON(): Promise { + async toTransportValue(): Promise { const handle = await this._ensureHandle(); return handle.toJSON(); } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireDict must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); + } + + return this._resolvedHandle.toJSON(); + } } diff --git a/samples/Metrics/ts/.modules/transport.ts b/samples/Metrics/ts/.modules/transport.ts index 7bddd74b..6d29cf28 100644 --- a/samples/Metrics/ts/.modules/transport.ts +++ b/samples/Metrics/ts/.modules/transport.ts @@ -77,7 +77,8 @@ export function isAtsError(value: unknown): value is { $error: AtsError } { value !== null && typeof value === 'object' && '$error' in value && - typeof (value as { $error: unknown }).$error === 'object' + typeof (value as { $error: unknown }).$error === 'object' && + (value as { $error: unknown }).$error !== null ); } @@ -93,6 +94,47 @@ export function isMarshalledHandle(value: unknown): value is MarshalledHandle { ); } +function isAbortSignal(value: unknown): value is AbortSignal { + return ( + value !== null && + typeof value === 'object' && + 'aborted' in value && + 'addEventListener' in value && + 'removeEventListener' in value + ); +} + +function isPlainObject(value: unknown): value is Record { + if (value === null || typeof value !== 'object') { + return false; + } + + const prototype = Object.getPrototypeOf(value); + return prototype === Object.prototype || prototype === null; +} + +function hasTransportValue(value: unknown): value is { toTransportValue(): unknown | Promise } { + return ( + value !== null && + typeof value === 'object' && + 'toTransportValue' in value && + typeof (value as { toTransportValue?: unknown }).toTransportValue === 'function' + ); +} + +function createAbortError(message: string): Error { + const error = new Error(message); + error.name = 'AbortError'; + return error; +} + +function createCircularReferenceError(capabilityId: string, path: string): AppHostUsageError { + return new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' contains a circular reference. ` + + 'Circular references are not supported by the AppHost transport.' + ); +} + // ============================================================================ // Handle // ============================================================================ @@ -136,6 +178,92 @@ export class Handle { } } +// ============================================================================ +// CancellationToken +// ============================================================================ + +/** + * Represents a transport-safe cancellation token value for the generated SDK. + * + * Use a plain {@link AbortSignal} when you create cancellation in user code. + * Generated APIs accept either an {@link AbortSignal} or a {@link CancellationToken}. + * + * Values returned from generated callbacks and context/property getters are + * {@link CancellationToken} instances because they may reference remote + * cancellation token handles received from the AppHost. + * + * @example + * ```typescript + * const controller = new AbortController(); + * await connectionStringExpression.getValue(controller.signal); + * ``` + * + * @example + * ```typescript + * const cancellationToken = await context.cancellationToken.get(); + * const connectionStringExpression = await db.uriExpression.get(); + * const connectionString = await connectionStringExpression.getValue(cancellationToken); + * ``` + */ +export class CancellationToken { + private readonly _signal?: AbortSignal; + private readonly _remoteTokenId?: string; + + constructor(signal?: AbortSignal); + constructor(tokenId?: string); + constructor(value?: AbortSignal | string | null) { + if (typeof value === 'string') { + this._remoteTokenId = value; + } else if (isAbortSignal(value)) { + this._signal = value; + } + } + + /** + * Creates a cancellation token from a local {@link AbortSignal}. + */ + static from(signal?: AbortSignal): CancellationToken { + return new CancellationToken(signal); + } + + /** + * Creates a cancellation token from a transport value. + * Generated code uses this to materialize values that come from the AppHost. + */ + static fromValue(value: unknown): CancellationToken { + if (value instanceof CancellationToken) { + return value; + } + + if (typeof value === 'string') { + return new CancellationToken(value); + } + + if (isAbortSignal(value)) { + return new CancellationToken(value); + } + + return new CancellationToken(); + } + + /** + * Serializes the token for JSON-RPC transport. + */ + toJSON(): string | undefined { + return this._remoteTokenId; + } + + register(client?: AspireClient): string | undefined { + if (this._remoteTokenId !== undefined) { + return this._remoteTokenId; + } + + return client + ? registerCancellation(client, this._signal) + : registerCancellation(this._signal); + } +} + // ============================================================================ // Handle Wrapper Registry // ============================================================================ @@ -167,22 +295,35 @@ export function registerHandleWrapper(typeId: string, factory: HandleWrapperFact * @param client - Optional client for creating typed wrapper instances */ export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { - if (value && typeof value === 'object') { - if (isMarshalledHandle(value)) { - const handle = new Handle(value); - const typeId = value.$type; - - // Try to find a registered wrapper factory for this type - if (typeId && client) { - const factory = handleWrapperRegistry.get(typeId); - if (factory) { - return factory(handle, client); - } + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); } + } + + return handle; + } - return handle; + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + value[i] = wrapIfHandle(value[i], client); + } + + return value; + } + + if (isPlainObject(value)) { + for (const [key, nestedValue] of Object.entries(value)) { + value[key] = wrapIfHandle(nestedValue, client); } } + return value; } @@ -213,6 +354,76 @@ export class CapabilityError extends Error { } } +/** + * Error thrown when the AppHost script uses the generated SDK incorrectly. + */ +export class AppHostUsageError extends Error { + constructor(message: string) { + super(message); + this.name = 'AppHostUsageError'; + } +} + +function isPromiseLike(value: unknown): value is PromiseLike { + return ( + value !== null && + (typeof value === 'object' || typeof value === 'function') && + 'then' in value && + typeof (value as { then?: unknown }).then === 'function' + ); +} + +function validateCapabilityArgs( + capabilityId: string, + args?: Record +): void { + if (!args) { + return; + } + + const validateValue = (value: unknown, path: string, ancestors: Set): void => { + if (value === null || value === undefined) { + return; + } + + if (isPromiseLike(value)) { + throw new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' is a Promise-like value. ` + + `This usually means an async builder call was not awaited. ` + + `Did you forget 'await' on a call like builder.addPostgres(...) or resource.addDatabase(...)?` + ); + } + + if (typeof value !== 'object') { + return; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + ancestors.add(value); + try { + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + validateValue(value[i], `${path}[${i}]`, ancestors); + } + return; + } + + for (const [key, nestedValue] of Object.entries(value)) { + validateValue(nestedValue, `${path}.${key}`, ancestors); + } + } finally { + ancestors.delete(value); + } + }; + + for (const [key, value] of Object.entries(args)) { + validateValue(value, key, new Set()); + } +} + // ============================================================================ // Callback Registry // ============================================================================ @@ -324,21 +535,50 @@ export function getCallbackCount(): number { */ const cancellationRegistry = new Map void>(); let cancellationIdCounter = 0; +const connectedClients = new Set(); -/** - * A reference to the current AspireClient for sending cancel requests. - * Set by AspireClient.connect(). - */ -let currentClient: AspireClient | null = null; +function resolveCancellationClient(client?: AspireClient): AspireClient { + if (client) { + return client; + } + + if (connectedClients.size === 1) { + return connectedClients.values().next().value as AspireClient; + } + + if (connectedClients.size === 0) { + throw new Error( + 'registerCancellation(signal) requires a connected AspireClient. ' + + 'Pass the client explicitly or connect the client first.' + ); + } + + throw new Error( + 'registerCancellation(signal) is ambiguous when multiple AspireClient instances are connected. ' + + 'Pass the client explicitly.' + ); +} /** - * Register an AbortSignal for cancellation support. - * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * Registers cancellation support for a local signal or SDK cancellation token. + * Returns a cancellation ID that should be passed to methods accepting cancellation input. * * When the AbortSignal is aborted, sends a cancelToken request to the host. * - * @param signal - The AbortSignal to register (optional) - * @returns The cancellation ID, or undefined if no signal provided + * @param client - The AspireClient that should route the cancellation request + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + */ +export function registerCancellation(client: AspireClient, signalOrToken?: AbortSignal | CancellationToken): string | undefined; +/** + * Registers cancellation support using the single connected AspireClient. + * + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + * + * @example + * const controller = new AbortController(); + * await expression.getValue(controller.signal); * * @example * const controller = new AbortController(); @@ -346,14 +586,29 @@ let currentClient: AspireClient | null = null; * // Pass id to capability invocation * // Later: controller.abort() will cancel the operation */ -export function registerCancellation(signal?: AbortSignal): string | undefined { - if (!signal) { +export function registerCancellation(signalOrToken?: AbortSignal | CancellationToken): string | undefined; +export function registerCancellation( + clientOrSignalOrToken?: AspireClient | AbortSignal | CancellationToken, + maybeSignalOrToken?: AbortSignal | CancellationToken +): string | undefined { + const client = clientOrSignalOrToken instanceof AspireClient ? clientOrSignalOrToken : undefined; + const signalOrToken = client + ? maybeSignalOrToken + : clientOrSignalOrToken as AbortSignal | CancellationToken | undefined; + + if (!signalOrToken) { return undefined; } - // Already aborted? Don't register + if (signalOrToken instanceof CancellationToken) { + return signalOrToken.register(client); + } + + const signal = signalOrToken; + const cancellationClient = resolveCancellationClient(client); + if (signal.aborted) { - return undefined; + throw createAbortError('The operation was aborted before it was sent to the AppHost.'); } const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; @@ -361,8 +616,8 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { // Set up the abort listener const onAbort = () => { // Send cancel request to host - if (currentClient?.connected) { - currentClient.cancelToken(cancellationId).catch(() => { + if (cancellationClient.connected) { + cancellationClient.cancelToken(cancellationId).catch(() => { // Ignore errors - the operation may have already completed }); } @@ -381,6 +636,56 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { return cancellationId; } +async function marshalTransportValue( + value: unknown, + client: AspireClient, + cancellationIds: string[], + capabilityId: string, + path: string = 'args', + ancestors: Set = new Set() +): Promise { + if (value === null || value === undefined || typeof value !== 'object') { + return value; + } + + if (value instanceof CancellationToken) { + const cancellationId = value.register(client); + if (cancellationId !== undefined) { + cancellationIds.push(cancellationId); + } + + return cancellationId; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + const nextAncestors = new Set(ancestors); + nextAncestors.add(value); + + if (hasTransportValue(value)) { + return await marshalTransportValue(await value.toTransportValue(), client, cancellationIds, capabilityId, path, nextAncestors); + } + + if (Array.isArray(value)) { + return await Promise.all( + value.map((item, index) => marshalTransportValue(item, client, cancellationIds, capabilityId, `${path}[${index}]`, nextAncestors)) + ); + } + + if (isPlainObject(value)) { + const entries = await Promise.all( + Object.entries(value).map(async ([key, nestedValue]) => + [key, await marshalTransportValue(nestedValue, client, cancellationIds, capabilityId, `${path}.${key}`, nextAncestors)] as const) + ); + + return Object.fromEntries(entries); + } + + return value; +} + /** * Unregister a cancellation token by its ID. * Call this when the operation completes to clean up resources. @@ -411,6 +716,8 @@ export class AspireClient { private socket: net.Socket | null = null; private disconnectCallbacks: (() => void)[] = []; private _pendingCalls = 0; + private _connectPromise: Promise | null = null; + private _disconnectNotified = false; constructor(private socketPath: string) { } @@ -422,6 +729,12 @@ export class AspireClient { } private notifyDisconnect(): void { + if (this._disconnectNotified) { + return; + } + + this._disconnectNotified = true; + for (const callback of this.disconnectCallbacks) { try { callback(); @@ -432,30 +745,106 @@ export class AspireClient { } connect(timeoutMs: number = 5000): Promise { - return new Promise((resolve, reject) => { - const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + if (this.connected) { + return Promise.resolve(); + } + + if (this._connectPromise) { + return this._connectPromise; + } + + this._disconnectNotified = false; + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this._connectPromise = new Promise((resolve, reject) => { + const socket = net.createConnection(pipePath); + this.socket = socket; - // On Windows, use named pipes; on Unix, use Unix domain sockets - const isWindows = process.platform === 'win32'; - const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + let settled = false; - this.socket = net.createConnection(pipePath); + const cleanupPendingListeners = () => { + socket.removeListener('connect', onConnect); + socket.removeListener('error', onPendingError); + socket.removeListener('close', onPendingClose); + }; - this.socket.once('error', (error: Error) => { + const failConnect = (error: Error) => { + if (settled) { + return; + } + + settled = true; clearTimeout(timeout); + cleanupPendingListeners(); + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + if (!socket.destroyed) { + socket.destroy(); + } + reject(error); - }); + }; + + const onConnectedSocketError = (error: Error) => { + console.error('Socket error:', error); + }; + + const onConnectedSocketClose = () => { + socket.removeListener('error', onConnectedSocketError); + + if (this.socket && this.socket !== socket) { + return; + } + + const connection = this.connection; + this.connection = null; + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + this.notifyDisconnect(); + }; + + const onPendingError = (error: Error) => { + failConnect(error); + }; + + const onPendingClose = () => { + failConnect(new Error('Connection closed before JSON-RPC was established')); + }; + + const onConnect = async () => { + if (settled) { + return; + } - this.socket.once('connect', () => { clearTimeout(timeout); + cleanupPendingListeners(); + try { - const reader = new rpc.SocketMessageReader(this.socket!); - const writer = new rpc.SocketMessageWriter(this.socket!); + const reader = new rpc.SocketMessageReader(socket); + const writer = new rpc.SocketMessageWriter(socket); this.connection = rpc.createMessageConnection(reader, writer); this.connection.onClose(() => { this.connection = null; - this.notifyDisconnect(); }); this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); @@ -475,26 +864,39 @@ export class AspireClient { } }); + socket.on('error', onConnectedSocketError); + socket.on('close', onConnectedSocketClose); + + const authToken = process.env.ASPIRE_REMOTE_APPHOST_TOKEN; + if (!authToken) { + throw new Error('ASPIRE_REMOTE_APPHOST_TOKEN environment variable is not set.'); + } this.connection.listen(); + const authenticated = await this.connection.sendRequest('authenticate', authToken); + if (!authenticated) { + throw new Error('Failed to authenticate to the AppHost server.'); + } - // Set the current client for cancellation registry - currentClient = this; + connectedClients.add(this); + this._connectPromise = null; + settled = true; resolve(); - } catch (e) { - reject(e); + } catch (error) { + failConnect(error instanceof Error ? error : new Error(String(error))); } - }); + }; - this.socket.on('close', () => { - this.connection?.dispose(); - this.connection = null; - if (currentClient === this) { - currentClient = null; - } - this.notifyDisconnect(); - }); + const timeout = setTimeout(() => { + failConnect(new Error('Connection timeout')); + }, timeoutMs); + + socket.once('error', onPendingError); + socket.once('close', onPendingClose); + socket.once('connect', onConnect); }); + + return this._connectPromise; } ping(): Promise { @@ -533,39 +935,66 @@ export class AspireClient { throw new Error('Not connected to AppHost'); } - // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. - // We ref() during RPC calls so the process doesn't exit mid-call, and - // unref() when idle so the process can exit naturally after all work completes. - if (this._pendingCalls === 0) { - this.socket?.ref(); - } - this._pendingCalls++; + validateCapabilityArgs(capabilityId, args); + const cancellationIds: string[] = []; try { - const result = await this.connection.sendRequest( - 'invokeCapability', - capabilityId, - args ?? null - ); + const rpcArgs = await marshalTransportValue(args ?? null, this, cancellationIds, capabilityId); - // Check for structured error response - if (isAtsError(result)) { - throw new CapabilityError(result.$error); + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); } + this._pendingCalls++; - // Wrap handles automatically - return wrapIfHandle(result, this) as T; + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + rpcArgs + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } } finally { - this._pendingCalls--; - if (this._pendingCalls === 0) { - this.socket?.unref(); + for (const cancellationId of cancellationIds) { + unregisterCancellation(cancellationId); } } } disconnect(): void { - try { this.connection?.dispose(); } finally { this.connection = null; } - try { this.socket?.end(); } finally { this.socket = null; } + const connection = this.connection; + const socket = this.socket; + + this.connection = null; + this.socket = null; + this._connectPromise = null; + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + if (socket && !socket.destroyed) { + socket.end(); + socket.destroy(); + } } get connected(): boolean { diff --git a/samples/Metrics/ts/apphost.run.json b/samples/Metrics/ts/aspire.config.json similarity index 67% rename from samples/Metrics/ts/apphost.run.json rename to samples/Metrics/ts/aspire.config.json index edfefa15..4e9ec95b 100644 --- a/samples/Metrics/ts/apphost.run.json +++ b/samples/Metrics/ts/aspire.config.json @@ -1,4 +1,11 @@ { + "appHost": { + "path": "apphost.ts", + "language": "typescript/nodejs" + }, + "packages": { + "Aspire.Hosting.JavaScript": "13.2.0" + }, "profiles": { "https": { "applicationUrl": "https://localhost:25773;http://localhost:60744", @@ -8,4 +15,4 @@ } } } -} \ No newline at end of file +} diff --git a/samples/aspire-shop/ts/.aspire/settings.json b/samples/aspire-shop/ts/.aspire/settings.json deleted file mode 100644 index af7e7dff..00000000 --- a/samples/aspire-shop/ts/.aspire/settings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "appHostPath": "../apphost.ts", - "language": "typescript/nodejs", - "channel": "staging", - "sdkVersion": "13.2.0-preview.1.26159.1", - "packages": { - "Aspire.Hosting.Redis": "13.2.0-preview.1.26159.1", - "Aspire.Hosting.PostgreSQL": "13.2.0-preview.1.26159.1" - } -} \ No newline at end of file diff --git a/samples/aspire-shop/ts/.modules/.codegen-hash b/samples/aspire-shop/ts/.modules/.codegen-hash index a7f470fb..88d08993 100644 --- a/samples/aspire-shop/ts/.modules/.codegen-hash +++ b/samples/aspire-shop/ts/.modules/.codegen-hash @@ -1 +1 @@ -F147B18FE6EF6F6CE366D1C57BBBD23C865B17C54A3C19C816F30FCDB7EE7930 \ No newline at end of file +16A657387C9BB45B283D5C70A9AA0A95DA2A73FDCF11882E484AB5003EDD6BC2 \ No newline at end of file diff --git a/samples/aspire-shop/ts/.modules/aspire.ts b/samples/aspire-shop/ts/.modules/aspire.ts index 879641f1..8bebc7ae 100644 --- a/samples/aspire-shop/ts/.modules/aspire.ts +++ b/samples/aspire-shop/ts/.modules/aspire.ts @@ -8,6 +8,8 @@ import { AspireClient as AspireClientRpc, Handle, MarshalledHandle, + AppHostUsageError, + CancellationToken, CapabilityError, registerCallback, wrapIfHandle, @@ -26,6 +28,15 @@ import { // Handle Type Aliases (Internal - not exported to users) // ============================================================================ +/** Handle to JavaScriptAppResource */ +type JavaScriptAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource'>; + +/** Handle to NodeAppResource */ +type NodeAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource'>; + +/** Handle to ViteAppResource */ +type ViteAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource'>; + /** Handle to PostgresDatabaseResource */ type PostgresDatabaseResourceHandle = Handle<'Aspire.Hosting.PostgreSQL/Aspire.Hosting.ApplicationModel.PostgresDatabaseResource'>; @@ -50,9 +61,21 @@ type RedisCommanderResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting. /** Handle to RedisInsightResource */ type RedisInsightResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisInsightResource'>; +/** Handle to AfterResourcesCreatedEvent */ +type AfterResourcesCreatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent'>; + +/** Handle to BeforeResourceStartedEvent */ +type BeforeResourceStartedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent'>; + +/** Handle to BeforeStartEvent */ +type BeforeStartEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent'>; + /** Handle to CommandLineArgsCallbackContext */ type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; +/** Handle to ConnectionStringAvailableEvent */ +type ConnectionStringAvailableEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent'>; + /** Handle to ContainerRegistryResource */ type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; @@ -62,6 +85,9 @@ type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Application /** Handle to CSharpAppResource */ type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; +/** Handle to DistributedApplicationModel */ +type DistributedApplicationModelHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel'>; + /** Handle to DotnetToolResource */ type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; @@ -80,9 +106,15 @@ type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicatio /** Handle to ExecuteCommandContext */ type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; +/** Handle to IComputeResource */ +type IComputeResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource'>; + /** Handle to IContainerFilesDestinationResource */ type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; +/** Handle to InitializeResourceEvent */ +type InitializeResourceEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent'>; + /** Handle to IResource */ type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; @@ -113,15 +145,27 @@ type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicati /** Handle to ReferenceExpressionBuilder */ type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; +/** Handle to ResourceEndpointsAllocatedEvent */ +type ResourceEndpointsAllocatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent'>; + /** Handle to ResourceLoggerService */ type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; /** Handle to ResourceNotificationService */ type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; +/** Handle to ResourceReadyEvent */ +type ResourceReadyEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent'>; + +/** Handle to ResourceStoppedEvent */ +type ResourceStoppedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent'>; + /** Handle to ResourceUrlsCallbackContext */ type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; +/** Handle to UpdateCommandStateContext */ +type UpdateCommandStateContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext'>; + /** Handle to ConnectionStringResource */ type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; @@ -146,18 +190,33 @@ type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hostin /** Handle to IResourceWithContainerFiles */ type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; -/** Handle to IResourceWithServiceDiscovery */ -type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; +/** Handle to IUserSecretsManager */ +type IUserSecretsManagerHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IUserSecretsManager'>; + +/** Handle to IReportingStep */ +type IReportingStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep'>; + +/** Handle to IReportingTask */ +type IReportingTaskHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask'>; /** Handle to PipelineConfigurationContext */ type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; +/** Handle to PipelineContext */ +type PipelineContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext'>; + /** Handle to PipelineStep */ type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; /** Handle to PipelineStepContext */ type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; +/** Handle to PipelineStepFactoryContext */ +type PipelineStepFactoryContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext'>; + +/** Handle to PipelineSummary */ +type PipelineSummaryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary'>; + /** Handle to ProjectResourceOptions */ type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; @@ -170,12 +229,18 @@ type ListanyHandle = Handle<'Aspire.Hosting/List'>; /** Handle to IConfiguration */ type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; +/** Handle to IConfigurationSection */ +type IConfigurationSectionHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfigurationSection'>; + /** Handle to IHostEnvironment */ type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; /** Handle to ILogger */ type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; +/** Handle to ILoggerFactory */ +type ILoggerFactoryHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory'>; + /** Handle to string[] */ type stringArrayHandle = Handle<'string[]'>; @@ -215,6 +280,7 @@ export enum EndpointProperty { Scheme = "Scheme", TargetPort = "TargetPort", HostAndPort = "HostAndPort", + TlsEnabled = "TlsEnabled", } /** Enum type for IconVariant */ @@ -346,6 +412,10 @@ export interface AddConnectionStringOptions { environmentVariableName?: string; } +export interface AddContainerRegistryFromStringOptions { + repository?: string; +} + export interface AddContainerRegistryOptions { repository?: ParameterResource; } @@ -359,6 +429,10 @@ export interface AddDockerfileOptions { stage?: string; } +export interface AddJavaScriptAppOptions { + runScriptName?: string; +} + export interface AddParameterFromConfigurationOptions { secret?: boolean; } @@ -367,6 +441,11 @@ export interface AddParameterOptions { secret?: boolean; } +export interface AddParameterWithValueOptions { + publishValueAsDefault?: boolean; + secret?: boolean; +} + export interface AddPostgresOptions { userName?: ParameterResource; password?: ParameterResource; @@ -382,6 +461,10 @@ export interface AddRedisWithPortOptions { port?: number; } +export interface AddViteAppOptions { + runScriptName?: string; +} + export interface AppendFormattedOptions { format?: string; } @@ -390,22 +473,89 @@ export interface AppendValueProviderOptions { format?: string; } +export interface CompleteStepMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteStepOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskOptions { + completionMessage?: string; + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateMarkdownTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + export interface GetValueAsyncOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface PublishAsDockerFileOptions { + configure?: (obj: ContainerResource) => Promise; +} + +export interface PublishResourceUpdateOptions { + state?: string; + stateStyle?: string; } export interface RunOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface SaveStateJsonOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskMarkdownOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; } export interface WaitForCompletionOptions { exitCode?: number; } +export interface WaitForResourceStateOptions { + targetState?: string; +} + export interface WithBindMountOptions { isReadOnly?: boolean; } +export interface WithBrowserDebuggerOptions { + browser?: string; +} + +export interface WithBuildScriptOptions { + args?: string[]; +} + +export interface WithBunOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithCommandOptions { commandOptions?: CommandOptions; } @@ -502,6 +652,12 @@ export interface WithMcpServerOptions { endpointName?: string; } +export interface WithNpmOptions { + install?: boolean; + installCommand?: string; + installArgs?: string[]; +} + export interface WithPersistenceOptions { interval?: number; keysChangedThreshold?: number; @@ -524,6 +680,11 @@ export interface WithPipelineStepFactoryOptions { description?: string; } +export interface WithPnpmOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithPostgresMcpOptions { configureContainer?: (obj: PostgresMcpContainerResource) => Promise; containerName?: string; @@ -542,12 +703,17 @@ export interface WithRedisInsightOptions { export interface WithReferenceOptions { connectionName?: string; optional?: boolean; + name?: string; } export interface WithRequiredCommandOptions { helpLink?: string; } +export interface WithRunScriptOptions { + args?: string[]; +} + export interface WithUrlExpressionOptions { displayText?: string; } @@ -561,6 +727,122 @@ export interface WithVolumeOptions { isReadOnly?: boolean; } +export interface WithYarnOptions { + install?: boolean; + installArgs?: string[]; +} + +// ============================================================================ +// AfterResourcesCreatedEvent +// ============================================================================ + +/** + * Type class for AfterResourcesCreatedEvent. + */ +export class AfterResourcesCreatedEvent { + constructor(private _handle: AfterResourcesCreatedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeResourceStartedEvent +// ============================================================================ + +/** + * Type class for BeforeResourceStartedEvent. + */ +export class BeforeResourceStartedEvent { + constructor(private _handle: BeforeResourceStartedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeStartEvent +// ============================================================================ + +/** + * Type class for BeforeStartEvent. + */ +export class BeforeStartEvent { + constructor(private _handle: BeforeStartEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + // ============================================================================ // CommandLineArgsCallbackContext // ============================================================================ @@ -590,11 +872,12 @@ export class CommandLineArgsCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, }; @@ -609,6 +892,65 @@ export class CommandLineArgsCallbackContext { }, }; + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ConnectionStringAvailableEvent +// ============================================================================ + +/** + * Type class for ConnectionStringAvailableEvent. + */ +export class ConnectionStringAvailableEvent { + constructor(private _handle: ConnectionStringAvailableEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + } // ============================================================================ @@ -626,9 +968,9 @@ export class DistributedApplication { /** Runs the distributed application */ /** @internal */ - async _runInternal(cancellationToken?: AbortSignal): Promise { + async _runInternal(cancellationToken?: AbortSignal | CancellationToken): Promise { const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); await this._client.invokeCapability( 'Aspire.Hosting/run', rpcArgs @@ -702,6 +1044,17 @@ export class DistributedApplicationExecutionContext { }, }; + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the IsPublishMode property */ isPublishMode = { get: async (): Promise => { @@ -724,6 +1077,70 @@ export class DistributedApplicationExecutionContext { } +// ============================================================================ +// DistributedApplicationModel +// ============================================================================ + +/** + * Type class for DistributedApplicationModel. + */ +export class DistributedApplicationModel { + constructor(private _handle: DistributedApplicationModelHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets resources from the distributed application model */ + async getResources(): Promise { + const rpcArgs: Record = { model: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResources', + rpcArgs + ); + } + + /** Finds a resource by name */ + /** @internal */ + async _findResourceByNameInternal(name: string): Promise { + const rpcArgs: Record = { model: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/findResourceByName', + rpcArgs + ); + return new Resource(result, this._client); + } + + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._findResourceByNameInternal(name)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationModel that enables fluent chaining. + */ +export class DistributedApplicationModelPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationModel) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets resources from the distributed application model */ + getResources(): Promise { + return this._promise.then(obj => obj.getResources()); + } + + /** Finds a resource by name */ + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.findResourceByName(name))); + } + +} + // ============================================================================ // EndpointReference // ============================================================================ @@ -737,6 +1154,17 @@ export class EndpointReference { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.resource', + { context: this._handle } + ); + return new ResourceWithEndpoints(handle, this._client); + }, + }; + /** Gets the EndpointName property */ endpointName = { get: async (): Promise => { @@ -803,6 +1231,16 @@ export class EndpointReference { }, }; + /** Gets the TlsEnabled property */ + tlsEnabled = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.tlsEnabled', + { context: this._handle } + ); + }, + }; + /** Gets the Port property */ port = { get: async (): Promise => { @@ -857,13 +1295,22 @@ export class EndpointReference { async getValueAsync(options?: GetValueAsyncOptions): Promise { const cancellationToken = options?.cancellationToken; const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); return await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/getValueAsync', rpcArgs ); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + async getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + const rpcArgs: Record = { context: this._handle, enabledValue, disabledValue }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.getTlsValue', + rpcArgs + ); + } + } /** @@ -884,6 +1331,11 @@ export class EndpointReferencePromise implements PromiseLike return this._promise.then(obj => obj.getValueAsync(options)); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + return this._promise.then(obj => obj.getTlsValue(enabledValue, disabledValue)); + } + } // ============================================================================ @@ -961,11 +1413,34 @@ export class EnvironmentCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; @@ -995,6 +1470,17 @@ export class ExecuteCommandContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the ResourceName property */ resourceName = { get: async (): Promise => { @@ -1013,16 +1499,17 @@ export class ExecuteCommandContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, - set: async (value: AbortSignal): Promise => { + set: async (value: AbortSignal | CancellationToken): Promise => { await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', - { context: this._handle, value } + { context: this._handle, value: CancellationToken.fromValue(value) } ); } }; @@ -1030,23 +1517,104 @@ export class ExecuteCommandContext { } // ============================================================================ -// PipelineConfigurationContext +// InitializeResourceEvent // ============================================================================ /** - * Type class for PipelineConfigurationContext. + * Type class for InitializeResourceEvent. */ -export class PipelineConfigurationContext { - constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} +export class InitializeResourceEvent { + constructor(private _handle: InitializeResourceEventHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the Steps property */ - steps = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Notifications property */ + notifications = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.notifications', + { context: this._handle } + ); + return new ResourceNotificationService(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', { context: this._handle } ); }, @@ -1058,6 +1626,17 @@ export class PipelineConfigurationContext { } }; + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + /** Gets pipeline steps with the specified tag */ async getStepsByTag(tag: string): Promise { const rpcArgs: Record = { context: this._handle, tag }; @@ -1089,6 +1668,93 @@ export class PipelineConfigurationContextPromise implements PromiseLike => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + set: async (value: AbortSignal | CancellationToken): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.setCancellationToken', + { context: this._handle, value: CancellationToken.fromValue(value) } + ); + } + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + // ============================================================================ // PipelineStep // ============================================================================ @@ -1176,6 +1842,17 @@ export class PipelineStep { return this._tags; } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + /** Adds a dependency on another step by name */ /** @internal */ async _dependsOnInternal(stepName: string): Promise { @@ -1246,6 +1923,39 @@ export class PipelineStepContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the ReportingStep property */ + reportingStep = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.reportingStep', + { context: this._handle } + ); + return new ReportingStep(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + /** Gets the ExecutionContext property */ executionContext = { get: async (): Promise => { @@ -1257,18 +1967,159 @@ export class PipelineStepContext { }, }; + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineStepFactoryContext +// ============================================================================ + +/** + * Type class for PipelineStepFactoryContext. + */ +export class PipelineStepFactoryContext { + constructor(private _handle: PipelineStepFactoryContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; } +// ============================================================================ +// PipelineSummary +// ============================================================================ + +/** + * Type class for PipelineSummary. + */ +export class PipelineSummary { + constructor(private _handle: PipelineSummaryHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Add method */ + /** @internal */ + async _addInternal(key: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, key, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineSummary.add', + rpcArgs + ); + return this; + } + + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addInternal(key, value)); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + /** @internal */ + async _addMarkdownInternal(key: string, markdownString: string): Promise { + const rpcArgs: Record = { summary: this._handle, key, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/addMarkdown', + rpcArgs + ); + return this; + } + + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addMarkdownInternal(key, markdownString)); + } + +} + +/** + * Thenable wrapper for PipelineSummary that enables fluent chaining. + */ +export class PipelineSummaryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineSummary) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Add method */ + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.add(key, value))); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.addMarkdown(key, markdownString))); + } + +} + // ============================================================================ // ProjectResourceOptions // ============================================================================ @@ -1451,3080 +2302,3400 @@ export class ReferenceExpressionBuilderPromise implements PromiseLike; - get urls(): AspireList { - if (!this._urls) { - this._urls = new AspireList( - this._handle, - this._client, - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' - ); - } - return this._urls; - } - - /** Gets the CancellationToken property */ - cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.resource', { context: this._handle } ); + return new Resource(handle, this._client); }, }; - /** Gets the ExecutionContext property */ - executionContext = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.services', { context: this._handle } ); - return new DistributedApplicationExecutionContext(handle, this._client); + return new ServiceProvider(handle, this._client); }, }; } // ============================================================================ -// DistributedApplicationBuilder +// ResourceLoggerService // ============================================================================ /** - * Type class for DistributedApplicationBuilder. + * Type class for ResourceLoggerService. */ -export class DistributedApplicationBuilder { - constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} +export class ResourceLoggerService { + constructor(private _handle: ResourceLoggerServiceHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the AppHostDirectory property */ - appHostDirectory = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', - { context: this._handle } - ); - }, - }; + /** Completes the log stream for a resource */ + /** @internal */ + async _completeLogInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { loggerService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLog', + rpcArgs + ); + return this; + } - /** Gets the Eventing property */ - eventing = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', - { context: this._handle } - ); - return new DistributedApplicationEventing(handle, this._client); - }, - }; - - /** Gets the ExecutionContext property */ - executionContext = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', - { context: this._handle } - ); - return new DistributedApplicationExecutionContext(handle, this._client); - }, - }; + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogInternal(resource)); + } - /** Builds the distributed application */ + /** Completes the log stream by resource name */ /** @internal */ - async _buildInternal(): Promise { - const rpcArgs: Record = { context: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/build', + async _completeLogByNameInternal(resourceName: string): Promise { + const rpcArgs: Record = { loggerService: this._handle, resourceName }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLogByName', rpcArgs ); - return new DistributedApplication(result, this._client); + return this; } - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._buildInternal()); + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogByNameInternal(resourceName)); } - /** Adds a connection string with a builder callback */ - /** @internal */ - async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { - const connectionStringBuilderId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; - const obj = new ReferenceExpressionBuilder(objHandle, this._client); - await connectionStringBuilder(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionStringBuilder', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } +} - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); - } +/** + * Thenable wrapper for ResourceLoggerService that enables fluent chaining. + */ +export class ResourceLoggerServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** Adds a container registry resource */ - /** @internal */ - async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpoint }; - if (repository !== undefined) rpcArgs.repository = repository; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainerRegistry', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + then( + onfulfilled?: ((value: ResourceLoggerService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - const repository = options?.repository; - return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + /** Completes the log stream for a resource */ + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLog(resource))); } - /** Adds a container resource */ - /** @internal */ - async _addContainerInternal(name: string, image: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, image }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainer', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Completes the log stream by resource name */ + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLogByName(resourceName))); } - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._addContainerInternal(name, image)); - } +} - /** Adds a container resource built from a Dockerfile */ - /** @internal */ - async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDockerfile', - rpcArgs - ); - return new ContainerResource(result, this._client); - } +// ============================================================================ +// ResourceNotificationService +// ============================================================================ - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); - } +/** + * Type class for ResourceNotificationService. + */ +export class ResourceNotificationService { + constructor(private _handle: ResourceNotificationServiceHandle, private _client: AspireClientRpc) {} - /** Adds a .NET tool resource */ + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Waits for a resource to reach a specified state */ /** @internal */ - async _addDotnetToolInternal(name: string, packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDotnetTool', + async _waitForResourceStateInternal(resourceName: string, targetState?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + if (targetState !== undefined) rpcArgs.targetState = targetState; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceState', rpcArgs ); - return new DotnetToolResource(result, this._client); + return this; } - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + const targetState = options?.targetState; + return new ResourceNotificationServicePromise(this._waitForResourceStateInternal(resourceName, targetState)); } - /** Adds an executable resource */ - /** @internal */ - async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExecutable', + /** Waits for a resource to reach one of the specified states */ + async waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName, targetStates }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStates', rpcArgs ); - return new ExecutableResource(result, this._client); - } - - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); } - /** Adds an external service resource */ - /** @internal */ - async _addExternalServiceInternal(name: string, url: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, url }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExternalService', + /** Waits for a resource to become healthy */ + async waitForResourceHealthy(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceHealthy', rpcArgs ); - return new ExternalServiceResource(result, this._client); - } - - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); } - /** Adds a parameter resource */ + /** Waits for all dependencies of a resource to be ready */ /** @internal */ - async _addParameterInternal(name: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameter', + async _waitForDependenciesInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForDependencies', rpcArgs ); - return new ParameterResource(result, this._client); + return this; } - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterInternal(name, secret)); + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._waitForDependenciesInternal(resource)); } - /** Adds a parameter sourced from configuration */ - /** @internal */ - async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name, configurationKey }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameterFromConfiguration', + /** Tries to get the current state of a resource */ + async tryGetResourceState(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/tryGetResourceState', rpcArgs ); - return new ParameterResource(result, this._client); - } - - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); } - /** Adds a connection string resource */ + /** Publishes an update for a resource's state */ /** @internal */ - async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionString', + async _publishResourceUpdateInternal(resource: ResourceBuilderBase, state?: string, stateStyle?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + if (state !== undefined) rpcArgs.state = state; + if (stateStyle !== undefined) rpcArgs.stateStyle = stateStyle; + await this._client.invokeCapability( + 'Aspire.Hosting/publishResourceUpdate', rpcArgs ); - return new ResourceWithConnectionString(result, this._client); + return this; } - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - const environmentVariableName = options?.environmentVariableName; - return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + const state = options?.state; + const stateStyle = options?.stateStyle; + return new ResourceNotificationServicePromise(this._publishResourceUpdateInternal(resource, state, stateStyle)); } - /** Adds a .NET project resource */ - /** @internal */ - async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProject', - rpcArgs - ); - return new ProjectResource(result, this._client); - } +} - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); - } +/** + * Thenable wrapper for ResourceNotificationService that enables fluent chaining. + */ +export class ResourceNotificationServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** Adds a project resource with configuration options */ - /** @internal */ - async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProjectWithOptions', - rpcArgs - ); - return new ProjectResource(result, this._client); + then( + onfulfilled?: ((value: ResourceNotificationService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + /** Waits for a resource to reach a specified state */ + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForResourceState(resourceName, options))); } - /** Adds a C# application resource */ - /** @internal */ - async _addCSharpAppInternal(name: string, path: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, path }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpApp', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Waits for a resource to reach one of the specified states */ + waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + return this._promise.then(obj => obj.waitForResourceStates(resourceName, targetStates)); } - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + /** Waits for a resource to become healthy */ + waitForResourceHealthy(resourceName: string): Promise { + return this._promise.then(obj => obj.waitForResourceHealthy(resourceName)); } - /** Adds a C# application resource with configuration options */ - /** @internal */ - async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpAppWithOptions', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Waits for all dependencies of a resource to be ready */ + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForDependencies(resource))); } - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + /** Tries to get the current state of a resource */ + tryGetResourceState(resourceName: string): Promise { + return this._promise.then(obj => obj.tryGetResourceState(resourceName)); } - /** Adds a Redis container resource with specific port */ - /** @internal */ - async _addRedisWithPortInternal(name: string, port?: number): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/addRedisWithPort', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Publishes an update for a resource's state */ + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.publishResourceUpdate(resource, options))); } - addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { - const port = options?.port; - return new RedisResourcePromise(this._addRedisWithPortInternal(name, port)); - } +} - /** Adds a Redis container resource */ - /** @internal */ - async _addRedisInternal(name: string, port?: number, password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (port !== undefined) rpcArgs.port = port; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/addRedis', - rpcArgs - ); - return new RedisResource(result, this._client); - } +// ============================================================================ +// ResourceReadyEvent +// ============================================================================ - addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { - const port = options?.port; - const password = options?.password; - return new RedisResourcePromise(this._addRedisInternal(name, port, password)); - } +/** + * Type class for ResourceReadyEvent. + */ +export class ResourceReadyEvent { + constructor(private _handle: ResourceReadyEventHandle, private _client: AspireClientRpc) {} - /** Adds a PostgreSQL server resource */ - /** @internal */ - async _addPostgresInternal(name: string, userName?: ParameterResource, password?: ParameterResource, port?: number): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (userName !== undefined) rpcArgs.userName = userName; - if (password !== undefined) rpcArgs.password = password; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/addPostgres', - rpcArgs - ); - return new PostgresServerResource(result, this._client); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - addPostgres(name: string, options?: AddPostgresOptions): PostgresServerResourcePromise { - const userName = options?.userName; - const password = options?.password; - const port = options?.port; - return new PostgresServerResourcePromise(this._addPostgresInternal(name, userName, password, port)); - } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; } +// ============================================================================ +// ResourceStoppedEvent +// ============================================================================ + /** - * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + * Type class for ResourceStoppedEvent. */ -export class DistributedApplicationBuilderPromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - - /** Builds the distributed application */ - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); - } +export class ResourceStoppedEvent { + constructor(private _handle: ResourceStoppedEventHandle, private _client: AspireClientRpc) {} - /** Adds a connection string with a builder callback */ - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Adds a container registry resource */ - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); - } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; - /** Adds a container resource */ - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); - } + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; - /** Adds a container resource built from a Dockerfile */ - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); - } +} - /** Adds a .NET tool resource */ - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); - } +// ============================================================================ +// ResourceUrlsCallbackContext +// ============================================================================ - /** Adds an executable resource */ - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); - } +/** + * Type class for ResourceUrlsCallbackContext. + */ +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} - /** Adds an external service resource */ - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Adds a parameter resource */ - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); - } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; - /** Adds a parameter sourced from configuration */ - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; } - /** Adds a connection string resource */ - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); - } + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + }; - /** Adds a .NET project resource */ - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); - } + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; - /** Adds a project resource with configuration options */ - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); - } + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; - /** Adds a C# application resource */ - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); - } +} - /** Adds a C# application resource with configuration options */ - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); - } +// ============================================================================ +// UpdateCommandStateContext +// ============================================================================ - /** Adds a Redis container resource with specific port */ - addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.addRedisWithPort(name, options))); - } +/** + * Type class for UpdateCommandStateContext. + */ +export class UpdateCommandStateContext { + constructor(private _handle: UpdateCommandStateContextHandle, private _client: AspireClientRpc) {} - /** Adds a Redis container resource */ - addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.addRedis(name, options))); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Adds a PostgreSQL server resource */ - addPostgres(name: string, options?: AddPostgresOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.addPostgres(name, options))); - } + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/UpdateCommandStateContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; } // ============================================================================ -// DistributedApplicationEventing +// Configuration // ============================================================================ /** - * Type class for DistributedApplicationEventing. + * Type class for Configuration. */ -export class DistributedApplicationEventing { - constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} +export class Configuration { + constructor(private _handle: IConfigurationHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Invokes the Unsubscribe method */ - /** @internal */ - async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { - const rpcArgs: Record = { context: this._handle, subscription }; - await this._client.invokeCapability( - 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + /** Gets a configuration value by key */ + async getConfigValue(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConfigValue', rpcArgs ); - return this; } - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + /** Gets a connection string by name */ + async getConnectionString(name: string): Promise { + const rpcArgs: Record = { configuration: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionString', + rpcArgs + ); + } + + /** Gets a configuration section by key */ + async getSection(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getSection', + rpcArgs + ); + } + + /** Gets child configuration sections */ + async getChildren(): Promise { + const rpcArgs: Record = { configuration: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getChildren', + rpcArgs + ); + } + + /** Checks whether a configuration section exists */ + async exists(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/exists', + rpcArgs + ); } } /** - * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + * Thenable wrapper for Configuration that enables fluent chaining. */ -export class DistributedApplicationEventingPromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ConfigurationPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: Configuration) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Invokes the Unsubscribe method */ - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + /** Gets a configuration value by key */ + getConfigValue(key: string): Promise { + return this._promise.then(obj => obj.getConfigValue(key)); } -} + /** Gets a connection string by name */ + getConnectionString(name: string): Promise { + return this._promise.then(obj => obj.getConnectionString(name)); + } -// ============================================================================ -// ConnectionStringResource -// ============================================================================ + /** Gets a configuration section by key */ + getSection(key: string): Promise { + return this._promise.then(obj => obj.getSection(key)); + } -export class ConnectionStringResource extends ResourceBuilderBase { - constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Gets child configuration sections */ + getChildren(): Promise { + return this._promise.then(obj => obj.getChildren()); } - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); + /** Checks whether a configuration section exists */ + exists(key: string): Promise { + return this._promise.then(obj => obj.exists(key)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); - } +} + +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Environment property */ + environment = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.environment', + { context: this._handle } + ); + return new HostEnvironment(handle, this._client); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the UserSecretsManager property */ + userSecretsManager = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.userSecretsManager', + { context: this._handle } + ); + return new UserSecretsManager(handle, this._client); + }, + }; + /** Builds the distributed application */ /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DistributedApplication(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); } + /** Adds a connection string with a reference expression */ /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + async _addConnectionStringExpressionInternal(name: string, connectionStringExpression: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, connectionStringExpression }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + 'Aspire.Hosting/addConnectionStringExpression', rpcArgs ); return new ConnectionStringResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { - const helpLink = options?.helpLink; - return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringExpressionInternal(name, connectionStringExpression)); } + /** Adds a connection string with a builder callback */ /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', + 'Aspire.Hosting/addConnectionStringBuilder', rpcArgs ); return new ConnectionStringResource(result, this._client); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); } + /** Adds a container registry resource */ /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); } + /** Adds a container registry with string endpoint */ /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + async _addContainerRegistryFromStringInternal(name: string, endpoint: string, repository?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistryFromString', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryFromStringInternal(name, endpoint, repository)); } + /** Adds a container resource */ /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); } + /** Adds a container resource built from a Dockerfile */ /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { - const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); } + /** Adds a .NET tool resource */ /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { - const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); } + /** Adds an executable resource */ /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); } + /** Adds an external service resource */ /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); } + /** Adds an external service with a URI */ /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + async _addExternalServiceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceUri', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceUriInternal(name, uri)); } + /** Adds an external service with a parameter URL */ /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + async _addExternalServiceParameterInternal(name: string, urlParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, urlParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceParameter', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceParameterInternal(name, urlParameter)); } + /** Adds a parameter resource */ /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); } + /** Adds a parameter with a default value */ /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + async _addParameterWithValueInternal(name: string, value: string, publishValueAsDefault?: boolean, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + if (publishValueAsDefault !== undefined) rpcArgs.publishValueAsDefault = publishValueAsDefault; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterWithValue', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + const publishValueAsDefault = options?.publishValueAsDefault; + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterWithValueInternal(name, value, publishValueAsDefault, secret)); } + /** Adds a parameter sourced from configuration */ /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); } + /** Adds a connection string resource */ /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ResourceWithConnectionString(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - const exitCode = options?.exitCode; - return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); } + /** Adds a .NET project resource */ /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); } + /** Adds a project resource with configuration options */ /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { - const commandOptions = options?.commandOptions; - return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); } + /** Adds a C# application resource */ /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); } + /** Adds a C# application resource with configuration options */ /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); } + /** Gets the application configuration */ /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + async _getConfigurationInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getConfiguration', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new Configuration(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { - const iconVariant = options?.iconVariant; - return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._getConfigurationInternal()); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + /** Subscribes to the BeforeStart event */ + async subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeStartEventHandle; + const arg = new BeforeStartEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeBeforeStart', rpcArgs ); - return new ConnectionStringResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + /** Subscribes to the AfterResourcesCreated event */ + async subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as AfterResourcesCreatedEventHandle; + const arg = new AfterResourcesCreatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeAfterResourcesCreated', + rpcArgs + ); } + /** Adds a Node.js application resource */ /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + async _addNodeAppInternal(name: string, appDirectory: string, scriptPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory, scriptPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addNodeApp', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._addNodeAppInternal(name, appDirectory, scriptPath)); } + /** Adds a JavaScript application resource */ /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + async _addJavaScriptAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addJavaScriptApp', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + const runScriptName = options?.runScriptName; + return new JavaScriptAppResourcePromise(this._addJavaScriptAppInternal(name, appDirectory, runScriptName)); } + /** Adds a Vite application resource */ /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + async _addViteAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addViteApp', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + const runScriptName = options?.runScriptName; + return new ViteAppResourcePromise(this._addViteAppInternal(name, appDirectory, runScriptName)); } + /** Adds a Redis container resource with specific port */ /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + async _addRedisWithPortInternal(name: string, port?: number): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/addRedisWithPort', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new RedisResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { + const port = options?.port; + return new RedisResourcePromise(this._addRedisWithPortInternal(name, port)); } + /** Adds a Redis container resource */ /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + async _addRedisInternal(name: string, port?: number, password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (port !== undefined) rpcArgs.port = port; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/addRedis', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new RedisResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { + const port = options?.port; + const password = options?.password; + return new RedisResourcePromise(this._addRedisInternal(name, port, password)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** Adds a PostgreSQL server resource */ + /** @internal */ + async _addPostgresInternal(name: string, userName?: ParameterResource, password?: ParameterResource, port?: number): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (userName !== undefined) rpcArgs.userName = userName; + if (password !== undefined) rpcArgs.password = password; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/addPostgres', rpcArgs ); + return new PostgresServerResource(result, this._client); + } + + addPostgres(name: string, options?: AddPostgresOptions): PostgresServerResourcePromise { + const userName = options?.userName; + const password = options?.password; + const port = options?.port; + return new PostgresServerResourcePromise(this._addPostgresInternal(name, userName, password, port)); } } /** - * Thenable wrapper for ConnectionStringResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. */ -export class ConnectionStringResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds a connection string with a reference expression */ + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringExpression(name, connectionStringExpression))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + /** Adds a container registry with string endpoint */ + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistryFromString(name, endpoint, options))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Adds an external service with a URI */ + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceUri(name, uri))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Adds an external service with a parameter URL */ + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceParameter(name, urlParameter))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Adds a parameter with a default value */ + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterWithValue(name, value, options))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Gets the application configuration */ + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._promise.then(obj => obj.getConfiguration())); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Subscribes to the BeforeStart event */ + subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeBeforeStart(callback)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Subscribes to the AfterResourcesCreated event */ + subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeAfterResourcesCreated(callback)); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds a Node.js application resource */ + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.addNodeApp(name, appDirectory, scriptPath))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Adds a JavaScript application resource */ + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.addJavaScriptApp(name, appDirectory, options))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds a Vite application resource */ + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.addViteApp(name, appDirectory, options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Adds a Redis container resource with specific port */ + addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.addRedisWithPort(name, options))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Adds a Redis container resource */ + addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.addRedis(name, options))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Adds a PostgreSQL server resource */ + addPostgres(name: string, options?: AddPostgresOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.addPostgres(name, options))); } } // ============================================================================ -// ContainerRegistryResource +// DistributedApplicationEventing // ============================================================================ -export class ContainerRegistryResource extends ResourceBuilderBase { - constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { - super(handle, client); - } +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Invokes the Unsubscribe method */ /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', +} + +// ============================================================================ +// HostEnvironment +// ============================================================================ + +/** + * Type class for HostEnvironment. + */ +export class HostEnvironment { + constructor(private _handle: IHostEnvironmentHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Checks if running in Development environment */ + async isDevelopment(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isDevelopment', rpcArgs ); - return new ContainerRegistryResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { - const helpLink = options?.helpLink; - return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Checks if running in Production environment */ + async isProduction(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isProduction', + rpcArgs + ); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + /** Checks if running in Staging environment */ + async isStaging(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isStaging', rpcArgs ); - return new ContainerRegistryResource(result, this._client); - } - - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + /** Checks if the environment matches the specified name */ + async isEnvironment(environmentName: string): Promise { + const rpcArgs: Record = { environment: this._handle, environmentName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isEnvironment', rpcArgs ); - return new ContainerRegistryResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); +} + +/** + * Thenable wrapper for HostEnvironment that enables fluent chaining. + */ +export class HostEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: HostEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Checks if running in Development environment */ + isDevelopment(): Promise { + return this._promise.then(obj => obj.isDevelopment()); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { - const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + /** Checks if running in Production environment */ + isProduction(): Promise { + return this._promise.then(obj => obj.isProduction()); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Checks if running in Staging environment */ + isStaging(): Promise { + return this._promise.then(obj => obj.isStaging()); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { - const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Checks if the environment matches the specified name */ + isEnvironment(environmentName: string): Promise { + return this._promise.then(obj => obj.isEnvironment(environmentName)); } +} + +// ============================================================================ +// Logger +// ============================================================================ + +/** + * Type class for Logger. + */ +export class Logger { + constructor(private _handle: ILoggerHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Logs an information message */ /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + async _logInformationInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logInformation', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._logInformationInternal(message)); } + /** Logs a warning message */ /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + async _logWarningInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logWarning', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._logWarningInternal(message)); } + /** Logs an error message */ /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + async _logErrorInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logError', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + logError(message: string): LoggerPromise { + return new LoggerPromise(this._logErrorInternal(message)); } + /** Logs a debug message */ /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + async _logDebugInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logDebug', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._logDebugInternal(message)); } + /** Logs a message with specified level */ /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + async _logInternal(level: string, message: string): Promise { + const rpcArgs: Record = { logger: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/log', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._logInternal(level, message)); + } + +} + +/** + * Thenable wrapper for Logger that enables fluent chaining. + */ +export class LoggerPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Logger) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Logs an information message */ + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logInformation(message))); + } + + /** Logs a warning message */ + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logWarning(message))); + } + + /** Logs an error message */ + logError(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logError(message))); + } + + /** Logs a debug message */ + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logDebug(message))); + } + + /** Logs a message with specified level */ + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.log(level, message))); } +} + +// ============================================================================ +// LoggerFactory +// ============================================================================ + +/** + * Type class for LoggerFactory. + */ +export class LoggerFactory { + constructor(private _handle: ILoggerFactoryHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Creates a logger for a category */ /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + async _createLoggerInternal(categoryName: string): Promise { + const rpcArgs: Record = { loggerFactory: this._handle, categoryName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createLogger', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new Logger(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._createLoggerInternal(categoryName)); + } + +} + +/** + * Thenable wrapper for LoggerFactory that enables fluent chaining. + */ +export class LoggerFactoryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: LoggerFactory) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Creates a logger for a category */ + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.createLogger(categoryName))); } +} + +// ============================================================================ +// ReportingStep +// ============================================================================ + +/** + * Type class for ReportingStep. + */ +export class ReportingStep { + constructor(private _handle: IReportingStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Creates a reporting task with plain-text status text */ /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + async _createTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createTask', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ReportingTask(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createTaskInternal(statusText, cancellationToken)); } + /** Creates a reporting task with Markdown-formatted status text */ /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + async _createMarkdownTaskInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createMarkdownTask', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ReportingTask(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createMarkdownTaskInternal(markdownString, cancellationToken)); } + /** Logs a plain-text message for the reporting step */ /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + async _logStepInternal(level: string, message: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStep', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepInternal(level, message)); } + /** Logs a Markdown-formatted message for the reporting step */ /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + async _logStepMarkdownInternal(level: string, markdownString: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStepMarkdown', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepMarkdownInternal(level, markdownString)); } + /** Completes the reporting step with plain-text completion text */ /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + async _completeStepInternal(completionText: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, completionText }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStep', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepInternal(completionText, completionState, cancellationToken)); } + /** Completes the reporting step with Markdown-formatted completion text */ /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + async _completeStepMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStepMarkdown', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); - } - - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); - } - - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); - } - - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepMarkdownInternal(markdownString, completionState, cancellationToken)); } } /** - * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); + * Thenable wrapper for ReportingStep that enables fluent chaining. */ -export class ContainerRegistryResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ReportingStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ReportingStep) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Creates a reporting task with plain-text status text */ + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createTask(statusText, options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Creates a reporting task with Markdown-formatted status text */ + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createMarkdownTask(markdownString, options))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Logs a plain-text message for the reporting step */ + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStep(level, message))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Logs a Markdown-formatted message for the reporting step */ + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStepMarkdown(level, markdownString))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Completes the reporting step with plain-text completion text */ + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStep(completionText, options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Completes the reporting step with Markdown-formatted completion text */ + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStepMarkdown(markdownString, options))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } +} - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } +// ============================================================================ +// ReportingTask +// ============================================================================ - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } +/** + * Type class for ReportingTask. + */ +export class ReportingTask { + constructor(private _handle: IReportingTaskHandle, private _client: AspireClientRpc) {} - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Updates the reporting task with plain-text status text */ + /** @internal */ + async _updateTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTask', + rpcArgs + ); + return this; } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskInternal(statusText, cancellationToken)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Updates the reporting task with Markdown-formatted status text */ + /** @internal */ + async _updateTaskMarkdownInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTaskMarkdown', + rpcArgs + ); + return this; } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskMarkdownInternal(markdownString, cancellationToken)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Completes the reporting task with plain-text completion text */ + /** @internal */ + async _completeTaskInternal(completionMessage?: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle }; + if (completionMessage !== undefined) rpcArgs.completionMessage = completionMessage; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTask', + rpcArgs + ); + return this; } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + const completionMessage = options?.completionMessage; + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskInternal(completionMessage, completionState, cancellationToken)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Completes the reporting task with Markdown-formatted completion text */ + /** @internal */ + async _completeTaskMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTaskMarkdown', + rpcArgs + ); + return this; } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskMarkdownInternal(markdownString, completionState, cancellationToken)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); +} + +/** + * Thenable wrapper for ReportingTask that enables fluent chaining. + */ +export class ReportingTaskPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReportingTask) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Updates the reporting task with plain-text status text */ + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTask(statusText, options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Updates the reporting task with Markdown-formatted status text */ + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTaskMarkdown(markdownString, options))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Completes the reporting task with plain-text completion text */ + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTask(options))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Completes the reporting task with Markdown-formatted completion text */ + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTaskMarkdown(markdownString, options))); } } // ============================================================================ -// ContainerResource +// ServiceProvider // ============================================================================ -export class ContainerResource extends ResourceBuilderBase { - constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { - super(handle, client); - } +/** + * Type class for ServiceProvider. + */ +export class ServiceProvider { + constructor(private _handle: IServiceProviderHandle, private _client: AspireClientRpc) {} + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the distributed application eventing service from the service provider */ /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + async _getEventingInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getEventing', rpcArgs ); - return new ContainerResource(result, this._client); + return new DistributedApplicationEventing(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._getEventingInternal()); } + /** Gets the logger factory from the service provider */ /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + async _getLoggerFactoryInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getLoggerFactory', rpcArgs ); - return new ContainerResource(result, this._client); + return new LoggerFactory(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._getLoggerFactoryInternal()); } + /** Gets the resource logger service from the service provider */ /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + async _getResourceLoggerServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceLoggerService', rpcArgs ); - return new ContainerResource(result, this._client); + return new ResourceLoggerService(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._getResourceLoggerServiceInternal()); } + /** Gets the distributed application model from the service provider */ /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + async _getDistributedApplicationModelInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getDistributedApplicationModel', rpcArgs ); - return new ContainerResource(result, this._client); + return new DistributedApplicationModel(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterInternal()); + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._getDistributedApplicationModelInternal()); } + /** Gets the resource notification service from the service provider */ /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + async _getResourceNotificationServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceNotificationService', rpcArgs ); - return new ContainerResource(result, this._client); + return new ResourceNotificationService(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._getResourceNotificationServiceInternal()); } + /** Gets the user secrets manager from the service provider */ /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + async _getUserSecretsManagerInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getUserSecretsManager', rpcArgs ); - return new ContainerResource(result, this._client); + return new UserSecretsManager(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - const helpLink = options?.helpLink; - return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getUserSecretsManagerInternal()); } - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ContainerResource(result, this._client); +} + +/** + * Thenable wrapper for ServiceProvider that enables fluent chaining. + */ +export class ServiceProviderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ServiceProvider) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + /** Gets the distributed application eventing service from the service provider */ + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.getEventing())); } - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + /** Gets the logger factory from the service provider */ + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._promise.then(obj => obj.getLoggerFactory())); + } + + /** Gets the resource logger service from the service provider */ + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.getResourceLoggerService())); + } + + /** Gets the distributed application model from the service provider */ + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._promise.then(obj => obj.getDistributedApplicationModel())); + } + + /** Gets the resource notification service from the service provider */ + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.getResourceNotificationService())); + } + + /** Gets the user secrets manager from the service provider */ + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getUserSecretsManager())); + } + +} + +// ============================================================================ +// UserSecretsManager +// ============================================================================ + +/** + * Type class for UserSecretsManager. + */ +export class UserSecretsManager { + constructor(private _handle: IUserSecretsManagerHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the IsAvailable property */ + isAvailable = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.isAvailable', + { context: this._handle } + ); + }, + }; + + /** Gets the FilePath property */ + filePath = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.filePath', + { context: this._handle } + ); + }, + }; + + /** Attempts to set a user secret value */ + async trySetSecret(name: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, name, value }; + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.trySetSecret', rpcArgs ); - return new ContainerResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Saves state to user secrets from a JSON string */ + /** @internal */ + async _saveStateJsonInternal(json: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, json }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/saveStateJson', + rpcArgs + ); + return this; + } + + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + const cancellationToken = options?.cancellationToken; + return new UserSecretsManagerPromise(this._saveStateJsonInternal(json, cancellationToken)); } + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + async _getOrSetSecretInternal(resourceBuilder: ResourceBuilderBase, name: string, value: string): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, resourceBuilder, name, value }; + await this._client.invokeCapability( + 'Aspire.Hosting/getOrSetSecret', rpcArgs ); - return new ContainerResource(result, this._client); + return this; } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getOrSetSecretInternal(resourceBuilder, name, value)); + } + +} + +/** + * Thenable wrapper for UserSecretsManager that enables fluent chaining. + */ +export class UserSecretsManagerPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: UserSecretsManager) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Attempts to set a user secret value */ + trySetSecret(name: string, value: string): Promise { + return this._promise.then(obj => obj.trySetSecret(name, value)); + } + + /** Saves state to user secrets from a JSON string */ + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.saveStateJson(json, options))); + } + + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getOrSetSecret(resourceBuilder, name, value))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsInternal(args)); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + return new ConnectionStringResource(result, this._client); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromManifestInternal()); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForInternal(dependency)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExplicitStartInternal()); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onConnectionStringAvailableInternal(callback)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - const exitCode = options?.exitCode; - return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceReadyInternal(callback)); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new ContainerResource(result, this._client); - } +} - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); - } +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ContainerResource(result, this._client); + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - const password = options?.password; - return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromMcpInternal()); + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } -} + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } -/** - * Thenable wrapper for ContainerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ContainerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } - then( - onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } +} - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ + +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceReadyInternal(callback)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); - } +} - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); - } +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -4532,952 +5703,1127 @@ export class ContainerResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ -// CSharpAppResource +// ContainerResource // ============================================================================ -export class CSharpAppResource extends ResourceBuilderBase { - constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withReplicasInternal(replicas: number): Promise { - const rpcArgs: Record = { builder: this._handle, replicas }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReplicas', + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _disableForwardedHeadersInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/disableForwardedHeaders', + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - const helpLink = options?.helpLink; - return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsInternal(args)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new CSharpAppResource(result, this._client); - } - - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + return new ContainerResource(result, this._client); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); - } - - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - const exitCode = options?.exitCode; - return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - const commandOptions = options?.commandOptions; - return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - const password = options?.password; - return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - const iconVariant = options?.iconVariant; - return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + const exitCode = options?.exitCode; + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + const password = options?.password; + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -5485,56 +6831,56 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -5545,226 +6891,400 @@ export class CSharpAppResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceReadyInternal(callback)); } } /** - * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * Thenable wrapper for ContainerResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class CSharpAppResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -5773,163 +7293,163 @@ export class CSharpAppResourcePromise implements PromiseLike } /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); - } + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } /** Gets the resource name */ @@ -5937,538 +7457,397 @@ export class CSharpAppResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ -// DotnetToolResource +// CSharpAppResource // ============================================================================ -export class DotnetToolResource extends ResourceBuilderBase { - constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withToolPackageInternal(packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPackage', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withToolVersionInternal(version: string): Promise { - const rpcArgs: Record = { builder: this._handle, version }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolVersion', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withToolPrereleaseInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPrerelease', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withToolSourceInternal(source: string): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolSource', + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); } /** @internal */ - private async _withToolIgnoreExistingFeedsInternal(): Promise { + private async _disableForwardedHeadersInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreExistingFeeds', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); } /** @internal */ - private async _withToolIgnoreFailedSourcesInternal(): Promise { + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreFailedSources', + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + const configure = options?.configure; + return new CSharpAppResourcePromise(this._publishAsDockerFileInternal(configure)); } /** @internal */ - private async _publishAsDockerFileInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFile', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); - } - - /** @internal */ - private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; - const obj = new ContainerResource(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFileWithConfigure', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); - } - - /** @internal */ - private async _withExecutableCommandInternal(command: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExecutableCommand', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); - } - - /** @internal */ - private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { - const rpcArgs: Record = { builder: this._handle, workingDirectory }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withWorkingDirectory', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); - } - - /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); - } - - /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); - } - - /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); - } - - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { const helpLink = options?.helpLink; - return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } - - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + const name = options?.name; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); - } - - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); - } - - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -6478,15 +7857,15 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -6495,72 +7874,72 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -6573,278 +7952,293 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { const exitCode = options?.exitCode; - return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -6852,130 +8246,130 @@ export class DotnetToolResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { const commandOptions = options?.commandOptions; - return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { const password = options?.password; - return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { const iconVariant = options?.iconVariant; - return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -6984,15 +8378,15 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -7000,56 +8394,56 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -7060,60 +8454,60 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -7125,201 +8519,246 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** - * Thenable wrapper for DotnetToolResource that enables fluent chaining. + * Thenable wrapper for CSharpAppResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class DotnetToolResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); - } - - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); - } - - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); - } - - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); - } - - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); - } - - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); - } - - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); - } - - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -7328,158 +8767,163 @@ export class DotnetToolResourcePromise implements PromiseLike obj.asHttp2Service())); + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -7487,383 +8931,500 @@ export class DotnetToolResourcePromise implements PromiseLike obj.getResourceName()); } -} + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } -// ============================================================================ -// ExecutableResource -// ============================================================================ + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } -export class ExecutableResource extends ResourceBuilderBase { - constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// DotnetToolResource +// ============================================================================ + +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - const helpLink = options?.helpLink; - return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsInternal(args)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -7873,15 +9434,15 @@ export class ExecutableResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -7890,72 +9451,72 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -7968,278 +9529,278 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); - } + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { const exitCode = options?.exitCode; - return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -8247,130 +9808,130 @@ export class ExecutableResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { const commandOptions = options?.commandOptions; - return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { const password = options?.password; - return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { const iconVariant = options?.iconVariant; - return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -8379,15 +9940,15 @@ export class ExecutableResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -8395,56 +9956,56 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -8455,60 +10016,60 @@ export class ExecutableResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -8520,151 +10081,281 @@ export class ExecutableResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** - * Thenable wrapper for ExecutableResource that enables fluent chaining. + * Thenable wrapper for DotnetToolResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ExecutableResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -8673,158 +10364,158 @@ export class ExecutableResourcePromise implements PromiseLike obj.asHttp2Service())); + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -8832,881 +10523,991 @@ export class ExecutableResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ -// ExternalServiceResource +// ExecutableResource // ============================================================================ -export class ExternalServiceResource extends ResourceBuilderBase { - constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + private async _publishAsDockerFileInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - const helpLink = options?.helpLink; - return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - const commandOptions = options?.commandOptions; - return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - const iconVariant = options?.iconVariant; - return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', rpcArgs ); + return new ExecutableResource(result, this._client); } -} - -/** - * Thenable wrapper for ExternalServiceResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ExternalServiceResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); - } - -} - -// ============================================================================ -// ParameterResource -// ============================================================================ - -export class ParameterResource extends ResourceBuilderBase { - constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, description }; - if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDescription', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - const enableMarkdown = options?.enableMarkdown; - return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - const helpLink = options?.helpLink; - return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromManifestInternal()); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._withExplicitStartInternal()); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ParameterResource(result, this._client); + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - const commandOptions = options?.commandOptions; - return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { const iconVariant = options?.iconVariant; - return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -9717,60 +11518,60 @@ export class ParameterResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -9782,4267 +11583,4410 @@ export class ParameterResource extends ResourceBuilderBase { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceReadyInternal(callback)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); +} + +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } -} + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } -// ============================================================================ -// PgAdminContainerResource -// ============================================================================ + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } -export class PgAdminContainerResource extends ResourceBuilderBase { - constructor(handle: PgAdminContainerResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withContainerRegistryInternal(registry)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): PgAdminContainerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new PgAdminContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** Sets the container image tag */ - withImageTag(tag: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withImageTagInternal(tag)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Sets the container image registry */ - withImageRegistry(registry: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withImageRegistryInternal(registry)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): PgAdminContainerResourcePromise { - const tag = options?.tag; - return new PgAdminContainerResourcePromise(this._withImageInternal(image, tag)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withImageSHA256Internal(sha256)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withLifetimeInternal(lifetime)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Configures the resource to be published as a container */ - publishAsContainer(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._publishAsContainerInternal()); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): PgAdminContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new PgAdminContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** Sets the container name */ - withContainerName(name: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withContainerNameInternal(name)); + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withBuildArgInternal(name, value)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withBuildSecretInternal(name, value)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PgAdminContainerResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new PgAdminContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): PgAdminContainerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new PgAdminContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withOtlpExporterInternal()); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._publishAsConnectionStringInternal()); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PgAdminContainerResourcePromise { - const helpLink = options?.helpLink; - return new PgAdminContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); - } - - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); - } +} - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); - } +// ============================================================================ +// ExternalServiceResource +// ============================================================================ - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withArgsInternal(args)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PgAdminContainerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new PgAdminContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): PgAdminContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new PgAdminContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): PgAdminContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new PgAdminContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): PgAdminContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new PgAdminContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new PgAdminContainerResource(result, this._client); - } - - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + return new ExternalServiceResource(result, this._client); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._asHttp2ServiceInternal()); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): PgAdminContainerResourcePromise { - const displayText = options?.displayText; - return new PgAdminContainerResourcePromise(this._withUrlInternal(url, displayText)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new PgAdminContainerResource(result, this._client); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PgAdminContainerResourcePromise { - const displayText = options?.displayText; - return new PgAdminContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._excludeFromManifestInternal()); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._waitForInternal(dependency)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceReadyInternal(callback)); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); - } +} - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); - } +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._waitForStartInternal(dependency)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withExplicitStartInternal()); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PgAdminContainerResourcePromise { - const exitCode = options?.exitCode; - return new PgAdminContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Adds a health check by key */ - withHealthCheck(key: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withHealthCheckInternal(key)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PgAdminContainerResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new PgAdminContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PgAdminContainerResourcePromise { - const commandOptions = options?.commandOptions; - return new PgAdminContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PgAdminContainerResourcePromise { - const password = options?.password; - return new PgAdminContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withParentRelationshipInternal(parent)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// JavaScriptAppResource +// ============================================================================ + +export class JavaScriptAppResource extends ResourceBuilderBase { + constructor(handle: JavaScriptAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withChildRelationshipInternal(child)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): PgAdminContainerResourcePromise { - const iconVariant = options?.iconVariant; - return new PgAdminContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new JavaScriptAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PgAdminContainerResourcePromise { + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new PgAdminContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new JavaScriptAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _withOtlpExporterInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._excludeFromMcpInternal()); + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + const helpLink = options?.helpLink; + return new JavaScriptAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PgAdminContainerResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new PgAdminContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): PgAdminContainerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new PgAdminContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withHostPortInternal(port?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/withPgAdminHostPort', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the host port for pgAdmin */ - withHostPort(options?: WithHostPortOptions): PgAdminContainerResourcePromise { - const port = options?.port; - return new PgAdminContainerResourcePromise(this._withHostPortInternal(port)); + /** Adds arguments */ + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsInternal(args)); } -} - -/** - * Thenable wrapper for PgAdminContainerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class PgAdminContainerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } - then( - onfulfilled?: ((value: PgAdminContainerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackInternal(callback)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new JavaScriptAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } - /** Sets the container image registry */ - withImageRegistry(registry: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceUriInternal(name, uri)); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } - /** Configures the resource to be published as a container */ - publishAsContainer(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new JavaScriptAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } - /** Sets the container name */ - withContainerName(name: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new JavaScriptAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new JavaScriptAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._asHttp2ServiceInternal()); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + const displayText = options?.displayText; + return new JavaScriptAppResourcePromise(this._withUrlInternal(url, displayText)); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + const displayText = options?.displayText; + return new JavaScriptAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._clearContainerFilesSourcesInternal()); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromManifestInternal()); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForInternal(dependency)); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartInternal(dependency)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Prevents resource from starting automatically */ + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExplicitStartInternal()); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + const exitCode = options?.exitCode; + return new JavaScriptAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Adds a health check by key */ + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withHealthCheckInternal(key)); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + const commandOptions = options?.commandOptions; + return new JavaScriptAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + const password = options?.password; + return new JavaScriptAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withChildRelationshipInternal(child)); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + const iconVariant = options?.iconVariant; + return new JavaScriptAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromMcpInternal()); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets the host port for pgAdmin */ - withHostPort(options?: WithHostPortOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } -} - -// ============================================================================ -// PgWebContainerResource -// ============================================================================ + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } -export class PgWebContainerResource extends ResourceBuilderBase { - constructor(handle: PgWebContainerResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new JavaScriptAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withContainerRegistryInternal(registry)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): PgWebContainerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new PgWebContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withImageTagInternal(tag)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withImageRegistryInternal(registry)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): PgWebContainerResourcePromise { - const tag = options?.tag; - return new PgWebContainerResourcePromise(this._withImageInternal(image, tag)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withImageSHA256Internal(sha256)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); } /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withLifetimeInternal(lifetime)); + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withBunInternal(install, installArgs)); } /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withYarnInternal(install, installArgs)); } /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._publishAsContainerInternal()); + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withPnpmInternal(install, installArgs)); } /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): PgWebContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new PgWebContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); } /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withContainerNameInternal(name)); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withBuildArgInternal(name, value)); + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + const browser = options?.browser; + return new JavaScriptAppResourcePromise(this._withBrowserDebuggerInternal(browser)); } - /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); - } +} - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withBuildSecretInternal(name, value)); - } +/** + * Thenable wrapper for JavaScriptAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class JavaScriptAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + then( + onfulfilled?: ((value: JavaScriptAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PgWebContainerResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new PgWebContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): PgWebContainerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new PgWebContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withOtlpExporterInternal()); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._publishAsConnectionStringInternal()); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PgWebContainerResourcePromise { - const helpLink = options?.helpLink; - return new PgWebContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Adds arguments */ + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withEnvironmentInternal(name, value)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Configures resource for HTTP/2 */ + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Adds arguments */ - withArgs(args: string[]): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withArgsInternal(args)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PgWebContainerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new PgWebContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withServiceReferenceInternal(source)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): PgWebContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new PgWebContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): PgWebContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new PgWebContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): PgWebContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new PgWebContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._asHttp2ServiceInternal()); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): PgWebContainerResourcePromise { - const displayText = options?.displayText; - return new PgWebContainerResourcePromise(this._withUrlInternal(url, displayText)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PgWebContainerResourcePromise { - const displayText = options?.displayText; - return new PgWebContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBun(options))); } - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._excludeFromManifestInternal()); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); } - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._waitForInternal(dependency)); +} + +// ============================================================================ +// NodeAppResource +// ============================================================================ + +export class NodeAppResource extends ResourceBuilderBase { + constructor(handle: NodeAppResourceHandle, client: AspireClientRpc) { + super(handle, client); } + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._waitForStartInternal(dependency)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new NodeAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withExplicitStartInternal()); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PgWebContainerResourcePromise { - const exitCode = options?.exitCode; - return new PgWebContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withHealthCheckInternal(key)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PgWebContainerResourcePromise { + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { const path = options?.path; - const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new PgWebContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new NodeAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PgWebContainerResourcePromise { - const commandOptions = options?.commandOptions; - return new PgWebContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + const helpLink = options?.helpLink; + return new NodeAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PgWebContainerResourcePromise { - const password = options?.password; - return new PgWebContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withParentRelationshipInternal(parent)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): PgWebContainerResourcePromise { - const iconVariant = options?.iconVariant; - return new PgWebContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PgWebContainerResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new PgWebContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Adds arguments */ + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._excludeFromMcpInternal()); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new NodeAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PgWebContainerResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new PgWebContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): PgWebContainerResourcePromise { + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new PgWebContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new NodeAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHostPortInternal(port?: number): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/withPgWebHostPort', + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the host port for pgweb */ - withHostPort(options?: WithHostPortOptions): PgWebContainerResourcePromise { + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { const port = options?.port; - return new PgWebContainerResourcePromise(this._withHostPortInternal(port)); + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } -} - -/** - * Thenable wrapper for PgWebContainerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class PgWebContainerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: PgWebContainerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._asHttp2ServiceInternal()); } - /** Sets the container image registry */ - withImageRegistry(registry: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlInternal(url, displayText)); } - /** Configures the resource to be published as a container */ - publishAsContainer(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Sets the container name */ - withContainerName(name: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._clearContainerFilesSourcesInternal()); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromManifestInternal()); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForInternal(dependency)); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartInternal(dependency)); } - /** Adds arguments */ - withArgs(args: string[]): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Prevents resource from starting automatically */ + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExplicitStartInternal()); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + const exitCode = options?.exitCode; + return new NodeAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** Adds a health check by key */ + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withHealthCheckInternal(key)); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + const commandOptions = options?.commandOptions; + return new NodeAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + const password = options?.password; + return new NodeAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withChildRelationshipInternal(child)); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + const iconVariant = options?.iconVariant; + return new NodeAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Prevents resource from starting automatically */ - withExplicitStart(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } - /** Adds a health check by key */ - withHealthCheck(key: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromMcpInternal()); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new NodeAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Sets the host port for pgweb */ - withHostPort(options?: WithHostPortOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new NodeAppResource(result, this._client); } -} - -// ============================================================================ -// PostgresDatabaseResource -// ============================================================================ - -export class PostgresDatabaseResource extends ResourceBuilderBase { - constructor(handle: PostgresDatabaseResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } - /** Gets the Parent property */ - parent = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.parent', - { context: this._handle } - ); - return new PostgresServerResource(handle, this._client); - }, - }; - - /** Gets the ConnectionStringExpression property */ - connectionStringExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.connectionStringExpression', - { context: this._handle } - ); - }, - }; - - /** Gets the DatabaseName property */ - databaseName = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.databaseName', - { context: this._handle } - ); - }, - }; - - /** Gets the UriExpression property */ - uriExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.uriExpression', - { context: this._handle } - ); - }, - }; - - /** Gets the JdbcConnectionString property */ - jdbcConnectionString = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.jdbcConnectionString', - { context: this._handle } - ); - }, - }; - - /** Gets the Name property */ - name = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.name', - { context: this._handle } - ); - }, - }; - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withContainerRegistryInternal(registry)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresDatabaseResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new PostgresDatabaseResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresDatabaseResourcePromise { - const helpLink = options?.helpLink; - return new PostgresDatabaseResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withBunInternal(install, installArgs)); } /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withYarnInternal(install, installArgs)); } /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withPnpmInternal(install, installArgs)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): PostgresDatabaseResourcePromise { - const displayText = options?.displayText; - return new PostgresDatabaseResourcePromise(this._withUrlInternal(url, displayText)); + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + const browser = options?.browser; + return new NodeAppResourcePromise(this._withBrowserDebuggerInternal(browser)); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new PostgresDatabaseResource(result, this._client); +} + +/** + * Thenable wrapper for NodeAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class NodeAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: NodeAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresDatabaseResourcePromise { - const displayText = options?.displayText; - return new PostgresDatabaseResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new PostgresDatabaseResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new PostgresDatabaseResource(result, this._client); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._excludeFromManifestInternal()); + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new PostgresDatabaseResource(result, this._client); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withExplicitStartInternal()); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new PostgresDatabaseResource(result, this._client); + /** Configures OTLP telemetry export */ + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Adds a health check by key */ - withHealthCheck(key: string): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withHealthCheckInternal(key)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new PostgresDatabaseResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresDatabaseResourcePromise { - const commandOptions = options?.commandOptions; - return new PostgresDatabaseResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new PostgresDatabaseResource(result, this._client); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withParentRelationshipInternal(parent)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new PostgresDatabaseResource(result, this._client); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new PostgresDatabaseResource(result, this._client); + /** Adds arguments */ + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): PostgresDatabaseResourcePromise { - const iconVariant = options?.iconVariant; - return new PostgresDatabaseResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new PostgresDatabaseResource(result, this._client); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._excludeFromMcpInternal()); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new PostgresDatabaseResource(result, this._client); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new PostgresDatabaseResource(result, this._client); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new PostgresDatabaseResource(result, this._client); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresDatabaseResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new PostgresDatabaseResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new PostgresDatabaseResource(result, this._client); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new PostgresDatabaseResource(result, this._client); + /** Configures resource for HTTP/2 */ + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** @internal */ - private async _withPostgresMcpInternal(configureContainer?: (obj: PostgresMcpContainerResource) => Promise, containerName?: string): Promise { - const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PostgresMcpContainerResourceHandle; - const obj = new PostgresMcpContainerResource(objHandle, this._client); - await configureContainer(obj); - }) : undefined; - const rpcArgs: Record = { builder: this._handle }; - if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; - if (containerName !== undefined) rpcArgs.containerName = containerName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/withPostgresMcp', - rpcArgs - ); - return new PostgresDatabaseResource(result, this._client); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Adds Postgres MCP server */ - withPostgresMcp(options?: WithPostgresMcpOptions): PostgresDatabaseResourcePromise { - const configureContainer = options?.configureContainer; - const containerName = options?.containerName; - return new PostgresDatabaseResourcePromise(this._withPostgresMcpInternal(configureContainer, containerName)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _withCreationScriptInternal(script: string): Promise { - const rpcArgs: Record = { builder: this._handle, script }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/withCreationScript', - rpcArgs - ); - return new PostgresDatabaseResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Defines the SQL script for database creation */ - withCreationScript(script: string): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withCreationScriptInternal(script)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } -} - -/** - * Thenable wrapper for PostgresDatabaseResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class PostgresDatabaseResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } - then( - onfulfilled?: ((value: PostgresDatabaseResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Prevents resource from starting automatically */ + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds a health check by key */ + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** Adds a health check by key */ - withHealthCheck(key: string): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -14050,7571 +15994,14761 @@ export class PostgresDatabaseResourcePromise implements PromiseLike obj.getResourceName()); } - /** Adds Postgres MCP server */ - withPostgresMcp(options?: WithPostgresMcpOptions): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withPostgresMcp(options))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Defines the SQL script for database creation */ - withCreationScript(script: string): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withCreationScript(script))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); } } // ============================================================================ -// PostgresMcpContainerResource +// ParameterResource // ============================================================================ -export class PostgresMcpContainerResource extends ResourceBuilderBase { - constructor(handle: PostgresMcpContainerResourceHandle, client: AspireClientRpc) { +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new ParameterResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): PostgresMcpContainerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new PostgresMcpContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withImageTagInternal(tag)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withImageRegistryInternal(registry)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): PostgresMcpContainerResourcePromise { - const tag = options?.tag; - return new PostgresMcpContainerResourcePromise(this._withImageInternal(image, tag)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withImageSHA256Internal(sha256)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withLifetimeInternal(lifetime)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _publishAsContainerInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._publishAsContainerInternal()); + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): PostgresMcpContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new PostgresMcpContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withContainerNameInternal(name)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withBuildArgInternal(name, value)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withBuildSecretInternal(name, value)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresMcpContainerResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new PostgresMcpContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); - } - - /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): PostgresMcpContainerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new PostgresMcpContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withOtlpExporterInternal()); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); - } - - /** Publishes the resource as a connection string */ - publishAsConnectionString(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._publishAsConnectionStringInternal()); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresMcpContainerResourcePromise { - const helpLink = options?.helpLink; - return new PostgresMcpContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withEnvironmentInternal(name, value)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceReadyInternal(callback)); } - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); } - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Adds arguments */ - withArgs(args: string[]): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withArgsInternal(args)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PostgresMcpContainerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new PostgresMcpContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withServiceReferenceInternal(source)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// PgAdminContainerResource +// ============================================================================ + +export class PgAdminContainerResource extends ResourceBuilderBase { + constructor(handle: PgAdminContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PgAdminContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new PgAdminContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): PostgresMcpContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new PostgresMcpContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): PostgresMcpContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new PostgresMcpContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets the container image tag */ + withImageTag(tag: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): PostgresMcpContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new PostgresMcpContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets the container image registry */ + withImageRegistry(registry: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); - } - - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + return new PgAdminContainerResource(result, this._client); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PgAdminContainerResourcePromise { + const tag = options?.tag; + return new PgAdminContainerResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._asHttp2ServiceInternal()); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withLifetimeInternal(lifetime)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): PostgresMcpContainerResourcePromise { - const displayText = options?.displayText; - return new PostgresMcpContainerResourcePromise(this._withUrlInternal(url, displayText)); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresMcpContainerResourcePromise { - const displayText = options?.displayText; - return new PostgresMcpContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Configures the resource to be published as a container */ + publishAsContainer(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PgAdminContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new PgAdminContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Sets the container name */ + withContainerName(name: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withContainerNameInternal(name)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._excludeFromManifestInternal()); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withBuildArgInternal(name, value)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._waitForInternal(dependency)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._waitForStartInternal(dependency)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PgAdminContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new PgAdminContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withExplicitStartInternal()); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PgAdminContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new PgAdminContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PostgresMcpContainerResourcePromise { - const exitCode = options?.exitCode; - return new PostgresMcpContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withHealthCheckInternal(key)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _publishAsConnectionStringInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PostgresMcpContainerResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new PostgresMcpContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._publishAsConnectionStringInternal()); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresMcpContainerResourcePromise { - const commandOptions = options?.commandOptions; - return new PostgresMcpContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PgAdminContainerResourcePromise { + const helpLink = options?.helpLink; + return new PgAdminContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PostgresMcpContainerResourcePromise { - const password = options?.password; - return new PostgresMcpContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withParentRelationshipInternal(parent)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withChildRelationshipInternal(child)); + /** Adds arguments */ + withArgs(args: string[]): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): PostgresMcpContainerResourcePromise { - const iconVariant = options?.iconVariant; - return new PostgresMcpContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PostgresMcpContainerResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new PostgresMcpContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._excludeFromMcpInternal()); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PgAdminContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new PgAdminContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresMcpContainerResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new PostgresMcpContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PgAdminContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new PgAdminContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PgAdminContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PgAdminContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): PostgresMcpContainerResourcePromise { + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PgAdminContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new PostgresMcpContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + const env = options?.env; + const isProxied = options?.isProxied; + return new PgAdminContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); + return new PgAdminContainerResource(result, this._client); } -} + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } -/** - * Thenable wrapper for PostgresMcpContainerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class PostgresMcpContainerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: PostgresMcpContainerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._asHttp2ServiceInternal()); } - /** Sets the container image tag */ - withImageTag(tag: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PgAdminContainerResourcePromise { + const displayText = options?.displayText; + return new PgAdminContainerResourcePromise(this._withUrlInternal(url, displayText)); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PgAdminContainerResourcePromise { + const displayText = options?.displayText; + return new PgAdminContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._excludeFromManifestInternal()); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._waitForInternal(dependency)); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._waitForStartInternal(dependency)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Prevents resource from starting automatically */ + withExplicitStart(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withExplicitStartInternal()); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PgAdminContainerResourcePromise { + const exitCode = options?.exitCode; + return new PgAdminContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Adds a health check by key */ + withHealthCheck(key: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withHealthCheckInternal(key)); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PgAdminContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new PgAdminContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PgAdminContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new PgAdminContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PgAdminContainerResourcePromise { + const password = options?.password; + return new PgAdminContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withChildRelationshipInternal(child)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PgAdminContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new PgAdminContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PgAdminContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new PgAdminContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._excludeFromMcpInternal()); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PgAdminContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new PgAdminContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PgAdminContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new PgAdminContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._onResourceReadyInternal(callback)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPgAdminHostPort', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); + } + + /** Sets the host port for pgAdmin */ + withHostPort(options?: WithHostPortOptions): PgAdminContainerResourcePromise { + const port = options?.port; + return new PgAdminContainerResourcePromise(this._withHostPortInternal(port)); } } -// ============================================================================ -// PostgresServerResource -// ============================================================================ +/** + * Thenable wrapper for PgAdminContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class PgAdminContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} -export class PostgresServerResource extends ResourceBuilderBase { - constructor(handle: PostgresServerResourceHandle, client: AspireClientRpc) { - super(handle, client); + then( + onfulfilled?: ((value: PgAdminContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Gets the PrimaryEndpoint property */ - primaryEndpoint = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.primaryEndpoint', - { context: this._handle } - ); - return new EndpointReference(handle, this._client); - }, - }; + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } - /** Gets the UserNameReference property */ - userNameReference = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.userNameReference', - { context: this._handle } - ); - }, - }; - - /** Gets the ConnectionStringExpression property */ - connectionStringExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.connectionStringExpression', - { context: this._handle } - ); - }, - }; - - /** Gets the Databases property */ - private _databases?: AspireDict; - get databases(): AspireDict { - if (!this._databases) { - this._databases = new AspireDict( - this._handle, - this._client, - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.databases', - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.databases' - ); - } - return this._databases; + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** Gets the Host property */ - host = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.host', - { context: this._handle } - ); - return new EndpointReferenceExpression(handle, this._client); - }, - }; - - /** Gets the Port property */ - port = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.port', - { context: this._handle } - ); - return new EndpointReferenceExpression(handle, this._client); - }, - }; + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } - /** Gets the UriExpression property */ - uriExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.uriExpression', - { context: this._handle } - ); - }, - }; + /** Sets the container image tag */ + withImageTag(tag: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } - /** Gets the JdbcConnectionString property */ - jdbcConnectionString = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.jdbcConnectionString', - { context: this._handle } - ); - }, - }; + /** Sets the container image registry */ + withImageRegistry(registry: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } - /** Gets the Entrypoint property */ - entrypoint = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.entrypoint', - { context: this._handle } - ); - }, - set: async (value: string): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.setEntrypoint', - { context: this._handle, value } - ); - } - }; + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } - /** Gets the ShellExecution property */ - shellExecution = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.shellExecution', - { context: this._handle } - ); - }, - set: async (value: boolean): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.setShellExecution', - { context: this._handle, value } - ); - } - }; + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } - /** Gets the Name property */ - name = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.name', - { context: this._handle } - ); - }, - }; + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withContainerRegistryInternal(registry)); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } - /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Configures the resource to be published as a container */ + publishAsContainer(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): PostgresServerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new PostgresServerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); } - /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Sets the container name */ + withContainerName(name: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); } - /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); } - /** Sets the container image tag */ - withImageTag(tag: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withImageTagInternal(tag)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } - /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets the container image registry */ - withImageRegistry(registry: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withImageRegistryInternal(registry)); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } - /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): PostgresServerResourcePromise { - const tag = options?.tag; - return new PostgresServerResourcePromise(this._withImageInternal(image, tag)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withImageSHA256Internal(sha256)); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } - /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withLifetimeInternal(lifetime)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Adds arguments */ + withArgs(args: string[]): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** Configures the resource to be published as a container */ - publishAsContainer(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._publishAsContainerInternal()); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): PostgresServerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new PostgresServerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Sets the container name */ - withContainerName(name: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withContainerNameInternal(name)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withBuildArgInternal(name, value)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withBuildSecretInternal(name, value)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Configures resource for HTTP/2 */ + asHttp2Service(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresServerResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new PostgresServerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): PostgresServerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new PostgresServerResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withOtlpExporterInternal()); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._publishAsConnectionStringInternal()); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresServerResourcePromise { - const helpLink = options?.helpLink; - return new PostgresServerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Adds arguments */ - withArgs(args: string[]): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withArgsInternal(args)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Sets the host port for pgAdmin */ + withHostPort(options?: WithHostPortOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PostgresServerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new PostgresServerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); +} + +// ============================================================================ +// PgWebContainerResource +// ============================================================================ + +export class PgWebContainerResource extends ResourceBuilderBase { + constructor(handle: PgWebContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withServiceReferenceInternal(source)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PgWebContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new PgWebContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Sets the container image tag */ + withImageTag(tag: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Sets the container image registry */ + withImageRegistry(registry: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): PostgresServerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new PostgresServerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PgWebContainerResourcePromise { + const tag = options?.tag; + return new PgWebContainerResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): PostgresServerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new PostgresServerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): PostgresServerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new PostgresServerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withLifetimeInternal(lifetime)); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); + return new PgWebContainerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { + private async _publishAsContainerInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._asHttp2ServiceInternal()); + /** Configures the resource to be published as a container */ + publishAsContainer(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PgWebContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new PgWebContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets the container name */ + withContainerName(name: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withContainerNameInternal(name)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): PostgresServerResourcePromise { - const displayText = options?.displayText; - return new PostgresServerResourcePromise(this._withUrlInternal(url, displayText)); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withBuildArgInternal(name, value)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresServerResourcePromise { - const displayText = options?.displayText; - return new PostgresServerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PgWebContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new PgWebContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._excludeFromManifestInternal()); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._waitForInternal(dependency)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PgWebContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new PgWebContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._waitForStartInternal(dependency)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._publishAsConnectionStringInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withExplicitStartInternal()); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PgWebContainerResourcePromise { + const helpLink = options?.helpLink; + return new PgWebContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PostgresServerResourcePromise { - const exitCode = options?.exitCode; - return new PostgresServerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withHealthCheckInternal(key)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PostgresServerResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new PostgresServerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresServerResourcePromise { - const commandOptions = options?.commandOptions; - return new PostgresServerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Adds arguments */ + withArgs(args: string[]): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PostgresServerResourcePromise { - const password = options?.password; - return new PostgresServerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withParentRelationshipInternal(parent)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PgWebContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new PgWebContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withChildRelationshipInternal(child)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): PostgresServerResourcePromise { - const iconVariant = options?.iconVariant; - return new PostgresServerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PostgresServerResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new PostgresServerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._excludeFromMcpInternal()); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PgWebContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new PgWebContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PgWebContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PgWebContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PgWebContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PgWebContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresServerResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new PostgresServerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', rpcArgs ); - return new PostgresServerResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): PostgresServerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new PostgresServerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); + return new PgWebContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PgWebContainerResourcePromise { + const displayText = options?.displayText; + return new PgWebContainerResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _addDatabaseInternal(name: string, databaseName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (databaseName !== undefined) rpcArgs.databaseName = databaseName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/addDatabase', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds a PostgreSQL database */ - addDatabase(name: string, options?: AddDatabaseOptions): PostgresDatabaseResourcePromise { - const databaseName = options?.databaseName; - return new PostgresDatabaseResourcePromise(this._addDatabaseInternal(name, databaseName)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PgWebContainerResourcePromise { + const displayText = options?.displayText; + return new PgWebContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withPgAdminInternal(configureContainer?: (obj: PgAdminContainerResource) => Promise, containerName?: string): Promise { - const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PgAdminContainerResourceHandle; - const obj = new PgAdminContainerResource(objHandle, this._client); - await configureContainer(obj); - }) : undefined; - const rpcArgs: Record = { builder: this._handle }; - if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; - if (containerName !== undefined) rpcArgs.containerName = containerName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/withPgAdmin', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds pgAdmin 4 management UI */ - withPgAdmin(options?: WithPgAdminOptions): PostgresServerResourcePromise { - const configureContainer = options?.configureContainer; - const containerName = options?.containerName; - return new PostgresServerResourcePromise(this._withPgAdminInternal(configureContainer, containerName)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withPgWebInternal(configureContainer?: (obj: PgWebContainerResource) => Promise, containerName?: string): Promise { - const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PgWebContainerResourceHandle; - const obj = new PgWebContainerResource(objHandle, this._client); - await configureContainer(obj); - }) : undefined; - const rpcArgs: Record = { builder: this._handle }; - if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; - if (containerName !== undefined) rpcArgs.containerName = containerName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/withPgWeb', + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds pgweb management UI */ - withPgWeb(options?: WithPgWebOptions): PostgresServerResourcePromise { - const configureContainer = options?.configureContainer; - const containerName = options?.containerName; - return new PostgresServerResourcePromise(this._withPgWebInternal(configureContainer, containerName)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/withDataVolume', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds a data volume for PostgreSQL */ - withDataVolume(options?: WithDataVolumeOptions): PostgresServerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new PostgresServerResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/withDataBindMount', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds a data bind mount for PostgreSQL */ - withDataBindMount(source: string, options?: WithDataBindMountOptions): PostgresServerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new PostgresServerResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withInitFilesInternal(source: string): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/withInitFiles', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Copies init files to PostgreSQL */ - withInitFiles(source: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withInitFilesInternal(source)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withPasswordInternal(password: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, password }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/withPassword', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Configures the PostgreSQL password */ - withPassword(password: ParameterResource): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withPasswordInternal(password)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withUserNameInternal(userName: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, userName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/withUserName', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Configures the PostgreSQL user name */ - withUserName(userName: ParameterResource): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withUserNameInternal(userName)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withHostPortInternal(port?: number): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/withPostgresHostPort', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Sets the host port for PostgreSQL */ - withHostPort(options?: WithHostPortOptions): PostgresServerResourcePromise { - const port = options?.port; - return new PostgresServerResourcePromise(this._withHostPortInternal(port)); + /** Prevents resource from starting automatically */ + withExplicitStart(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withExplicitStartInternal()); } -} - -/** - * Thenable wrapper for PostgresServerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class PostgresServerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: PostgresServerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PgWebContainerResourcePromise { + const exitCode = options?.exitCode; + return new PgWebContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** Adds a health check by key */ + withHealthCheck(key: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withHealthCheckInternal(key)); } - /** Sets the container image tag */ - withImageTag(tag: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PgWebContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new PgWebContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PgWebContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new PgWebContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PgWebContainerResourcePromise { + const password = options?.password; + return new PgWebContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withChildRelationshipInternal(child)); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PgWebContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new PgWebContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PgWebContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new PgWebContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._excludeFromMcpInternal()); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PgWebContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new PgWebContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Adds arguments */ - withArgs(args: string[]): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PgWebContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new PgWebContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._onResourceReadyInternal(callback)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPgWebHostPort', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Sets the host port for pgweb */ + withHostPort(options?: WithHostPortOptions): PgWebContainerResourcePromise { + const port = options?.port; + return new PgWebContainerResourcePromise(this._withHostPortInternal(port)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } +} - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } +/** + * Thenable wrapper for PgWebContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class PgWebContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + then( + onfulfilled?: ((value: PgWebContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Sets the container image tag */ + withImageTag(tag: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Sets the container image registry */ + withImageRegistry(registry: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } - /** Adds a health check by key */ - withHealthCheck(key: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** Configures the resource to be published as a container */ + publishAsContainer(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Sets the container name */ + withContainerName(name: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Adds a PostgreSQL database */ - addDatabase(name: string, options?: AddDatabaseOptions): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.addDatabase(name, options))); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Adds pgAdmin 4 management UI */ - withPgAdmin(options?: WithPgAdminOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPgAdmin(options))); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** Adds pgweb management UI */ - withPgWeb(options?: WithPgWebOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPgWeb(options))); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Adds a data volume for PostgreSQL */ - withDataVolume(options?: WithDataVolumeOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + /** Adds arguments */ + withArgs(args: string[]): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** Adds a data bind mount for PostgreSQL */ - withDataBindMount(source: string, options?: WithDataBindMountOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Copies init files to PostgreSQL */ - withInitFiles(source: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withInitFiles(source))); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** Configures the PostgreSQL password */ - withPassword(password: ParameterResource): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPassword(password))); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Configures the PostgreSQL user name */ - withUserName(userName: ParameterResource): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUserName(userName))); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Sets the host port for PostgreSQL */ - withHostPort(options?: WithHostPortOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } -} + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } -// ============================================================================ -// ProjectResource -// ============================================================================ + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } -export class ProjectResource extends ResourceBuilderBase { - constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterInternal()); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - const helpLink = options?.helpLink; - return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Prevents resource from starting automatically */ + withExplicitStart(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Adds a health check by key */ + withHealthCheck(key: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsInternal(args)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Sets the host port for pgweb */ + withHostPort(options?: WithHostPortOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new ProjectResource(result, this._client); - } +} - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); +// ============================================================================ +// PostgresDatabaseResource +// ============================================================================ + +export class PostgresDatabaseResource extends ResourceBuilderBase { + constructor(handle: PostgresDatabaseResourceHandle, client: AspireClientRpc) { + super(handle, client); } + /** Gets the Parent property */ + parent = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.parent', + { context: this._handle } + ); + return new PostgresServerResource(handle, this._client); + }, + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the DatabaseName property */ + databaseName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.databaseName', + { context: this._handle } + ); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the JdbcConnectionString property */ + jdbcConnectionString = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.jdbcConnectionString', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresDatabaseResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new PostgresDatabaseResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresDatabaseResourcePromise { + const helpLink = options?.helpLink; + return new PostgresDatabaseResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withConnectionPropertyInternal(name, value)); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', rpcArgs ); + return new PostgresDatabaseResource(result, this._client); } - /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withConnectionPropertyValueInternal(name, value)); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + withUrl(url: string, options?: WithUrlOptions): PostgresDatabaseResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + return new PostgresDatabaseResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresDatabaseResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new PostgresDatabaseResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + /** Prevents resource from starting automatically */ + withExplicitStart(): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromManifestInternal()); + /** Adds a health check by key */ + withHealthCheck(key: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForInternal(dependency)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresDatabaseResourcePromise { + const commandOptions = options?.commandOptions; + return new PostgresDatabaseResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PostgresDatabaseResourcePromise { + const iconVariant = options?.iconVariant; + return new PostgresDatabaseResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExplicitStartInternal()); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { - const exitCode = options?.exitCode; - return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresDatabaseResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new PostgresDatabaseResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new ProjectResource(result, this._client); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { - const commandOptions = options?.commandOptions; - return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { - const password = options?.password; - return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._onConnectionStringAvailableInternal(callback)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withPostgresMcpInternal(configureContainer?: (obj: PostgresMcpContainerResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PostgresMcpContainerResourceHandle; + const obj = new PostgresMcpContainerResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPostgresMcp', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + /** Adds Postgres MCP server */ + withPostgresMcp(options?: WithPostgresMcpOptions): PostgresDatabaseResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new PostgresDatabaseResourcePromise(this._withPostgresMcpInternal(configureContainer, containerName)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withCreationScriptInternal(script: string): Promise { + const rpcArgs: Record = { builder: this._handle, script }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withCreationScript', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { - const iconVariant = options?.iconVariant; - return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Defines the SQL script for database creation */ + withCreationScript(script: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withCreationScriptInternal(script)); } - /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', - rpcArgs - ); - return new ProjectResource(result, this._client); +} + +/** + * Thenable wrapper for PostgresDatabaseResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class PostgresDatabaseResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PostgresDatabaseResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromMcpInternal()); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Prevents resource from starting automatically */ + withExplicitStart(): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Adds a health check by key */ + withHealthCheck(key: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } -} - -/** - * Thenable wrapper for ProjectResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ProjectResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Adds Postgres MCP server */ + withPostgresMcp(options?: WithPostgresMcpOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withPostgresMcp(options))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Defines the SQL script for database creation */ + withCreationScript(script: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withCreationScript(script))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); - } +} - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } +// ============================================================================ +// PostgresMcpContainerResource +// ============================================================================ - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); +export class PostgresMcpContainerResource extends ResourceBuilderBase { + constructor(handle: PostgresMcpContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withContainerRegistryInternal(registry)); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PostgresMcpContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new PostgresMcpContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEntrypointInternal(entrypoint)); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Sets the container image tag */ + withImageTag(tag: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withImageTagInternal(tag)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Sets the container image registry */ + withImageRegistry(registry: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withImageRegistryInternal(registry)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PostgresMcpContainerResourcePromise { + const tag = options?.tag; + return new PostgresMcpContainerResourcePromise(this._withImageInternal(image, tag)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withImageSHA256Internal(sha256)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withLifetimeInternal(lifetime)); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Configures the resource to be published as a container */ + publishAsContainer(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._publishAsContainerInternal()); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PostgresMcpContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new PostgresMcpContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } - /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** Sets the container name */ + withContainerName(name: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withContainerNameInternal(name)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withBuildArgInternal(name, value)); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withBuildSecretInternal(name, value)); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresMcpContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new PostgresMcpContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PostgresMcpContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new PostgresMcpContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withOtlpExporterInternal()); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } -} - -// ============================================================================ -// RedisCommanderResource -// ============================================================================ - -export class RedisCommanderResource extends ResourceBuilderBase { - constructor(handle: RedisCommanderResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withContainerRegistryInternal(registry)); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._publishAsConnectionStringInternal()); } /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisCommanderResourcePromise { - const isReadOnly = options?.isReadOnly; - return new RedisCommanderResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresMcpContainerResourcePromise { + const helpLink = options?.helpLink; + return new PostgresMcpContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withImageTagInternal(tag)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withImageRegistryInternal(registry)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): RedisCommanderResourcePromise { - const tag = options?.tag; - return new RedisCommanderResourcePromise(this._withImageInternal(image, tag)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withImageSHA256Internal(sha256)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Adds arguments */ + withArgs(args: string[]): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withLifetimeInternal(lifetime)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._publishAsContainerInternal()); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PostgresMcpContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new PostgresMcpContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new RedisCommanderResource(result, this._client); - } - - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisCommanderResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new RedisCommanderResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + return new PostgresMcpContainerResource(result, this._client); } - /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); - } - - /** Sets the container name */ - withContainerName(name: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withContainerNameInternal(name)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withBuildArgInternal(name, value)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withBuildSecretInternal(name, value)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PostgresMcpContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new PostgresMcpContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisCommanderResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new RedisCommanderResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PostgresMcpContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PostgresMcpContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PostgresMcpContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PostgresMcpContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): RedisCommanderResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new RedisCommanderResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', rpcArgs ); - return new RedisCommanderResource(result, this._client); - } - - /** Configures OTLP telemetry export */ - withOtlpExporter(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._publishAsConnectionStringInternal()); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisCommanderResourcePromise { - const helpLink = options?.helpLink; - return new RedisCommanderResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PostgresMcpContainerResourcePromise { + const displayText = options?.displayText; + return new PostgresMcpContainerResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresMcpContainerResourcePromise { + const displayText = options?.displayText; + return new PostgresMcpContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withArgsInternal(args)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withArgsCallbackInternal(callback)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Prevents resource from starting automatically */ + withExplicitStart(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisCommanderResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new RedisCommanderResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PostgresMcpContainerResourcePromise { + const exitCode = options?.exitCode; + return new PostgresMcpContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a health check by key */ + withHealthCheck(key: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PostgresMcpContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new PostgresMcpContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresMcpContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new PostgresMcpContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): RedisCommanderResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new RedisCommanderResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PostgresMcpContainerResourcePromise { + const password = options?.password; + return new PostgresMcpContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): RedisCommanderResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new RedisCommanderResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisCommanderResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new RedisCommanderResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new RedisCommanderResource(result, this._client); - } - - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withExternalHttpEndpointsInternal()); + return new PostgresMcpContainerResource(result, this._client); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._asHttp2ServiceInternal()); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PostgresMcpContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new PostgresMcpContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PostgresMcpContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new PostgresMcpContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): RedisCommanderResourcePromise { - const displayText = options?.displayText; - return new RedisCommanderResourcePromise(this._withUrlInternal(url, displayText)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisCommanderResourcePromise { - const displayText = options?.displayText; - return new RedisCommanderResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresMcpContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new PostgresMcpContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._excludeFromManifestInternal()); - } - - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._waitForInternal(dependency)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PostgresMcpContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new PostgresMcpContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new RedisCommanderResource(result, this._client); - } - - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withExplicitStartInternal()); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisCommanderResourcePromise { - const exitCode = options?.exitCode; - return new RedisCommanderResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withHealthCheckInternal(key)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisCommanderResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new RedisCommanderResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._onResourceReadyInternal(callback)); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); - } +} - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisCommanderResourcePromise { - const commandOptions = options?.commandOptions; - return new RedisCommanderResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); +/** + * Thenable wrapper for PostgresMcpContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class PostgresMcpContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PostgresMcpContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Sets the container image tag */ + withImageTag(tag: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); + /** Sets the container image registry */ + withImageRegistry(registry: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisCommanderResourcePromise { - const password = options?.password; - return new RedisCommanderResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withoutHttpsCertificateInternal()); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withParentRelationshipInternal(parent)); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); + /** Configures the resource to be published as a container */ + publishAsContainer(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withChildRelationshipInternal(child)); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); + /** Sets the container name */ + withContainerName(name: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): RedisCommanderResourcePromise { - const iconVariant = options?.iconVariant; - return new RedisCommanderResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); } - /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisCommanderResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new RedisCommanderResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._excludeFromMcpInternal()); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisCommanderResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new RedisCommanderResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); + /** Adds arguments */ + withArgs(args: string[]): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): RedisCommanderResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new RedisCommanderResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** @internal */ - private async _withHostPortInternal(port?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withRedisCommanderHostPort', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Sets the host port for Redis Commander */ - withHostPort(options?: WithHostPortOptions): RedisCommanderResourcePromise { - const port = options?.port; - return new RedisCommanderResourcePromise(this._withHostPortInternal(port)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } -} - -/** - * Thenable wrapper for RedisCommanderResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class RedisCommanderResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: RedisCommanderResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } - - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** Sets the container image tag */ - withImageTag(tag: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Sets the container image registry */ - withImageRegistry(registry: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Configures the resource to be published as a container */ - publishAsContainer(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Sets the container name */ - withContainerName(name: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Prevents resource from starting automatically */ + withExplicitStart(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** Adds a health check by key */ + withHealthCheck(key: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Adds arguments */ - withArgs(args: string[]): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); - } +} - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); - } +// ============================================================================ +// PostgresServerResource +// ============================================================================ - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); +export class PostgresServerResource extends ResourceBuilderBase { + constructor(handle: PostgresServerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the PrimaryEndpoint property */ + primaryEndpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.primaryEndpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the UserNameParameter property */ + userNameParameter = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.userNameParameter', + { context: this._handle } + ); + return new ParameterResource(handle, this._client); + }, + }; + + /** Gets the UserNameReference property */ + userNameReference = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.userNameReference', + { context: this._handle } + ); + }, + }; + + /** Gets the PasswordParameter property */ + passwordParameter = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.passwordParameter', + { context: this._handle } + ); + return new ParameterResource(handle, this._client); + }, + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the Databases property */ + private _databases?: AspireDict; + get databases(): AspireDict { + if (!this._databases) { + this._databases = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.databases', + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.databases' + ); + } + return this._databases; + } + + /** Gets the Host property */ + host = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.host', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.port', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the JdbcConnectionString property */ + jdbcConnectionString = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.jdbcConnectionString', + { context: this._handle } + ); + }, + }; + + /** Gets the Entrypoint property */ + entrypoint = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.entrypoint', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.setEntrypoint', + { context: this._handle, value } + ); + } + }; + + /** Gets the ShellExecution property */ + shellExecution = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.shellExecution', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.setShellExecution', + { context: this._handle, value } + ); + } + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PostgresServerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new PostgresServerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PostgresServerResourcePromise { + const tag = options?.tag; + return new PostgresServerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PostgresServerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new PostgresServerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresServerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new PostgresServerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PostgresServerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new PostgresServerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresServerResourcePromise { + const helpLink = options?.helpLink; + return new PostgresServerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PostgresServerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new PostgresServerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PostgresServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new PostgresServerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PostgresServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PostgresServerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PostgresServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PostgresServerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PostgresServerResourcePromise { + const displayText = options?.displayText; + return new PostgresServerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresServerResourcePromise { + const displayText = options?.displayText; + return new PostgresServerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PostgresServerResourcePromise { + const exitCode = options?.exitCode; + return new PostgresServerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PostgresServerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new PostgresServerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresServerResourcePromise { + const commandOptions = options?.commandOptions; + return new PostgresServerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PostgresServerResourcePromise { + const password = options?.password; + return new PostgresServerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PostgresServerResourcePromise { + const iconVariant = options?.iconVariant; + return new PostgresServerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PostgresServerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new PostgresServerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresServerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new PostgresServerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PostgresServerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new PostgresServerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._onConnectionStringAvailableInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _addDatabaseInternal(name: string, databaseName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (databaseName !== undefined) rpcArgs.databaseName = databaseName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/addDatabase', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Adds a PostgreSQL database */ + addDatabase(name: string, options?: AddDatabaseOptions): PostgresDatabaseResourcePromise { + const databaseName = options?.databaseName; + return new PostgresDatabaseResourcePromise(this._addDatabaseInternal(name, databaseName)); + } + + /** @internal */ + private async _withPgAdminInternal(configureContainer?: (obj: PgAdminContainerResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PgAdminContainerResourceHandle; + const obj = new PgAdminContainerResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPgAdmin', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds pgAdmin 4 management UI */ + withPgAdmin(options?: WithPgAdminOptions): PostgresServerResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new PostgresServerResourcePromise(this._withPgAdminInternal(configureContainer, containerName)); + } + + /** @internal */ + private async _withPgWebInternal(configureContainer?: (obj: PgWebContainerResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PgWebContainerResourceHandle; + const obj = new PgWebContainerResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPgWeb', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds pgweb management UI */ + withPgWeb(options?: WithPgWebOptions): PostgresServerResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new PostgresServerResourcePromise(this._withPgWebInternal(configureContainer, containerName)); + } + + /** @internal */ + private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withDataVolume', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a data volume for PostgreSQL */ + withDataVolume(options?: WithDataVolumeOptions): PostgresServerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new PostgresServerResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + } + + /** @internal */ + private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withDataBindMount', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a data bind mount for PostgreSQL */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): PostgresServerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new PostgresServerResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); + } + + /** @internal */ + private async _withInitFilesInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withInitFiles', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Copies init files to PostgreSQL */ + withInitFiles(source: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withInitFilesInternal(source)); + } + + /** @internal */ + private async _withPasswordInternal(password: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, password }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPassword', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures the PostgreSQL password */ + withPassword(password: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withPasswordInternal(password)); + } + + /** @internal */ + private async _withUserNameInternal(userName: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, userName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withUserName', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures the PostgreSQL user name */ + withUserName(userName: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withUserNameInternal(userName)); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPostgresHostPort', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the host port for PostgreSQL */ + withHostPort(options?: WithHostPortOptions): PostgresServerResourcePromise { + const port = options?.port; + return new PostgresServerResourcePromise(this._withHostPortInternal(port)); + } + +} + +/** + * Thenable wrapper for PostgresServerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class PostgresServerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PostgresServerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Adds arguments */ + withArgs(args: string[]): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Adds a PostgreSQL database */ + addDatabase(name: string, options?: AddDatabaseOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.addDatabase(name, options))); + } + + /** Adds pgAdmin 4 management UI */ + withPgAdmin(options?: WithPgAdminOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPgAdmin(options))); + } + + /** Adds pgweb management UI */ + withPgWeb(options?: WithPgWebOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPgWeb(options))); + } + + /** Adds a data volume for PostgreSQL */ + withDataVolume(options?: WithDataVolumeOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + } + + /** Adds a data bind mount for PostgreSQL */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); + } + + /** Copies init files to PostgreSQL */ + withInitFiles(source: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withInitFiles(source))); + } + + /** Configures the PostgreSQL password */ + withPassword(password: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPassword(password))); + } + + /** Configures the PostgreSQL user name */ + withUserName(userName: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUserName(userName))); + } + + /** Sets the host port for PostgreSQL */ + withHostPort(options?: WithHostPortOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + const configure = options?.configure; + return new ProjectResourcePromise(this._publishAsDockerFileInternal(configure)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceReadyInternal(callback)); + } + +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// RedisCommanderResource +// ============================================================================ + +export class RedisCommanderResource extends ResourceBuilderBase { + constructor(handle: RedisCommanderResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisCommanderResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisCommanderResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisCommanderResourcePromise { + const tag = options?.tag; + return new RedisCommanderResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisCommanderResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new RedisCommanderResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisCommanderResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new RedisCommanderResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisCommanderResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new RedisCommanderResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisCommanderResourcePromise { + const helpLink = options?.helpLink; + return new RedisCommanderResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisCommanderResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new RedisCommanderResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisCommanderResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new RedisCommanderResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisCommanderResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisCommanderResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisCommanderResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisCommanderResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisCommanderResourcePromise { + const displayText = options?.displayText; + return new RedisCommanderResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisCommanderResourcePromise { + const displayText = options?.displayText; + return new RedisCommanderResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisCommanderResourcePromise { + const exitCode = options?.exitCode; + return new RedisCommanderResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisCommanderResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new RedisCommanderResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisCommanderResourcePromise { + const commandOptions = options?.commandOptions; + return new RedisCommanderResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisCommanderResourcePromise { + const password = options?.password; + return new RedisCommanderResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisCommanderResourcePromise { + const iconVariant = options?.iconVariant; + return new RedisCommanderResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisCommanderResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new RedisCommanderResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisCommanderResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new RedisCommanderResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisCommanderResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisCommanderResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisCommanderHostPort', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the host port for Redis Commander */ + withHostPort(options?: WithHostPortOptions): RedisCommanderResourcePromise { + const port = options?.port; + return new RedisCommanderResourcePromise(this._withHostPortInternal(port)); + } + +} + +/** + * Thenable wrapper for RedisCommanderResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class RedisCommanderResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: RedisCommanderResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Sets the host port for Redis Commander */ + withHostPort(options?: WithHostPortOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + +} + +// ============================================================================ +// RedisInsightResource +// ============================================================================ + +export class RedisInsightResource extends ResourceBuilderBase { + constructor(handle: RedisInsightResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisInsightResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisInsightResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisInsightResourcePromise { + const tag = options?.tag; + return new RedisInsightResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisInsightResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new RedisInsightResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisInsightResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new RedisInsightResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisInsightResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new RedisInsightResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisInsightResourcePromise { + const helpLink = options?.helpLink; + return new RedisInsightResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisInsightResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new RedisInsightResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisInsightResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new RedisInsightResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisInsightResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisInsightResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisInsightResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisInsightResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisInsightResourcePromise { + const displayText = options?.displayText; + return new RedisInsightResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisInsightResourcePromise { + const displayText = options?.displayText; + return new RedisInsightResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisInsightResourcePromise { + const exitCode = options?.exitCode; + return new RedisInsightResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisInsightResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new RedisInsightResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisInsightResourcePromise { + const commandOptions = options?.commandOptions; + return new RedisInsightResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisInsightResourcePromise { + const password = options?.password; + return new RedisInsightResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisInsightResourcePromise { + const iconVariant = options?.iconVariant; + return new RedisInsightResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisInsightResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new RedisInsightResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisInsightResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new RedisInsightResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisInsightResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsightHostPort', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the host port for Redis Insight */ + withHostPort(options?: WithHostPortOptions): RedisInsightResourcePromise { + const port = options?.port; + return new RedisInsightResourcePromise(this._withHostPortInternal(port)); + } + + /** @internal */ + private async _withDataVolumeInternal(name?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsightDataVolume', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a data volume for Redis Insight */ + withDataVolume(options?: WithDataVolumeOptions): RedisInsightResourcePromise { + const name = options?.name; + return new RedisInsightResourcePromise(this._withDataVolumeInternal(name)); + } + + /** @internal */ + private async _withDataBindMountInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsightDataBindMount', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a data bind mount for Redis Insight */ + withDataBindMount(source: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withDataBindMountInternal(source)); + } + +} + +/** + * Thenable wrapper for RedisInsightResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class RedisInsightResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: RedisInsightResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Sets the host port for Redis Insight */ + withHostPort(options?: WithHostPortOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHostPort(options))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Adds a data volume for Redis Insight */ + withDataVolume(options?: WithDataVolumeOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); } - /** Sets the host port for Redis Commander */ - withHostPort(options?: WithHostPortOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + /** Adds a data bind mount for Redis Insight */ + withDataBindMount(source: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDataBindMount(source))); } } // ============================================================================ -// RedisInsightResource +// RedisResource // ============================================================================ -export class RedisInsightResource extends ResourceBuilderBase { - constructor(handle: RedisInsightResourceHandle, client: AspireClientRpc) { +export class RedisResource extends ResourceBuilderBase { + constructor(handle: RedisResourceHandle, client: AspireClientRpc) { super(handle, client); } + /** Gets the PrimaryEndpoint property */ + primaryEndpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.primaryEndpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.host', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.port', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the PasswordParameter property */ + passwordParameter = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.passwordParameter', + { context: this._handle } + ); + return new ParameterResource(handle, this._client); + }, + }; + + /** Gets the TlsEnabled property */ + tlsEnabled = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.tlsEnabled', + { context: this._handle } + ); + }, + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the Entrypoint property */ + entrypoint = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.entrypoint', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.setEntrypoint', + { context: this._handle, value } + ); + } + }; + + /** Gets the ShellExecution property */ + shellExecution = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.shellExecution', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.setShellExecution', + { context: this._handle, value } + ); + } + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { const rpcArgs: Record = { builder: this._handle, source, target }; if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withBindMount', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisInsightResourcePromise { + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisResourcePromise { const isReadOnly = options?.isReadOnly; - return new RedisInsightResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + return new RedisResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { + private async _withEntrypointInternal(entrypoint: string): Promise { const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEntrypointInternal(entrypoint)); + withEntrypoint(entrypoint: string): RedisResourcePromise { + return new RedisResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { + private async _withImageTagInternal(tag: string): Promise { const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withImageTag', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the container image tag */ - withImageTag(tag: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withImageTagInternal(tag)); + withImageTag(tag: string): RedisResourcePromise { + return new RedisResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { + private async _withImageRegistryInternal(registry: string): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the container image registry */ - withImageRegistry(registry: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withImageRegistryInternal(registry)); + withImageRegistry(registry: string): RedisResourcePromise { + return new RedisResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { + private async _withImageInternal(image: string, tag?: string): Promise { const rpcArgs: Record = { builder: this._handle, image }; if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withImage', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): RedisInsightResourcePromise { + withImage(image: string, options?: WithImageOptions): RedisResourcePromise { const tag = options?.tag; - return new RedisInsightResourcePromise(this._withImageInternal(image, tag)); + return new RedisResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { + private async _withImageSHA256Internal(sha256: string): Promise { const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withImageSHA256Internal(sha256)); + withImageSHA256(sha256: string): RedisResourcePromise { + return new RedisResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withContainerRuntimeArgsInternal(args)); + withContainerRuntimeArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withLifetime', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withLifetimeInternal(lifetime)); + withLifetime(lifetime: ContainerLifetime): RedisResourcePromise { + return new RedisResourcePromise(this._withLifetimeInternal(lifetime)); } /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisResourcePromise { + return new RedisResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } /** @internal */ - private async _publishAsContainerInternal(): Promise { + private async _publishAsContainerInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/publishAsContainer', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Configures the resource to be published as a container */ - publishAsContainer(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._publishAsContainerInternal()); + publishAsContainer(): RedisResourcePromise { + return new RedisResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { const rpcArgs: Record = { builder: this._handle, contextPath }; if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfile', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisInsightResourcePromise { + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisResourcePromise { const dockerfilePath = options?.dockerfilePath; const stage = options?.stage; - return new RedisInsightResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + return new RedisResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } /** @internal */ - private async _withContainerNameInternal(name: string): Promise { + private async _withContainerNameInternal(name: string): Promise { const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerName', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the container name */ - withContainerName(name: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withContainerNameInternal(name)); + withContainerName(name: string): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerNameInternal(name)); } /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withBuildArgInternal(name, value)); + withBuildArg(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withBuildArgInternal(name, value)); } /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withBuildSecretInternal(name, value)); + withBuildSecret(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + withEndpointProxySupport(proxyEnabled: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisInsightResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new RedisInsightResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new RedisResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { + private async _withContainerNetworkAliasInternal(alias: string): Promise { const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerNetworkAlias', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withContainerNetworkAliasInternal(alias)); + withContainerNetworkAlias(alias: string): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerNetworkAliasInternal(alias)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): RedisInsightResourcePromise { + withMcpServer(options?: WithMcpServerOptions): RedisResourcePromise { const path = options?.path; const endpointName = options?.endpointName; - return new RedisInsightResourcePromise(this._withMcpServerInternal(path, endpointName)); + return new RedisResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { + private async _withOtlpExporterInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Configures OTLP telemetry export */ - withOtlpExporter(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withOtlpExporterInternal()); + withOtlpExporter(): RedisResourcePromise { + return new RedisResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisResourcePromise { + return new RedisResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { + private async _publishAsConnectionStringInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/publishAsConnectionString', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Publishes the resource as a connection string */ - publishAsConnectionString(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._publishAsConnectionStringInternal()); + publishAsConnectionString(): RedisResourcePromise { + return new RedisResourcePromise(this._publishAsConnectionStringInternal()); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisInsightResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisResourcePromise { const helpLink = options?.helpLink; - return new RedisInsightResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new RedisResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentInternal(name, value)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._withConnectionPropertyInternal(name, value)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._withConnectionPropertyValueInternal(name, value)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new RedisInsightResource(result, this._client); - } - - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisInsightResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new RedisInsightResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new RedisResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', rpcArgs ); - return new RedisInsightResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): RedisResourcePromise { + return new RedisResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): RedisResourcePromise { + return new RedisResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -21624,15 +30758,15 @@ export class RedisInsightResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): RedisInsightResourcePromise { + withEndpoint(options?: WithEndpointOptions): RedisResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -21641,72 +30775,72 @@ export class RedisInsightResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): RedisInsightResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new RedisInsightResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new RedisResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisInsightResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new RedisInsightResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new RedisResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): RedisResourcePromise { + return new RedisResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -21719,278 +30853,278 @@ export class RedisInsightResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): RedisResourcePromise { + return new RedisResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): RedisInsightResourcePromise { + withUrl(url: string, options?: WithUrlOptions): RedisResourcePromise { const displayText = options?.displayText; - return new RedisInsightResourcePromise(this._withUrlInternal(url, displayText)); + return new RedisResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisInsightResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisResourcePromise { const displayText = options?.displayText; - return new RedisInsightResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new RedisResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): RedisResourcePromise { + return new RedisResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): RedisResourcePromise { + return new RedisResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisInsightResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisResourcePromise { const exitCode = options?.exitCode; - return new RedisInsightResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new RedisResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): RedisResourcePromise { + return new RedisResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisInsightResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new RedisInsightResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new RedisResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -21998,130 +31132,130 @@ export class RedisInsightResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisInsightResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisResourcePromise { const commandOptions = options?.commandOptions; - return new RedisInsightResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new RedisResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): RedisResourcePromise { + return new RedisResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisInsightResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisResourcePromise { const password = options?.password; - return new RedisInsightResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new RedisResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): RedisResourcePromise { + return new RedisResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): RedisInsightResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): RedisResourcePromise { const iconVariant = options?.iconVariant; - return new RedisInsightResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new RedisResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -22130,15 +31264,15 @@ export class RedisInsightResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisInsightResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -22146,56 +31280,56 @@ export class RedisInsightResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): RedisResourcePromise { + return new RedisResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): RedisResourcePromise { + return new RedisResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): RedisResourcePromise { + return new RedisResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -22206,79 +31340,79 @@ export class RedisInsightResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisInsightResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new RedisInsightResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new RedisResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { const rpcArgs: Record = { resource: this._handle, target }; if (name !== undefined) rpcArgs.name = name; if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withVolume', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { + withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { const name = options?.name; const isReadOnly = options?.isReadOnly; - return new RedisInsightResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + return new RedisResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); } /** Gets the resource name */ @@ -22291,1252 +31425,1131 @@ export class RedisInsightResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withRedisInsightHostPort', - rpcArgs - ); - return new RedisInsightResource(result, this._client); - } - - /** Sets the host port for Redis Insight */ - withHostPort(options?: WithHostPortOptions): RedisInsightResourcePromise { - const port = options?.port; - return new RedisInsightResourcePromise(this._withHostPortInternal(port)); - } - - /** @internal */ - private async _withDataVolumeInternal(name?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (name !== undefined) rpcArgs.name = name; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withRedisInsightDataVolume', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new RedisResource(result, this._client); } - /** Adds a data volume for Redis Insight */ - withDataVolume(options?: WithDataVolumeOptions): RedisInsightResourcePromise { - const name = options?.name; - return new RedisInsightResourcePromise(this._withDataVolumeInternal(name)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withDataBindMountInternal(source: string): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withRedisInsightDataBindMount', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs - ); - return new RedisInsightResource(result, this._client); - } - - /** Adds a data bind mount for Redis Insight */ - withDataBindMount(source: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withDataBindMountInternal(source)); - } - -} - -/** - * Thenable wrapper for RedisInsightResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class RedisInsightResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: RedisInsightResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } - - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); - } - - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); - } - - /** Sets the container image tag */ - withImageTag(tag: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); - } - - /** Sets the container image registry */ - withImageRegistry(registry: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); - } - - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImage(image, options))); - } - - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); - } - - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + ); + return new RedisResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onConnectionStringAvailableInternal(callback)); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onResourceReadyInternal(callback)); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** @internal */ + private async _withRedisCommanderInternal(configureContainer?: (obj: RedisCommanderResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as RedisCommanderResourceHandle; + const obj = new RedisCommanderResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisCommander', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Adds Redis Commander management UI */ + withRedisCommander(options?: WithRedisCommanderOptions): RedisResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new RedisResourcePromise(this._withRedisCommanderInternal(configureContainer, containerName)); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _withRedisInsightInternal(configureContainer?: (obj: RedisInsightResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as RedisInsightResourceHandle; + const obj = new RedisInsightResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsight', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Adds Redis Insight management UI */ + withRedisInsight(options?: WithRedisInsightOptions): RedisResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new RedisResourcePromise(this._withRedisInsightInternal(configureContainer, containerName)); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** @internal */ + private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withDataVolume', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds a data volume with persistence */ + withDataVolume(options?: WithDataVolumeOptions): RedisResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withDataBindMount', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Adds a data bind mount with persistence */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): RedisResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _withPersistenceInternal(interval?: number, keysChangedThreshold?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (interval !== undefined) rpcArgs.interval = interval; + if (keysChangedThreshold !== undefined) rpcArgs.keysChangedThreshold = keysChangedThreshold; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withPersistence', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Configures Redis persistence */ + withPersistence(options?: WithPersistenceOptions): RedisResourcePromise { + const interval = options?.interval; + const keysChangedThreshold = options?.keysChangedThreshold; + return new RedisResourcePromise(this._withPersistenceInternal(interval, keysChangedThreshold)); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _withPasswordInternal(password: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, password }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withPassword', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Configures the password for Redis */ + withPassword(password: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withPasswordInternal(password)); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withHostPort', + rpcArgs + ); + return new RedisResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Sets the host port for Redis */ + withHostPort(options?: WithHostPortOptions): RedisResourcePromise { + const port = options?.port; + return new RedisResourcePromise(this._withHostPortInternal(port)); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); - } +} - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); +/** + * Thenable wrapper for RedisResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class RedisResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: RedisResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Sets the container image tag */ + withImageTag(tag: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.publishAsContainer())); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Sets the container name */ + withContainerName(name: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerName(name))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Adds a health check by key */ - withHealthCheck(key: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** Adds arguments */ + withArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** Sets the host port for Redis Insight */ - withHostPort(options?: WithHostPortOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Adds a data volume for Redis Insight */ - withDataVolume(options?: WithDataVolumeOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Adds a data bind mount for Redis Insight */ - withDataBindMount(source: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDataBindMount(source))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } -} + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } -// ============================================================================ -// RedisResource -// ============================================================================ + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } -export class RedisResource extends ResourceBuilderBase { - constructor(handle: RedisResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Gets the PrimaryEndpoint property */ - primaryEndpoint = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.primaryEndpoint', - { context: this._handle } - ); - return new EndpointReference(handle, this._client); - }, - }; + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } - /** Gets the Host property */ - host = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.host', - { context: this._handle } - ); - return new EndpointReferenceExpression(handle, this._client); - }, - }; + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } - /** Gets the Port property */ - port = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.port', - { context: this._handle } - ); - return new EndpointReferenceExpression(handle, this._client); - }, - }; + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } - /** Gets the TlsEnabled property */ - tlsEnabled = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.tlsEnabled', - { context: this._handle } - ); - }, - set: async (value: boolean): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.setTlsEnabled', - { context: this._handle, value } - ); - } - }; + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } - /** Gets the ConnectionStringExpression property */ - connectionStringExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.connectionStringExpression', - { context: this._handle } - ); - }, - }; + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } - /** Gets the UriExpression property */ - uriExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.uriExpression', - { context: this._handle } - ); - }, - }; + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } - /** Gets the Entrypoint property */ - entrypoint = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.entrypoint', - { context: this._handle } - ); - }, - set: async (value: string): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.setEntrypoint', - { context: this._handle, value } - ); - } - }; + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } - /** Gets the ShellExecution property */ - shellExecution = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.shellExecution', - { context: this._handle } - ); - }, - set: async (value: boolean): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.setShellExecution', - { context: this._handle, value } - ); - } - }; + /** Adds a health check by key */ + withHealthCheck(key: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } - /** Gets the Name property */ - name = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.name', - { context: this._handle } - ); - }, - }; + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._withContainerRegistryInternal(registry)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisResourcePromise { - const isReadOnly = options?.isReadOnly; - return new RedisResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): RedisResourcePromise { - return new RedisResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Sets the container image tag */ - withImageTag(tag: string): RedisResourcePromise { - return new RedisResourcePromise(this._withImageTagInternal(tag)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Sets the container image registry */ - withImageRegistry(registry: string): RedisResourcePromise { - return new RedisResourcePromise(this._withImageRegistryInternal(registry)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): RedisResourcePromise { - const tag = options?.tag; - return new RedisResourcePromise(this._withImageInternal(image, tag)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): RedisResourcePromise { - return new RedisResourcePromise(this._withImageSHA256Internal(sha256)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): RedisResourcePromise { - return new RedisResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } - /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): RedisResourcePromise { - return new RedisResourcePromise(this._withLifetimeInternal(lifetime)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisResourcePromise { - return new RedisResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } - /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Configures the resource to be published as a container */ - publishAsContainer(): RedisResourcePromise { - return new RedisResourcePromise(this._publishAsContainerInternal()); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new RedisResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Adds Redis Commander management UI */ + withRedisCommander(options?: WithRedisCommanderOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRedisCommander(options))); } - /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Adds Redis Insight management UI */ + withRedisInsight(options?: WithRedisInsightOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRedisInsight(options))); } - /** Sets the container name */ - withContainerName(name: string): RedisResourcePromise { - return new RedisResourcePromise(this._withContainerNameInternal(name)); + /** Adds a data volume with persistence */ + withDataVolume(options?: WithDataVolumeOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); } - /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Adds a data bind mount with persistence */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): RedisResourcePromise { - return new RedisResourcePromise(this._withBuildArgInternal(name, value)); + /** Configures Redis persistence */ + withPersistence(options?: WithPersistenceOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPersistence(options))); } - /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Configures the password for Redis */ + withPassword(password: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPassword(password))); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): RedisResourcePromise { - return new RedisResourcePromise(this._withBuildSecretInternal(name, value)); + /** Sets the host port for Redis */ + withHostPort(options?: WithHostPortOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + +} + +// ============================================================================ +// ViteAppResource +// ============================================================================ + +export class ViteAppResource extends ResourceBuilderBase { + constructor(handle: ViteAppResourceHandle, client: AspireClientRpc) { + super(handle, client); } + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): RedisResourcePromise { - return new RedisResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new RedisResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); - } - - /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', - rpcArgs - ); - return new RedisResource(result, this._client); - } - - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): RedisResourcePromise { - return new RedisResourcePromise(this._withContainerNetworkAliasInternal(alias)); + return new ViteAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _publishAsDockerFileInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): RedisResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new RedisResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): RedisResourcePromise { - return new RedisResourcePromise(this._withOtlpExporterInternal()); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): RedisResourcePromise { - return new RedisResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): RedisResourcePromise { - return new RedisResourcePromise(this._publishAsConnectionStringInternal()); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs - ); - return new RedisResource(result, this._client); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisResourcePromise { - const helpLink = options?.helpLink; - return new RedisResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + ); + return new ViteAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ViteAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentInternal(name, value)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { + const helpLink = options?.helpLink; + return new ViteAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); - } - - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new RedisResource(result, this._client); - } - - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): RedisResourcePromise { - return new RedisResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): RedisResourcePromise { - return new RedisResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): RedisResourcePromise { - return new RedisResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new RedisResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new RedisResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new RedisResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisResourcePromise { - return new RedisResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ViteAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): RedisResourcePromise { - return new RedisResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): RedisResourcePromise { - return new RedisResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): RedisResourcePromise { - return new RedisResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -23546,15 +32559,15 @@ export class RedisResource extends ResourceBuilderBase { if (isProxied !== undefined) rpcArgs.isProxied = isProxied; if (isExternal !== undefined) rpcArgs.isExternal = isExternal; if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): RedisResourcePromise { + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -23563,72 +32576,72 @@ export class RedisResource extends ResourceBuilderBase { const isProxied = options?.isProxied; const isExternal = options?.isExternal; const protocol = options?.protocol; - return new RedisResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + return new ViteAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): RedisResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new RedisResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new RedisResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): RedisResourcePromise { - return new RedisResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -23641,278 +32654,308 @@ export class RedisResource extends ResourceBuilderBase { } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): RedisResourcePromise { - return new RedisResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): RedisResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new RedisResourcePromise(this._withUrlInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new RedisResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): RedisResourcePromise { - return new RedisResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { - return new RedisResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { - return new RedisResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): RedisResourcePromise { - return new RedisResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { const exitCode = options?.exitCode; - return new RedisResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ViteAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): RedisResourcePromise { - return new RedisResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new RedisResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new ViteAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -23920,130 +32963,130 @@ export class RedisResource extends ResourceBuilderBase { }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { const commandOptions = options?.commandOptions; - return new RedisResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ViteAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): RedisResourcePromise { - return new RedisResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): RedisResourcePromise { - return new RedisResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { const password = options?.password; - return new RedisResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new ViteAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): RedisResourcePromise { - return new RedisResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): RedisResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { const iconVariant = options?.iconVariant; - return new RedisResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ViteAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -24052,15 +33095,15 @@ export class RedisResource extends ResourceBuilderBase { if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -24068,56 +33111,56 @@ export class RedisResource extends ResourceBuilderBase { const failureThreshold = options?.failureThreshold; const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new RedisResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new ViteAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): RedisResourcePromise { - return new RedisResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): RedisResourcePromise { - return new RedisResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): RedisResourcePromise { - return new RedisResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -24128,79 +33171,60 @@ export class RedisResource extends ResourceBuilderBase { if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; if (tags !== undefined) rpcArgs.tags = tags; if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new RedisResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ViteAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withPipelineConfigurationInternal(callback)); - } - - /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', - rpcArgs - ); - return new RedisResource(result, this._client); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new RedisResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -24213,380 +33237,394 @@ export class RedisResource extends ResourceBuilderBase { } /** @internal */ - private async _withRedisCommanderInternal(configureContainer?: (obj: RedisCommanderResource) => Promise, containerName?: string): Promise { - const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as RedisCommanderResourceHandle; - const obj = new RedisCommanderResource(objHandle, this._client); - await configureContainer(obj); - }) : undefined; - const rpcArgs: Record = { builder: this._handle }; - if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; - if (containerName !== undefined) rpcArgs.containerName = containerName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withRedisCommander', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds Redis Commander management UI */ - withRedisCommander(options?: WithRedisCommanderOptions): RedisResourcePromise { - const configureContainer = options?.configureContainer; - const containerName = options?.containerName; - return new RedisResourcePromise(this._withRedisCommanderInternal(configureContainer, containerName)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withRedisInsightInternal(configureContainer?: (obj: RedisInsightResource) => Promise, containerName?: string): Promise { - const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as RedisInsightResourceHandle; - const obj = new RedisInsightResource(objHandle, this._client); - await configureContainer(obj); - }) : undefined; - const rpcArgs: Record = { builder: this._handle }; - if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; - if (containerName !== undefined) rpcArgs.containerName = containerName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withRedisInsight', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds Redis Insight management UI */ - withRedisInsight(options?: WithRedisInsightOptions): RedisResourcePromise { - const configureContainer = options?.configureContainer; - const containerName = options?.containerName; - return new RedisResourcePromise(this._withRedisInsightInternal(configureContainer, containerName)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withDataVolume', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a data volume with persistence */ - withDataVolume(options?: WithDataVolumeOptions): RedisResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new RedisResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withDataBindMount', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a data bind mount with persistence */ - withDataBindMount(source: string, options?: WithDataBindMountOptions): RedisResourcePromise { - const isReadOnly = options?.isReadOnly; - return new RedisResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withPersistenceInternal(interval?: number, keysChangedThreshold?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (interval !== undefined) rpcArgs.interval = interval; - if (keysChangedThreshold !== undefined) rpcArgs.keysChangedThreshold = keysChangedThreshold; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withPersistence', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures Redis persistence */ - withPersistence(options?: WithPersistenceOptions): RedisResourcePromise { - const interval = options?.interval; - const keysChangedThreshold = options?.keysChangedThreshold; - return new RedisResourcePromise(this._withPersistenceInternal(interval, keysChangedThreshold)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withPasswordInternal(password: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, password }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withPassword', + private async _withViteConfigInternal(configPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, configPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withViteConfig', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures the password for Redis */ - withPassword(password: ParameterResource): RedisResourcePromise { - return new RedisResourcePromise(this._withPasswordInternal(password)); + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withViteConfigInternal(configPath)); } /** @internal */ - private async _withHostPortInternal(port?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withHostPort', + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', rpcArgs ); - return new RedisResource(result, this._client); - } - - /** Sets the host port for Redis */ - withHostPort(options?: WithHostPortOptions): RedisResourcePromise { - const port = options?.port; - return new RedisResourcePromise(this._withHostPortInternal(port)); - } - -} - -/** - * Thenable wrapper for RedisResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class RedisResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: RedisResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + return new ViteAppResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withBunInternal(install, installArgs)); } - /** Sets the container image tag */ - withImageTag(tag: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withYarnInternal(install, installArgs)); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withPnpmInternal(install, installArgs)); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + const browser = options?.browser; + return new ViteAppResourcePromise(this._withBrowserDebuggerInternal(browser)); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); - } +} - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); +/** + * Thenable wrapper for ViteAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ViteAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ViteAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); - } - - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); - } - - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -24595,163 +33633,168 @@ export class RedisResourcePromise implements PromiseLike { } /** Configures resource for HTTP/2 */ - asHttp2Service(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -24759,39 +33802,137 @@ export class RedisResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } - /** Adds Redis Commander management UI */ - withRedisCommander(options?: WithRedisCommanderOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withRedisCommander(options))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Adds Redis Insight management UI */ - withRedisInsight(options?: WithRedisInsightOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withRedisInsight(options))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Adds a data volume with persistence */ - withDataVolume(options?: WithDataVolumeOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Adds a data bind mount with persistence */ - withDataBindMount(source: string, options?: WithDataBindMountOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withViteConfig(configPath))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + +} + +// ============================================================================ +// ComputeResource +// ============================================================================ + +export class ComputeResource extends ResourceBuilderBase { + constructor(handle: IComputeResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Configures Redis persistence */ - withPersistence(options?: WithPersistenceOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withPersistence(options))); +} + +/** + * Thenable wrapper for ComputeResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ComputeResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ComputeResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Configures the password for Redis */ - withPassword(password: ParameterResource): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withPassword(password))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Sets the host port for Redis */ - withHostPort(options?: WithHostPortOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } } @@ -24809,7 +33950,7 @@ export class ContainerFilesDestinationResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); return new ContainerFilesDestinationResource(result, this._client); @@ -25068,7 +34209,7 @@ export class Resource extends ResourceBuilderBase { private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new Resource(result, this._client); @@ -25083,7 +34224,7 @@ export class Resource extends ResourceBuilderBase { private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new Resource(result, this._client); @@ -25126,36 +34267,6 @@ export class Resource extends ResourceBuilderBase { return new ResourcePromise(this._excludeFromMcpInternal()); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -25233,6 +34344,86 @@ export class Resource extends ResourceBuilderBase { ); } + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -25330,16 +34521,6 @@ export class ResourcePromise implements PromiseLike { return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); @@ -25360,6 +34541,26 @@ export class ResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -25499,6 +34700,35 @@ export class ResourceWithConnectionString extends ResourceBuilderBase { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._onConnectionStringAvailableInternal(callback)); + } + } /** @@ -25526,6 +34756,16 @@ export class ResourceWithConnectionStringPromise implements PromiseLike obj.withConnectionPropertyValue(name, value))); } + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + } // ============================================================================ @@ -25814,6 +35054,26 @@ export class ResourceWithEndpoints extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + } /** @@ -25881,6 +35141,11 @@ export class ResourceWithEndpointsPromise implements PromiseLike obj.withHttpProbe(probeType, options))); } + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + } // ============================================================================ @@ -25923,41 +35188,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -25968,43 +35203,38 @@ export class ResourceWithEnvironment extends ResourceBuilderBase Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -26038,10 +35268,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -26053,37 +35284,8 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -26166,7 +35368,7 @@ export class ResourceWithEnvironment extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ResourceWithEnvironment(result, this._client); @@ -26220,31 +35422,21 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withOtlpExporterProtocol(protocol))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -26260,16 +35452,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -26307,34 +35489,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike { - constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { - super(handle, client); - } - -} - -/** - * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ResourceWithServiceDiscoveryPromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - -} - // ============================================================================ // ResourceWithWaitSupport // ============================================================================ @@ -26348,7 +35502,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -26378,7 +35532,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -26409,7 +35563,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -26528,7 +35682,7 @@ export async function createBuilder(options?: CreateBuilderOptions): Promise { const error = reason instanceof Error ? reason : new Error(String(reason)); - if (reason instanceof CapabilityError) { + if (reason instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else if (reason instanceof CapabilityError) { console.error(`\n❌ Capability Error: ${error.message}`); console.error(` Code: ${(reason as CapabilityError).code}`); if ((reason as CapabilityError).capability) { @@ -26559,8 +35715,12 @@ process.on('unhandledRejection', (reason: unknown) => { }); process.on('uncaughtException', (error: Error) => { - console.error(`\n❌ Uncaught Exception: ${error.message}`); - if (error.stack) { + if (error instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + } + if (!(error instanceof AppHostUsageError) && error.stack) { console.error(error.stack); } process.exit(1); @@ -26571,21 +35731,44 @@ process.on('uncaughtException', (error: Error) => { // ============================================================================ // Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent', (handle, client) => new AfterResourcesCreatedEvent(handle as AfterResourcesCreatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent', (handle, client) => new BeforeResourceStartedEvent(handle as BeforeResourceStartedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent', (handle, client) => new BeforeStartEvent(handle as BeforeStartEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent', (handle, client) => new ConnectionStringAvailableEvent(handle as ConnectionStringAvailableEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel', (handle, client) => new DistributedApplicationModel(handle as DistributedApplicationModelHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent', (handle, client) => new InitializeResourceEvent(handle as InitializeResourceEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext', (handle, client) => new PipelineContext(handle as PipelineContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext', (handle, client) => new PipelineStepFactoryContext(handle as PipelineStepFactoryContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary', (handle, client) => new PipelineSummary(handle as PipelineSummaryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent', (handle, client) => new ResourceEndpointsAllocatedEvent(handle as ResourceEndpointsAllocatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService', (handle, client) => new ResourceLoggerService(handle as ResourceLoggerServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService', (handle, client) => new ResourceNotificationService(handle as ResourceNotificationServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent', (handle, client) => new ResourceReadyEvent(handle as ResourceReadyEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent', (handle, client) => new ResourceStoppedEvent(handle as ResourceStoppedEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext', (handle, client) => new UpdateCommandStateContext(handle as UpdateCommandStateContextHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration', (handle, client) => new Configuration(handle as IConfigurationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment', (handle, client) => new HostEnvironment(handle as IHostEnvironmentHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger', (handle, client) => new Logger(handle as ILoggerHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory', (handle, client) => new LoggerFactory(handle as ILoggerFactoryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep', (handle, client) => new ReportingStep(handle as IReportingStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask', (handle, client) => new ReportingTask(handle as IReportingTaskHandle, client)); +registerHandleWrapper('System.ComponentModel/System.IServiceProvider', (handle, client) => new ServiceProvider(handle as IServiceProviderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IUserSecretsManager', (handle, client) => new UserSecretsManager(handle as IUserSecretsManagerHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); @@ -26593,6 +35776,8 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppR registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource', (handle, client) => new JavaScriptAppResource(handle as JavaScriptAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource', (handle, client) => new NodeAppResource(handle as NodeAppResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.PostgreSQL/Aspire.Hosting.Postgres.PgAdminContainerResource', (handle, client) => new PgAdminContainerResource(handle as PgAdminContainerResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.PostgreSQL/Aspire.Hosting.Postgres.PgWebContainerResource', (handle, client) => new PgWebContainerResource(handle as PgWebContainerResourceHandle, client)); @@ -26603,6 +35788,8 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectRes registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisCommanderResource', (handle, client) => new RedisCommanderResource(handle as RedisCommanderResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisInsightResource', (handle, client) => new RedisInsightResource(handle as RedisInsightResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.ApplicationModel.RedisResource', (handle, client) => new RedisResource(handle as RedisResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource', (handle, client) => new ViteAppResource(handle as ViteAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource', (handle, client) => new ComputeResource(handle as IComputeResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); @@ -26610,6 +35797,5 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceW registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); diff --git a/samples/aspire-shop/ts/.modules/base.ts b/samples/aspire-shop/ts/.modules/base.ts index 7778b0f1..b3d8b8be 100644 --- a/samples/aspire-shop/ts/.modules/base.ts +++ b/samples/aspire-shop/ts/.modules/base.ts @@ -1,8 +1,8 @@ -// aspire.ts - Core Aspire types: base classes, ReferenceExpression -import { Handle, AspireClient, MarshalledHandle } from './transport.js'; +// base.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle, CancellationToken, registerCancellation, registerHandleWrapper, unregisterCancellation } from './transport.js'; // Re-export transport types for convenience -export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export { Handle, AspireClient, CapabilityError, CancellationToken, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; @@ -43,22 +43,46 @@ export class ReferenceExpression { private readonly _format?: string; private readonly _valueProviders?: unknown[]; + // Conditional mode fields + private readonly _condition?: unknown; + private readonly _whenTrue?: ReferenceExpression; + private readonly _whenFalse?: ReferenceExpression; + private readonly _matchValue?: string; + // Handle mode fields (when wrapping a server-returned handle) private readonly _handle?: Handle; private readonly _client?: AspireClient; constructor(format: string, valueProviders: unknown[]); constructor(handle: Handle, client: AspireClient); - constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { - if (typeof handleOrFormat === 'string') { - this._format = handleOrFormat; - this._valueProviders = clientOrValueProviders as unknown[]; + constructor(condition: unknown, matchValue: string, whenTrue: ReferenceExpression, whenFalse: ReferenceExpression); + constructor( + handleOrFormatOrCondition: Handle | string | unknown, + clientOrValueProvidersOrMatchValue: AspireClient | unknown[] | string, + whenTrueOrWhenFalse?: ReferenceExpression, + whenFalse?: ReferenceExpression + ) { + if (typeof handleOrFormatOrCondition === 'string') { + this._format = handleOrFormatOrCondition; + this._valueProviders = clientOrValueProvidersOrMatchValue as unknown[]; + } else if (handleOrFormatOrCondition instanceof Handle) { + this._handle = handleOrFormatOrCondition; + this._client = clientOrValueProvidersOrMatchValue as AspireClient; } else { - this._handle = handleOrFormat; - this._client = clientOrValueProviders as AspireClient; + this._condition = handleOrFormatOrCondition; + this._matchValue = (clientOrValueProvidersOrMatchValue as string) ?? 'True'; + this._whenTrue = whenTrueOrWhenFalse; + this._whenFalse = whenFalse; } } + /** + * Gets whether this reference expression is conditional. + */ + get isConditional(): boolean { + return this._condition !== undefined; + } + /** * Creates a reference expression from a tagged template literal. * @@ -82,16 +106,46 @@ export class ReferenceExpression { return new ReferenceExpression(format, valueProviders); } + /** + * Creates a conditional reference expression from its constituent parts. + * + * @param condition - A value provider whose result is compared to matchValue + * @param whenTrue - The expression to use when the condition matches + * @param whenFalse - The expression to use when the condition does not match + * @param matchValue - The value to compare the condition against (defaults to "True") + * @returns A ReferenceExpression instance in conditional mode + */ + static createConditional( + condition: unknown, + matchValue: string, + whenTrue: ReferenceExpression, + whenFalse: ReferenceExpression + ): ReferenceExpression { + return new ReferenceExpression(condition, matchValue, whenTrue, whenFalse); + } + /** * Serializes the reference expression for JSON-RPC transport. - * In template-literal mode, uses the $expr format. + * In expression mode, uses the $expr format with format + valueProviders. + * In conditional mode, uses the $expr format with condition + whenTrue + whenFalse. * In handle mode, delegates to the handle's serialization. */ - toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } | { condition: unknown; whenTrue: unknown; whenFalse: unknown; matchValue: string } } | MarshalledHandle { if (this._handle) { return this._handle.toJSON(); } + if (this.isConditional) { + return { + $expr: { + condition: extractHandleForExpr(this._condition), + whenTrue: this._whenTrue!.toJSON(), + whenFalse: this._whenFalse!.toJSON(), + matchValue: this._matchValue! + } + }; + } + return { $expr: { format: this._format!, @@ -100,6 +154,30 @@ export class ReferenceExpression { }; } + /** + * Resolves the expression to its string value on the server. + * Only available on server-returned ReferenceExpression instances (handle mode). + * + * @param cancellationToken - Optional AbortSignal or CancellationToken for cancellation support + * @returns The resolved string value, or null if the expression resolves to null + */ + async getValue(cancellationToken?: AbortSignal | CancellationToken): Promise { + if (!this._handle || !this._client) { + throw new Error('getValue is only available on server-returned ReferenceExpression instances'); + } + const cancellationTokenId = registerCancellation(this._client, cancellationToken); + try { + const rpcArgs: Record = { context: this._handle }; + if (cancellationTokenId !== undefined) rpcArgs.cancellationToken = cancellationTokenId; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValue', + rpcArgs + ); + } finally { + unregisterCancellation(cancellationTokenId); + } + } + /** * String representation for debugging. */ @@ -107,10 +185,17 @@ export class ReferenceExpression { if (this._handle) { return `ReferenceExpression(handle)`; } + if (this.isConditional) { + return `ReferenceExpression(conditional)`; + } return `ReferenceExpression(${this._format})`; } } +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression', (handle, client) => + new ReferenceExpression(handle, client) +); + /** * Extracts a value for use in reference expressions. * Supports handles (objects) and string literals. @@ -136,15 +221,15 @@ function extractHandleForExpr(value: unknown): unknown { return value.toJSON(); } - // Objects with $handle property (already in handle format) - if (typeof value === 'object' && value !== null && '$handle' in value) { + // Objects with marshalled expression/handle payloads + if (typeof value === 'object' && value !== null && ('$handle' in value || '$expr' in value)) { return value; } - // Objects with toJSON that returns a handle + // Objects with toJSON that returns a marshalled expression or handle if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { const json = value.toJSON(); - if (json && typeof json === 'object' && '$handle' in json) { + if (json && typeof json === 'object' && ('$handle' in json || '$expr' in json)) { return json; } } @@ -307,11 +392,20 @@ export class AspireList { }) as T[]; } - toJSON(): MarshalledHandle { - if (this._resolvedHandle) { - return this._resolvedHandle.toJSON(); + async toTransportValue(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireList must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); } - return this._handleOrContext.toJSON(); + + return this._resolvedHandle.toJSON(); } } @@ -466,8 +560,19 @@ export class AspireDict { }) as Record; } - async toJSON(): Promise { + async toTransportValue(): Promise { const handle = await this._ensureHandle(); return handle.toJSON(); } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireDict must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); + } + + return this._resolvedHandle.toJSON(); + } } diff --git a/samples/aspire-shop/ts/.modules/transport.ts b/samples/aspire-shop/ts/.modules/transport.ts index 7bddd74b..6d29cf28 100644 --- a/samples/aspire-shop/ts/.modules/transport.ts +++ b/samples/aspire-shop/ts/.modules/transport.ts @@ -77,7 +77,8 @@ export function isAtsError(value: unknown): value is { $error: AtsError } { value !== null && typeof value === 'object' && '$error' in value && - typeof (value as { $error: unknown }).$error === 'object' + typeof (value as { $error: unknown }).$error === 'object' && + (value as { $error: unknown }).$error !== null ); } @@ -93,6 +94,47 @@ export function isMarshalledHandle(value: unknown): value is MarshalledHandle { ); } +function isAbortSignal(value: unknown): value is AbortSignal { + return ( + value !== null && + typeof value === 'object' && + 'aborted' in value && + 'addEventListener' in value && + 'removeEventListener' in value + ); +} + +function isPlainObject(value: unknown): value is Record { + if (value === null || typeof value !== 'object') { + return false; + } + + const prototype = Object.getPrototypeOf(value); + return prototype === Object.prototype || prototype === null; +} + +function hasTransportValue(value: unknown): value is { toTransportValue(): unknown | Promise } { + return ( + value !== null && + typeof value === 'object' && + 'toTransportValue' in value && + typeof (value as { toTransportValue?: unknown }).toTransportValue === 'function' + ); +} + +function createAbortError(message: string): Error { + const error = new Error(message); + error.name = 'AbortError'; + return error; +} + +function createCircularReferenceError(capabilityId: string, path: string): AppHostUsageError { + return new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' contains a circular reference. ` + + 'Circular references are not supported by the AppHost transport.' + ); +} + // ============================================================================ // Handle // ============================================================================ @@ -136,6 +178,92 @@ export class Handle { } } +// ============================================================================ +// CancellationToken +// ============================================================================ + +/** + * Represents a transport-safe cancellation token value for the generated SDK. + * + * Use a plain {@link AbortSignal} when you create cancellation in user code. + * Generated APIs accept either an {@link AbortSignal} or a {@link CancellationToken}. + * + * Values returned from generated callbacks and context/property getters are + * {@link CancellationToken} instances because they may reference remote + * cancellation token handles received from the AppHost. + * + * @example + * ```typescript + * const controller = new AbortController(); + * await connectionStringExpression.getValue(controller.signal); + * ``` + * + * @example + * ```typescript + * const cancellationToken = await context.cancellationToken.get(); + * const connectionStringExpression = await db.uriExpression.get(); + * const connectionString = await connectionStringExpression.getValue(cancellationToken); + * ``` + */ +export class CancellationToken { + private readonly _signal?: AbortSignal; + private readonly _remoteTokenId?: string; + + constructor(signal?: AbortSignal); + constructor(tokenId?: string); + constructor(value?: AbortSignal | string | null) { + if (typeof value === 'string') { + this._remoteTokenId = value; + } else if (isAbortSignal(value)) { + this._signal = value; + } + } + + /** + * Creates a cancellation token from a local {@link AbortSignal}. + */ + static from(signal?: AbortSignal): CancellationToken { + return new CancellationToken(signal); + } + + /** + * Creates a cancellation token from a transport value. + * Generated code uses this to materialize values that come from the AppHost. + */ + static fromValue(value: unknown): CancellationToken { + if (value instanceof CancellationToken) { + return value; + } + + if (typeof value === 'string') { + return new CancellationToken(value); + } + + if (isAbortSignal(value)) { + return new CancellationToken(value); + } + + return new CancellationToken(); + } + + /** + * Serializes the token for JSON-RPC transport. + */ + toJSON(): string | undefined { + return this._remoteTokenId; + } + + register(client?: AspireClient): string | undefined { + if (this._remoteTokenId !== undefined) { + return this._remoteTokenId; + } + + return client + ? registerCancellation(client, this._signal) + : registerCancellation(this._signal); + } +} + // ============================================================================ // Handle Wrapper Registry // ============================================================================ @@ -167,22 +295,35 @@ export function registerHandleWrapper(typeId: string, factory: HandleWrapperFact * @param client - Optional client for creating typed wrapper instances */ export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { - if (value && typeof value === 'object') { - if (isMarshalledHandle(value)) { - const handle = new Handle(value); - const typeId = value.$type; - - // Try to find a registered wrapper factory for this type - if (typeId && client) { - const factory = handleWrapperRegistry.get(typeId); - if (factory) { - return factory(handle, client); - } + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); } + } + + return handle; + } - return handle; + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + value[i] = wrapIfHandle(value[i], client); + } + + return value; + } + + if (isPlainObject(value)) { + for (const [key, nestedValue] of Object.entries(value)) { + value[key] = wrapIfHandle(nestedValue, client); } } + return value; } @@ -213,6 +354,76 @@ export class CapabilityError extends Error { } } +/** + * Error thrown when the AppHost script uses the generated SDK incorrectly. + */ +export class AppHostUsageError extends Error { + constructor(message: string) { + super(message); + this.name = 'AppHostUsageError'; + } +} + +function isPromiseLike(value: unknown): value is PromiseLike { + return ( + value !== null && + (typeof value === 'object' || typeof value === 'function') && + 'then' in value && + typeof (value as { then?: unknown }).then === 'function' + ); +} + +function validateCapabilityArgs( + capabilityId: string, + args?: Record +): void { + if (!args) { + return; + } + + const validateValue = (value: unknown, path: string, ancestors: Set): void => { + if (value === null || value === undefined) { + return; + } + + if (isPromiseLike(value)) { + throw new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' is a Promise-like value. ` + + `This usually means an async builder call was not awaited. ` + + `Did you forget 'await' on a call like builder.addPostgres(...) or resource.addDatabase(...)?` + ); + } + + if (typeof value !== 'object') { + return; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + ancestors.add(value); + try { + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + validateValue(value[i], `${path}[${i}]`, ancestors); + } + return; + } + + for (const [key, nestedValue] of Object.entries(value)) { + validateValue(nestedValue, `${path}.${key}`, ancestors); + } + } finally { + ancestors.delete(value); + } + }; + + for (const [key, value] of Object.entries(args)) { + validateValue(value, key, new Set()); + } +} + // ============================================================================ // Callback Registry // ============================================================================ @@ -324,21 +535,50 @@ export function getCallbackCount(): number { */ const cancellationRegistry = new Map void>(); let cancellationIdCounter = 0; +const connectedClients = new Set(); -/** - * A reference to the current AspireClient for sending cancel requests. - * Set by AspireClient.connect(). - */ -let currentClient: AspireClient | null = null; +function resolveCancellationClient(client?: AspireClient): AspireClient { + if (client) { + return client; + } + + if (connectedClients.size === 1) { + return connectedClients.values().next().value as AspireClient; + } + + if (connectedClients.size === 0) { + throw new Error( + 'registerCancellation(signal) requires a connected AspireClient. ' + + 'Pass the client explicitly or connect the client first.' + ); + } + + throw new Error( + 'registerCancellation(signal) is ambiguous when multiple AspireClient instances are connected. ' + + 'Pass the client explicitly.' + ); +} /** - * Register an AbortSignal for cancellation support. - * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * Registers cancellation support for a local signal or SDK cancellation token. + * Returns a cancellation ID that should be passed to methods accepting cancellation input. * * When the AbortSignal is aborted, sends a cancelToken request to the host. * - * @param signal - The AbortSignal to register (optional) - * @returns The cancellation ID, or undefined if no signal provided + * @param client - The AspireClient that should route the cancellation request + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + */ +export function registerCancellation(client: AspireClient, signalOrToken?: AbortSignal | CancellationToken): string | undefined; +/** + * Registers cancellation support using the single connected AspireClient. + * + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + * + * @example + * const controller = new AbortController(); + * await expression.getValue(controller.signal); * * @example * const controller = new AbortController(); @@ -346,14 +586,29 @@ let currentClient: AspireClient | null = null; * // Pass id to capability invocation * // Later: controller.abort() will cancel the operation */ -export function registerCancellation(signal?: AbortSignal): string | undefined { - if (!signal) { +export function registerCancellation(signalOrToken?: AbortSignal | CancellationToken): string | undefined; +export function registerCancellation( + clientOrSignalOrToken?: AspireClient | AbortSignal | CancellationToken, + maybeSignalOrToken?: AbortSignal | CancellationToken +): string | undefined { + const client = clientOrSignalOrToken instanceof AspireClient ? clientOrSignalOrToken : undefined; + const signalOrToken = client + ? maybeSignalOrToken + : clientOrSignalOrToken as AbortSignal | CancellationToken | undefined; + + if (!signalOrToken) { return undefined; } - // Already aborted? Don't register + if (signalOrToken instanceof CancellationToken) { + return signalOrToken.register(client); + } + + const signal = signalOrToken; + const cancellationClient = resolveCancellationClient(client); + if (signal.aborted) { - return undefined; + throw createAbortError('The operation was aborted before it was sent to the AppHost.'); } const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; @@ -361,8 +616,8 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { // Set up the abort listener const onAbort = () => { // Send cancel request to host - if (currentClient?.connected) { - currentClient.cancelToken(cancellationId).catch(() => { + if (cancellationClient.connected) { + cancellationClient.cancelToken(cancellationId).catch(() => { // Ignore errors - the operation may have already completed }); } @@ -381,6 +636,56 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { return cancellationId; } +async function marshalTransportValue( + value: unknown, + client: AspireClient, + cancellationIds: string[], + capabilityId: string, + path: string = 'args', + ancestors: Set = new Set() +): Promise { + if (value === null || value === undefined || typeof value !== 'object') { + return value; + } + + if (value instanceof CancellationToken) { + const cancellationId = value.register(client); + if (cancellationId !== undefined) { + cancellationIds.push(cancellationId); + } + + return cancellationId; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + const nextAncestors = new Set(ancestors); + nextAncestors.add(value); + + if (hasTransportValue(value)) { + return await marshalTransportValue(await value.toTransportValue(), client, cancellationIds, capabilityId, path, nextAncestors); + } + + if (Array.isArray(value)) { + return await Promise.all( + value.map((item, index) => marshalTransportValue(item, client, cancellationIds, capabilityId, `${path}[${index}]`, nextAncestors)) + ); + } + + if (isPlainObject(value)) { + const entries = await Promise.all( + Object.entries(value).map(async ([key, nestedValue]) => + [key, await marshalTransportValue(nestedValue, client, cancellationIds, capabilityId, `${path}.${key}`, nextAncestors)] as const) + ); + + return Object.fromEntries(entries); + } + + return value; +} + /** * Unregister a cancellation token by its ID. * Call this when the operation completes to clean up resources. @@ -411,6 +716,8 @@ export class AspireClient { private socket: net.Socket | null = null; private disconnectCallbacks: (() => void)[] = []; private _pendingCalls = 0; + private _connectPromise: Promise | null = null; + private _disconnectNotified = false; constructor(private socketPath: string) { } @@ -422,6 +729,12 @@ export class AspireClient { } private notifyDisconnect(): void { + if (this._disconnectNotified) { + return; + } + + this._disconnectNotified = true; + for (const callback of this.disconnectCallbacks) { try { callback(); @@ -432,30 +745,106 @@ export class AspireClient { } connect(timeoutMs: number = 5000): Promise { - return new Promise((resolve, reject) => { - const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + if (this.connected) { + return Promise.resolve(); + } + + if (this._connectPromise) { + return this._connectPromise; + } + + this._disconnectNotified = false; + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this._connectPromise = new Promise((resolve, reject) => { + const socket = net.createConnection(pipePath); + this.socket = socket; - // On Windows, use named pipes; on Unix, use Unix domain sockets - const isWindows = process.platform === 'win32'; - const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + let settled = false; - this.socket = net.createConnection(pipePath); + const cleanupPendingListeners = () => { + socket.removeListener('connect', onConnect); + socket.removeListener('error', onPendingError); + socket.removeListener('close', onPendingClose); + }; - this.socket.once('error', (error: Error) => { + const failConnect = (error: Error) => { + if (settled) { + return; + } + + settled = true; clearTimeout(timeout); + cleanupPendingListeners(); + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + if (!socket.destroyed) { + socket.destroy(); + } + reject(error); - }); + }; + + const onConnectedSocketError = (error: Error) => { + console.error('Socket error:', error); + }; + + const onConnectedSocketClose = () => { + socket.removeListener('error', onConnectedSocketError); + + if (this.socket && this.socket !== socket) { + return; + } + + const connection = this.connection; + this.connection = null; + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + this.notifyDisconnect(); + }; + + const onPendingError = (error: Error) => { + failConnect(error); + }; + + const onPendingClose = () => { + failConnect(new Error('Connection closed before JSON-RPC was established')); + }; + + const onConnect = async () => { + if (settled) { + return; + } - this.socket.once('connect', () => { clearTimeout(timeout); + cleanupPendingListeners(); + try { - const reader = new rpc.SocketMessageReader(this.socket!); - const writer = new rpc.SocketMessageWriter(this.socket!); + const reader = new rpc.SocketMessageReader(socket); + const writer = new rpc.SocketMessageWriter(socket); this.connection = rpc.createMessageConnection(reader, writer); this.connection.onClose(() => { this.connection = null; - this.notifyDisconnect(); }); this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); @@ -475,26 +864,39 @@ export class AspireClient { } }); + socket.on('error', onConnectedSocketError); + socket.on('close', onConnectedSocketClose); + + const authToken = process.env.ASPIRE_REMOTE_APPHOST_TOKEN; + if (!authToken) { + throw new Error('ASPIRE_REMOTE_APPHOST_TOKEN environment variable is not set.'); + } this.connection.listen(); + const authenticated = await this.connection.sendRequest('authenticate', authToken); + if (!authenticated) { + throw new Error('Failed to authenticate to the AppHost server.'); + } - // Set the current client for cancellation registry - currentClient = this; + connectedClients.add(this); + this._connectPromise = null; + settled = true; resolve(); - } catch (e) { - reject(e); + } catch (error) { + failConnect(error instanceof Error ? error : new Error(String(error))); } - }); + }; - this.socket.on('close', () => { - this.connection?.dispose(); - this.connection = null; - if (currentClient === this) { - currentClient = null; - } - this.notifyDisconnect(); - }); + const timeout = setTimeout(() => { + failConnect(new Error('Connection timeout')); + }, timeoutMs); + + socket.once('error', onPendingError); + socket.once('close', onPendingClose); + socket.once('connect', onConnect); }); + + return this._connectPromise; } ping(): Promise { @@ -533,39 +935,66 @@ export class AspireClient { throw new Error('Not connected to AppHost'); } - // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. - // We ref() during RPC calls so the process doesn't exit mid-call, and - // unref() when idle so the process can exit naturally after all work completes. - if (this._pendingCalls === 0) { - this.socket?.ref(); - } - this._pendingCalls++; + validateCapabilityArgs(capabilityId, args); + const cancellationIds: string[] = []; try { - const result = await this.connection.sendRequest( - 'invokeCapability', - capabilityId, - args ?? null - ); + const rpcArgs = await marshalTransportValue(args ?? null, this, cancellationIds, capabilityId); - // Check for structured error response - if (isAtsError(result)) { - throw new CapabilityError(result.$error); + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); } + this._pendingCalls++; - // Wrap handles automatically - return wrapIfHandle(result, this) as T; + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + rpcArgs + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } } finally { - this._pendingCalls--; - if (this._pendingCalls === 0) { - this.socket?.unref(); + for (const cancellationId of cancellationIds) { + unregisterCancellation(cancellationId); } } } disconnect(): void { - try { this.connection?.dispose(); } finally { this.connection = null; } - try { this.socket?.end(); } finally { this.socket = null; } + const connection = this.connection; + const socket = this.socket; + + this.connection = null; + this.socket = null; + this._connectPromise = null; + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + if (socket && !socket.destroyed) { + socket.end(); + socket.destroy(); + } } get connected(): boolean { diff --git a/samples/aspire-shop/ts/apphost.ts b/samples/aspire-shop/ts/apphost.ts index 81df39e2..24aa76ea 100644 --- a/samples/aspire-shop/ts/apphost.ts +++ b/samples/aspire-shop/ts/apphost.ts @@ -40,8 +40,8 @@ const frontend = await builder.addProject("frontend", "../AspireShop.Frontend/As .withHttpHealthCheck({ path: "/health" }) - .withServiceReference(basketService) - .withServiceReference(catalogService) + .withReference(basketService) + .withReference(catalogService) .waitFor(catalogService); await builder.build().run(); diff --git a/samples/aspire-shop/ts/apphost.run.json b/samples/aspire-shop/ts/aspire.config.json similarity index 57% rename from samples/aspire-shop/ts/apphost.run.json rename to samples/aspire-shop/ts/aspire.config.json index 7560a5ad..3b177bf8 100644 --- a/samples/aspire-shop/ts/apphost.run.json +++ b/samples/aspire-shop/ts/aspire.config.json @@ -1,4 +1,13 @@ { + "appHost": { + "path": "apphost.ts", + "language": "typescript/nodejs" + }, + "packages": { + "Aspire.Hosting.JavaScript": "13.2.0", + "Aspire.Hosting.Redis": "13.2.0", + "Aspire.Hosting.PostgreSQL": "13.2.0" + }, "profiles": { "https": { "applicationUrl": "https://localhost:37315;http://localhost:43038", @@ -8,4 +17,4 @@ } } } -} \ No newline at end of file +} diff --git a/samples/aspire-with-azure-functions/ts/.aspire/settings.json b/samples/aspire-with-azure-functions/ts/.aspire/settings.json deleted file mode 100644 index a6bc88b0..00000000 --- a/samples/aspire-with-azure-functions/ts/.aspire/settings.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "appHostPath": "../apphost.ts", - "language": "typescript/nodejs", - "channel": "staging", - "sdkVersion": "13.2.0-preview.1.26159.1", - "packages": { - "Aspire.Hosting.Azure.AppContainers": "13.2.0-preview.1.26159.1", - "Aspire.Hosting.Azure.Storage": "13.2.0-preview.1.26159.1", - "Aspire.Hosting.Azure.Functions": "13.2.0-preview.1.26159.1" - } -} \ No newline at end of file diff --git a/samples/aspire-with-azure-functions/ts/.modules/.codegen-hash b/samples/aspire-with-azure-functions/ts/.modules/.codegen-hash index 896ea9a9..0bbbc659 100644 --- a/samples/aspire-with-azure-functions/ts/.modules/.codegen-hash +++ b/samples/aspire-with-azure-functions/ts/.modules/.codegen-hash @@ -1 +1 @@ -74DF45CA80E160A211D073E6A077C37D170FF22691C6920AC5C042F48ED9EFF7 \ No newline at end of file +8997E7E376E2000CFBB2CA2DEFABAB60FE6DC34FDDF6EA5442E13306BDBD6EEA \ No newline at end of file diff --git a/samples/aspire-with-azure-functions/ts/.modules/aspire.ts b/samples/aspire-with-azure-functions/ts/.modules/aspire.ts index 983e0579..1d486fa6 100644 --- a/samples/aspire-with-azure-functions/ts/.modules/aspire.ts +++ b/samples/aspire-with-azure-functions/ts/.modules/aspire.ts @@ -8,6 +8,8 @@ import { AspireClient as AspireClientRpc, Handle, MarshalledHandle, + AppHostUsageError, + CancellationToken, CapabilityError, registerCallback, wrapIfHandle, @@ -89,9 +91,30 @@ type BicepOutputReferenceHandle = Handle<'Aspire.Hosting.Azure/Aspire.Hosting.Az /** Handle to IAzureKeyVaultSecretReference */ type IAzureKeyVaultSecretReferenceHandle = Handle<'Aspire.Hosting.Azure/Aspire.Hosting.Azure.IAzureKeyVaultSecretReference'>; +/** Handle to JavaScriptAppResource */ +type JavaScriptAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource'>; + +/** Handle to NodeAppResource */ +type NodeAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource'>; + +/** Handle to ViteAppResource */ +type ViteAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource'>; + +/** Handle to AfterResourcesCreatedEvent */ +type AfterResourcesCreatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent'>; + +/** Handle to BeforeResourceStartedEvent */ +type BeforeResourceStartedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent'>; + +/** Handle to BeforeStartEvent */ +type BeforeStartEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent'>; + /** Handle to CommandLineArgsCallbackContext */ type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; +/** Handle to ConnectionStringAvailableEvent */ +type ConnectionStringAvailableEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent'>; + /** Handle to ContainerRegistryResource */ type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; @@ -101,6 +124,9 @@ type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Application /** Handle to CSharpAppResource */ type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; +/** Handle to DistributedApplicationModel */ +type DistributedApplicationModelHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel'>; + /** Handle to DotnetToolResource */ type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; @@ -125,6 +151,9 @@ type IComputeResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationM /** Handle to IContainerFilesDestinationResource */ type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; +/** Handle to InitializeResourceEvent */ +type InitializeResourceEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent'>; + /** Handle to IResource */ type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; @@ -155,15 +184,27 @@ type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicati /** Handle to ReferenceExpressionBuilder */ type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; +/** Handle to ResourceEndpointsAllocatedEvent */ +type ResourceEndpointsAllocatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent'>; + /** Handle to ResourceLoggerService */ type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; /** Handle to ResourceNotificationService */ type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; +/** Handle to ResourceReadyEvent */ +type ResourceReadyEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent'>; + +/** Handle to ResourceStoppedEvent */ +type ResourceStoppedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent'>; + /** Handle to ResourceUrlsCallbackContext */ type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; +/** Handle to UpdateCommandStateContext */ +type UpdateCommandStateContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext'>; + /** Handle to ConnectionStringResource */ type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; @@ -188,18 +229,33 @@ type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hostin /** Handle to IResourceWithContainerFiles */ type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; -/** Handle to IResourceWithServiceDiscovery */ -type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; +/** Handle to IUserSecretsManager */ +type IUserSecretsManagerHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IUserSecretsManager'>; + +/** Handle to IReportingStep */ +type IReportingStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep'>; + +/** Handle to IReportingTask */ +type IReportingTaskHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask'>; /** Handle to PipelineConfigurationContext */ type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; +/** Handle to PipelineContext */ +type PipelineContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext'>; + /** Handle to PipelineStep */ type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; /** Handle to PipelineStepContext */ type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; +/** Handle to PipelineStepFactoryContext */ +type PipelineStepFactoryContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext'>; + +/** Handle to PipelineSummary */ +type PipelineSummaryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary'>; + /** Handle to ProjectResourceOptions */ type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; @@ -218,12 +274,18 @@ type ContainerAppJobHandle = Handle<'Azure.Provisioning.AppContainers/Azure.Prov /** Handle to IConfiguration */ type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; +/** Handle to IConfigurationSection */ +type IConfigurationSectionHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfigurationSection'>; + /** Handle to IHostEnvironment */ type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; /** Handle to ILogger */ type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; +/** Handle to ILoggerFactory */ +type ILoggerFactoryHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory'>; + /** Handle to string[] */ type stringArrayHandle = Handle<'string[]'>; @@ -305,6 +367,7 @@ export enum EndpointProperty { Scheme = "Scheme", TargetPort = "TargetPort", HostAndPort = "HostAndPort", + TlsEnabled = "TlsEnabled", } /** Enum type for IconVariant */ @@ -440,6 +503,10 @@ export interface AddConnectionStringOptions { environmentVariableName?: string; } +export interface AddContainerRegistryFromStringOptions { + repository?: string; +} + export interface AddContainerRegistryOptions { repository?: ParameterResource; } @@ -453,6 +520,10 @@ export interface AddDockerfileOptions { stage?: string; } +export interface AddJavaScriptAppOptions { + runScriptName?: string; +} + export interface AddParameterFromConfigurationOptions { secret?: boolean; } @@ -461,10 +532,19 @@ export interface AddParameterOptions { secret?: boolean; } +export interface AddParameterWithValueOptions { + publishValueAsDefault?: boolean; + secret?: boolean; +} + export interface AddQueueOptions { queueName?: string; } +export interface AddViteAppOptions { + runScriptName?: string; +} + export interface AppendFormattedOptions { format?: string; } @@ -473,26 +553,80 @@ export interface AppendValueProviderOptions { format?: string; } +export interface CompleteStepMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteStepOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskOptions { + completionMessage?: string; + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateMarkdownTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + export interface GetValueAsyncOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; } export interface PublishAsConfiguredScheduledAzureContainerAppJobOptions { configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise; } +export interface PublishAsDockerFileOptions { + configure?: (obj: ContainerResource) => Promise; +} + +export interface PublishResourceUpdateOptions { + state?: string; + stateStyle?: string; +} + export interface RunAsEmulatorOptions { configureContainer?: (obj: AzureStorageEmulatorResource) => Promise; } export interface RunOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface SaveStateJsonOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskMarkdownOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; } export interface WaitForCompletionOptions { exitCode?: number; } +export interface WaitForResourceStateOptions { + targetState?: string; +} + export interface WithApiVersionCheckOptions { enable?: boolean; } @@ -501,6 +635,19 @@ export interface WithBindMountOptions { isReadOnly?: boolean; } +export interface WithBrowserDebuggerOptions { + browser?: string; +} + +export interface WithBuildScriptOptions { + args?: string[]; +} + +export interface WithBunOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithCommandOptions { commandOptions?: CommandOptions; } @@ -602,6 +749,12 @@ export interface WithMcpServerOptions { endpointName?: string; } +export interface WithNpmOptions { + install?: boolean; + installCommand?: string; + installArgs?: string[]; +} + export interface WithPipelineStepFactoryOptions { dependsOn?: string[]; requiredBy?: string[]; @@ -609,6 +762,11 @@ export interface WithPipelineStepFactoryOptions { description?: string; } +export interface WithPnpmOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithPurgeTaskOptions { filter?: string; ago?: number; @@ -619,12 +777,17 @@ export interface WithPurgeTaskOptions { export interface WithReferenceOptions { connectionName?: string; optional?: boolean; + name?: string; } export interface WithRequiredCommandOptions { helpLink?: string; } +export interface WithRunScriptOptions { + args?: string[]; +} + export interface WithUrlExpressionOptions { displayText?: string; } @@ -638,6 +801,48 @@ export interface WithVolumeOptions { isReadOnly?: boolean; } +export interface WithYarnOptions { + install?: boolean; + installArgs?: string[]; +} + +// ============================================================================ +// AfterResourcesCreatedEvent +// ============================================================================ + +/** + * Type class for AfterResourcesCreatedEvent. + */ +export class AfterResourcesCreatedEvent { + constructor(private _handle: AfterResourcesCreatedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + // ============================================================================ // AzureResourceInfrastructure // ============================================================================ @@ -679,6 +884,80 @@ export class AzureResourceInfrastructure { } +// ============================================================================ +// BeforeResourceStartedEvent +// ============================================================================ + +/** + * Type class for BeforeResourceStartedEvent. + */ +export class BeforeResourceStartedEvent { + constructor(private _handle: BeforeResourceStartedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeStartEvent +// ============================================================================ + +/** + * Type class for BeforeStartEvent. + */ +export class BeforeStartEvent { + constructor(private _handle: BeforeStartEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + // ============================================================================ // BicepOutputReference // ============================================================================ @@ -753,11 +1032,12 @@ export class CommandLineArgsCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, }; @@ -772,6 +1052,65 @@ export class CommandLineArgsCallbackContext { }, }; + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ConnectionStringAvailableEvent +// ============================================================================ + +/** + * Type class for ConnectionStringAvailableEvent. + */ +export class ConnectionStringAvailableEvent { + constructor(private _handle: ConnectionStringAvailableEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + } // ============================================================================ @@ -789,9 +1128,9 @@ export class DistributedApplication { /** Runs the distributed application */ /** @internal */ - async _runInternal(cancellationToken?: AbortSignal): Promise { + async _runInternal(cancellationToken?: AbortSignal | CancellationToken): Promise { const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); await this._client.invokeCapability( 'Aspire.Hosting/run', rpcArgs @@ -865,6 +1204,17 @@ export class DistributedApplicationExecutionContext { }, }; + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the IsPublishMode property */ isPublishMode = { get: async (): Promise => { @@ -887,6 +1237,70 @@ export class DistributedApplicationExecutionContext { } +// ============================================================================ +// DistributedApplicationModel +// ============================================================================ + +/** + * Type class for DistributedApplicationModel. + */ +export class DistributedApplicationModel { + constructor(private _handle: DistributedApplicationModelHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets resources from the distributed application model */ + async getResources(): Promise { + const rpcArgs: Record = { model: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResources', + rpcArgs + ); + } + + /** Finds a resource by name */ + /** @internal */ + async _findResourceByNameInternal(name: string): Promise { + const rpcArgs: Record = { model: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/findResourceByName', + rpcArgs + ); + return new Resource(result, this._client); + } + + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._findResourceByNameInternal(name)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationModel that enables fluent chaining. + */ +export class DistributedApplicationModelPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationModel) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets resources from the distributed application model */ + getResources(): Promise { + return this._promise.then(obj => obj.getResources()); + } + + /** Finds a resource by name */ + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.findResourceByName(name))); + } + +} + // ============================================================================ // EndpointReference // ============================================================================ @@ -900,6 +1314,17 @@ export class EndpointReference { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.resource', + { context: this._handle } + ); + return new ResourceWithEndpoints(handle, this._client); + }, + }; + /** Gets the EndpointName property */ endpointName = { get: async (): Promise => { @@ -966,6 +1391,16 @@ export class EndpointReference { }, }; + /** Gets the TlsEnabled property */ + tlsEnabled = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.tlsEnabled', + { context: this._handle } + ); + }, + }; + /** Gets the Port property */ port = { get: async (): Promise => { @@ -1020,13 +1455,22 @@ export class EndpointReference { async getValueAsync(options?: GetValueAsyncOptions): Promise { const cancellationToken = options?.cancellationToken; const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); return await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/getValueAsync', rpcArgs ); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + async getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + const rpcArgs: Record = { context: this._handle, enabledValue, disabledValue }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.getTlsValue', + rpcArgs + ); + } + } /** @@ -1047,6 +1491,11 @@ export class EndpointReferencePromise implements PromiseLike return this._promise.then(obj => obj.getValueAsync(options)); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + return this._promise.then(obj => obj.getTlsValue(enabledValue, disabledValue)); + } + } // ============================================================================ @@ -1124,11 +1573,34 @@ export class EnvironmentCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; @@ -1158,6 +1630,17 @@ export class ExecuteCommandContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the ResourceName property */ resourceName = { get: async (): Promise => { @@ -1176,22 +1659,93 @@ export class ExecuteCommandContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, - set: async (value: AbortSignal): Promise => { + set: async (value: AbortSignal | CancellationToken): Promise => { await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', - { context: this._handle, value } + { context: this._handle, value: CancellationToken.fromValue(value) } ); } }; } +// ============================================================================ +// InitializeResourceEvent +// ============================================================================ + +/** + * Type class for InitializeResourceEvent. + */ +export class InitializeResourceEvent { + constructor(private _handle: InitializeResourceEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Notifications property */ + notifications = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.notifications', + { context: this._handle } + ); + return new ResourceNotificationService(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + // ============================================================================ // PipelineConfigurationContext // ============================================================================ @@ -1205,6 +1759,17 @@ export class PipelineConfigurationContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the Steps property */ steps = { get: async (): Promise => { @@ -1221,6 +1786,17 @@ export class PipelineConfigurationContext { } }; + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + /** Gets pipeline steps with the specified tag */ async getStepsByTag(tag: string): Promise { const rpcArgs: Record = { context: this._handle, tag }; @@ -1252,6 +1828,93 @@ export class PipelineConfigurationContextPromise implements PromiseLike => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + set: async (value: AbortSignal | CancellationToken): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.setCancellationToken', + { context: this._handle, value: CancellationToken.fromValue(value) } + ); + } + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + // ============================================================================ // PipelineStep // ============================================================================ @@ -1339,6 +2002,17 @@ export class PipelineStep { return this._tags; } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + /** Adds a dependency on another step by name */ /** @internal */ async _dependsOnInternal(stepName: string): Promise { @@ -1409,6 +2083,39 @@ export class PipelineStepContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the ReportingStep property */ + reportingStep = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.reportingStep', + { context: this._handle } + ); + return new ReportingStep(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + /** Gets the ExecutionContext property */ executionContext = { get: async (): Promise => { @@ -1420,18 +2127,159 @@ export class PipelineStepContext { }, }; + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineStepFactoryContext +// ============================================================================ + +/** + * Type class for PipelineStepFactoryContext. + */ +export class PipelineStepFactoryContext { + constructor(private _handle: PipelineStepFactoryContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; } +// ============================================================================ +// PipelineSummary +// ============================================================================ + +/** + * Type class for PipelineSummary. + */ +export class PipelineSummary { + constructor(private _handle: PipelineSummaryHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Add method */ + /** @internal */ + async _addInternal(key: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, key, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineSummary.add', + rpcArgs + ); + return this; + } + + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addInternal(key, value)); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + /** @internal */ + async _addMarkdownInternal(key: string, markdownString: string): Promise { + const rpcArgs: Record = { summary: this._handle, key, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/addMarkdown', + rpcArgs + ); + return this; + } + + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addMarkdownInternal(key, markdownString)); + } + +} + +/** + * Thenable wrapper for PipelineSummary that enables fluent chaining. + */ +export class PipelineSummaryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineSummary) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Add method */ + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.add(key, value))); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.addMarkdown(key, markdownString))); + } + +} + // ============================================================================ // ProjectResourceOptions // ============================================================================ @@ -1613,6 +2461,325 @@ export class ReferenceExpressionBuilderPromise implements PromiseLike => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ResourceLoggerService +// ============================================================================ + +/** + * Type class for ResourceLoggerService. + */ +export class ResourceLoggerService { + constructor(private _handle: ResourceLoggerServiceHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Completes the log stream for a resource */ + /** @internal */ + async _completeLogInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { loggerService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLog', + rpcArgs + ); + return this; + } + + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogInternal(resource)); + } + + /** Completes the log stream by resource name */ + /** @internal */ + async _completeLogByNameInternal(resourceName: string): Promise { + const rpcArgs: Record = { loggerService: this._handle, resourceName }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLogByName', + rpcArgs + ); + return this; + } + + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogByNameInternal(resourceName)); + } + +} + +/** + * Thenable wrapper for ResourceLoggerService that enables fluent chaining. + */ +export class ResourceLoggerServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceLoggerService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Completes the log stream for a resource */ + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLog(resource))); + } + + /** Completes the log stream by resource name */ + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLogByName(resourceName))); + } + +} + +// ============================================================================ +// ResourceNotificationService +// ============================================================================ + +/** + * Type class for ResourceNotificationService. + */ +export class ResourceNotificationService { + constructor(private _handle: ResourceNotificationServiceHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Waits for a resource to reach a specified state */ + /** @internal */ + async _waitForResourceStateInternal(resourceName: string, targetState?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + if (targetState !== undefined) rpcArgs.targetState = targetState; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceState', + rpcArgs + ); + return this; + } + + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + const targetState = options?.targetState; + return new ResourceNotificationServicePromise(this._waitForResourceStateInternal(resourceName, targetState)); + } + + /** Waits for a resource to reach one of the specified states */ + async waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName, targetStates }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStates', + rpcArgs + ); + } + + /** Waits for a resource to become healthy */ + async waitForResourceHealthy(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceHealthy', + rpcArgs + ); + } + + /** Waits for all dependencies of a resource to be ready */ + /** @internal */ + async _waitForDependenciesInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForDependencies', + rpcArgs + ); + return this; + } + + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._waitForDependenciesInternal(resource)); + } + + /** Tries to get the current state of a resource */ + async tryGetResourceState(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/tryGetResourceState', + rpcArgs + ); + } + + /** Publishes an update for a resource's state */ + /** @internal */ + async _publishResourceUpdateInternal(resource: ResourceBuilderBase, state?: string, stateStyle?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + if (state !== undefined) rpcArgs.state = state; + if (stateStyle !== undefined) rpcArgs.stateStyle = stateStyle; + await this._client.invokeCapability( + 'Aspire.Hosting/publishResourceUpdate', + rpcArgs + ); + return this; + } + + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + const state = options?.state; + const stateStyle = options?.stateStyle; + return new ResourceNotificationServicePromise(this._publishResourceUpdateInternal(resource, state, stateStyle)); + } + +} + +/** + * Thenable wrapper for ResourceNotificationService that enables fluent chaining. + */ +export class ResourceNotificationServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceNotificationService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Waits for a resource to reach a specified state */ + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForResourceState(resourceName, options))); + } + + /** Waits for a resource to reach one of the specified states */ + waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + return this._promise.then(obj => obj.waitForResourceStates(resourceName, targetStates)); + } + + /** Waits for a resource to become healthy */ + waitForResourceHealthy(resourceName: string): Promise { + return this._promise.then(obj => obj.waitForResourceHealthy(resourceName)); + } + + /** Waits for all dependencies of a resource to be ready */ + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForDependencies(resource))); + } + + /** Tries to get the current state of a resource */ + tryGetResourceState(resourceName: string): Promise { + return this._promise.then(obj => obj.tryGetResourceState(resourceName)); + } + + /** Publishes an update for a resource's state */ + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.publishResourceUpdate(resource, options))); + } + +} + +// ============================================================================ +// ResourceReadyEvent +// ============================================================================ + +/** + * Type class for ResourceReadyEvent. + */ +export class ResourceReadyEvent { + constructor(private _handle: ResourceReadyEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ResourceStoppedEvent +// ============================================================================ + +/** + * Type class for ResourceStoppedEvent. + */ +export class ResourceStoppedEvent { + constructor(private _handle: ResourceStoppedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + // ============================================================================ // ResourceUrlsCallbackContext // ============================================================================ @@ -1626,6 +2793,17 @@ export class ResourceUrlsCallbackContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + /** Gets the Urls property */ private _urls?: AspireList; get urls(): AspireList { @@ -1642,11 +2820,23 @@ export class ResourceUrlsCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); }, }; @@ -1663,6 +2853,132 @@ export class ResourceUrlsCallbackContext { } +// ============================================================================ +// UpdateCommandStateContext +// ============================================================================ + +/** + * Type class for UpdateCommandStateContext. + */ +export class UpdateCommandStateContext { + constructor(private _handle: UpdateCommandStateContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/UpdateCommandStateContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// Configuration +// ============================================================================ + +/** + * Type class for Configuration. + */ +export class Configuration { + constructor(private _handle: IConfigurationHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets a configuration value by key */ + async getConfigValue(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConfigValue', + rpcArgs + ); + } + + /** Gets a connection string by name */ + async getConnectionString(name: string): Promise { + const rpcArgs: Record = { configuration: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionString', + rpcArgs + ); + } + + /** Gets a configuration section by key */ + async getSection(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getSection', + rpcArgs + ); + } + + /** Gets child configuration sections */ + async getChildren(): Promise { + const rpcArgs: Record = { configuration: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getChildren', + rpcArgs + ); + } + + /** Checks whether a configuration section exists */ + async exists(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/exists', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for Configuration that enables fluent chaining. + */ +export class ConfigurationPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Configuration) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets a configuration value by key */ + getConfigValue(key: string): Promise { + return this._promise.then(obj => obj.getConfigValue(key)); + } + + /** Gets a connection string by name */ + getConnectionString(name: string): Promise { + return this._promise.then(obj => obj.getConnectionString(name)); + } + + /** Gets a configuration section by key */ + getSection(key: string): Promise { + return this._promise.then(obj => obj.getSection(key)); + } + + /** Gets child configuration sections */ + getChildren(): Promise { + return this._promise.then(obj => obj.getChildren()); + } + + /** Checks whether a configuration section exists */ + exists(key: string): Promise { + return this._promise.then(obj => obj.exists(key)); + } + +} + // ============================================================================ // DistributedApplicationBuilder // ============================================================================ @@ -1686,6 +3002,17 @@ export class DistributedApplicationBuilder { }, }; + /** Gets the Environment property */ + environment = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.environment', + { context: this._handle } + ); + return new HostEnvironment(handle, this._client); + }, + }; + /** Gets the Eventing property */ eventing = { get: async (): Promise => { @@ -1708,6 +3035,17 @@ export class DistributedApplicationBuilder { }, }; + /** Gets the UserSecretsManager property */ + userSecretsManager = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.userSecretsManager', + { context: this._handle } + ); + return new UserSecretsManager(handle, this._client); + }, + }; + /** Builds the distributed application */ /** @internal */ async _buildInternal(): Promise { @@ -1723,6 +3061,21 @@ export class DistributedApplicationBuilder { return new DistributedApplicationPromise(this._buildInternal()); } + /** Adds a connection string with a reference expression */ + /** @internal */ + async _addConnectionStringExpressionInternal(name: string, connectionStringExpression: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, connectionStringExpression }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionStringExpression', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringExpressionInternal(name, connectionStringExpression)); + } + /** Adds a connection string with a builder callback */ /** @internal */ async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { @@ -1760,6 +3113,23 @@ export class DistributedApplicationBuilder { return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); } + /** Adds a container registry with string endpoint */ + /** @internal */ + async _addContainerRegistryFromStringInternal(name: string, endpoint: string, repository?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistryFromString', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryFromStringInternal(name, endpoint, repository)); + } + /** Adds a container resource */ /** @internal */ async _addContainerInternal(name: string, image: string): Promise { @@ -1839,6 +3209,36 @@ export class DistributedApplicationBuilder { return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); } + /** Adds an external service with a URI */ + /** @internal */ + async _addExternalServiceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceUri', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceUriInternal(name, uri)); + } + + /** Adds an external service with a parameter URL */ + /** @internal */ + async _addExternalServiceParameterInternal(name: string, urlParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, urlParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceParameter', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceParameterInternal(name, urlParameter)); + } + /** Adds a parameter resource */ /** @internal */ async _addParameterInternal(name: string, secret?: boolean): Promise { @@ -1856,6 +3256,25 @@ export class DistributedApplicationBuilder { return new ParameterResourcePromise(this._addParameterInternal(name, secret)); } + /** Adds a parameter with a default value */ + /** @internal */ + async _addParameterWithValueInternal(name: string, value: string, publishValueAsDefault?: boolean, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + if (publishValueAsDefault !== undefined) rpcArgs.publishValueAsDefault = publishValueAsDefault; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterWithValue', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + const publishValueAsDefault = options?.publishValueAsDefault; + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterWithValueInternal(name, value, publishValueAsDefault, secret)); + } + /** Adds a parameter sourced from configuration */ /** @internal */ async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { @@ -1960,57 +3379,149 @@ export class DistributedApplicationBuilder { return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); } - /** Adds an Azure Container App Environment resource */ + /** Gets the application configuration */ /** @internal */ - async _addAzureContainerAppEnvironmentInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.AppContainers/addAzureContainerAppEnvironment', + async _getConfigurationInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getConfiguration', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new Configuration(result, this._client); } - addAzureContainerAppEnvironment(name: string): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._addAzureContainerAppEnvironmentInternal(name)); + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._getConfigurationInternal()); } - /** Adds an Azure Storage resource */ - /** @internal */ - async _addAzureStorageInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/addAzureStorage', + /** Subscribes to the BeforeStart event */ + async subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeStartEventHandle; + const arg = new BeforeStartEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeBeforeStart', rpcArgs ); - return new AzureStorageResource(result, this._client); } - addAzureStorage(name: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._addAzureStorageInternal(name)); + /** Subscribes to the AfterResourcesCreated event */ + async subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as AfterResourcesCreatedEventHandle; + const arg = new AfterResourcesCreatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeAfterResourcesCreated', + rpcArgs + ); } - /** Adds an Azure Functions project to the distributed application */ + /** Adds a Node.js application resource */ /** @internal */ - async _addAzureFunctionsProjectInternal(name: string, projectPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, projectPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Functions/addAzureFunctionsProject', + async _addNodeAppInternal(name: string, appDirectory: string, scriptPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory, scriptPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addNodeApp', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new NodeAppResource(result, this._client); } - addAzureFunctionsProject(name: string, projectPath: string): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._addAzureFunctionsProjectInternal(name, projectPath)); + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._addNodeAppInternal(name, appDirectory, scriptPath)); } - /** Adds an Azure Bicep template resource from a file */ + /** Adds a JavaScript application resource */ /** @internal */ - async _addBicepTemplateInternal(name: string, bicepFile: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, bicepFile }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/addBicepTemplate', + async _addJavaScriptAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addJavaScriptApp', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + const runScriptName = options?.runScriptName; + return new JavaScriptAppResourcePromise(this._addJavaScriptAppInternal(name, appDirectory, runScriptName)); + } + + /** Adds a Vite application resource */ + /** @internal */ + async _addViteAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addViteApp', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + const runScriptName = options?.runScriptName; + return new ViteAppResourcePromise(this._addViteAppInternal(name, appDirectory, runScriptName)); + } + + /** Adds an Azure Container App Environment resource */ + /** @internal */ + async _addAzureContainerAppEnvironmentInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/addAzureContainerAppEnvironment', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); + } + + addAzureContainerAppEnvironment(name: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._addAzureContainerAppEnvironmentInternal(name)); + } + + /** Adds an Azure Storage resource */ + /** @internal */ + async _addAzureStorageInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addAzureStorage', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + addAzureStorage(name: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._addAzureStorageInternal(name)); + } + + /** Adds an Azure Functions project to the distributed application */ + /** @internal */ + async _addAzureFunctionsProjectInternal(name: string, projectPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Functions/addAzureFunctionsProject', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + addAzureFunctionsProject(name: string, projectPath: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._addAzureFunctionsProjectInternal(name, projectPath)); + } + + /** Adds an Azure Bicep template resource from a file */ + /** @internal */ + async _addBicepTemplateInternal(name: string, bicepFile: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepFile }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/addBicepTemplate', rpcArgs ); return new AzureBicepResource(result, this._client); @@ -2150,6 +3661,11 @@ export class DistributedApplicationBuilderPromise implements PromiseLike obj.build())); } + /** Adds a connection string with a reference expression */ + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringExpression(name, connectionStringExpression))); + } + /** Adds a connection string with a builder callback */ addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); @@ -2160,6 +3676,11 @@ export class DistributedApplicationBuilderPromise implements PromiseLike obj.addContainerRegistry(name, endpoint, options))); } + /** Adds a container registry with string endpoint */ + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistryFromString(name, endpoint, options))); + } + /** Adds a container resource */ addContainer(name: string, image: string): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); @@ -2185,11 +3706,26 @@ export class DistributedApplicationBuilderPromise implements PromiseLike obj.addExternalService(name, url))); } + /** Adds an external service with a URI */ + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceUri(name, uri))); + } + + /** Adds an external service with a parameter URL */ + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceParameter(name, urlParameter))); + } + /** Adds a parameter resource */ addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); } + /** Adds a parameter with a default value */ + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterWithValue(name, value, options))); + } + /** Adds a parameter sourced from configuration */ addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); @@ -2220,6 +3756,36 @@ export class DistributedApplicationBuilderPromise implements PromiseLike obj.addCSharpAppWithOptions(name, path, configure))); } + /** Gets the application configuration */ + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._promise.then(obj => obj.getConfiguration())); + } + + /** Subscribes to the BeforeStart event */ + subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeBeforeStart(callback)); + } + + /** Subscribes to the AfterResourcesCreated event */ + subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeAfterResourcesCreated(callback)); + } + + /** Adds a Node.js application resource */ + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.addNodeApp(name, appDirectory, scriptPath))); + } + + /** Adds a JavaScript application resource */ + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.addJavaScriptApp(name, appDirectory, options))); + } + + /** Adds a Vite application resource */ + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.addViteApp(name, appDirectory, options))); + } + /** Adds an Azure Container App Environment resource */ addAzureContainerAppEnvironment(name: string): AzureContainerAppEnvironmentResourcePromise { return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.addAzureContainerAppEnvironment(name))); @@ -2328,1001 +3894,1013 @@ export class DistributedApplicationEventingPromise implements PromiseLike { - constructor(handle: AzureBicepResourceHandle, client: AspireClientRpc) { - super(handle, client); - } +/** + * Type class for HostEnvironment. + */ +export class HostEnvironment { + constructor(private _handle: IHostEnvironmentHandle, private _client: AspireClientRpc) {} - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Checks if running in Development environment */ + async isDevelopment(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isDevelopment', rpcArgs ); - return new AzureBicepResource(result, this._client); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withContainerRegistryInternal(registry)); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + /** Checks if running in Production environment */ + async isProduction(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isProduction', rpcArgs ); - return new AzureBicepResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBicepResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new AzureBicepResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Checks if running in Staging environment */ + async isStaging(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isStaging', + rpcArgs + ); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + /** Checks if the environment matches the specified name */ + async isEnvironment(environmentName: string): Promise { + const rpcArgs: Record = { environment: this._handle, environmentName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isEnvironment', rpcArgs ); - return new AzureBicepResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBicepResourcePromise { - const helpLink = options?.helpLink; - return new AzureBicepResourcePromise(this._withRequiredCommandInternal(command, helpLink)); +} + +/** + * Thenable wrapper for HostEnvironment that enables fluent chaining. + */ +export class HostEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: HostEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new AzureBicepResource(result, this._client); + /** Checks if running in Development environment */ + isDevelopment(): Promise { + return this._promise.then(obj => obj.isDevelopment()); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Checks if running in Production environment */ + isProduction(): Promise { + return this._promise.then(obj => obj.isProduction()); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new AzureBicepResource(result, this._client); + /** Checks if running in Staging environment */ + isStaging(): Promise { + return this._promise.then(obj => obj.isStaging()); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Checks if the environment matches the specified name */ + isEnvironment(environmentName: string): Promise { + return this._promise.then(obj => obj.isEnvironment(environmentName)); } +} + +// ============================================================================ +// Logger +// ============================================================================ + +/** + * Type class for Logger. + */ +export class Logger { + constructor(private _handle: ILoggerHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Logs an information message */ /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + async _logInformationInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logInformation', rpcArgs ); - return new AzureBicepResource(result, this._client); + return this; } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureBicepResourcePromise { - const displayText = options?.displayText; - return new AzureBicepResourcePromise(this._withUrlInternal(url, displayText)); + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._logInformationInternal(message)); } + /** Logs a warning message */ /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + async _logWarningInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logWarning', rpcArgs ); - return new AzureBicepResource(result, this._client); + return this; } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBicepResourcePromise { - const displayText = options?.displayText; - return new AzureBicepResourcePromise(this._withUrlExpressionInternal(url, displayText)); + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._logWarningInternal(message)); } + /** Logs an error message */ /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + async _logErrorInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logError', rpcArgs ); - return new AzureBicepResource(result, this._client); + return this; } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + logError(message: string): LoggerPromise { + return new LoggerPromise(this._logErrorInternal(message)); } + /** Logs a debug message */ /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + async _logDebugInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logDebug', rpcArgs ); - return new AzureBicepResource(result, this._client); + return this; } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._excludeFromManifestInternal()); + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._logDebugInternal(message)); } + /** Logs a message with specified level */ /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + async _logInternal(level: string, message: string): Promise { + const rpcArgs: Record = { logger: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/log', rpcArgs ); - return new AzureBicepResource(result, this._client); + return this; } - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withExplicitStartInternal()); + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._logInternal(level, message)); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new AzureBicepResource(result, this._client); +} + +/** + * Thenable wrapper for Logger that enables fluent chaining. + */ +export class LoggerPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Logger) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a health check by key */ - withHealthCheck(key: string): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withHealthCheckInternal(key)); + /** Logs an information message */ + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logInformation(message))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new AzureBicepResource(result, this._client); + /** Logs a warning message */ + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logWarning(message))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBicepResourcePromise { - const commandOptions = options?.commandOptions; - return new AzureBicepResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Logs an error message */ + logError(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logError(message))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new AzureBicepResource(result, this._client); + /** Logs a debug message */ + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logDebug(message))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withParentRelationshipInternal(parent)); + /** Logs a message with specified level */ + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.log(level, message))); } +} + +// ============================================================================ +// LoggerFactory +// ============================================================================ + +/** + * Type class for LoggerFactory. + */ +export class LoggerFactory { + constructor(private _handle: ILoggerFactoryHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Creates a logger for a category */ /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + async _createLoggerInternal(categoryName: string): Promise { + const rpcArgs: Record = { loggerFactory: this._handle, categoryName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createLogger', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new Logger(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withChildRelationshipInternal(child)); + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._createLoggerInternal(categoryName)); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new AzureBicepResource(result, this._client); +} + +/** + * Thenable wrapper for LoggerFactory that enables fluent chaining. + */ +export class LoggerFactoryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: LoggerFactory) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureBicepResourcePromise { - const iconVariant = options?.iconVariant; - return new AzureBicepResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Creates a logger for a category */ + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.createLogger(categoryName))); } +} + +// ============================================================================ +// ReportingStep +// ============================================================================ + +/** + * Type class for ReportingStep. + */ +export class ReportingStep { + constructor(private _handle: IReportingStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Creates a reporting task with plain-text status text */ /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + async _createTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createTask', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new ReportingTask(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._excludeFromMcpInternal()); + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createTaskInternal(statusText, cancellationToken)); } + /** Creates a reporting task with Markdown-formatted status text */ /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + async _createMarkdownTaskInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createMarkdownTask', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new ReportingTask(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createMarkdownTaskInternal(markdownString, cancellationToken)); } + /** Logs a plain-text message for the reporting step */ /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + async _logStepInternal(level: string, message: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStep', rpcArgs ); - return new AzureBicepResource(result, this._client); + return this; } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepInternal(level, message)); } + /** Logs a Markdown-formatted message for the reporting step */ /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + async _logStepMarkdownInternal(level: string, markdownString: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStepMarkdown', rpcArgs ); - return new AzureBicepResource(result, this._client); + return this; } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBicepResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new AzureBicepResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepMarkdownInternal(level, markdownString)); } + /** Completes the reporting step with plain-text completion text */ /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + async _completeStepInternal(completionText: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, completionText }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStep', rpcArgs ); - return new AzureBicepResource(result, this._client); + return this; } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepInternal(completionText, completionState, cancellationToken)); } + /** Completes the reporting step with Markdown-formatted completion text */ /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + async _completeStepMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStepMarkdown', rpcArgs ); - return new AzureBicepResource(result, this._client); + return this; } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withPipelineConfigurationInternal(callback)); + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepMarkdownInternal(markdownString, completionState, cancellationToken)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); +} + +/** + * Thenable wrapper for ReportingStep that enables fluent chaining. + */ +export class ReportingStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReportingStep) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', - rpcArgs - ); - return new AzureBicepResource(result, this._client); + /** Creates a reporting task with plain-text status text */ + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createTask(statusText, options))); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Creates a reporting task with Markdown-formatted status text */ + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createMarkdownTask(markdownString, options))); } - /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsConnectionString', - rpcArgs - ); - return new AzureBicepResource(result, this._client); + /** Logs a plain-text message for the reporting step */ + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStep(level, message))); } - /** Publishes an Azure resource to the manifest as a connection string */ - publishAsConnectionString(): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._publishAsConnectionStringInternal()); + /** Logs a Markdown-formatted message for the reporting step */ + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStepMarkdown(level, markdownString))); } - /** Gets the normalized Bicep identifier for an Azure resource */ - async getBicepIdentifier(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/getBicepIdentifier', - rpcArgs - ); + /** Completes the reporting step with plain-text completion text */ + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStep(completionText, options))); } + /** Completes the reporting step with Markdown-formatted completion text */ + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStepMarkdown(markdownString, options))); + } + +} + +// ============================================================================ +// ReportingTask +// ============================================================================ + +/** + * Type class for ReportingTask. + */ +export class ReportingTask { + constructor(private _handle: IReportingTaskHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Updates the reporting task with plain-text status text */ /** @internal */ - private async _clearDefaultRoleAssignmentsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', + async _updateTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTask', rpcArgs ); - return new AzureBicepResource(result, this._client); + return this; } - /** Clears the default Azure role assignments from a resource */ - clearDefaultRoleAssignments(): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskInternal(statusText, cancellationToken)); } - /** Determines whether a resource is marked as existing */ - async isExisting(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/isExisting', + /** Updates the reporting task with Markdown-formatted status text */ + /** @internal */ + async _updateTaskMarkdownInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTaskMarkdown', rpcArgs ); + return this; } + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskMarkdownInternal(markdownString, cancellationToken)); + } + + /** Completes the reporting task with plain-text completion text */ /** @internal */ - private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/runAsExistingFromParameters', + async _completeTaskInternal(completionMessage?: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle }; + if (completionMessage !== undefined) rpcArgs.completionMessage = completionMessage; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTask', rpcArgs ); - return new AzureBicepResource(result, this._client); + return this; } - /** Marks an Azure resource as existing in run mode by using parameter resources */ - runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + const completionMessage = options?.completionMessage; + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskInternal(completionMessage, completionState, cancellationToken)); } + /** Completes the reporting task with Markdown-formatted completion text */ /** @internal */ - private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/runAsExisting', + async _completeTaskMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTaskMarkdown', rpcArgs ); - return new AzureBicepResource(result, this._client); + return this; } - /** Marks an Azure resource as existing in run mode */ - runAsExisting(name: string, resourceGroup: string): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._runAsExistingInternal(name, resourceGroup)); + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskMarkdownInternal(markdownString, completionState, cancellationToken)); + } + +} + +/** + * Thenable wrapper for ReportingTask that enables fluent chaining. + */ +export class ReportingTaskPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReportingTask) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Updates the reporting task with plain-text status text */ + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTask(statusText, options))); + } + + /** Updates the reporting task with Markdown-formatted status text */ + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTaskMarkdown(markdownString, options))); + } + + /** Completes the reporting task with plain-text completion text */ + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTask(options))); + } + + /** Completes the reporting task with Markdown-formatted completion text */ + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTaskMarkdown(markdownString, options))); } +} + +// ============================================================================ +// ServiceProvider +// ============================================================================ + +/** + * Type class for ServiceProvider. + */ +export class ServiceProvider { + constructor(private _handle: IServiceProviderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the distributed application eventing service from the service provider */ /** @internal */ - private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsExistingFromParameters', + async _getEventingInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getEventing', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new DistributedApplicationEventing(result, this._client); } - /** Marks an Azure resource as existing in publish mode by using parameter resources */ - publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._getEventingInternal()); } + /** Gets the logger factory from the service provider */ /** @internal */ - private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsExisting', + async _getLoggerFactoryInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getLoggerFactory', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new LoggerFactory(result, this._client); } - /** Marks an Azure resource as existing in publish mode */ - publishAsExisting(name: string, resourceGroup: string): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._getLoggerFactoryInternal()); } + /** Gets the resource logger service from the service provider */ /** @internal */ - private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/asExisting', + async _getResourceLoggerServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceLoggerService', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new ResourceLoggerService(result, this._client); } - /** Marks an Azure resource as existing in both run and publish modes */ - asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._getResourceLoggerServiceInternal()); } + /** Gets the distributed application model from the service provider */ /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { - const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + async _getDistributedApplicationModelInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getDistributedApplicationModel', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new DistributedApplicationModel(result, this._client); } - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._getDistributedApplicationModelInternal()); } + /** Gets the resource notification service from the service provider */ /** @internal */ - private async _getAzureContainerRegistryInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + async _getResourceNotificationServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceNotificationService', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new ResourceNotificationService(result, this._client); } - /** Gets the Azure Container Registry associated with a compute environment resource. */ - getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._getResourceNotificationServiceInternal()); } + /** Gets the user secrets manager from the service provider */ /** @internal */ - private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + async _getUserSecretsManagerInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getUserSecretsManager', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new UserSecretsManager(result, this._client); } - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getUserSecretsManagerInternal()); } } /** - * Thenable wrapper for AzureBicepResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); + * Thenable wrapper for ServiceProvider that enables fluent chaining. */ -export class AzureBicepResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ServiceProviderPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: AzureBicepResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ServiceProvider) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); - } - - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); - } - - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Gets the distributed application eventing service from the service provider */ + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.getEventing())); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Gets the logger factory from the service provider */ + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._promise.then(obj => obj.getLoggerFactory())); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Gets the resource logger service from the service provider */ + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.getResourceLoggerService())); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Gets the distributed application model from the service provider */ + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._promise.then(obj => obj.getDistributedApplicationModel())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Gets the resource notification service from the service provider */ + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.getResourceNotificationService())); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Gets the user secrets manager from the service provider */ + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getUserSecretsManager())); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); - } +} - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); - } +// ============================================================================ +// UserSecretsManager +// ============================================================================ - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } +/** + * Type class for UserSecretsManager. + */ +export class UserSecretsManager { + constructor(private _handle: IUserSecretsManagerHandle, private _client: AspireClientRpc) {} - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); - } + /** Gets the IsAvailable property */ + isAvailable = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.isAvailable', + { context: this._handle } + ); + }, + }; - /** Publishes an Azure resource to the manifest as a connection string */ - publishAsConnectionString(): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); - } + /** Gets the FilePath property */ + filePath = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.filePath', + { context: this._handle } + ); + }, + }; - /** Gets the normalized Bicep identifier for an Azure resource */ - getBicepIdentifier(): Promise { - return this._promise.then(obj => obj.getBicepIdentifier()); + /** Attempts to set a user secret value */ + async trySetSecret(name: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, name, value }; + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.trySetSecret', + rpcArgs + ); } - /** Clears the default Azure role assignments from a resource */ - clearDefaultRoleAssignments(): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + /** Saves state to user secrets from a JSON string */ + /** @internal */ + async _saveStateJsonInternal(json: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, json }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/saveStateJson', + rpcArgs + ); + return this; } - /** Determines whether a resource is marked as existing */ - isExisting(): Promise { - return this._promise.then(obj => obj.isExisting()); + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + const cancellationToken = options?.cancellationToken; + return new UserSecretsManagerPromise(this._saveStateJsonInternal(json, cancellationToken)); } - /** Marks an Azure resource as existing in run mode by using parameter resources */ - runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ + /** @internal */ + async _getOrSetSecretInternal(resourceBuilder: ResourceBuilderBase, name: string, value: string): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, resourceBuilder, name, value }; + await this._client.invokeCapability( + 'Aspire.Hosting/getOrSetSecret', + rpcArgs + ); + return this; } - /** Marks an Azure resource as existing in run mode */ - runAsExisting(name: string, resourceGroup: string): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getOrSetSecretInternal(resourceBuilder, name, value)); } - /** Marks an Azure resource as existing in publish mode by using parameter resources */ - publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); - } +} - /** Marks an Azure resource as existing in publish mode */ - publishAsExisting(name: string, resourceGroup: string): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); - } +/** + * Thenable wrapper for UserSecretsManager that enables fluent chaining. + */ +export class UserSecretsManagerPromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** Marks an Azure resource as existing in both run and publish modes */ - asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + then( + onfulfilled?: ((value: UserSecretsManager) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + /** Attempts to set a user secret value */ + trySetSecret(name: string, value: string): Promise { + return this._promise.then(obj => obj.trySetSecret(name, value)); } - /** Gets the Azure Container Registry associated with a compute environment resource. */ - getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + /** Saves state to user secrets from a JSON string */ + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.saveStateJson(json, options))); } - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getOrSetSecret(resourceBuilder, name, value))); } } // ============================================================================ -// AzureBlobStorageContainerResource +// AzureBicepResource // ============================================================================ -export class AzureBlobStorageContainerResource extends ResourceBuilderBase { - constructor(handle: AzureBlobStorageContainerResourceHandle, client: AspireClientRpc) { +export class AzureBicepResource extends ResourceBuilderBase { + constructor(handle: AzureBicepResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBlobStorageContainerResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBicepResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new AzureBlobStorageContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new AzureBicepResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBlobStorageContainerResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBicepResourcePromise { const helpLink = options?.helpLink; - return new AzureBlobStorageContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } - - /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', - rpcArgs - ); - return new AzureBlobStorageContainerResource(result, this._client); - } - - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withConnectionPropertyInternal(name, value)); - } - - /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', - rpcArgs - ); - return new AzureBlobStorageContainerResource(result, this._client); - } - - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + return new AzureBicepResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureBlobStorageContainerResourcePromise { + withUrl(url: string, options?: WithUrlOptions): AzureBicepResourcePromise { const displayText = options?.displayText; - return new AzureBlobStorageContainerResourcePromise(this._withUrlInternal(url, displayText)); + return new AzureBicepResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBlobStorageContainerResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBicepResourcePromise { const displayText = options?.displayText; - return new AzureBlobStorageContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new AzureBicepResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -3330,113 +4908,83 @@ export class AzureBlobStorageContainerResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBlobStorageContainerResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBicepResourcePromise { const commandOptions = options?.commandOptions; - return new AzureBlobStorageContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new AzureBicepResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureBlobStorageContainerResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): AzureBicepResourcePromise { const iconVariant = options?.iconVariant; - return new AzureBlobStorageContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new AzureBicepResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._excludeFromMcpInternal()); - } - - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new AzureBlobStorageContainerResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new AzureBlobStorageContainerResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + excludeFromMcp(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -3447,60 +4995,60 @@ export class AzureBlobStorageContainerResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBlobStorageContainerResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBicepResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new AzureBlobStorageContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new AzureBicepResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -3513,671 +5061,365 @@ export class AzureBlobStorageContainerResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { - const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _getAzureContainerRegistryInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Gets the Azure Container Registry associated with a compute environment resource. */ - getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); - } - - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); - } - -} - -/** - * Thenable wrapper for AzureBlobStorageContainerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class AzureBlobStorageContainerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: AzureBlobStorageContainerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); - } - - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); - } - - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); - } - - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); - } - - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); - } - - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + return new AzureBicepResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._onResourceReadyInternal(callback)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureBicepResource(result, this._client); } /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); - } - - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); - } - - /** Gets the Azure Container Registry associated with a compute environment resource. */ - getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); - } - - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } -} - -// ============================================================================ -// AzureBlobStorageResource -// ============================================================================ - -export class AzureBlobStorageResource extends ResourceBuilderBase { - constructor(handle: AzureBlobStorageResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Gets an output reference from an Azure Bicep template resource */ + async getOutput(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getOutput', + rpcArgs + ); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withParameterInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameter', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withParameterInternal(name)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withParameterStringValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValue', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBlobStorageResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new AzureBlobStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withParameterStringValueInternal(name, value)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValues', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBlobStorageResourcePromise { - const helpLink = options?.helpLink; - return new AzureBlobStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withParameterStringValuesInternal(name, value)); } /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromParameter', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withParameterFromParameterInternal(name, value)); } /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromConnectionString', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromOutput', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withParameterFromOutputInternal(name, value)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromEndpoint', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureBlobStorageResourcePromise { - const displayText = options?.displayText; - return new AzureBlobStorageResourcePromise(this._withUrlInternal(url, displayText)); + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withParameterFromEndpointInternal(name, value)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsConnectionString', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBlobStorageResourcePromise { - const displayText = options?.displayText; - return new AzureBlobStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._publishAsConnectionStringInternal()); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + /** Gets the normalized Bicep identifier for an Azure resource */ + async getBicepIdentifier(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getBicepIdentifier', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _clearDefaultRoleAssignmentsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._excludeFromManifestInternal()); + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._clearDefaultRoleAssignmentsInternal()); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + /** Determines whether a resource is marked as existing */ + async isExisting(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/isExisting', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExistingFromParameters', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withHealthCheckInternal(key)); + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExisting', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBlobStorageResourcePromise { - const commandOptions = options?.commandOptions; - return new AzureBlobStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._runAsExistingInternal(name, resourceGroup)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExistingFromParameters', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withParentRelationshipInternal(parent)); + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExisting', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withChildRelationshipInternal(child)); + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/asExistingFromParameters', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureBlobStorageResourcePromise { - const iconVariant = options?.iconVariant; - return new AzureBlobStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._excludeFromMcpInternal()); - } - - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new AzureBlobStorageResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new AzureBlobStorageResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new AzureBlobStorageResource(result, this._client); - } - - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBlobStorageResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new AzureBlobStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); - } - - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new AzureBlobStorageResource(result, this._client); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); - } - - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new AzureBlobStorageResource(result, this._client); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); - } - - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); - } - - /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', - rpcArgs - ); - return new AzureBlobStorageResource(result, this._client); - } - - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); - } - - /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { - const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', - rpcArgs - ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); } /** @internal */ @@ -4196,150 +5438,130 @@ export class AzureBlobStorageResource extends ResourceBuilderBase { + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); } } /** - * Thenable wrapper for AzureBlobStorageResource that enables fluent chaining. + * Thenable wrapper for AzureBicepResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class AzureBlobStorageResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class AzureBicepResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: AzureBlobStorageResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: AzureBicepResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); - } - - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + excludeFromMcp(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -4347,14 +5569,124 @@ export class AzureBlobStorageResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Gets an output reference from an Azure Bicep template resource */ + getOutput(name: string): Promise { + return this._promise.then(obj => obj.getOutput(name)); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withParameter(name))); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + getBicepIdentifier(): Promise { + return this._promise.then(obj => obj.getBicepIdentifier()); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + } + + /** Determines whether a resource is marked as existing */ + isExisting(): Promise { + return this._promise.then(obj => obj.isExisting()); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); } /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); } /** Gets the Azure Container Registry associated with a compute environment resource. */ @@ -4363,212 +5695,251 @@ export class AzureBlobStorageResourcePromise implements PromiseLike obj.withContainerRegistryRoleAssignments(target, roles))); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); } } // ============================================================================ -// AzureContainerAppEnvironmentResource +// AzureBlobStorageContainerResource // ============================================================================ -export class AzureContainerAppEnvironmentResource extends ResourceBuilderBase { - constructor(handle: AzureContainerAppEnvironmentResourceHandle, client: AspireClientRpc) { +export class AzureBlobStorageContainerResource extends ResourceBuilderBase { + constructor(handle: AzureBlobStorageContainerResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureContainerAppEnvironmentResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBlobStorageContainerResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new AzureContainerAppEnvironmentResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new AzureBlobStorageContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureContainerAppEnvironmentResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBlobStorageContainerResourcePromise { const helpLink = options?.helpLink; - return new AzureContainerAppEnvironmentResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new AzureBlobStorageContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureContainerAppEnvironmentResourcePromise { + withUrl(url: string, options?: WithUrlOptions): AzureBlobStorageContainerResourcePromise { const displayText = options?.displayText; - return new AzureContainerAppEnvironmentResourcePromise(this._withUrlInternal(url, displayText)); + return new AzureBlobStorageContainerResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureContainerAppEnvironmentResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBlobStorageContainerResourcePromise { const displayText = options?.displayText; - return new AzureContainerAppEnvironmentResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new AzureBlobStorageContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -4576,113 +5947,83 @@ export class AzureContainerAppEnvironmentResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureContainerAppEnvironmentResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBlobStorageContainerResourcePromise { const commandOptions = options?.commandOptions; - return new AzureContainerAppEnvironmentResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new AzureBlobStorageContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureContainerAppEnvironmentResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): AzureBlobStorageContainerResourcePromise { const iconVariant = options?.iconVariant; - return new AzureContainerAppEnvironmentResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new AzureBlobStorageContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._excludeFromMcpInternal()); - } - - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new AzureContainerAppEnvironmentResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new AzureContainerAppEnvironmentResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + excludeFromMcp(): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -4693,60 +6034,60 @@ export class AzureContainerAppEnvironmentResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureContainerAppEnvironmentResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBlobStorageContainerResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new AzureContainerAppEnvironmentResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new AzureBlobStorageContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -4759,885 +6100,583 @@ export class AzureContainerAppEnvironmentResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.AppContainers/withAzdResourceNaming', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } - /** Configures resources to use azd naming conventions */ - withAzdResourceNaming(): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withAzdResourceNamingInternal()); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withCompactResourceNamingInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.AppContainers/withCompactResourceNaming', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } - /** Configures resources to use compact naming for length-constrained Azure resources */ - withCompactResourceNaming(): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withCompactResourceNamingInternal()); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withDashboardInternal(enable?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (enable !== undefined) rpcArgs.enable = enable; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.AppContainers/withDashboard', + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } - /** Configures whether the Aspire dashboard is included in the container app environment */ - withDashboard(options?: WithDashboardOptions): AzureContainerAppEnvironmentResourcePromise { - const enable = options?.enable; - return new AzureContainerAppEnvironmentResourcePromise(this._withDashboardInternal(enable)); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._onConnectionStringAvailableInternal(callback)); } /** @internal */ - private async _withHttpsUpgradeInternal(upgrade?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (upgrade !== undefined) rpcArgs.upgrade = upgrade; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.AppContainers/withHttpsUpgrade', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } - /** Configures whether HTTP endpoints are upgraded to HTTPS */ - withHttpsUpgrade(options?: WithHttpsUpgradeOptions): AzureContainerAppEnvironmentResourcePromise { - const upgrade = options?.upgrade; - return new AzureContainerAppEnvironmentResourcePromise(this._withHttpsUpgradeInternal(upgrade)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withAzureLogAnalyticsWorkspaceInternal(workspaceBuilder: AzureLogAnalyticsWorkspaceResource): Promise { - const rpcArgs: Record = { builder: this._handle, workspaceBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.AppContainers/withAzureLogAnalyticsWorkspace', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } - /** Configures the container app environment to use a specific Log Analytics Workspace */ - withAzureLogAnalyticsWorkspace(workspaceBuilder: AzureLogAnalyticsWorkspaceResource): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withAzureLogAnalyticsWorkspaceInternal(workspaceBuilder)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); - } - - /** Gets an output reference from an Azure Bicep template resource */ - async getOutput(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/getOutput', - rpcArgs - ); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } /** @internal */ - private async _withParameterInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameter', + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } - /** Adds a Bicep parameter without a value */ - withParameter(name: string): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withParameterInternal(name)); + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); } /** @internal */ - private async _withParameterStringValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterStringValue', + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } - /** Adds a Bicep parameter with a string value */ - withParameterStringValue(name: string, value: string): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withParameterStringValueInternal(name, value)); + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); } /** @internal */ - private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterStringValues', + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', rpcArgs ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } - /** Adds a Bicep parameter with a string list value */ - withParameterStringValues(name: string, value: string[]): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withParameterStringValuesInternal(name, value)); + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); } - /** @internal */ - private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromParameter', - rpcArgs - ); - return new AzureContainerAppEnvironmentResource(result, this._client); +} + +/** + * Thenable wrapper for AzureBlobStorageContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureBlobStorageContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureBlobStorageContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a Bicep parameter from a parameter resource builder */ - withParameterFromParameter(name: string, value: ParameterResource): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withParameterFromParameterInternal(name, value)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromConnectionString', - rpcArgs - ); - return new AzureContainerAppEnvironmentResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a Bicep parameter from a connection string resource builder */ - withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromOutput', - rpcArgs - ); - return new AzureContainerAppEnvironmentResource(result, this._client); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } - /** Adds a Bicep parameter from another Bicep output reference */ - withParameterFromOutput(name: string, value: BicepOutputReference): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withParameterFromOutputInternal(name, value)); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } - /** @internal */ - private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', - rpcArgs - ); - return new AzureContainerAppEnvironmentResource(result, this._client); + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } - /** Adds a Bicep parameter from a reference expression */ - withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromEndpoint', - rpcArgs - ); - return new AzureContainerAppEnvironmentResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Adds a Bicep parameter from an endpoint reference */ - withParameterFromEndpoint(name: string, value: EndpointReference): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withParameterFromEndpointInternal(name, value)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _configureInfrastructureInternal(configure: (obj: AzureResourceInfrastructure) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; - const obj = new AzureResourceInfrastructure(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/configureInfrastructure', - rpcArgs - ); - return new AzureContainerAppEnvironmentResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Configures the Azure provisioning infrastructure callback */ - configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._configureInfrastructureInternal(configure)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsConnectionString', - rpcArgs - ); - return new AzureContainerAppEnvironmentResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Publishes an Azure resource to the manifest as a connection string */ - publishAsConnectionString(): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._publishAsConnectionStringInternal()); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Gets the normalized Bicep identifier for an Azure resource */ - async getBicepIdentifier(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/getBicepIdentifier', - rpcArgs - ); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _clearDefaultRoleAssignmentsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', - rpcArgs - ); - return new AzureContainerAppEnvironmentResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Clears the default Azure role assignments from a resource */ - clearDefaultRoleAssignments(): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Determines whether a resource is marked as existing */ - async isExisting(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/isExisting', - rpcArgs - ); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** @internal */ - private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/runAsExistingFromParameters', - rpcArgs - ); - return new AzureContainerAppEnvironmentResource(result, this._client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Marks an Azure resource as existing in run mode by using parameter resources */ - runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/runAsExisting', - rpcArgs - ); - return new AzureContainerAppEnvironmentResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Marks an Azure resource as existing in run mode */ - runAsExisting(name: string, resourceGroup: string): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._runAsExistingInternal(name, resourceGroup)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsExistingFromParameters', - rpcArgs - ); - return new AzureContainerAppEnvironmentResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Marks an Azure resource as existing in publish mode by using parameter resources */ - publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** @internal */ - private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsExisting', - rpcArgs - ); - return new AzureContainerAppEnvironmentResource(result, this._client); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Marks an Azure resource as existing in publish mode */ - publishAsExisting(name: string, resourceGroup: string): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** @internal */ - private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/asExisting', - rpcArgs - ); - return new AzureContainerAppEnvironmentResource(result, this._client); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } - /** Marks an Azure resource as existing in both run and publish modes */ - asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { - const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', - rpcArgs - ); - return new AzureContainerAppEnvironmentResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } - /** @internal */ - private async _getAzureContainerRegistryInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', - rpcArgs - ); - return new AzureContainerRegistryResource(result, this._client); + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); } /** Gets the Azure Container Registry associated with a compute environment resource. */ getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); - } - - /** @internal */ - private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', - rpcArgs - ); - return new AzureContainerAppEnvironmentResource(result, this._client); + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); } /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); } } -/** - * Thenable wrapper for AzureContainerAppEnvironmentResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class AzureContainerAppEnvironmentResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +// ============================================================================ +// AzureBlobStorageResource +// ============================================================================ - then( - onfulfilled?: ((value: AzureContainerAppEnvironmentResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); - } - - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); - } - - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); - } - - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); - } - - /** Configures resources to use azd naming conventions */ - withAzdResourceNaming(): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withAzdResourceNaming())); - } - - /** Configures resources to use compact naming for length-constrained Azure resources */ - withCompactResourceNaming(): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withCompactResourceNaming())); - } - - /** Configures whether the Aspire dashboard is included in the container app environment */ - withDashboard(options?: WithDashboardOptions): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withDashboard(options))); - } - - /** Configures whether HTTP endpoints are upgraded to HTTPS */ - withHttpsUpgrade(options?: WithHttpsUpgradeOptions): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withHttpsUpgrade(options))); - } - - /** Configures the container app environment to use a specific Log Analytics Workspace */ - withAzureLogAnalyticsWorkspace(workspaceBuilder: AzureLogAnalyticsWorkspaceResource): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withAzureLogAnalyticsWorkspace(workspaceBuilder))); - } - - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); - } - - /** Gets an output reference from an Azure Bicep template resource */ - getOutput(name: string): Promise { - return this._promise.then(obj => obj.getOutput(name)); - } - - /** Adds a Bicep parameter without a value */ - withParameter(name: string): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParameter(name))); - } - - /** Adds a Bicep parameter with a string value */ - withParameterStringValue(name: string, value: string): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); - } - - /** Adds a Bicep parameter with a string list value */ - withParameterStringValues(name: string, value: string[]): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); - } - - /** Adds a Bicep parameter from a parameter resource builder */ - withParameterFromParameter(name: string, value: ParameterResource): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); - } - - /** Adds a Bicep parameter from a connection string resource builder */ - withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); - } - - /** Adds a Bicep parameter from another Bicep output reference */ - withParameterFromOutput(name: string, value: BicepOutputReference): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); - } - - /** Adds a Bicep parameter from a reference expression */ - withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); - } - - /** Adds a Bicep parameter from an endpoint reference */ - withParameterFromEndpoint(name: string, value: EndpointReference): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); - } - - /** Configures the Azure provisioning infrastructure callback */ - configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.configureInfrastructure(configure))); - } - - /** Publishes an Azure resource to the manifest as a connection string */ - publishAsConnectionString(): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); - } - - /** Gets the normalized Bicep identifier for an Azure resource */ - getBicepIdentifier(): Promise { - return this._promise.then(obj => obj.getBicepIdentifier()); - } - - /** Clears the default Azure role assignments from a resource */ - clearDefaultRoleAssignments(): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); - } - - /** Determines whether a resource is marked as existing */ - isExisting(): Promise { - return this._promise.then(obj => obj.isExisting()); - } - - /** Marks an Azure resource as existing in run mode by using parameter resources */ - runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); - } - - /** Marks an Azure resource as existing in run mode */ - runAsExisting(name: string, resourceGroup: string): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); - } - - /** Marks an Azure resource as existing in publish mode by using parameter resources */ - publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); - } - - /** Marks an Azure resource as existing in publish mode */ - publishAsExisting(name: string, resourceGroup: string): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); - } - - /** Marks an Azure resource as existing in both run and publish modes */ - asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); - } - - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); - } - - /** Gets the Azure Container Registry associated with a compute environment resource. */ - getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); - } - - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureContainerAppEnvironmentResourcePromise { - return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); - } - -} - -// ============================================================================ -// AzureContainerRegistryResource -// ============================================================================ - -export class AzureContainerRegistryResource extends ResourceBuilderBase { - constructor(handle: AzureContainerRegistryResourceHandle, client: AspireClientRpc) { +export class AzureBlobStorageResource extends ResourceBuilderBase { + constructor(handle: AzureBlobStorageResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureContainerRegistryResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBlobStorageResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new AzureContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new AzureBlobStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureContainerRegistryResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBlobStorageResourcePromise { const helpLink = options?.helpLink; - return new AzureContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new AzureBlobStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureContainerRegistryResourcePromise { + withUrl(url: string, options?: WithUrlOptions): AzureBlobStorageResourcePromise { const displayText = options?.displayText; - return new AzureContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + return new AzureBlobStorageResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureContainerRegistryResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBlobStorageResourcePromise { const displayText = options?.displayText; - return new AzureContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new AzureBlobStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -5645,113 +6684,83 @@ export class AzureContainerRegistryResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureContainerRegistryResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBlobStorageResourcePromise { const commandOptions = options?.commandOptions; - return new AzureContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new AzureBlobStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureContainerRegistryResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): AzureBlobStorageResourcePromise { const iconVariant = options?.iconVariant; - return new AzureContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new AzureBlobStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._excludeFromMcpInternal()); - } - - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new AzureContainerRegistryResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new AzureContainerRegistryResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + excludeFromMcp(): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -5762,60 +6771,60 @@ export class AzureContainerRegistryResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureContainerRegistryResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBlobStorageResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new AzureContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new AzureBlobStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -5828,305 +6837,133 @@ export class AzureContainerRegistryResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', - rpcArgs - ); - return new AzureContainerRegistryResource(result, this._client); - } - - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); - } - - /** Gets an output reference from an Azure Bicep template resource */ - async getOutput(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/getOutput', - rpcArgs - ); - } - - /** @internal */ - private async _withParameterInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameter', - rpcArgs - ); - return new AzureContainerRegistryResource(result, this._client); - } - - /** Adds a Bicep parameter without a value */ - withParameter(name: string): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._withParameterInternal(name)); - } - - /** @internal */ - private async _withParameterStringValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterStringValue', - rpcArgs - ); - return new AzureContainerRegistryResource(result, this._client); - } - - /** Adds a Bicep parameter with a string value */ - withParameterStringValue(name: string, value: string): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._withParameterStringValueInternal(name, value)); - } - - /** @internal */ - private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterStringValues', - rpcArgs - ); - return new AzureContainerRegistryResource(result, this._client); - } - - /** Adds a Bicep parameter with a string list value */ - withParameterStringValues(name: string, value: string[]): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._withParameterStringValuesInternal(name, value)); - } - - /** @internal */ - private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromParameter', - rpcArgs - ); - return new AzureContainerRegistryResource(result, this._client); - } - - /** Adds a Bicep parameter from a parameter resource builder */ - withParameterFromParameter(name: string, value: ParameterResource): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._withParameterFromParameterInternal(name, value)); - } - - /** @internal */ - private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromConnectionString', - rpcArgs - ); - return new AzureContainerRegistryResource(result, this._client); - } - - /** Adds a Bicep parameter from a connection string resource builder */ - withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); - } - - /** @internal */ - private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromOutput', - rpcArgs - ); - return new AzureContainerRegistryResource(result, this._client); - } - - /** Adds a Bicep parameter from another Bicep output reference */ - withParameterFromOutput(name: string, value: BicepOutputReference): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._withParameterFromOutputInternal(name, value)); - } - - /** @internal */ - private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', - rpcArgs - ); - return new AzureContainerRegistryResource(result, this._client); - } - - /** Adds a Bicep parameter from a reference expression */ - withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); - } - - /** @internal */ - private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromEndpoint', - rpcArgs - ); - return new AzureContainerRegistryResource(result, this._client); - } - - /** Adds a Bicep parameter from an endpoint reference */ - withParameterFromEndpoint(name: string, value: EndpointReference): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._withParameterFromEndpointInternal(name, value)); - } - - /** @internal */ - private async _configureInfrastructureInternal(configure: (obj: AzureResourceInfrastructure) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; - const obj = new AzureResourceInfrastructure(objHandle, this._client); - await configure(obj); + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/configureInfrastructure', - rpcArgs - ); - return new AzureContainerRegistryResource(result, this._client); - } - - /** Configures the Azure provisioning infrastructure callback */ - configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._configureInfrastructureInternal(configure)); - } - - /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsConnectionString', - rpcArgs - ); - return new AzureContainerRegistryResource(result, this._client); - } - - /** Publishes an Azure resource to the manifest as a connection string */ - publishAsConnectionString(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._publishAsConnectionStringInternal()); - } - - /** Gets the normalized Bicep identifier for an Azure resource */ - async getBicepIdentifier(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/getBicepIdentifier', - rpcArgs - ); - } - - /** @internal */ - private async _clearDefaultRoleAssignmentsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); - } - - /** Clears the default Azure role assignments from a resource */ - clearDefaultRoleAssignments(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + return new AzureBlobStorageResource(result, this._client); } - /** Determines whether a resource is marked as existing */ - async isExisting(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/isExisting', - rpcArgs - ); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/runAsExistingFromParameters', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Marks an Azure resource as existing in run mode by using parameter resources */ - runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/runAsExisting', + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Marks an Azure resource as existing in run mode */ - runAsExisting(name: string, resourceGroup: string): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._runAsExistingInternal(name, resourceGroup)); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._onConnectionStringAvailableInternal(callback)); } /** @internal */ - private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsExistingFromParameters', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Marks an Azure resource as existing in publish mode by using parameter resources */ - publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsExisting', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Marks an Azure resource as existing in publish mode */ - publishAsExisting(name: string, resourceGroup: string): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/asExisting', + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Marks an Azure resource as existing in both run and publish modes */ - asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); } /** @internal */ @@ -6145,163 +6982,145 @@ export class AzureContainerRegistryResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, schedule }; - if (filter !== undefined) rpcArgs.filter = filter; - if (ago !== undefined) rpcArgs.ago = ago; - if (keep !== undefined) rpcArgs.keep = keep; - if (taskName !== undefined) rpcArgs.taskName = taskName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withPurgeTask', - rpcArgs - ); - return new AzureContainerRegistryResource(result, this._client); - } - - /** Configures a purge task for the Azure Container Registry resource. */ - withPurgeTask(schedule: string, options?: WithPurgeTaskOptions): AzureContainerRegistryResourcePromise { - const filter = options?.filter; - const ago = options?.ago; - const keep = options?.keep; - const taskName = options?.taskName; - return new AzureContainerRegistryResourcePromise(this._withPurgeTaskInternal(schedule, filter, ago, keep, taskName)); - } - - /** @internal */ - private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); } } /** - * Thenable wrapper for AzureContainerRegistryResource that enables fluent chaining. + * Thenable wrapper for AzureBlobStorageResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class AzureContainerRegistryResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class AzureBlobStorageResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: AzureContainerRegistryResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: AzureBlobStorageResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + excludeFromMcp(): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -6309,358 +7128,253 @@ export class AzureContainerRegistryResourcePromise implements PromiseLike obj.getResourceName()); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Gets an output reference from an Azure Bicep template resource */ - getOutput(name: string): Promise { - return this._promise.then(obj => obj.getOutput(name)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Adds a Bicep parameter without a value */ - withParameter(name: string): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParameter(name))); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } - /** Adds a Bicep parameter with a string value */ - withParameterStringValue(name: string, value: string): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Adds a Bicep parameter with a string list value */ - withParameterStringValues(name: string, value: string[]): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Adds a Bicep parameter from a parameter resource builder */ - withParameterFromParameter(name: string, value: ParameterResource): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } - /** Adds a Bicep parameter from a connection string resource builder */ - withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); } - /** Adds a Bicep parameter from another Bicep output reference */ - withParameterFromOutput(name: string, value: BicepOutputReference): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); } - /** Adds a Bicep parameter from a reference expression */ - withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); } - /** Adds a Bicep parameter from an endpoint reference */ - withParameterFromEndpoint(name: string, value: EndpointReference): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); - } +} - /** Configures the Azure provisioning infrastructure callback */ - configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.configureInfrastructure(configure))); - } +// ============================================================================ +// AzureContainerAppEnvironmentResource +// ============================================================================ - /** Publishes an Azure resource to the manifest as a connection string */ - publishAsConnectionString(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); +export class AzureContainerAppEnvironmentResource extends ResourceBuilderBase { + constructor(handle: AzureContainerAppEnvironmentResourceHandle, client: AspireClientRpc) { + super(handle, client); } - /** Gets the normalized Bicep identifier for an Azure resource */ - getBicepIdentifier(): Promise { - return this._promise.then(obj => obj.getBicepIdentifier()); + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Clears the default Azure role assignments from a resource */ - clearDefaultRoleAssignments(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withContainerRegistryInternal(registry)); } - /** Determines whether a resource is marked as existing */ - isExisting(): Promise { - return this._promise.then(obj => obj.isExisting()); - } - - /** Marks an Azure resource as existing in run mode by using parameter resources */ - runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); - } - - /** Marks an Azure resource as existing in run mode */ - runAsExisting(name: string, resourceGroup: string): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); - } - - /** Marks an Azure resource as existing in publish mode by using parameter resources */ - publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); - } - - /** Marks an Azure resource as existing in publish mode */ - publishAsExisting(name: string, resourceGroup: string): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); - } - - /** Marks an Azure resource as existing in both run and publish modes */ - asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); - } - - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); - } - - /** Gets the Azure Container Registry associated with a compute environment resource. */ - getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); - } - - /** Configures a purge task for the Azure Container Registry resource. */ - withPurgeTask(schedule: string, options?: WithPurgeTaskOptions): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withPurgeTask(schedule, options))); - } - - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); - } - -} - -// ============================================================================ -// AzureDataLakeStorageFileSystemResource -// ============================================================================ - -export class AzureDataLakeStorageFileSystemResource extends ResourceBuilderBase { - constructor(handle: AzureDataLakeStorageFileSystemResourceHandle, client: AspireClientRpc) { - super(handle, client); - } - - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withContainerRegistryInternal(registry)); - } - - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureDataLakeStorageFileSystemResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureContainerAppEnvironmentResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new AzureDataLakeStorageFileSystemResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new AzureContainerAppEnvironmentResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureDataLakeStorageFileSystemResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureContainerAppEnvironmentResourcePromise { const helpLink = options?.helpLink; - return new AzureDataLakeStorageFileSystemResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } - - /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', - rpcArgs - ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); - } - - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withConnectionPropertyInternal(name, value)); - } - - /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', - rpcArgs - ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); - } - - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + return new AzureContainerAppEnvironmentResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureDataLakeStorageFileSystemResourcePromise { + withUrl(url: string, options?: WithUrlOptions): AzureContainerAppEnvironmentResourcePromise { const displayText = options?.displayText; - return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlInternal(url, displayText)); + return new AzureContainerAppEnvironmentResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureDataLakeStorageFileSystemResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureContainerAppEnvironmentResourcePromise { const displayText = options?.displayText; - return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new AzureContainerAppEnvironmentResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -6668,113 +7382,83 @@ export class AzureDataLakeStorageFileSystemResource extends ResourceBuilderBase< }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureDataLakeStorageFileSystemResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureContainerAppEnvironmentResourcePromise { const commandOptions = options?.commandOptions; - return new AzureDataLakeStorageFileSystemResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new AzureContainerAppEnvironmentResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureDataLakeStorageFileSystemResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): AzureContainerAppEnvironmentResourcePromise { const iconVariant = options?.iconVariant; - return new AzureDataLakeStorageFileSystemResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new AzureContainerAppEnvironmentResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._excludeFromMcpInternal()); - } - - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + excludeFromMcp(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -6785,60 +7469,60 @@ export class AzureDataLakeStorageFileSystemResource extends ResourceBuilderBase< if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; if (tags !== undefined) rpcArgs.tags = tags; if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureDataLakeStorageFileSystemResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureContainerAppEnvironmentResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new AzureDataLakeStorageFileSystemResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new AzureContainerAppEnvironmentResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -6851,848 +7535,761 @@ export class AzureDataLakeStorageFileSystemResource extends ResourceBuilderBase< } /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { - const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _getAzureContainerRegistryInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Gets the Azure Container Registry associated with a compute environment resource. */ - getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); - } - - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + return new AzureContainerAppEnvironmentResource(result, this._client); } -} - -/** - * Thenable wrapper for AzureDataLakeStorageFileSystemResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class AzureDataLakeStorageFileSystemResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: AzureDataLakeStorageFileSystemResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._onResourceReadyInternal(callback)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withAzdResourceNamingInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/withAzdResourceNaming', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Configures resources to use azd naming conventions */ + withAzdResourceNaming(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withAzdResourceNamingInternal()); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** @internal */ + private async _withCompactResourceNamingInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/withCompactResourceNaming', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + /** Configures resources to use compact naming for length-constrained Azure resources */ + withCompactResourceNaming(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withCompactResourceNamingInternal()); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + /** @internal */ + private async _withDashboardInternal(enable?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (enable !== undefined) rpcArgs.enable = enable; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/withDashboard', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Configures whether the Aspire dashboard is included in the container app environment */ + withDashboard(options?: WithDashboardOptions): AzureContainerAppEnvironmentResourcePromise { + const enable = options?.enable; + return new AzureContainerAppEnvironmentResourcePromise(this._withDashboardInternal(enable)); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** @internal */ + private async _withHttpsUpgradeInternal(upgrade?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (upgrade !== undefined) rpcArgs.upgrade = upgrade; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/withHttpsUpgrade', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Configures whether HTTP endpoints are upgraded to HTTPS */ + withHttpsUpgrade(options?: WithHttpsUpgradeOptions): AzureContainerAppEnvironmentResourcePromise { + const upgrade = options?.upgrade; + return new AzureContainerAppEnvironmentResourcePromise(this._withHttpsUpgradeInternal(upgrade)); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** @internal */ + private async _withAzureLogAnalyticsWorkspaceInternal(workspaceBuilder: AzureLogAnalyticsWorkspaceResource): Promise { + const rpcArgs: Record = { builder: this._handle, workspaceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/withAzureLogAnalyticsWorkspace', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Configures the container app environment to use a specific Log Analytics Workspace */ + withAzureLogAnalyticsWorkspace(workspaceBuilder: AzureLogAnalyticsWorkspaceResource): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withAzureLogAnalyticsWorkspaceInternal(workspaceBuilder)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } - /** Adds a health check by key */ - withHealthCheck(key: string): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Gets an output reference from an Azure Bicep template resource */ + async getOutput(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getOutput', + rpcArgs + ); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _withParameterInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameter', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withParameterInternal(name)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); - } - - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); - } - - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); - } - - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); - } - - /** Gets the Azure Container Registry associated with a compute environment resource. */ - getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); - } - - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + /** @internal */ + private async _withParameterStringValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValue', + rpcArgs + ); + return new AzureContainerAppEnvironmentResource(result, this._client); } -} - -// ============================================================================ -// AzureDataLakeStorageResource -// ============================================================================ - -export class AzureDataLakeStorageResource extends ResourceBuilderBase { - constructor(handle: AzureDataLakeStorageResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withParameterStringValueInternal(name, value)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValues', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withParameterStringValuesInternal(name, value)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromParameter', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureDataLakeStorageResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new AzureDataLakeStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withParameterFromParameterInternal(name, value)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromConnectionString', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureDataLakeStorageResourcePromise { - const helpLink = options?.helpLink; - return new AzureDataLakeStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); } /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromOutput', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withParameterFromOutputInternal(name, value)); } /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromEndpoint', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withParameterFromEndpointInternal(name, value)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); + private async _configureInfrastructureInternal(configure: (obj: AzureResourceInfrastructure) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; + const obj = new AzureResourceInfrastructure(objHandle, this._client); + await configure(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/configureInfrastructure', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._configureInfrastructureInternal(configure)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsConnectionString', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureDataLakeStorageResourcePromise { - const displayText = options?.displayText; - return new AzureDataLakeStorageResourcePromise(this._withUrlInternal(url, displayText)); + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._publishAsConnectionStringInternal()); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + /** Gets the normalized Bicep identifier for an Azure resource */ + async getBicepIdentifier(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getBicepIdentifier', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureDataLakeStorageResourcePromise { - const displayText = options?.displayText; - return new AzureDataLakeStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _clearDefaultRoleAssignmentsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._clearDefaultRoleAssignmentsInternal()); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + /** Determines whether a resource is marked as existing */ + async isExisting(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/isExisting', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExistingFromParameters', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withExplicitStartInternal()); + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExisting', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withHealthCheckInternal(key)); + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._runAsExistingInternal(name, resourceGroup)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExistingFromParameters', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureDataLakeStorageResourcePromise { - const commandOptions = options?.commandOptions; - return new AzureDataLakeStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExisting', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withParentRelationshipInternal(parent)); + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/asExistingFromParameters', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withChildRelationshipInternal(child)); + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureDataLakeStorageResourcePromise { - const iconVariant = options?.iconVariant; - return new AzureDataLakeStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _getAzureContainerRegistryInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._excludeFromMcpInternal()); + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureContainerAppEnvironmentResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new AzureDataLakeStorageResource(result, this._client); - } +} - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); +/** + * Thenable wrapper for AzureContainerAppEnvironmentResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureContainerAppEnvironmentResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureContainerAppEnvironmentResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new AzureDataLakeStorageResource(result, this._client); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureDataLakeStorageResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new AzureDataLakeStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new AzureDataLakeStorageResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new AzureDataLakeStorageResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', - rpcArgs - ); - return new AzureDataLakeStorageResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { - const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', - rpcArgs - ); - return new AzureDataLakeStorageResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _getAzureContainerRegistryInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', - rpcArgs - ); - return new AzureContainerRegistryResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Gets the Azure Container Registry associated with a compute environment resource. */ - getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', - rpcArgs - ); - return new AzureDataLakeStorageResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } -} + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } -/** - * Thenable wrapper for AzureDataLakeStorageResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class AzureDataLakeStorageResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } - then( - onfulfilled?: ((value: AzureDataLakeStorageResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Configures resources to use azd naming conventions */ + withAzdResourceNaming(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withAzdResourceNaming())); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Configures resources to use compact naming for length-constrained Azure resources */ + withCompactResourceNaming(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withCompactResourceNaming())); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Configures whether the Aspire dashboard is included in the container app environment */ + withDashboard(options?: WithDashboardOptions): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withDashboard(options))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Configures whether HTTP endpoints are upgraded to HTTPS */ + withHttpsUpgrade(options?: WithHttpsUpgradeOptions): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withHttpsUpgrade(options))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Configures the container app environment to use a specific Log Analytics Workspace */ + withAzureLogAnalyticsWorkspace(workspaceBuilder: AzureLogAnalyticsWorkspaceResource): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withAzureLogAnalyticsWorkspace(workspaceBuilder))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } - /** Adds a health check by key */ - withHealthCheck(key: string): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Gets an output reference from an Azure Bicep template resource */ + getOutput(name: string): Promise { + return this._promise.then(obj => obj.getOutput(name)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParameter(name))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.configureInfrastructure(configure))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Gets the normalized Bicep identifier for an Azure resource */ + getBicepIdentifier(): Promise { + return this._promise.then(obj => obj.getBicepIdentifier()); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + } + + /** Determines whether a resource is marked as existing */ + isExisting(): Promise { + return this._promise.then(obj => obj.isExisting()); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); } /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); } /** Gets the Azure Container Registry associated with a compute environment resource. */ @@ -7701,212 +8298,212 @@ export class AzureDataLakeStorageResourcePromise implements PromiseLike obj.withContainerRegistryRoleAssignments(target, roles))); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureContainerAppEnvironmentResourcePromise { + return new AzureContainerAppEnvironmentResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); } } // ============================================================================ -// AzureEnvironmentResource +// AzureContainerRegistryResource // ============================================================================ -export class AzureEnvironmentResource extends ResourceBuilderBase { - constructor(handle: AzureEnvironmentResourceHandle, client: AspireClientRpc) { +export class AzureContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: AzureContainerRegistryResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureEnvironmentResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureContainerRegistryResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new AzureEnvironmentResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new AzureContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureEnvironmentResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureContainerRegistryResourcePromise { const helpLink = options?.helpLink; - return new AzureEnvironmentResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new AzureContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureEnvironmentResourcePromise { + withUrl(url: string, options?: WithUrlOptions): AzureContainerRegistryResourcePromise { const displayText = options?.displayText; - return new AzureEnvironmentResourcePromise(this._withUrlInternal(url, displayText)); + return new AzureContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureEnvironmentResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureContainerRegistryResourcePromise { const displayText = options?.displayText; - return new AzureEnvironmentResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new AzureContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -7914,113 +8511,83 @@ export class AzureEnvironmentResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureEnvironmentResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureContainerRegistryResourcePromise { const commandOptions = options?.commandOptions; - return new AzureEnvironmentResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new AzureContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureEnvironmentResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): AzureContainerRegistryResourcePromise { const iconVariant = options?.iconVariant; - return new AzureEnvironmentResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new AzureContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._excludeFromMcpInternal()); - } - - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new AzureEnvironmentResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new AzureEnvironmentResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + excludeFromMcp(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -8031,60 +8598,60 @@ export class AzureEnvironmentResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureEnvironmentResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureContainerRegistryResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new AzureEnvironmentResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new AzureContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -8097,1050 +8664,938 @@ export class AzureEnvironmentResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withLocationInternal(location: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, location }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withLocation', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } - /** Sets the Azure location for the shared Azure environment resource */ - withLocation(location: ParameterResource): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withLocationInternal(location)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withResourceGroupInternal(resourceGroup: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, resourceGroup }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withResourceGroup', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } - /** Sets the Azure resource group for the shared Azure environment resource */ - withResourceGroup(resourceGroup: ParameterResource): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withResourceGroupInternal(resourceGroup)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { - const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _getAzureContainerRegistryInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); return new AzureContainerRegistryResource(result, this._client); } - /** Gets the Azure Container Registry associated with a compute environment resource. */ - getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } - /** @internal */ - private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + /** Gets an output reference from an Azure Bicep template resource */ + async getOutput(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getOutput', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); - } - - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); - } - -} - -/** - * Thenable wrapper for AzureEnvironmentResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class AzureEnvironmentResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: AzureEnvironmentResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); - } - - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); - } - - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); - } - - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withParameterInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameter', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withParameterInternal(name)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withParameterStringValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValue', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withParameterStringValueInternal(name, value)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValues', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withParameterStringValuesInternal(name, value)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromParameter', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withParameterFromParameterInternal(name, value)); } - /** Sets the Azure location for the shared Azure environment resource */ - withLocation(location: ParameterResource): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withLocation(location))); + /** @internal */ + private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromConnectionString', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); } - /** Sets the Azure resource group for the shared Azure environment resource */ - withResourceGroup(resourceGroup: ParameterResource): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withResourceGroup(resourceGroup))); + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); } - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + /** @internal */ + private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromOutput', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); } - /** Gets the Azure Container Registry associated with a compute environment resource. */ - getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withParameterFromOutputInternal(name, value)); } - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + /** @internal */ + private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); } -} - -// ============================================================================ -// AzureFunctionsProjectResource -// ============================================================================ - -export class AzureFunctionsProjectResource extends ResourceBuilderBase { - constructor(handle: AzureFunctionsProjectResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromEndpoint', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withParameterFromEndpointInternal(name, value)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _configureInfrastructureInternal(configure: (obj: AzureResourceInfrastructure) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; + const obj = new AzureResourceInfrastructure(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/configureInfrastructure', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureFunctionsProjectResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new AzureFunctionsProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._configureInfrastructureInternal(configure)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _publishAsConnectionStringInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsConnectionString', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): AzureFunctionsProjectResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new AzureFunctionsProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._publishAsConnectionStringInternal()); } - /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + /** Gets the normalized Bicep identifier for an Azure resource */ + async getBicepIdentifier(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getBicepIdentifier', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); - } - - /** Configures OTLP telemetry export */ - withOtlpExporter(): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _clearDefaultRoleAssignmentsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._clearDefaultRoleAssignmentsInternal()); } - /** @internal */ - private async _withReplicasInternal(replicas: number): Promise { - const rpcArgs: Record = { builder: this._handle, replicas }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReplicas', + /** Determines whether a resource is marked as existing */ + async isExisting(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/isExisting', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); - } - - /** Sets the number of replicas */ - withReplicas(replicas: number): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withReplicasInternal(replicas)); } /** @internal */ - private async _disableForwardedHeadersInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/disableForwardedHeaders', + private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExistingFromParameters', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._disableForwardedHeadersInternal()); + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExisting', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureFunctionsProjectResourcePromise { - const helpLink = options?.helpLink; - return new AzureFunctionsProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._runAsExistingInternal(name, resourceGroup)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExistingFromParameters', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withEnvironmentInternal(name, value)); + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExisting', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/asExistingFromParameters', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withPurgeTaskInternal(schedule: string, filter?: string, ago?: number, keep?: number, taskName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, schedule }; + if (filter !== undefined) rpcArgs.filter = filter; + if (ago !== undefined) rpcArgs.ago = ago; + if (keep !== undefined) rpcArgs.keep = keep; + if (taskName !== undefined) rpcArgs.taskName = taskName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withPurgeTask', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Configures a purge task for the Azure Container Registry resource. */ + withPurgeTask(schedule: string, options?: WithPurgeTaskOptions): AzureContainerRegistryResourcePromise { + const filter = options?.filter; + const ago = options?.ago; + const keep = options?.keep; + const taskName = options?.taskName; + return new AzureContainerRegistryResourcePromise(this._withPurgeTaskInternal(schedule, filter, ago, keep, taskName)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); +} + +/** + * Thenable wrapper for AzureContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds arguments */ - withArgs(args: string[]): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withArgsInternal(args)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withArgsCallbackInternal(callback)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): AzureFunctionsProjectResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new AzureFunctionsProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withServiceReferenceInternal(source)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): AzureFunctionsProjectResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new AzureFunctionsProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Gets an output reference from an Azure Bicep template resource */ + getOutput(name: string): Promise { + return this._promise.then(obj => obj.getOutput(name)); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParameter(name))); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); + } + + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.configureInfrastructure(configure))); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + getBicepIdentifier(): Promise { + return this._promise.then(obj => obj.getBicepIdentifier()); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + } + + /** Determines whether a resource is marked as existing */ + isExisting(): Promise { + return this._promise.then(obj => obj.isExisting()); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Configures a purge task for the Azure Container Registry resource. */ + withPurgeTask(schedule: string, options?: WithPurgeTaskOptions): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withPurgeTask(schedule, options))); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureDataLakeStorageFileSystemResource +// ============================================================================ + +export class AzureDataLakeStorageFileSystemResource extends ResourceBuilderBase { + constructor(handle: AzureDataLakeStorageFileSystemResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): AzureFunctionsProjectResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new AzureFunctionsProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureFunctionsProjectResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new AzureFunctionsProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureDataLakeStorageFileSystemResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureDataLakeStorageFileSystemResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureDataLakeStorageFileSystemResourcePromise { + const helpLink = options?.helpLink; + return new AzureDataLakeStorageFileSystemResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', rpcArgs ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withConnectionPropertyInternal(name, value)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._asHttp2ServiceInternal()); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureFunctionsProjectResourcePromise { + withUrl(url: string, options?: WithUrlOptions): AzureDataLakeStorageFileSystemResourcePromise { const displayText = options?.displayText; - return new AzureFunctionsProjectResourcePromise(this._withUrlInternal(url, displayText)); + return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureFunctionsProjectResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureDataLakeStorageFileSystemResourcePromise { const displayText = options?.displayText; - return new AzureFunctionsProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); - } - - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); - } - - /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); - } - - /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._excludeFromManifestInternal()); - } - - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); - } - - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._waitForInternal(dependency)); - } - - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); - } - - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); - } - - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); - } - - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._waitForStartInternal(dependency)); - } - - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); - } - - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + excludeFromManifest(): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withExplicitStartInternal()); - } - - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); - } - - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): AzureFunctionsProjectResourcePromise { - const exitCode = options?.exitCode; - return new AzureFunctionsProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + withExplicitStart(): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withHealthCheckInternal(key)); - } - - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); - } - - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureFunctionsProjectResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new AzureFunctionsProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + withHealthCheck(key: string): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -9148,204 +9603,83 @@ export class AzureFunctionsProjectResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureFunctionsProjectResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureDataLakeStorageFileSystemResourcePromise { const commandOptions = options?.commandOptions; - return new AzureFunctionsProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); - } - - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); - } - - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); - } - - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); - } - - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); - } - - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); - } - - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): AzureFunctionsProjectResourcePromise { - const password = options?.password; - return new AzureFunctionsProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); - } - - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); - } - - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withoutHttpsCertificateInternal()); + return new AzureDataLakeStorageFileSystemResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureFunctionsProjectResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): AzureDataLakeStorageFileSystemResourcePromise { const iconVariant = options?.iconVariant; - return new AzureFunctionsProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); - } - - /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); - } - - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureFunctionsProjectResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new AzureFunctionsProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new AzureDataLakeStorageFileSystemResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._excludeFromMcpInternal()); - } - - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + excludeFromMcp(): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -9356,60 +9690,60 @@ export class AzureFunctionsProjectResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureFunctionsProjectResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureDataLakeStorageFileSystemResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new AzureFunctionsProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new AzureDataLakeStorageFileSystemResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -9422,191 +9756,133 @@ export class AzureFunctionsProjectResource extends ResourceBuilderBase Promise): Promise { - const configureId = registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; - const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); - const arg2 = wrapIfHandle(args.p1) as ContainerAppHandle; - await configure(arg1, arg2); + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { project: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.AppContainers/publishProjectAsAzureContainerApp', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Configures the project resource to be published as an Azure Container App */ - publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._publishAsAzureContainerAppInternal(configure)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _publishAsConfiguredAzureContainerAppJobInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { - const configureId = registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; - const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); - const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; - await configure(arg1, arg2); + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { resource: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredAzureContainerAppJob', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Configures the compute resource as an Azure Container App Job with custom configuration */ - publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._publishAsConfiguredAzureContainerAppJobInternal(configure)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _publishAsAzureContainerAppJobInternal(): Promise { - const rpcArgs: Record = { resource: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.AppContainers/publishAsAzureContainerAppJob', + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Configures the compute resource as a manually triggered Azure Container App Job */ - publishAsAzureContainerAppJob(): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._publishAsAzureContainerAppJobInternal()); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._onConnectionStringAvailableInternal(callback)); } /** @internal */ - private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { - const configureId = configure ? registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; - const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); - const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; - await configure(arg1, arg2); - }) : undefined; - const rpcArgs: Record = { resource: this._handle, cronExpression }; - if (configure !== undefined) rpcArgs.configure = configureId; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredScheduledAzureContainerAppJob', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ - publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): AzureFunctionsProjectResourcePromise { - const configure = options?.configure; - return new AzureFunctionsProjectResourcePromise(this._publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression, configure)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _publishAsScheduledAzureContainerAppJobInternal(cronExpression: string): Promise { - const rpcArgs: Record = { resource: this._handle, cronExpression }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.AppContainers/publishAsScheduledAzureContainerAppJob', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Configures the compute resource as a scheduled Azure Container App Job */ - publishAsScheduledAzureContainerAppJob(cronExpression: string): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._publishAsScheduledAzureContainerAppJobInternal(cronExpression)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); - } - - /** @internal */ - private async _withHostStorageInternal(storage: AzureStorageResource): Promise { - const rpcArgs: Record = { builder: this._handle, storage }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Functions/withHostStorage', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); - } - - /** Configures the Azure Functions project to use specified Azure Storage as host storage */ - withHostStorage(storage: AzureStorageResource): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withHostStorageInternal(storage)); - } - - /** @internal */ - private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withEnvironmentFromOutput', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); - } - - /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); - } - - /** @internal */ - private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, name, secretReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); - } - - /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); - } - - /** @internal */ - private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { - const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', - rpcArgs - ); - return new AzureFunctionsProjectResource(result, this._client); - } - - /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); } /** @internal */ @@ -9625,340 +9901,145 @@ export class AzureFunctionsProjectResource extends ResourceBuilderBase { + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', rpcArgs ); - return new AzureFunctionsProjectResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); } } /** - * Thenable wrapper for AzureFunctionsProjectResource that enables fluent chaining. + * Thenable wrapper for AzureDataLakeStorageFileSystemResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class AzureFunctionsProjectResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class AzureDataLakeStorageFileSystemResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: AzureFunctionsProjectResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: AzureDataLakeStorageFileSystemResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); - } - - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); - } - - /** Configures OTLP telemetry export */ - withOtlpExporter(): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); - } - - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); - } - - /** Sets the number of replicas */ - withReplicas(replicas: number): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); - } - - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); - } - - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); - } - - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); - } - - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); - } - - /** Adds arguments */ - withArgs(args: string[]): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); - } - - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); - } - - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); - } - - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); - } - - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); - } - - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); - } - - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); - } - - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); - } - - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } - - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } - - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); - } - - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); - } - - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); - } - - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + excludeFromManifest(): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } - - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + withExplicitStart(): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHealthCheck(key: string): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); - } - - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); - } - - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); - } - - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); - } - - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); - } - - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withIconName(iconName: string, options?: WithIconNameOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + excludeFromMcp(): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -9966,59 +10047,39 @@ export class AzureFunctionsProjectResourcePromise implements PromiseLike obj.getResourceName()); } - /** Configures the project resource to be published as an Azure Container App */ - publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerApp(configure))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Configures the compute resource as an Azure Container App Job with custom configuration */ - publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Configures the compute resource as a manually triggered Azure Container App Job */ - publishAsAzureContainerAppJob(): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerAppJob())); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } - /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ - publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.publishAsConfiguredScheduledAzureContainerAppJob(cronExpression, options))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Configures the compute resource as a scheduled Azure Container App Job */ - publishAsScheduledAzureContainerAppJob(cronExpression: string): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.publishAsScheduledAzureContainerAppJob(cronExpression))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); - } - - /** Configures the Azure Functions project to use specified Azure Storage as host storage */ - withHostStorage(storage: AzureStorageResource): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withHostStorage(storage))); - } - - /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); - } - - /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); - } - - /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureFunctionsProjectResourcePromise { - return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); } /** Gets the Azure Container Registry associated with a compute environment resource. */ @@ -10027,212 +10088,251 @@ export class AzureFunctionsProjectResourcePromise implements PromiseLike obj.withContainerRegistryRoleAssignments(target, roles))); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); } } // ============================================================================ -// AzureLogAnalyticsWorkspaceResource +// AzureDataLakeStorageResource // ============================================================================ -export class AzureLogAnalyticsWorkspaceResource extends ResourceBuilderBase { - constructor(handle: AzureLogAnalyticsWorkspaceResourceHandle, client: AspireClientRpc) { +export class AzureDataLakeStorageResource extends ResourceBuilderBase { + constructor(handle: AzureDataLakeStorageResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureLogAnalyticsWorkspaceResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureDataLakeStorageResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new AzureDataLakeStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureLogAnalyticsWorkspaceResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureDataLakeStorageResourcePromise { const helpLink = options?.helpLink; - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new AzureDataLakeStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureLogAnalyticsWorkspaceResourcePromise { + withUrl(url: string, options?: WithUrlOptions): AzureDataLakeStorageResourcePromise { const displayText = options?.displayText; - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withUrlInternal(url, displayText)); + return new AzureDataLakeStorageResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureLogAnalyticsWorkspaceResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureDataLakeStorageResourcePromise { const displayText = options?.displayText; - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new AzureDataLakeStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -10240,113 +10340,83 @@ export class AzureLogAnalyticsWorkspaceResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureLogAnalyticsWorkspaceResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureDataLakeStorageResourcePromise { const commandOptions = options?.commandOptions; - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new AzureDataLakeStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureLogAnalyticsWorkspaceResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): AzureDataLakeStorageResourcePromise { const iconVariant = options?.iconVariant; - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new AzureDataLakeStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._excludeFromMcpInternal()); - } - - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + excludeFromMcp(): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -10357,60 +10427,60 @@ export class AzureLogAnalyticsWorkspaceResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureLogAnalyticsWorkspaceResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureDataLakeStorageResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new AzureDataLakeStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -10423,305 +10493,133 @@ export class AzureLogAnalyticsWorkspaceResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', - rpcArgs - ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); - } - - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); - } - - /** Gets an output reference from an Azure Bicep template resource */ - async getOutput(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/getOutput', - rpcArgs - ); - } - - /** @internal */ - private async _withParameterInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameter', - rpcArgs - ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); - } - - /** Adds a Bicep parameter without a value */ - withParameter(name: string): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParameterInternal(name)); - } - - /** @internal */ - private async _withParameterStringValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterStringValue', - rpcArgs - ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); - } - - /** Adds a Bicep parameter with a string value */ - withParameterStringValue(name: string, value: string): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParameterStringValueInternal(name, value)); - } - - /** @internal */ - private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterStringValues', - rpcArgs - ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); - } - - /** Adds a Bicep parameter with a string list value */ - withParameterStringValues(name: string, value: string[]): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParameterStringValuesInternal(name, value)); - } - - /** @internal */ - private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromParameter', - rpcArgs - ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); - } - - /** Adds a Bicep parameter from a parameter resource builder */ - withParameterFromParameter(name: string, value: ParameterResource): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParameterFromParameterInternal(name, value)); - } - - /** @internal */ - private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromConnectionString', - rpcArgs - ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); - } - - /** Adds a Bicep parameter from a connection string resource builder */ - withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); - } - - /** @internal */ - private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromOutput', - rpcArgs - ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); - } - - /** Adds a Bicep parameter from another Bicep output reference */ - withParameterFromOutput(name: string, value: BicepOutputReference): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParameterFromOutputInternal(name, value)); - } - - /** @internal */ - private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', - rpcArgs - ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); - } - - /** Adds a Bicep parameter from a reference expression */ - withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); - } - - /** @internal */ - private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromEndpoint', - rpcArgs - ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); - } - - /** Adds a Bicep parameter from an endpoint reference */ - withParameterFromEndpoint(name: string, value: EndpointReference): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParameterFromEndpointInternal(name, value)); - } - - /** @internal */ - private async _configureInfrastructureInternal(configure: (obj: AzureResourceInfrastructure) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; - const obj = new AzureResourceInfrastructure(objHandle, this._client); - await configure(obj); + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/configureInfrastructure', - rpcArgs - ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); - } - - /** Configures the Azure provisioning infrastructure callback */ - configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._configureInfrastructureInternal(configure)); - } - - /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsConnectionString', - rpcArgs - ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); - } - - /** Publishes an Azure resource to the manifest as a connection string */ - publishAsConnectionString(): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._publishAsConnectionStringInternal()); - } - - /** Gets the normalized Bicep identifier for an Azure resource */ - async getBicepIdentifier(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/getBicepIdentifier', - rpcArgs - ); - } - - /** @internal */ - private async _clearDefaultRoleAssignmentsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); - } - - /** Clears the default Azure role assignments from a resource */ - clearDefaultRoleAssignments(): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + return new AzureDataLakeStorageResource(result, this._client); } - /** Determines whether a resource is marked as existing */ - async isExisting(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/isExisting', - rpcArgs - ); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/runAsExistingFromParameters', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } - /** Marks an Azure resource as existing in run mode by using parameter resources */ - runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/runAsExisting', + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } - /** Marks an Azure resource as existing in run mode */ - runAsExisting(name: string, resourceGroup: string): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._runAsExistingInternal(name, resourceGroup)); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._onConnectionStringAvailableInternal(callback)); } /** @internal */ - private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsExistingFromParameters', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } - /** Marks an Azure resource as existing in publish mode by using parameter resources */ - publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsExisting', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } - /** Marks an Azure resource as existing in publish mode */ - publishAsExisting(name: string, resourceGroup: string): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/asExisting', + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } - /** Marks an Azure resource as existing in both run and publish modes */ - asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); } /** @internal */ @@ -10740,140 +10638,145 @@ export class AzureLogAnalyticsWorkspaceResource extends ResourceBuilderBase { + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', rpcArgs ); - return new AzureLogAnalyticsWorkspaceResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); } } /** - * Thenable wrapper for AzureLogAnalyticsWorkspaceResource that enables fluent chaining. + * Thenable wrapper for AzureDataLakeStorageResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class AzureLogAnalyticsWorkspaceResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class AzureDataLakeStorageResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: AzureLogAnalyticsWorkspaceResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: AzureDataLakeStorageResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + excludeFromMcp(): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -10881,109 +10784,39 @@ export class AzureLogAnalyticsWorkspaceResourcePromise implements PromiseLike obj.getResourceName()); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Gets an output reference from an Azure Bicep template resource */ - getOutput(name: string): Promise { - return this._promise.then(obj => obj.getOutput(name)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Adds a Bicep parameter without a value */ - withParameter(name: string): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParameter(name))); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } - /** Adds a Bicep parameter with a string value */ - withParameterStringValue(name: string, value: string): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Adds a Bicep parameter with a string list value */ - withParameterStringValues(name: string, value: string[]): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Adds a Bicep parameter from a parameter resource builder */ - withParameterFromParameter(name: string, value: ParameterResource): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } - /** Adds a Bicep parameter from a connection string resource builder */ - withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); - } - - /** Adds a Bicep parameter from another Bicep output reference */ - withParameterFromOutput(name: string, value: BicepOutputReference): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); - } - - /** Adds a Bicep parameter from a reference expression */ - withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); - } - - /** Adds a Bicep parameter from an endpoint reference */ - withParameterFromEndpoint(name: string, value: EndpointReference): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); - } - - /** Configures the Azure provisioning infrastructure callback */ - configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.configureInfrastructure(configure))); - } - - /** Publishes an Azure resource to the manifest as a connection string */ - publishAsConnectionString(): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); - } - - /** Gets the normalized Bicep identifier for an Azure resource */ - getBicepIdentifier(): Promise { - return this._promise.then(obj => obj.getBicepIdentifier()); - } - - /** Clears the default Azure role assignments from a resource */ - clearDefaultRoleAssignments(): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); - } - - /** Determines whether a resource is marked as existing */ - isExisting(): Promise { - return this._promise.then(obj => obj.isExisting()); - } - - /** Marks an Azure resource as existing in run mode by using parameter resources */ - runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); - } - - /** Marks an Azure resource as existing in run mode */ - runAsExisting(name: string, resourceGroup: string): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); - } - - /** Marks an Azure resource as existing in publish mode by using parameter resources */ - publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); - } - - /** Marks an Azure resource as existing in publish mode */ - publishAsExisting(name: string, resourceGroup: string): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); - } - - /** Marks an Azure resource as existing in both run and publish modes */ - asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); - } - - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureLogAnalyticsWorkspaceResourcePromise { - return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); } /** Gets the Azure Container Registry associated with a compute environment resource. */ @@ -10992,212 +10825,212 @@ export class AzureLogAnalyticsWorkspaceResourcePromise implements PromiseLike obj.withContainerRegistryRoleAssignments(target, roles))); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); } } // ============================================================================ -// AzureProvisioningResource +// AzureEnvironmentResource // ============================================================================ -export class AzureProvisioningResource extends ResourceBuilderBase { - constructor(handle: AzureProvisioningResourceHandle, client: AspireClientRpc) { +export class AzureEnvironmentResource extends ResourceBuilderBase { + constructor(handle: AzureEnvironmentResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureProvisioningResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureEnvironmentResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new AzureProvisioningResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new AzureEnvironmentResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureProvisioningResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureEnvironmentResourcePromise { const helpLink = options?.helpLink; - return new AzureProvisioningResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new AzureEnvironmentResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureProvisioningResourcePromise { + withUrl(url: string, options?: WithUrlOptions): AzureEnvironmentResourcePromise { const displayText = options?.displayText; - return new AzureProvisioningResourcePromise(this._withUrlInternal(url, displayText)); + return new AzureEnvironmentResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureProvisioningResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureEnvironmentResourcePromise { const displayText = options?.displayText; - return new AzureProvisioningResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new AzureEnvironmentResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -11205,113 +11038,83 @@ export class AzureProvisioningResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureProvisioningResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureEnvironmentResourcePromise { const commandOptions = options?.commandOptions; - return new AzureProvisioningResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new AzureEnvironmentResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureProvisioningResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): AzureEnvironmentResourcePromise { const iconVariant = options?.iconVariant; - return new AzureProvisioningResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new AzureEnvironmentResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._excludeFromMcpInternal()); - } - - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new AzureProvisioningResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new AzureProvisioningResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + excludeFromMcp(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -11322,60 +11125,60 @@ export class AzureProvisioningResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureProvisioningResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureEnvironmentResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new AzureProvisioningResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new AzureEnvironmentResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -11388,437 +11191,285 @@ export class AzureProvisioningResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new AzureProvisioningResource(result, this._client); - } - - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + return new AzureEnvironmentResource(result, this._client); } - /** Gets an output reference from an Azure Bicep template resource */ - async getOutput(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/getOutput', - rpcArgs - ); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withParameterInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameter', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } - /** Adds a Bicep parameter without a value */ - withParameter(name: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withParameterInternal(name)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withParameterStringValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterStringValue', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } - /** Adds a Bicep parameter with a string value */ - withParameterStringValue(name: string, value: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withParameterStringValueInternal(name, value)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterStringValues', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } - /** Adds a Bicep parameter with a string list value */ - withParameterStringValues(name: string, value: string[]): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withParameterStringValuesInternal(name, value)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromParameter', + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } - /** Adds a Bicep parameter from a parameter resource builder */ - withParameterFromParameter(name: string, value: ParameterResource): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withParameterFromParameterInternal(name, value)); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } /** @internal */ - private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromConnectionString', + private async _withLocationInternal(location: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, location }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withLocation', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } - /** Adds a Bicep parameter from a connection string resource builder */ - withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); + /** Sets the Azure location for the shared Azure environment resource */ + withLocation(location: ParameterResource): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withLocationInternal(location)); } /** @internal */ - private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromOutput', + private async _withResourceGroupInternal(resourceGroup: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withResourceGroup', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } - /** Adds a Bicep parameter from another Bicep output reference */ - withParameterFromOutput(name: string, value: BicepOutputReference): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withParameterFromOutputInternal(name, value)); + /** Sets the Azure resource group for the shared Azure environment resource */ + withResourceGroup(resourceGroup: ParameterResource): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withResourceGroupInternal(resourceGroup)); } /** @internal */ - private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } - /** Adds a Bicep parameter from a reference expression */ - withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); } /** @internal */ - private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromEndpoint', + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureContainerRegistryResource(result, this._client); } - /** Adds a Bicep parameter from an endpoint reference */ - withParameterFromEndpoint(name: string, value: EndpointReference): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withParameterFromEndpointInternal(name, value)); + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); } /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsConnectionString', + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } - /** Publishes an Azure resource to the manifest as a connection string */ - publishAsConnectionString(): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._publishAsConnectionStringInternal()); + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); } - /** Gets the normalized Bicep identifier for an Azure resource */ - async getBicepIdentifier(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/getBicepIdentifier', - rpcArgs - ); - } +} - /** @internal */ - private async _clearDefaultRoleAssignmentsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', - rpcArgs - ); - return new AzureProvisioningResource(result, this._client); +/** + * Thenable wrapper for AzureEnvironmentResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureEnvironmentResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureEnvironmentResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Clears the default Azure role assignments from a resource */ - clearDefaultRoleAssignments(): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Determines whether a resource is marked as existing */ - async isExisting(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/isExisting', - rpcArgs - ); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** @internal */ - private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/runAsExistingFromParameters', - rpcArgs - ); - return new AzureProvisioningResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Marks an Azure resource as existing in run mode by using parameter resources */ - runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); - } - - /** @internal */ - private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/runAsExisting', - rpcArgs - ); - return new AzureProvisioningResource(result, this._client); - } - - /** Marks an Azure resource as existing in run mode */ - runAsExisting(name: string, resourceGroup: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._runAsExistingInternal(name, resourceGroup)); - } - - /** @internal */ - private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsExistingFromParameters', - rpcArgs - ); - return new AzureProvisioningResource(result, this._client); - } - - /** Marks an Azure resource as existing in publish mode by using parameter resources */ - publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); - } - - /** @internal */ - private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsExisting', - rpcArgs - ); - return new AzureProvisioningResource(result, this._client); - } - - /** Marks an Azure resource as existing in publish mode */ - publishAsExisting(name: string, resourceGroup: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); - } - - /** @internal */ - private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/asExisting', - rpcArgs - ); - return new AzureProvisioningResource(result, this._client); - } - - /** Marks an Azure resource as existing in both run and publish modes */ - asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); - } - - /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { - const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', - rpcArgs - ); - return new AzureProvisioningResource(result, this._client); - } - - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); - } - - /** @internal */ - private async _getAzureContainerRegistryInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', - rpcArgs - ); - return new AzureContainerRegistryResource(result, this._client); - } - - /** Gets the Azure Container Registry associated with a compute environment resource. */ - getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); - } - - /** @internal */ - private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', - rpcArgs - ); - return new AzureProvisioningResource(result, this._client); - } - - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); - } - -} - -/** - * Thenable wrapper for AzureProvisioningResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class AzureProvisioningResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: AzureProvisioningResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + excludeFromMcp(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -11826,104 +11477,44 @@ export class AzureProvisioningResourcePromise implements PromiseLike obj.getResourceName()); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); - } - - /** Gets an output reference from an Azure Bicep template resource */ - getOutput(name: string): Promise { - return this._promise.then(obj => obj.getOutput(name)); - } - - /** Adds a Bicep parameter without a value */ - withParameter(name: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameter(name))); - } - - /** Adds a Bicep parameter with a string value */ - withParameterStringValue(name: string, value: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); - } - - /** Adds a Bicep parameter with a string list value */ - withParameterStringValues(name: string, value: string[]): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); - } - - /** Adds a Bicep parameter from a parameter resource builder */ - withParameterFromParameter(name: string, value: ParameterResource): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); - } - - /** Adds a Bicep parameter from a connection string resource builder */ - withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); - } - - /** Adds a Bicep parameter from another Bicep output reference */ - withParameterFromOutput(name: string, value: BicepOutputReference): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); - } - - /** Adds a Bicep parameter from a reference expression */ - withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); - } - - /** Adds a Bicep parameter from an endpoint reference */ - withParameterFromEndpoint(name: string, value: EndpointReference): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); - } - - /** Publishes an Azure resource to the manifest as a connection string */ - publishAsConnectionString(): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); - } - - /** Gets the normalized Bicep identifier for an Azure resource */ - getBicepIdentifier(): Promise { - return this._promise.then(obj => obj.getBicepIdentifier()); - } - - /** Clears the default Azure role assignments from a resource */ - clearDefaultRoleAssignments(): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Determines whether a resource is marked as existing */ - isExisting(): Promise { - return this._promise.then(obj => obj.isExisting()); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Marks an Azure resource as existing in run mode by using parameter resources */ - runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Marks an Azure resource as existing in run mode */ - runAsExisting(name: string, resourceGroup: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Marks an Azure resource as existing in publish mode by using parameter resources */ - publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } - /** Marks an Azure resource as existing in publish mode */ - publishAsExisting(name: string, resourceGroup: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + /** Sets the Azure location for the shared Azure environment resource */ + withLocation(location: ParameterResource): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withLocation(location))); } - /** Marks an Azure resource as existing in both run and publish modes */ - asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + /** Sets the Azure resource group for the shared Azure environment resource */ + withResourceGroup(resourceGroup: ParameterResource): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withResourceGroup(resourceGroup))); } /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); } /** Gets the Azure Container Registry associated with a compute environment resource. */ @@ -11932,994 +11523,972 @@ export class AzureProvisioningResourcePromise implements PromiseLike obj.withContainerRegistryRoleAssignments(target, roles))); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); } } // ============================================================================ -// AzureQueueStorageQueueResource +// AzureFunctionsProjectResource // ============================================================================ -export class AzureQueueStorageQueueResource extends ResourceBuilderBase { - constructor(handle: AzureQueueStorageQueueResourceHandle, client: AspireClientRpc) { +export class AzureFunctionsProjectResource extends ResourceBuilderBase { + constructor(handle: AzureFunctionsProjectResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureQueueStorageQueueResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureFunctionsProjectResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new AzureQueueStorageQueueResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new AzureFunctionsProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureQueueStorageQueueResourcePromise { - const helpLink = options?.helpLink; - return new AzureQueueStorageQueueResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): AzureFunctionsProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new AzureFunctionsProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets the number of replicas */ + withReplicas(replicas: number): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withReplicasInternal(replicas)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._disableForwardedHeadersInternal()); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureQueueStorageQueueResourcePromise { - const displayText = options?.displayText; - return new AzureQueueStorageQueueResourcePromise(this._withUrlInternal(url, displayText)); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): AzureFunctionsProjectResourcePromise { + const configure = options?.configure; + return new AzureFunctionsProjectResourcePromise(this._publishAsDockerFileInternal(configure)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureQueueStorageQueueResourcePromise { - const displayText = options?.displayText; - return new AzureQueueStorageQueueResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureFunctionsProjectResourcePromise { + const helpLink = options?.helpLink; + return new AzureFunctionsProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._excludeFromManifestInternal()); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withExplicitStartInternal()); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withHealthCheckInternal(key)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureQueueStorageQueueResourcePromise { - const commandOptions = options?.commandOptions; - return new AzureQueueStorageQueueResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withParentRelationshipInternal(parent)); + /** Adds arguments */ + withArgs(args: string[]): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureQueueStorageQueueResourcePromise { - const iconVariant = options?.iconVariant; - return new AzureQueueStorageQueueResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._excludeFromMcpInternal()); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): AzureFunctionsProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new AzureFunctionsProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureQueueStorageQueueResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new AzureQueueStorageQueueResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): AzureFunctionsProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new AzureFunctionsProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): AzureFunctionsProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new AzureFunctionsProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureFunctionsProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new AzureFunctionsProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { - const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); - } - - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); } /** @internal */ - private async _getAzureContainerRegistryInternal(): Promise { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Gets the Azure Container Registry associated with a compute environment resource. */ - getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + /** Configures resource for HTTP/2 */ + asHttp2Service(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withUrlsCallbackInternal(callback)); } -} - -/** - * Thenable wrapper for AzureQueueStorageQueueResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class AzureQueueStorageQueueResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } - then( - onfulfilled?: ((value: AzureQueueStorageQueueResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureFunctionsProjectResourcePromise { + const displayText = options?.displayText; + return new AzureFunctionsProjectResourcePromise(this._withUrlInternal(url, displayText)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureFunctionsProjectResourcePromise { + const displayText = options?.displayText; + return new AzureFunctionsProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._excludeFromManifestInternal()); } - /** Adds a health check by key */ - withHealthCheck(key: string): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._waitForInternal(dependency)); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); - } - - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); - } - - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); - } - - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); - } - - /** Gets the Azure Container Registry associated with a compute environment resource. */ - getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); - } - - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); - } - -} - -// ============================================================================ -// AzureQueueStorageResource -// ============================================================================ - -export class AzureQueueStorageResource extends ResourceBuilderBase { - constructor(handle: AzureQueueStorageResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withContainerRegistryInternal(registry)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureQueueStorageResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new AzureQueueStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureQueueStorageResourcePromise { - const helpLink = options?.helpLink; - return new AzureQueueStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): AzureFunctionsProjectResourcePromise { + const exitCode = options?.exitCode; + return new AzureFunctionsProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureFunctionsProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new AzureFunctionsProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new AzureQueueStorageResource(result, this._client); - } - - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); - } - - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureQueueStorageResourcePromise { - const displayText = options?.displayText; - return new AzureQueueStorageResourcePromise(this._withUrlInternal(url, displayText)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureFunctionsProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureFunctionsProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureQueueStorageResourcePromise { - const displayText = options?.displayText; - return new AzureQueueStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._excludeFromManifestInternal()); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): AzureFunctionsProjectResourcePromise { + const password = options?.password; + return new AzureFunctionsProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new AzureQueueStorageResource(result, this._client); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withExplicitStartInternal()); - } - - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new AzureQueueStorageResource(result, this._client); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withHealthCheckInternal(key)); - } - - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureQueueStorageResourcePromise { - const commandOptions = options?.commandOptions; - return new AzureQueueStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureQueueStorageResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): AzureFunctionsProjectResourcePromise { const iconVariant = options?.iconVariant; - return new AzureQueueStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new AzureFunctionsProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureFunctionsProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new AzureFunctionsProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -12930,60 +12499,60 @@ export class AzureQueueStorageResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureQueueStorageResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureFunctionsProjectResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new AzureQueueStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new AzureFunctionsProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -12996,195 +12565,11089 @@ export class AzureQueueStorageResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { - const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _getAzureContainerRegistryInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Gets the Azure Container Registry associated with a compute environment resource. */ - getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureFunctionsProjectResource(result, this._client); } - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } -} + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } -/** - * Thenable wrapper for AzureQueueStorageResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class AzureQueueStorageResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _publishAsAzureContainerAppInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(arg2Data) as ContainerAppHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { project: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishProjectAsAzureContainerApp', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Configures the project resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._publishAsAzureContainerAppInternal(configure)); + } + + /** @internal */ + private async _publishAsConfiguredAzureContainerAppJobInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(arg2Data) as ContainerAppJobHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { resource: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredAzureContainerAppJob', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._publishAsConfiguredAzureContainerAppJobInternal(configure)); + } + + /** @internal */ + private async _publishAsAzureContainerAppJobInternal(): Promise { + const rpcArgs: Record = { resource: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsAzureContainerAppJob', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._publishAsAzureContainerAppJobInternal()); + } + + /** @internal */ + private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = configure ? registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(arg2Data) as ContainerAppJobHandle; + await configure(arg1, arg2); + }) : undefined; + const rpcArgs: Record = { resource: this._handle, cronExpression }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredScheduledAzureContainerAppJob', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): AzureFunctionsProjectResourcePromise { + const configure = options?.configure; + return new AzureFunctionsProjectResourcePromise(this._publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression, configure)); + } + + /** @internal */ + private async _publishAsScheduledAzureContainerAppJobInternal(cronExpression: string): Promise { + const rpcArgs: Record = { resource: this._handle, cronExpression }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsScheduledAzureContainerAppJob', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._publishAsScheduledAzureContainerAppJobInternal(cronExpression)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withHostStorageInternal(storage: AzureStorageResource): Promise { + const rpcArgs: Record = { builder: this._handle, storage }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Functions/withHostStorage', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Configures the Azure Functions project to use specified Azure Storage as host storage */ + withHostStorage(storage: AzureStorageResource): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withHostStorageInternal(storage)); + } + + /** @internal */ + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + } + + /** @internal */ + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + } + + /** @internal */ + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withUserAssignedIdentityAzureUserAssignedIdentity', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureFunctionsProjectResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureFunctionsProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureFunctionsProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureFunctionsProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures the project resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerApp(configure))); + } + + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); + } + + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerAppJob())); + } + + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.publishAsConfiguredScheduledAzureContainerAppJob(cronExpression, options))); + } + + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.publishAsScheduledAzureContainerAppJob(cronExpression))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Configures the Azure Functions project to use specified Azure Storage as host storage */ + withHostStorage(storage: AzureStorageResource): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withHostStorage(storage))); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureFunctionsProjectResourcePromise { + return new AzureFunctionsProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureLogAnalyticsWorkspaceResource +// ============================================================================ + +export class AzureLogAnalyticsWorkspaceResource extends ResourceBuilderBase { + constructor(handle: AzureLogAnalyticsWorkspaceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureLogAnalyticsWorkspaceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureLogAnalyticsWorkspaceResourcePromise { + const helpLink = options?.helpLink; + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureLogAnalyticsWorkspaceResourcePromise { + const displayText = options?.displayText; + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureLogAnalyticsWorkspaceResourcePromise { + const displayText = options?.displayText; + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureLogAnalyticsWorkspaceResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureLogAnalyticsWorkspaceResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureLogAnalyticsWorkspaceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** Gets an output reference from an Azure Bicep template resource */ + async getOutput(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getOutput', + rpcArgs + ); + } + + /** @internal */ + private async _withParameterInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameter', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParameterInternal(name)); + } + + /** @internal */ + private async _withParameterStringValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValue', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParameterStringValueInternal(name, value)); + } + + /** @internal */ + private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValues', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParameterStringValuesInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromParameter', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParameterFromParameterInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromConnectionString', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromOutput', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParameterFromOutputInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromEndpoint', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withParameterFromEndpointInternal(name, value)); + } + + /** @internal */ + private async _configureInfrastructureInternal(configure: (obj: AzureResourceInfrastructure) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; + const obj = new AzureResourceInfrastructure(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/configureInfrastructure', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._configureInfrastructureInternal(configure)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsConnectionString', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + async getBicepIdentifier(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getBicepIdentifier', + rpcArgs + ); + } + + /** @internal */ + private async _clearDefaultRoleAssignmentsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + } + + /** Determines whether a resource is marked as existing */ + async isExisting(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/isExisting', + rpcArgs + ); + } + + /** @internal */ + private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExistingFromParameters', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExisting', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._runAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExistingFromParameters', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExisting', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/asExistingFromParameters', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureLogAnalyticsWorkspaceResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureLogAnalyticsWorkspaceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureLogAnalyticsWorkspaceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureLogAnalyticsWorkspaceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Gets an output reference from an Azure Bicep template resource */ + getOutput(name: string): Promise { + return this._promise.then(obj => obj.getOutput(name)); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParameter(name))); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); + } + + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.configureInfrastructure(configure))); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + getBicepIdentifier(): Promise { + return this._promise.then(obj => obj.getBicepIdentifier()); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + } + + /** Determines whether a resource is marked as existing */ + isExisting(): Promise { + return this._promise.then(obj => obj.isExisting()); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureLogAnalyticsWorkspaceResourcePromise { + return new AzureLogAnalyticsWorkspaceResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureProvisioningResource +// ============================================================================ + +export class AzureProvisioningResource extends ResourceBuilderBase { + constructor(handle: AzureProvisioningResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureProvisioningResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureProvisioningResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureProvisioningResourcePromise { + const helpLink = options?.helpLink; + return new AzureProvisioningResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureProvisioningResourcePromise { + const displayText = options?.displayText; + return new AzureProvisioningResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureProvisioningResourcePromise { + const displayText = options?.displayText; + return new AzureProvisioningResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureProvisioningResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureProvisioningResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureProvisioningResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureProvisioningResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureProvisioningResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureProvisioningResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** Gets an output reference from an Azure Bicep template resource */ + async getOutput(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getOutput', + rpcArgs + ); + } + + /** @internal */ + private async _withParameterInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameter', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterInternal(name)); + } + + /** @internal */ + private async _withParameterStringValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValue', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterStringValueInternal(name, value)); + } + + /** @internal */ + private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValues', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterStringValuesInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromParameter', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterFromParameterInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromConnectionString', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromOutput', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterFromOutputInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromEndpoint', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterFromEndpointInternal(name, value)); + } + + /** @internal */ + private async _configureInfrastructureInternal(configure: (obj: AzureResourceInfrastructure) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; + const obj = new AzureResourceInfrastructure(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/configureInfrastructure', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._configureInfrastructureInternal(configure)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsConnectionString', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + async getBicepIdentifier(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getBicepIdentifier', + rpcArgs + ); + } + + /** @internal */ + private async _clearDefaultRoleAssignmentsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + } + + /** Determines whether a resource is marked as existing */ + async isExisting(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/isExisting', + rpcArgs + ); + } + + /** @internal */ + private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExistingFromParameters', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExisting', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._runAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExistingFromParameters', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExisting', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/asExistingFromParameters', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureProvisioningResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureProvisioningResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureProvisioningResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureProvisioningResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Gets an output reference from an Azure Bicep template resource */ + getOutput(name: string): Promise { + return this._promise.then(obj => obj.getOutput(name)); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameter(name))); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); + } + + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.configureInfrastructure(configure))); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + getBicepIdentifier(): Promise { + return this._promise.then(obj => obj.getBicepIdentifier()); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + } + + /** Determines whether a resource is marked as existing */ + isExisting(): Promise { + return this._promise.then(obj => obj.isExisting()); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureQueueStorageQueueResource +// ============================================================================ + +export class AzureQueueStorageQueueResource extends ResourceBuilderBase { + constructor(handle: AzureQueueStorageQueueResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureQueueStorageQueueResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureQueueStorageQueueResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureQueueStorageQueueResourcePromise { + const helpLink = options?.helpLink; + return new AzureQueueStorageQueueResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureQueueStorageQueueResourcePromise { + const displayText = options?.displayText; + return new AzureQueueStorageQueueResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureQueueStorageQueueResourcePromise { + const displayText = options?.displayText; + return new AzureQueueStorageQueueResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureQueueStorageQueueResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureQueueStorageQueueResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureQueueStorageQueueResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureQueueStorageQueueResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureQueueStorageQueueResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureQueueStorageQueueResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._onConnectionStringAvailableInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureQueueStorageQueueResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureQueueStorageQueueResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureQueueStorageQueueResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureQueueStorageResource +// ============================================================================ + +export class AzureQueueStorageResource extends ResourceBuilderBase { + constructor(handle: AzureQueueStorageResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureQueueStorageResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureQueueStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureQueueStorageResourcePromise { + const helpLink = options?.helpLink; + return new AzureQueueStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureQueueStorageResourcePromise { + const displayText = options?.displayText; + return new AzureQueueStorageResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureQueueStorageResourcePromise { + const displayText = options?.displayText; + return new AzureQueueStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureQueueStorageResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureQueueStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureQueueStorageResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureQueueStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureQueueStorageResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureQueueStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._onConnectionStringAvailableInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureQueueStorageResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureQueueStorageResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureQueueStorageResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureStorageEmulatorResource +// ============================================================================ + +export class AzureStorageEmulatorResource extends ResourceBuilderBase { + constructor(handle: AzureStorageEmulatorResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): AzureStorageEmulatorResourcePromise { + const isReadOnly = options?.isReadOnly; + return new AzureStorageEmulatorResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): AzureStorageEmulatorResourcePromise { + const tag = options?.tag; + return new AzureStorageEmulatorResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): AzureStorageEmulatorResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new AzureStorageEmulatorResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureStorageEmulatorResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureStorageEmulatorResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): AzureStorageEmulatorResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new AzureStorageEmulatorResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureStorageEmulatorResourcePromise { + const helpLink = options?.helpLink; + return new AzureStorageEmulatorResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): AzureStorageEmulatorResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new AzureStorageEmulatorResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): AzureStorageEmulatorResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new AzureStorageEmulatorResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): AzureStorageEmulatorResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new AzureStorageEmulatorResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureStorageEmulatorResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new AzureStorageEmulatorResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureStorageEmulatorResourcePromise { + const displayText = options?.displayText; + return new AzureStorageEmulatorResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureStorageEmulatorResourcePromise { + const displayText = options?.displayText; + return new AzureStorageEmulatorResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): AzureStorageEmulatorResourcePromise { + const exitCode = options?.exitCode; + return new AzureStorageEmulatorResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureStorageEmulatorResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new AzureStorageEmulatorResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureStorageEmulatorResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureStorageEmulatorResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): AzureStorageEmulatorResourcePromise { + const password = options?.password; + return new AzureStorageEmulatorResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureStorageEmulatorResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureStorageEmulatorResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureStorageEmulatorResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new AzureStorageEmulatorResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureStorageEmulatorResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureStorageEmulatorResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): AzureStorageEmulatorResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new AzureStorageEmulatorResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _publishAsAzureContainerAppInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(arg2Data) as ContainerAppHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { container: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishContainerAsAzureContainerApp', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures the container resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._publishAsAzureContainerAppInternal(configure)); + } + + /** @internal */ + private async _publishAsConfiguredAzureContainerAppJobInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(arg2Data) as ContainerAppJobHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { resource: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredAzureContainerAppJob', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._publishAsConfiguredAzureContainerAppJobInternal(configure)); + } + + /** @internal */ + private async _publishAsAzureContainerAppJobInternal(): Promise { + const rpcArgs: Record = { resource: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsAzureContainerAppJob', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._publishAsAzureContainerAppJobInternal()); + } + + /** @internal */ + private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = configure ? registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(arg2Data) as ContainerAppJobHandle; + await configure(arg1, arg2); + }) : undefined; + const rpcArgs: Record = { resource: this._handle, cronExpression }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredScheduledAzureContainerAppJob', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): AzureStorageEmulatorResourcePromise { + const configure = options?.configure; + return new AzureStorageEmulatorResourcePromise(this._publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression, configure)); + } + + /** @internal */ + private async _publishAsScheduledAzureContainerAppJobInternal(cronExpression: string): Promise { + const rpcArgs: Record = { resource: this._handle, cronExpression }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsScheduledAzureContainerAppJob', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._publishAsScheduledAzureContainerAppJobInternal(cronExpression)); + } + + /** @internal */ + private async _withDataBindMountInternal(path?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withDataBindMount', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a bind mount for the data folder to an Azure Storage emulator resource */ + withDataBindMount(options?: WithDataBindMountOptions): AzureStorageEmulatorResourcePromise { + const path = options?.path; + const isReadOnly = options?.isReadOnly; + return new AzureStorageEmulatorResourcePromise(this._withDataBindMountInternal(path, isReadOnly)); + } + + /** @internal */ + private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withDataVolume', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a named volume for the data folder to an Azure Storage emulator resource */ + withDataVolume(options?: WithDataVolumeOptions): AzureStorageEmulatorResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new AzureStorageEmulatorResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + } + + /** @internal */ + private async _withBlobPortInternal(port: number): Promise { + const rpcArgs: Record = { builder: this._handle, port }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withBlobPort', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the host port for blob requests on the storage emulator */ + withBlobPort(port: number): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withBlobPortInternal(port)); + } + + /** @internal */ + private async _withQueuePortInternal(port: number): Promise { + const rpcArgs: Record = { builder: this._handle, port }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withQueuePort', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the host port for queue requests on the storage emulator */ + withQueuePort(port: number): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withQueuePortInternal(port)); + } + + /** @internal */ + private async _withTablePortInternal(port: number): Promise { + const rpcArgs: Record = { builder: this._handle, port }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withTablePort', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the host port for table requests on the storage emulator */ + withTablePort(port: number): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withTablePortInternal(port)); + } + + /** @internal */ + private async _withApiVersionCheckInternal(enable?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (enable !== undefined) rpcArgs.enable = enable; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withApiVersionCheck', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures whether the emulator checks API version validity */ + withApiVersionCheck(options?: WithApiVersionCheckOptions): AzureStorageEmulatorResourcePromise { + const enable = options?.enable; + return new AzureStorageEmulatorResourcePromise(this._withApiVersionCheckInternal(enable)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + } + + /** @internal */ + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + } + + /** @internal */ + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withUserAssignedIdentityAzureUserAssignedIdentity', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureStorageEmulatorResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureStorageEmulatorResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureStorageEmulatorResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures the container resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerApp(configure))); + } + + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); + } + + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerAppJob())); + } + + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsConfiguredScheduledAzureContainerAppJob(cronExpression, options))); + } + + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsScheduledAzureContainerAppJob(cronExpression))); + } + + /** Adds a bind mount for the data folder to an Azure Storage emulator resource */ + withDataBindMount(options?: WithDataBindMountOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDataBindMount(options))); + } + + /** Adds a named volume for the data folder to an Azure Storage emulator resource */ + withDataVolume(options?: WithDataVolumeOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + } + + /** Sets the host port for blob requests on the storage emulator */ + withBlobPort(port: number): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withBlobPort(port))); + } + + /** Sets the host port for queue requests on the storage emulator */ + withQueuePort(port: number): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withQueuePort(port))); + } + + /** Sets the host port for table requests on the storage emulator */ + withTablePort(port: number): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withTablePort(port))); + } + + /** Configures whether the emulator checks API version validity */ + withApiVersionCheck(options?: WithApiVersionCheckOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withApiVersionCheck(options))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureStorageResource +// ============================================================================ + +export class AzureStorageResource extends ResourceBuilderBase { + constructor(handle: AzureStorageResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureStorageResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): AzureStorageResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new AzureStorageResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureStorageResourcePromise { + const helpLink = options?.helpLink; + return new AzureStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): AzureStorageResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new AzureStorageResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): AzureStorageResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new AzureStorageResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureStorageResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new AzureStorageResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureStorageResourcePromise { + const displayText = options?.displayText; + return new AzureStorageResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureStorageResourcePromise { + const displayText = options?.displayText; + return new AzureStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureStorageResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new AzureStorageResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureStorageResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureStorageResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureStorageResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new AzureStorageResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureStorageResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _runAsEmulatorInternal(configureContainer?: (obj: AzureStorageEmulatorResource) => Promise): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as AzureStorageEmulatorResourceHandle; + const obj = new AzureStorageEmulatorResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/runAsEmulator', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Configures the Azure Storage resource to be emulated using Azurite */ + runAsEmulator(options?: RunAsEmulatorOptions): AzureStorageResourcePromise { + const configureContainer = options?.configureContainer; + return new AzureStorageResourcePromise(this._runAsEmulatorInternal(configureContainer)); + } + + /** @internal */ + private async _addBlobsInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addBlobs', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Adds an Azure Blob Storage resource */ + addBlobs(name: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._addBlobsInternal(name)); + } + + /** @internal */ + private async _addDataLakeInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addDataLake', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Adds an Azure Data Lake Storage resource */ + addDataLake(name: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._addDataLakeInternal(name)); + } + + /** @internal */ + private async _addBlobContainerInternal(name: string, blobContainerName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (blobContainerName !== undefined) rpcArgs.blobContainerName = blobContainerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addBlobContainer', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Adds an Azure Blob Storage container resource */ + addBlobContainer(name: string, options?: AddBlobContainerOptions): AzureBlobStorageContainerResourcePromise { + const blobContainerName = options?.blobContainerName; + return new AzureBlobStorageContainerResourcePromise(this._addBlobContainerInternal(name, blobContainerName)); + } + + /** @internal */ + private async _addDataLakeFileSystemInternal(name: string, dataLakeFileSystemName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (dataLakeFileSystemName !== undefined) rpcArgs.dataLakeFileSystemName = dataLakeFileSystemName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addDataLakeFileSystem', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Adds an Azure Data Lake Storage file system resource */ + addDataLakeFileSystem(name: string, options?: AddDataLakeFileSystemOptions): AzureDataLakeStorageFileSystemResourcePromise { + const dataLakeFileSystemName = options?.dataLakeFileSystemName; + return new AzureDataLakeStorageFileSystemResourcePromise(this._addDataLakeFileSystemInternal(name, dataLakeFileSystemName)); + } + + /** @internal */ + private async _addTablesInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addTables', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Adds an Azure Table Storage resource */ + addTables(name: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._addTablesInternal(name)); + } + + /** @internal */ + private async _addQueuesInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addQueues', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); + } + + /** Adds an Azure Queue Storage resource */ + addQueues(name: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._addQueuesInternal(name)); + } + + /** @internal */ + private async _addQueueInternal(name: string, queueName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (queueName !== undefined) rpcArgs.queueName = queueName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addQueue', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Adds an Azure Storage queue resource */ + addQueue(name: string, options?: AddQueueOptions): AzureQueueStorageQueueResourcePromise { + const queueName = options?.queueName; + return new AzureQueueStorageQueueResourcePromise(this._addQueueInternal(name, queueName)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** Gets an output reference from an Azure Bicep template resource */ + async getOutput(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getOutput', + rpcArgs + ); + } + + /** @internal */ + private async _withParameterInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameter', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterInternal(name)); + } + + /** @internal */ + private async _withParameterStringValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValue', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterStringValueInternal(name, value)); + } + + /** @internal */ + private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValues', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterStringValuesInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromParameter', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterFromParameterInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromConnectionString', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromOutput', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterFromOutputInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromEndpoint', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterFromEndpointInternal(name, value)); + } + + /** @internal */ + private async _configureInfrastructureInternal(configure: (obj: AzureResourceInfrastructure) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; + const obj = new AzureResourceInfrastructure(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/configureInfrastructure', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._configureInfrastructureInternal(configure)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsConnectionString', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + async getBicepIdentifier(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getBicepIdentifier', + rpcArgs + ); + } + + /** @internal */ + private async _clearDefaultRoleAssignmentsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + } + + /** Determines whether a resource is marked as existing */ + async isExisting(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/isExisting', + rpcArgs + ); + } + + /** @internal */ + private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExistingFromParameters', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExisting', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._runAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExistingFromParameters', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExisting', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/asExistingFromParameters', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureStorageResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureStorageResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureStorageResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures the Azure Storage resource to be emulated using Azurite */ + runAsEmulator(options?: RunAsEmulatorOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.runAsEmulator(options))); + } + + /** Adds an Azure Blob Storage resource */ + addBlobs(name: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.addBlobs(name))); + } + + /** Adds an Azure Data Lake Storage resource */ + addDataLake(name: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.addDataLake(name))); + } + + /** Adds an Azure Blob Storage container resource */ + addBlobContainer(name: string, options?: AddBlobContainerOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.addBlobContainer(name, options))); + } + + /** Adds an Azure Data Lake Storage file system resource */ + addDataLakeFileSystem(name: string, options?: AddDataLakeFileSystemOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.addDataLakeFileSystem(name, options))); + } + + /** Adds an Azure Table Storage resource */ + addTables(name: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.addTables(name))); + } + + /** Adds an Azure Queue Storage resource */ + addQueues(name: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.addQueues(name))); + } + + /** Adds an Azure Storage queue resource */ + addQueue(name: string, options?: AddQueueOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.addQueue(name, options))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Gets an output reference from an Azure Bicep template resource */ + getOutput(name: string): Promise { + return this._promise.then(obj => obj.getOutput(name)); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameter(name))); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); + } + + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.configureInfrastructure(configure))); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + getBicepIdentifier(): Promise { + return this._promise.then(obj => obj.getBicepIdentifier()); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + } + + /** Determines whether a resource is marked as existing */ + isExisting(): Promise { + return this._promise.then(obj => obj.isExisting()); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureTableStorageResource +// ============================================================================ + +export class AzureTableStorageResource extends ResourceBuilderBase { + constructor(handle: AzureTableStorageResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureTableStorageResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureTableStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureTableStorageResourcePromise { + const helpLink = options?.helpLink; + return new AzureTableStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureTableStorageResourcePromise { + const displayText = options?.displayText; + return new AzureTableStorageResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureTableStorageResourcePromise { + const displayText = options?.displayText; + return new AzureTableStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureTableStorageResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureTableStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureTableStorageResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureTableStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureTableStorageResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureTableStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._onConnectionStringAvailableInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureTableStorageResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureTableStorageResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureTableStorageResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// AzureUserAssignedIdentityResource +// ============================================================================ + +export class AzureUserAssignedIdentityResource extends ResourceBuilderBase { + constructor(handle: AzureUserAssignedIdentityResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureUserAssignedIdentityResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureUserAssignedIdentityResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureUserAssignedIdentityResourcePromise { + const helpLink = options?.helpLink; + return new AzureUserAssignedIdentityResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureUserAssignedIdentityResourcePromise { + const displayText = options?.displayText; + return new AzureUserAssignedIdentityResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureUserAssignedIdentityResourcePromise { + const displayText = options?.displayText; + return new AzureUserAssignedIdentityResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureUserAssignedIdentityResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureUserAssignedIdentityResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureUserAssignedIdentityResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureUserAssignedIdentityResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureUserAssignedIdentityResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureUserAssignedIdentityResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** Gets an output reference from an Azure Bicep template resource */ + async getOutput(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getOutput', + rpcArgs + ); + } + + /** @internal */ + private async _withParameterInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameter', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterInternal(name)); + } + + /** @internal */ + private async _withParameterStringValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValue', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterStringValueInternal(name, value)); + } + + /** @internal */ + private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValues', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterStringValuesInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromParameter', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromParameterInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromConnectionString', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromOutput', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromOutputInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); + } + + /** @internal */ + private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromEndpoint', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromEndpointInternal(name, value)); + } + + /** @internal */ + private async _configureInfrastructureInternal(configure: (obj: AzureResourceInfrastructure) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; + const obj = new AzureResourceInfrastructure(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/configureInfrastructure', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._configureInfrastructureInternal(configure)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsConnectionString', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + async getBicepIdentifier(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getBicepIdentifier', + rpcArgs + ); + } + + /** @internal */ + private async _clearDefaultRoleAssignmentsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + } + + /** Determines whether a resource is marked as existing */ + async isExisting(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/isExisting', + rpcArgs + ); + } + + /** @internal */ + private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExistingFromParameters', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExisting', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._runAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExistingFromParameters', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExisting', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); + } + + /** @internal */ + private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/asExistingFromParameters', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureUserAssignedIdentityResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureUserAssignedIdentityResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureUserAssignedIdentityResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Gets an output reference from an Azure Bicep template resource */ + getOutput(name: string): Promise { + return this._promise.then(obj => obj.getOutput(name)); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameter(name))); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); + } + + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.configureInfrastructure(configure))); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + getBicepIdentifier(): Promise { + return this._promise.then(obj => obj.getBicepIdentifier()); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + } + + /** Determines whether a resource is marked as existing */ + isExisting(): Promise { + return this._promise.then(obj => obj.isExisting()); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onConnectionStringAvailableInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ + +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } - then( - onfulfilled?: ((value: AzureQueueStorageResource) => TResult1 | PromiseLike) | null, + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + const rpcArgs: Record = { builder: this._handle, registryBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + } + + /** @internal */ + private async _getAzureContainerRegistryInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + rpcArgs + ); + return new AzureContainerRegistryResource(result, this._client); + } + + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + } + + /** @internal */ + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); - } - - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -13192,14 +23655,34 @@ export class AzureQueueStorageResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); } /** Gets the Azure Container Registry associated with a compute environment resource. */ @@ -13208,650 +23691,587 @@ export class AzureQueueStorageResourcePromise implements PromiseLike obj.withContainerRegistryRoleAssignments(target, roles))); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); } } // ============================================================================ -// AzureStorageEmulatorResource +// ContainerResource // ============================================================================ -export class AzureStorageEmulatorResource extends ResourceBuilderBase { - constructor(handle: AzureStorageEmulatorResourceHandle, client: AspireClientRpc) { +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { const rpcArgs: Record = { builder: this._handle, source, target }; if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withBindMount', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): AzureStorageEmulatorResourcePromise { + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { const isReadOnly = options?.isReadOnly; - return new AzureStorageEmulatorResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { + private async _withEntrypointInternal(entrypoint: string): Promise { const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withEntrypointInternal(entrypoint)); + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { + private async _withImageTagInternal(tag: string): Promise { const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withImageTag', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the container image tag */ - withImageTag(tag: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withImageTagInternal(tag)); + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { + private async _withImageRegistryInternal(registry: string): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the container image registry */ - withImageRegistry(registry: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withImageRegistryInternal(registry)); + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { + private async _withImageInternal(image: string, tag?: string): Promise { const rpcArgs: Record = { builder: this._handle, image }; if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withImage', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): AzureStorageEmulatorResourcePromise { + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { const tag = options?.tag; - return new AzureStorageEmulatorResourcePromise(this._withImageInternal(image, tag)); + return new ContainerResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { + private async _withImageSHA256Internal(sha256: string): Promise { const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withImageSHA256Internal(sha256)); + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withContainerRuntimeArgsInternal(args)); + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withLifetime', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withLifetimeInternal(lifetime)); + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); } /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } /** @internal */ - private async _publishAsContainerInternal(): Promise { + private async _publishAsContainerInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/publishAsContainer', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures the resource to be published as a container */ - publishAsContainer(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._publishAsContainerInternal()); + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { const rpcArgs: Record = { builder: this._handle, contextPath }; if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfile', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): AzureStorageEmulatorResourcePromise { + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { const dockerfilePath = options?.dockerfilePath; const stage = options?.stage; - return new AzureStorageEmulatorResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } /** @internal */ - private async _withContainerNameInternal(name: string): Promise { + private async _withContainerNameInternal(name: string): Promise { const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerName', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the container name */ - withContainerName(name: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withContainerNameInternal(name)); + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); } /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withBuildArgInternal(name, value)); + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); } /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withBuildSecretInternal(name, value)); + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureStorageEmulatorResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new AzureStorageEmulatorResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { + private async _withContainerNetworkAliasInternal(alias: string): Promise { const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerNetworkAlias', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withContainerNetworkAliasInternal(alias)); + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): AzureStorageEmulatorResourcePromise { + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { const path = options?.path; const endpointName = options?.endpointName; - return new AzureStorageEmulatorResourcePromise(this._withMcpServerInternal(path, endpointName)); + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { + private async _withOtlpExporterInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures OTLP telemetry export */ - withOtlpExporter(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withOtlpExporterInternal()); + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { + private async _publishAsConnectionStringInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/publishAsConnectionString', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Publishes the resource as a connection string */ - publishAsConnectionString(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._publishAsConnectionStringInternal()); + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureStorageEmulatorResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { const helpLink = options?.helpLink; - return new AzureStorageEmulatorResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } - - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withEnvironmentCallbackInternal(callback)); + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): AzureStorageEmulatorResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new AzureStorageEmulatorResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -13861,15 +24281,15 @@ export class AzureStorageEmulatorResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): AzureStorageEmulatorResourcePromise { + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -13878,72 +24298,72 @@ export class AzureStorageEmulatorResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): AzureStorageEmulatorResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new AzureStorageEmulatorResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureStorageEmulatorResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new AzureStorageEmulatorResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -13956,278 +24376,278 @@ export class AzureStorageEmulatorResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureStorageEmulatorResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { const displayText = options?.displayText; - return new AzureStorageEmulatorResourcePromise(this._withUrlInternal(url, displayText)); + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureStorageEmulatorResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { const displayText = options?.displayText; - return new AzureStorageEmulatorResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): AzureStorageEmulatorResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { const exitCode = options?.exitCode; - return new AzureStorageEmulatorResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureStorageEmulatorResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new AzureStorageEmulatorResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -14235,130 +24655,130 @@ export class AzureStorageEmulatorResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureStorageEmulatorResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { const commandOptions = options?.commandOptions; - return new AzureStorageEmulatorResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): AzureStorageEmulatorResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { const password = options?.password; - return new AzureStorageEmulatorResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureStorageEmulatorResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { const iconVariant = options?.iconVariant; - return new AzureStorageEmulatorResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -14367,15 +24787,15 @@ export class AzureStorageEmulatorResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureStorageEmulatorResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -14383,56 +24803,56 @@ export class AzureStorageEmulatorResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -14443,79 +24863,79 @@ export class AzureStorageEmulatorResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureStorageEmulatorResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new AzureStorageEmulatorResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { const rpcArgs: Record = { resource: this._handle, target }; if (name !== undefined) rpcArgs.name = name; if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withVolume', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): AzureStorageEmulatorResourcePromise { + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { const name = options?.name; const isReadOnly = options?.isReadOnly; - return new AzureStorageEmulatorResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); } /** Gets the resource name */ @@ -14528,276 +24948,273 @@ export class AzureStorageEmulatorResource extends ResourceBuilderBase Promise): Promise { - const configureId = registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; - const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); - const arg2 = wrapIfHandle(args.p1) as ContainerAppHandle; - await configure(arg1, arg2); + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { container: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.AppContainers/publishContainerAsAzureContainerApp', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures the container resource to be published as an Azure Container App */ - publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._publishAsAzureContainerAppInternal(configure)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _publishAsConfiguredAzureContainerAppJobInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { - const configureId = registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; - const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); - const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; - await configure(arg1, arg2); + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { resource: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredAzureContainerAppJob', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); - } - - /** Configures the compute resource as an Azure Container App Job with custom configuration */ - publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._publishAsConfiguredAzureContainerAppJobInternal(configure)); - } - - /** @internal */ - private async _publishAsAzureContainerAppJobInternal(): Promise { - const rpcArgs: Record = { resource: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.AppContainers/publishAsAzureContainerAppJob', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures the compute resource as a manually triggered Azure Container App Job */ - publishAsAzureContainerAppJob(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._publishAsAzureContainerAppJobInternal()); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { - const configureId = configure ? registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; - const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); - const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; - await configure(arg1, arg2); - }) : undefined; - const rpcArgs: Record = { resource: this._handle, cronExpression }; - if (configure !== undefined) rpcArgs.configure = configureId; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredScheduledAzureContainerAppJob', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ - publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): AzureStorageEmulatorResourcePromise { - const configure = options?.configure; - return new AzureStorageEmulatorResourcePromise(this._publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression, configure)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _publishAsScheduledAzureContainerAppJobInternal(cronExpression: string): Promise { - const rpcArgs: Record = { resource: this._handle, cronExpression }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.AppContainers/publishAsScheduledAzureContainerAppJob', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures the compute resource as a scheduled Azure Container App Job */ - publishAsScheduledAzureContainerAppJob(cronExpression: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._publishAsScheduledAzureContainerAppJobInternal(cronExpression)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withDataBindMountInternal(path?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withDataBindMount', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a bind mount for the data folder to an Azure Storage emulator resource */ - withDataBindMount(options?: WithDataBindMountOptions): AzureStorageEmulatorResourcePromise { - const path = options?.path; - const isReadOnly = options?.isReadOnly; - return new AzureStorageEmulatorResourcePromise(this._withDataBindMountInternal(path, isReadOnly)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withDataVolume', + private async _publishAsAzureContainerAppInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(arg2Data) as ContainerAppHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { container: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishContainerAsAzureContainerApp', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a named volume for the data folder to an Azure Storage emulator resource */ - withDataVolume(options?: WithDataVolumeOptions): AzureStorageEmulatorResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new AzureStorageEmulatorResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + /** Configures the container resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsAzureContainerAppInternal(configure)); } /** @internal */ - private async _withBlobPortInternal(port: number): Promise { - const rpcArgs: Record = { builder: this._handle, port }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withBlobPort', + private async _publishAsConfiguredAzureContainerAppJobInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(arg2Data) as ContainerAppJobHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { resource: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredAzureContainerAppJob', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the host port for blob requests on the storage emulator */ - withBlobPort(port: number): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withBlobPortInternal(port)); + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConfiguredAzureContainerAppJobInternal(configure)); } /** @internal */ - private async _withQueuePortInternal(port: number): Promise { - const rpcArgs: Record = { builder: this._handle, port }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withQueuePort', + private async _publishAsAzureContainerAppJobInternal(): Promise { + const rpcArgs: Record = { resource: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsAzureContainerAppJob', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the host port for queue requests on the storage emulator */ - withQueuePort(port: number): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withQueuePortInternal(port)); + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsAzureContainerAppJobInternal()); } /** @internal */ - private async _withTablePortInternal(port: number): Promise { - const rpcArgs: Record = { builder: this._handle, port }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withTablePort', + private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = configure ? registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(arg2Data) as ContainerAppJobHandle; + await configure(arg1, arg2); + }) : undefined; + const rpcArgs: Record = { resource: this._handle, cronExpression }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredScheduledAzureContainerAppJob', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the host port for table requests on the storage emulator */ - withTablePort(port: number): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withTablePortInternal(port)); + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): ContainerResourcePromise { + const configure = options?.configure; + return new ContainerResourcePromise(this._publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression, configure)); } /** @internal */ - private async _withApiVersionCheckInternal(enable?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (enable !== undefined) rpcArgs.enable = enable; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withApiVersionCheck', + private async _publishAsScheduledAzureContainerAppJobInternal(cronExpression: string): Promise { + const rpcArgs: Record = { resource: this._handle, cronExpression }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsScheduledAzureContainerAppJob', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures whether the emulator checks API version validity */ - withApiVersionCheck(options?: WithApiVersionCheckOptions): AzureStorageEmulatorResourcePromise { - const enable = options?.enable; - return new AzureStorageEmulatorResourcePromise(this._withApiVersionCheckInternal(enable)); + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsScheduledAzureContainerAppJobInternal(cronExpression)); } /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } /** @internal */ - private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure/withEnvironmentFromOutput', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); } /** @internal */ - private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, name, secretReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); } /** @internal */ - private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withUserAssignedIdentityAzureUserAssignedIdentity', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); } /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); } /** @internal */ @@ -14816,250 +25233,230 @@ export class AzureStorageEmulatorResource extends ResourceBuilderBase { + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new ContainerResource(result, this._client); } /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); } } /** - * Thenable wrapper for AzureStorageEmulatorResource that enables fluent chaining. + * Thenable wrapper for ContainerResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class AzureStorageEmulatorResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: AzureStorageEmulatorResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } /** Sets the container image tag */ - withImageTag(tag: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } /** Sets the container image registry */ - withImageRegistry(registry: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); } /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } /** Configures the resource to be published as a container */ - publishAsContainer(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); } /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); } /** Sets the container name */ - withContainerName(name: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); } /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); } /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); } /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ - withOtlpExporter(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } /** Publishes the resource as a connection string */ - publishAsConnectionString(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -15068,163 +25465,163 @@ export class AzureStorageEmulatorResourcePromise implements PromiseLike obj.asHttp2Service())); + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } /** Gets the resource name */ @@ -15232,84 +25629,79 @@ export class AzureStorageEmulatorResourcePromise implements PromiseLike obj.getResourceName()); } - /** Configures the container resource to be published as an Azure Container App */ - publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerApp(configure))); - } - - /** Configures the compute resource as an Azure Container App Job with custom configuration */ - publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Configures the compute resource as a manually triggered Azure Container App Job */ - publishAsAzureContainerAppJob(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerAppJob())); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ - publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsConfiguredScheduledAzureContainerAppJob(cronExpression, options))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Configures the compute resource as a scheduled Azure Container App Job */ - publishAsScheduledAzureContainerAppJob(cronExpression: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsScheduledAzureContainerAppJob(cronExpression))); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** Adds a bind mount for the data folder to an Azure Storage emulator resource */ - withDataBindMount(options?: WithDataBindMountOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDataBindMount(options))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Adds a named volume for the data folder to an Azure Storage emulator resource */ - withDataVolume(options?: WithDataVolumeOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + /** Configures the container resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerApp(configure))); } - /** Sets the host port for blob requests on the storage emulator */ - withBlobPort(port: number): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withBlobPort(port))); + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); } - /** Sets the host port for queue requests on the storage emulator */ - withQueuePort(port: number): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withQueuePort(port))); + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerAppJob())); } - /** Sets the host port for table requests on the storage emulator */ - withTablePort(port: number): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withTablePort(port))); + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConfiguredScheduledAzureContainerAppJob(cronExpression, options))); } - /** Configures whether the emulator checks API version validity */ - withApiVersionCheck(options?: WithApiVersionCheckOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withApiVersionCheck(options))); + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsScheduledAzureContainerAppJob(cronExpression))); } /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); } /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); } /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); } /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); } /** Gets the Azure Container Registry associated with a compute environment resource. */ @@ -15318,93 +25710,376 @@ export class AzureStorageEmulatorResourcePromise implements PromiseLike obj.withContainerRegistryRoleAssignments(target, roles))); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); } } // ============================================================================ -// AzureStorageResource +// CSharpAppResource // ============================================================================ -export class AzureStorageResource extends ResourceBuilderBase { - constructor(handle: AzureStorageResourceHandle, client: AspireClientRpc) { +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureStorageResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new AzureStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): AzureStorageResourcePromise { + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { const path = options?.path; const endpointName = options?.endpointName; - return new AzureStorageResourcePromise(this._withMcpServerInternal(path, endpointName)); + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + const configure = options?.configure; + return new CSharpAppResourcePromise(this._publishAsDockerFileInternal(configure)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureStorageResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { const helpLink = options?.helpLink; - return new AzureStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -15414,15 +26089,15 @@ export class AzureStorageResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): AzureStorageResourcePromise { + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -15431,72 +26106,72 @@ export class AzureStorageResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): AzureStorageResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new AzureStorageResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureStorageResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new AzureStorageResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -15509,852 +26184,841 @@ export class AzureStorageResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureStorageResourcePromise { + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { const displayText = options?.displayText; - return new AzureStorageResourcePromise(this._withUrlInternal(url, displayText)); + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureStorageResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { const displayText = options?.displayText; - return new AzureStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._excludeFromManifestInternal()); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withExplicitStartInternal()); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withHealthCheckInternal(key)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureStorageResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new AzureStorageResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureStorageResourcePromise { - const commandOptions = options?.commandOptions; - return new AzureStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withParentRelationshipInternal(parent)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withChildRelationshipInternal(child)); + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureStorageResourcePromise { - const iconVariant = options?.iconVariant; - return new AzureStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + const exitCode = options?.exitCode; + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureStorageResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new AzureStorageResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new AzureStorageResource(result, this._client); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._excludeFromMcpInternal()); - } - - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new AzureStorageResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureStorageResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new AzureStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + const commandOptions = options?.commandOptions; + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new AzureStorageResource(result, this._client); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new CSharpAppResource(result, this._client); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _runAsEmulatorInternal(configureContainer?: (obj: AzureStorageEmulatorResource) => Promise): Promise { - const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as AzureStorageEmulatorResourceHandle; - const obj = new AzureStorageEmulatorResource(objHandle, this._client); - await configureContainer(obj); - }) : undefined; + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; - if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/runAsEmulator', - rpcArgs - ); - return new AzureStorageResource(result, this._client); - } - - /** Configures the Azure Storage resource to be emulated using Azurite */ - runAsEmulator(options?: RunAsEmulatorOptions): AzureStorageResourcePromise { - const configureContainer = options?.configureContainer; - return new AzureStorageResourcePromise(this._runAsEmulatorInternal(configureContainer)); - } - - /** @internal */ - private async _addBlobsInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/addBlobs', - rpcArgs - ); - return new AzureBlobStorageResource(result, this._client); - } - - /** Adds an Azure Blob Storage resource */ - addBlobs(name: string): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._addBlobsInternal(name)); - } - - /** @internal */ - private async _addDataLakeInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/addDataLake', + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds an Azure Data Lake Storage resource */ - addDataLake(name: string): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._addDataLakeInternal(name)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + const password = options?.password; + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _addBlobContainerInternal(name: string, blobContainerName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (blobContainerName !== undefined) rpcArgs.blobContainerName = blobContainerName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/addBlobContainer', + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds an Azure Blob Storage container resource */ - addBlobContainer(name: string, options?: AddBlobContainerOptions): AzureBlobStorageContainerResourcePromise { - const blobContainerName = options?.blobContainerName; - return new AzureBlobStorageContainerResourcePromise(this._addBlobContainerInternal(name, blobContainerName)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _addDataLakeFileSystemInternal(name: string, dataLakeFileSystemName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (dataLakeFileSystemName !== undefined) rpcArgs.dataLakeFileSystemName = dataLakeFileSystemName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/addDataLakeFileSystem', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds an Azure Data Lake Storage file system resource */ - addDataLakeFileSystem(name: string, options?: AddDataLakeFileSystemOptions): AzureDataLakeStorageFileSystemResourcePromise { - const dataLakeFileSystemName = options?.dataLakeFileSystemName; - return new AzureDataLakeStorageFileSystemResourcePromise(this._addDataLakeFileSystemInternal(name, dataLakeFileSystemName)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _addTablesInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/addTables', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds an Azure Table Storage resource */ - addTables(name: string): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._addTablesInternal(name)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _addQueuesInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/addQueues', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds an Azure Queue Storage resource */ - addQueues(name: string): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._addQueuesInternal(name)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + const iconVariant = options?.iconVariant; + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _addQueueInternal(name: string, queueName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (queueName !== undefined) rpcArgs.queueName = queueName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/addQueue', + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds an Azure Storage queue resource */ - addQueue(name: string, options?: AddQueueOptions): AzureQueueStorageQueueResourcePromise { - const queueName = options?.queueName; - return new AzureQueueStorageQueueResourcePromise(this._addQueueInternal(name, queueName)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); } - - /** Gets an output reference from an Azure Bicep template resource */ - async getOutput(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/getOutput', + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); + return new CSharpAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withParameterInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameter', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a Bicep parameter without a value */ - withParameter(name: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withParameterInternal(name)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withParameterStringValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterStringValue', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a Bicep parameter with a string value */ - withParameterStringValue(name: string, value: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withParameterStringValueInternal(name, value)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterStringValues', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a Bicep parameter with a string list value */ - withParameterStringValues(name: string, value: string[]): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withParameterStringValuesInternal(name, value)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromParameter', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a Bicep parameter from a parameter resource builder */ - withParameterFromParameter(name: string, value: ParameterResource): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withParameterFromParameterInternal(name, value)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } /** @internal */ - private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromConnectionString', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a Bicep parameter from a connection string resource builder */ - withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromOutput', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a Bicep parameter from another Bicep output reference */ - withParameterFromOutput(name: string, value: BicepOutputReference): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withParameterFromOutputInternal(name, value)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a Bicep parameter from a reference expression */ - withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromEndpoint', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a Bicep parameter from an endpoint reference */ - withParameterFromEndpoint(name: string, value: EndpointReference): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withParameterFromEndpointInternal(name, value)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _configureInfrastructureInternal(configure: (obj: AzureResourceInfrastructure) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; - const obj = new AzureResourceInfrastructure(objHandle, this._client); - await configure(obj); + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/configureInfrastructure', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Configures the Azure provisioning infrastructure callback */ - configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._configureInfrastructureInternal(configure)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsConnectionString', + private async _publishAsAzureContainerAppInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(arg2Data) as ContainerAppHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { project: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishProjectAsAzureContainerApp', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Publishes an Azure resource to the manifest as a connection string */ - publishAsConnectionString(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._publishAsConnectionStringInternal()); + /** Configures the project resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishAsAzureContainerAppInternal(configure)); } - /** Gets the normalized Bicep identifier for an Azure resource */ - async getBicepIdentifier(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/getBicepIdentifier', + /** @internal */ + private async _publishAsConfiguredAzureContainerAppJobInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(arg2Data) as ContainerAppJobHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { resource: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredAzureContainerAppJob', rpcArgs ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishAsConfiguredAzureContainerAppJobInternal(configure)); } /** @internal */ - private async _clearDefaultRoleAssignmentsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', + private async _publishAsAzureContainerAppJobInternal(): Promise { + const rpcArgs: Record = { resource: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsAzureContainerAppJob', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Clears the default Azure role assignments from a resource */ - clearDefaultRoleAssignments(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishAsAzureContainerAppJobInternal()); } - /** Determines whether a resource is marked as existing */ - async isExisting(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/isExisting', + /** @internal */ + private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = configure ? registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(arg2Data) as ContainerAppJobHandle; + await configure(arg1, arg2); + }) : undefined; + const rpcArgs: Record = { resource: this._handle, cronExpression }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredScheduledAzureContainerAppJob', rpcArgs ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): CSharpAppResourcePromise { + const configure = options?.configure; + return new CSharpAppResourcePromise(this._publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression, configure)); } /** @internal */ - private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/runAsExistingFromParameters', + private async _publishAsScheduledAzureContainerAppJobInternal(cronExpression: string): Promise { + const rpcArgs: Record = { resource: this._handle, cronExpression }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsScheduledAzureContainerAppJob', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Marks an Azure resource as existing in run mode by using parameter resources */ - runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishAsScheduledAzureContainerAppJobInternal(cronExpression)); } /** @internal */ - private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/runAsExisting', + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Marks an Azure resource as existing in run mode */ - runAsExisting(name: string, resourceGroup: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._runAsExistingInternal(name, resourceGroup)); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } /** @internal */ - private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsExistingFromParameters', + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Marks an Azure resource as existing in publish mode by using parameter resources */ - publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); } /** @internal */ - private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsExisting', + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Marks an Azure resource as existing in publish mode */ - publishAsExisting(name: string, resourceGroup: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); } /** @internal */ - private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/asExisting', + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withUserAssignedIdentityAzureUserAssignedIdentity', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Marks an Azure resource as existing in both run and publish modes */ - asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); } /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); } /** @internal */ @@ -16373,1192 +27037,1262 @@ export class AzureStorageResource extends ResourceBuilderBase { + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); } } /** - * Thenable wrapper for AzureStorageResource that enables fluent chaining. + * Thenable wrapper for CSharpAppResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class AzureStorageResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: AzureStorageResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); - } - - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); - } - - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); - } - - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); - } - - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); - } - - /** Configures resource for HTTP/2 */ - asHttp2Service(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.asHttp2Service())); - } - - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); - } - - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); - } - - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } - - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Adds a health check by key */ - withHealthCheck(key: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Configures the Azure Storage resource to be emulated using Azurite */ - runAsEmulator(options?: RunAsEmulatorOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.runAsEmulator(options))); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Adds an Azure Blob Storage resource */ - addBlobs(name: string): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.addBlobs(name))); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** Adds an Azure Data Lake Storage resource */ - addDataLake(name: string): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.addDataLake(name))); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** Adds an Azure Blob Storage container resource */ - addBlobContainer(name: string, options?: AddBlobContainerOptions): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.addBlobContainer(name, options))); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** Adds an Azure Data Lake Storage file system resource */ - addDataLakeFileSystem(name: string, options?: AddDataLakeFileSystemOptions): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.addDataLakeFileSystem(name, options))); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Adds an Azure Table Storage resource */ - addTables(name: string): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.addTables(name))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Adds an Azure Queue Storage resource */ - addQueues(name: string): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.addQueues(name))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Adds an Azure Storage queue resource */ - addQueue(name: string, options?: AddQueueOptions): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.addQueue(name, options))); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** Gets an output reference from an Azure Bicep template resource */ - getOutput(name: string): Promise { - return this._promise.then(obj => obj.getOutput(name)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Adds a Bicep parameter without a value */ - withParameter(name: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameter(name))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Adds a Bicep parameter with a string value */ - withParameterStringValue(name: string, value: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Adds a Bicep parameter with a string list value */ - withParameterStringValues(name: string, value: string[]): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Adds a Bicep parameter from a parameter resource builder */ - withParameterFromParameter(name: string, value: ParameterResource): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Adds a Bicep parameter from a connection string resource builder */ - withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Adds a Bicep parameter from another Bicep output reference */ - withParameterFromOutput(name: string, value: BicepOutputReference): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } - /** Adds a Bicep parameter from a reference expression */ - withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Adds a Bicep parameter from an endpoint reference */ - withParameterFromEndpoint(name: string, value: EndpointReference): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Configures the Azure provisioning infrastructure callback */ - configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.configureInfrastructure(configure))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Publishes an Azure resource to the manifest as a connection string */ - publishAsConnectionString(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Gets the normalized Bicep identifier for an Azure resource */ - getBicepIdentifier(): Promise { - return this._promise.then(obj => obj.getBicepIdentifier()); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Clears the default Azure role assignments from a resource */ - clearDefaultRoleAssignments(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Determines whether a resource is marked as existing */ - isExisting(): Promise { - return this._promise.then(obj => obj.isExisting()); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** Marks an Azure resource as existing in run mode by using parameter resources */ - runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Marks an Azure resource as existing in run mode */ - runAsExisting(name: string, resourceGroup: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** Marks an Azure resource as existing in publish mode by using parameter resources */ - publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Marks an Azure resource as existing in publish mode */ - publishAsExisting(name: string, resourceGroup: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** Marks an Azure resource as existing in both run and publish modes */ - asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** Gets the Azure Container Registry associated with a compute environment resource. */ - getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } -} - -// ============================================================================ -// AzureTableStorageResource -// ============================================================================ + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } -export class AzureTableStorageResource extends ResourceBuilderBase { - constructor(handle: AzureTableStorageResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new AzureTableStorageResource(result, this._client); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withContainerRegistryInternal(registry)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new AzureTableStorageResource(result, this._client); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureTableStorageResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new AzureTableStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new AzureTableStorageResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureTableStorageResourcePromise { - const helpLink = options?.helpLink; - return new AzureTableStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', - rpcArgs - ); - return new AzureTableStorageResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', - rpcArgs - ); - return new AzureTableStorageResource(result, this._client); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new AzureTableStorageResource(result, this._client); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new AzureTableStorageResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Configures the project resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerApp(configure))); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new AzureTableStorageResource(result, this._client); + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureTableStorageResourcePromise { - const displayText = options?.displayText; - return new AzureTableStorageResourcePromise(this._withUrlInternal(url, displayText)); + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerAppJob())); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new AzureTableStorageResource(result, this._client); + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsConfiguredScheduledAzureContainerAppJob(cronExpression, options))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureTableStorageResourcePromise { - const displayText = options?.displayText; - return new AzureTableStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsScheduledAzureContainerAppJob(cronExpression))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new AzureTableStorageResource(result, this._client); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new AzureTableStorageResource(result, this._client); + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._excludeFromManifestInternal()); + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new AzureTableStorageResource(result, this._client); + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withExplicitStartInternal()); + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new AzureTableStorageResource(result, this._client); + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); } - /** Adds a health check by key */ - withHealthCheck(key: string): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withHealthCheckInternal(key)); +} + +// ============================================================================ +// DotnetToolResource +// ============================================================================ + +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureTableStorageResourcePromise { - const commandOptions = options?.commandOptions; - return new AzureTableStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withParentRelationshipInternal(parent)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureTableStorageResourcePromise { - const iconVariant = options?.iconVariant; - return new AzureTableStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _withToolPrereleaseInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._excludeFromMcpInternal()); + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureTableStorageResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new AzureTableStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { - const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _getAzureContainerRegistryInternal(): Promise { + private async _withOtlpExporterInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Gets the Azure Container Registry associated with a compute environment resource. */ - getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } -} - -/** - * Thenable wrapper for AzureTableStorageResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class AzureTableStorageResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: AzureTableStorageResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Gets the Azure Container Registry associated with a compute environment resource. */ - getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } -} - -// ============================================================================ -// AzureUserAssignedIdentityResource -// ============================================================================ - -export class AzureUserAssignedIdentityResource extends ResourceBuilderBase { - constructor(handle: AzureUserAssignedIdentityResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureUserAssignedIdentityResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new AzureUserAssignedIdentityResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureUserAssignedIdentityResourcePromise { - const helpLink = options?.helpLink; - return new AzureUserAssignedIdentityResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureUserAssignedIdentityResourcePromise { + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { const displayText = options?.displayText; - return new AzureUserAssignedIdentityResourcePromise(this._withUrlInternal(url, displayText)); + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureUserAssignedIdentityResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { const displayText = options?.displayText; - return new AzureUserAssignedIdentityResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + const exitCode = options?.exitCode; + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -17566,113 +28300,204 @@ export class AzureUserAssignedIdentityResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureUserAssignedIdentityResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { const commandOptions = options?.commandOptions; - return new AzureUserAssignedIdentityResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + const password = options?.password; + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureUserAssignedIdentityResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { const iconVariant = options?.iconVariant; - return new AzureUserAssignedIdentityResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -17683,371 +28508,339 @@ export class AzureUserAssignedIdentityResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureUserAssignedIdentityResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new AzureUserAssignedIdentityResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); - } - - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withPipelineConfigurationInternal(callback)); - } - - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); - } - - /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); - } - - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); - } - - /** Gets an output reference from an Azure Bicep template resource */ - async getOutput(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/getOutput', - rpcArgs - ); - } - - /** @internal */ - private async _withParameterInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameter', + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a Bicep parameter without a value */ - withParameter(name: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withParameterInternal(name)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withParameterStringValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterStringValue', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a Bicep parameter with a string value */ - withParameterStringValue(name: string, value: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withParameterStringValueInternal(name, value)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterStringValues', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); - } - - /** Adds a Bicep parameter with a string list value */ - withParameterStringValues(name: string, value: string[]): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withParameterStringValuesInternal(name, value)); } /** @internal */ - private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromParameter', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a Bicep parameter from a parameter resource builder */ - withParameterFromParameter(name: string, value: ParameterResource): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromParameterInternal(name, value)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromConnectionString', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a Bicep parameter from a connection string resource builder */ - withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromOutput', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a Bicep parameter from another Bicep output reference */ - withParameterFromOutput(name: string, value: BicepOutputReference): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromOutputInternal(name, value)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a Bicep parameter from a reference expression */ - withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromEndpoint', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a Bicep parameter from an endpoint reference */ - withParameterFromEndpoint(name: string, value: EndpointReference): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromEndpointInternal(name, value)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _configureInfrastructureInternal(configure: (obj: AzureResourceInfrastructure) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; - const obj = new AzureResourceInfrastructure(objHandle, this._client); - await configure(obj); + private async _publishAsAzureContainerAppInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(arg2Data) as ContainerAppHandle; + await configure(arg1, arg2); }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/configureInfrastructure', + const rpcArgs: Record = { executable: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishExecutableAsAzureContainerApp', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures the Azure provisioning infrastructure callback */ - configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._configureInfrastructureInternal(configure)); + /** Configures the executable resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsAzureContainerAppInternal(configure)); } /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsConnectionString', + private async _publishAsConfiguredAzureContainerAppJobInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(arg2Data) as ContainerAppJobHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { resource: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredAzureContainerAppJob', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Publishes an Azure resource to the manifest as a connection string */ - publishAsConnectionString(): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._publishAsConnectionStringInternal()); + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsConfiguredAzureContainerAppJobInternal(configure)); } - /** Gets the normalized Bicep identifier for an Azure resource */ - async getBicepIdentifier(): Promise { + /** @internal */ + private async _publishAsAzureContainerAppJobInternal(): Promise { const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/getBicepIdentifier', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsAzureContainerAppJob', rpcArgs ); + return new DotnetToolResource(result, this._client); + } + + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsAzureContainerAppJobInternal()); } /** @internal */ - private async _clearDefaultRoleAssignmentsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', + private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = configure ? registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(arg2Data) as ContainerAppJobHandle; + await configure(arg1, arg2); + }) : undefined; + const rpcArgs: Record = { resource: this._handle, cronExpression }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredScheduledAzureContainerAppJob', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); - } - - /** Clears the default Azure role assignments from a resource */ - clearDefaultRoleAssignments(): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + return new DotnetToolResource(result, this._client); } - /** Determines whether a resource is marked as existing */ - async isExisting(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/isExisting', - rpcArgs - ); + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): DotnetToolResourcePromise { + const configure = options?.configure; + return new DotnetToolResourcePromise(this._publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression, configure)); } /** @internal */ - private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/runAsExistingFromParameters', + private async _publishAsScheduledAzureContainerAppJobInternal(cronExpression: string): Promise { + const rpcArgs: Record = { resource: this._handle, cronExpression }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsScheduledAzureContainerAppJob', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Marks an Azure resource as existing in run mode by using parameter resources */ - runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsScheduledAzureContainerAppJobInternal(cronExpression)); } /** @internal */ - private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/runAsExisting', + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Marks an Azure resource as existing in run mode */ - runAsExisting(name: string, resourceGroup: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._runAsExistingInternal(name, resourceGroup)); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } /** @internal */ - private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsExistingFromParameters', + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Marks an Azure resource as existing in publish mode by using parameter resources */ - publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); } /** @internal */ - private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsExisting', + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Marks an Azure resource as existing in publish mode */ - publishAsExisting(name: string, resourceGroup: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); } /** @internal */ - private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/asExisting', + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withUserAssignedIdentityAzureUserAssignedIdentity', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Marks an Azure resource as existing in both run and publish modes */ - asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); } /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); } /** @internal */ @@ -18066,140 +28859,355 @@ export class AzureUserAssignedIdentityResource extends ResourceBuilderBase { + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); } } /** - * Thenable wrapper for AzureUserAssignedIdentityResource that enables fluent chaining. + * Thenable wrapper for DotnetToolResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class AzureUserAssignedIdentityResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + } + + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + } + + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + } + + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + } + + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + } + + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } - then( - onfulfilled?: ((value: AzureUserAssignedIdentityResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** Adds a health check by key */ - withHealthCheck(key: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -18207,109 +29215,79 @@ export class AzureUserAssignedIdentityResourcePromise implements PromiseLike obj.getResourceName()); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); - } - - /** Gets an output reference from an Azure Bicep template resource */ - getOutput(name: string): Promise { - return this._promise.then(obj => obj.getOutput(name)); - } - - /** Adds a Bicep parameter without a value */ - withParameter(name: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameter(name))); - } - - /** Adds a Bicep parameter with a string value */ - withParameterStringValue(name: string, value: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); - } - - /** Adds a Bicep parameter with a string list value */ - withParameterStringValues(name: string, value: string[]): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); - } - - /** Adds a Bicep parameter from a parameter resource builder */ - withParameterFromParameter(name: string, value: ParameterResource): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); - } - - /** Adds a Bicep parameter from a connection string resource builder */ - withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Adds a Bicep parameter from another Bicep output reference */ - withParameterFromOutput(name: string, value: BicepOutputReference): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Adds a Bicep parameter from a reference expression */ - withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Adds a Bicep parameter from an endpoint reference */ - withParameterFromEndpoint(name: string, value: EndpointReference): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** Configures the Azure provisioning infrastructure callback */ - configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.configureInfrastructure(configure))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Publishes an Azure resource to the manifest as a connection string */ - publishAsConnectionString(): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** Configures the executable resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerApp(configure))); } - /** Gets the normalized Bicep identifier for an Azure resource */ - getBicepIdentifier(): Promise { - return this._promise.then(obj => obj.getBicepIdentifier()); + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); } - /** Clears the default Azure role assignments from a resource */ - clearDefaultRoleAssignments(): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerAppJob())); } - /** Determines whether a resource is marked as existing */ - isExisting(): Promise { - return this._promise.then(obj => obj.isExisting()); + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsConfiguredScheduledAzureContainerAppJob(cronExpression, options))); } - /** Marks an Azure resource as existing in run mode by using parameter resources */ - runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsScheduledAzureContainerAppJob(cronExpression))); } - /** Marks an Azure resource as existing in run mode */ - runAsExisting(name: string, resourceGroup: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } - /** Marks an Azure resource as existing in publish mode by using parameter resources */ - publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); } - /** Marks an Azure resource as existing in publish mode */ - publishAsExisting(name: string, resourceGroup: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); } - /** Marks an Azure resource as existing in both run and publish modes */ - asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); } /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); } /** Gets the Azure Container Registry associated with a compute environment resource. */ @@ -18318,1169 +29296,1313 @@ export class AzureUserAssignedIdentityResourcePromise implements PromiseLike obj.withContainerRegistryRoleAssignments(target, roles))); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); } } // ============================================================================ -// ConnectionStringResource +// ExecutableResource // ============================================================================ -export class ConnectionStringResource extends ResourceBuilderBase { - constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { - const helpLink = options?.helpLink; - return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { - const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { - const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - const exitCode = options?.exitCode; - return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { - const commandOptions = options?.commandOptions; - return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { - const iconVariant = options?.iconVariant; - return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', rpcArgs ); - return new ConnectionStringResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { - const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _getAzureContainerRegistryInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Gets the Azure Container Registry associated with a compute environment resource. */ - getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ConnectionStringResource(result, this._client); - } - - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); - } - -} - -/** - * Thenable wrapper for ConnectionStringResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ConnectionStringResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); - } - - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Gets the Azure Container Registry associated with a compute environment resource. */ - getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); } -} - -// ============================================================================ -// ContainerRegistryResource -// ============================================================================ - -export class ContainerRegistryResource extends ResourceBuilderBase { - constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { - const helpLink = options?.helpLink; - return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { - const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { - const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _publishAsAzureContainerAppInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(arg2Data) as ContainerAppHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { executable: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishExecutableAsAzureContainerApp', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + /** Configures the executable resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsAzureContainerAppInternal(configure)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _publishAsConfiguredAzureContainerAppJobInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(arg2Data) as ContainerAppJobHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { resource: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredAzureContainerAppJob', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsConfiguredAzureContainerAppJobInternal(configure)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _publishAsAzureContainerAppJobInternal(): Promise { + const rpcArgs: Record = { resource: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsAzureContainerAppJob', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsAzureContainerAppJobInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = configure ? registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(arg2Data) as ContainerAppJobHandle; + await configure(arg1, arg2); + }) : undefined; + const rpcArgs: Record = { resource: this._handle, cronExpression }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredScheduledAzureContainerAppJob', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): ExecutableResourcePromise { + const configure = options?.configure; + return new ExecutableResourcePromise(this._publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression, configure)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _publishAsScheduledAzureContainerAppJobInternal(cronExpression: string): Promise { + const rpcArgs: Record = { resource: this._handle, cronExpression }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsScheduledAzureContainerAppJob', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsScheduledAzureContainerAppJobInternal(cronExpression)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', rpcArgs ); - return new ContainerRegistryResource(result, this._client); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new ExecutableResource(result, this._client); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); } /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withUserAssignedIdentityAzureUserAssignedIdentity', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); } /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); } /** @internal */ @@ -19499,1125 +30621,722 @@ export class ContainerRegistryResource extends ResourceBuilderBase { + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); } } /** - * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * Thenable wrapper for ExecutableResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ContainerRegistryResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Gets the Azure Container Registry associated with a compute environment resource. */ - getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } -} + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } -// ============================================================================ -// ContainerResource -// ============================================================================ + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } -export class ContainerResource extends ResourceBuilderBase { - constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterInternal()); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - const helpLink = options?.helpLink; - return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsInternal(args)); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Configures the executable resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerApp(configure))); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerAppJob())); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsConfiguredScheduledAzureContainerAppJob(cronExpression, options))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsScheduledAzureContainerAppJob(cronExpression))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + return new ExternalServiceResource(result, this._client); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); - } - - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); - } - - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromManifestInternal()); - } - - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForInternal(dependency)); - } - - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); - } - - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartInternal(dependency)); - } - - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); - } - - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExplicitStartInternal()); - } - - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - const exitCode = options?.exitCode; - return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); - } - - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withHealthCheckInternal(key)); - } - - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); - } - - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - const password = options?.password; - return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { const iconVariant = options?.iconVariant; - return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); - } - - /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromMcpInternal()); - } - - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -20628,60 +31347,60 @@ export class ContainerResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -20694,154 +31413,113 @@ export class ContainerResource extends ResourceBuilderBase Promise): Promise { - const configureId = registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; - const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); - const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; - await configure(arg1, arg2); + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { resource: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredAzureContainerAppJob', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Configures the compute resource as an Azure Container App Job with custom configuration */ - publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsConfiguredAzureContainerAppJobInternal(configure)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _publishAsAzureContainerAppJobInternal(): Promise { - const rpcArgs: Record = { resource: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.AppContainers/publishAsAzureContainerAppJob', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Configures the compute resource as a manually triggered Azure Container App Job */ - publishAsAzureContainerAppJob(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsAzureContainerAppJobInternal()); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { - const configureId = configure ? registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; - const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); - const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; - await configure(arg1, arg2); - }) : undefined; - const rpcArgs: Record = { resource: this._handle, cronExpression }; - if (configure !== undefined) rpcArgs.configure = configureId; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredScheduledAzureContainerAppJob', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ - publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): ContainerResourcePromise { - const configure = options?.configure; - return new ContainerResourcePromise(this._publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression, configure)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _publishAsScheduledAzureContainerAppJobInternal(cronExpression: string): Promise { - const rpcArgs: Record = { resource: this._handle, cronExpression }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.AppContainers/publishAsScheduledAzureContainerAppJob', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Configures the compute resource as a scheduled Azure Container App Job */ - publishAsScheduledAzureContainerAppJob(cronExpression: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsScheduledAzureContainerAppJobInternal(cronExpression)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); - } - - /** @internal */ - private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withEnvironmentFromOutput', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); - } - - /** @internal */ - private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, name, secretReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); - } - - /** @internal */ - private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { - const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); } /** @internal */ @@ -20860,325 +31538,135 @@ export class ContainerResource extends ResourceBuilderBase { + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', rpcArgs ); - return new ContainerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); } } /** - * Thenable wrapper for ContainerResource that enables fluent chaining. + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ContainerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); - } - - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); - } - - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); - } - - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); - } - - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); - } - - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); - } - - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); - } - - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); - } - - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); - } - - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); - } - - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); - } - - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); - } - - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); - } - - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); - } - - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); - } - - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); - } - - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); - } - - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); - } - - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); - } - - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); - } - - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); - } - - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } - - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); - } - - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -21186,49 +31674,34 @@ export class ContainerResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } - /** Configures the compute resource as an Azure Container App Job with custom configuration */ - publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Configures the compute resource as a manually triggered Azure Container App Job */ - publishAsAzureContainerAppJob(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerAppJob())); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ - publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConfiguredScheduledAzureContainerAppJob(cronExpression, options))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Configures the compute resource as a scheduled Azure Container App Job */ - publishAsScheduledAzureContainerAppJob(cronExpression: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsScheduledAzureContainerAppJob(cronExpression))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); - } - - /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); - } - - /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); - } - - /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); } /** Gets the Azure Container Registry associated with a compute environment resource. */ @@ -21237,417 +31710,419 @@ export class ContainerResourcePromise implements PromiseLike } /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); } } // ============================================================================ -// CSharpAppResource +// JavaScriptAppResource // ============================================================================ -export class CSharpAppResource extends ResourceBuilderBase { - constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { +export class JavaScriptAppResource extends ResourceBuilderBase { + constructor(handle: JavaScriptAppResourceHandle, client: AspireClientRpc) { super(handle, client); } + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new JavaScriptAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _publishAsDockerFileInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withReplicasInternal(replicas: number): Promise { - const rpcArgs: Record = { builder: this._handle, replicas }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReplicas', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _disableForwardedHeadersInternal(): Promise { + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/disableForwardedHeaders', + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - const helpLink = options?.helpLink; - return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + const helpLink = options?.helpLink; + return new JavaScriptAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new CSharpAppResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new CSharpAppResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new JavaScriptAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -21657,15 +32132,15 @@ export class CSharpAppResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -21674,72 +32149,72 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new JavaScriptAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new JavaScriptAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -21752,293 +32227,308 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + return new JavaScriptAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new JavaScriptAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _clearContainerFilesSourcesInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { const exitCode = options?.exitCode; - return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new JavaScriptAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new JavaScriptAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -22046,130 +32536,130 @@ export class CSharpAppResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { const commandOptions = options?.commandOptions; - return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new JavaScriptAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { const password = options?.password; - return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new JavaScriptAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { const iconVariant = options?.iconVariant; - return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new JavaScriptAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -22178,15 +32668,15 @@ export class CSharpAppResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -22194,56 +32684,56 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -22254,60 +32744,60 @@ export class CSharpAppResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new JavaScriptAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -22320,176 +32810,402 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): Promise { - const configureId = registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withYarnInternal(install, installArgs)); + } + + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withPnpmInternal(install, installArgs)); + } + + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withRunScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + const browser = options?.browser; + return new JavaScriptAppResourcePromise(this._withBrowserDebuggerInternal(browser)); + } + + /** @internal */ + private async _publishAsAzureContainerAppInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); - const arg2 = wrapIfHandle(args.p1) as ContainerAppHandle; + const arg2 = wrapIfHandle(arg2Data) as ContainerAppHandle; await configure(arg1, arg2); }); - const rpcArgs: Record = { project: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.AppContainers/publishProjectAsAzureContainerApp', + const rpcArgs: Record = { executable: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishExecutableAsAzureContainerApp', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures the project resource to be published as an Azure Container App */ - publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._publishAsAzureContainerAppInternal(configure)); + /** Configures the executable resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsAzureContainerAppInternal(configure)); } /** @internal */ - private async _publishAsConfiguredAzureContainerAppJobInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { - const configureId = registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + private async _publishAsConfiguredAzureContainerAppJobInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); - const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; + const arg2 = wrapIfHandle(arg2Data) as ContainerAppJobHandle; await configure(arg1, arg2); }); const rpcArgs: Record = { resource: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredAzureContainerAppJob', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Configures the compute resource as an Azure Container App Job with custom configuration */ - publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._publishAsConfiguredAzureContainerAppJobInternal(configure)); + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsConfiguredAzureContainerAppJobInternal(configure)); } /** @internal */ - private async _publishAsAzureContainerAppJobInternal(): Promise { + private async _publishAsAzureContainerAppJobInternal(): Promise { const rpcArgs: Record = { resource: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.AppContainers/publishAsAzureContainerAppJob', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Configures the compute resource as a manually triggered Azure Container App Job */ - publishAsAzureContainerAppJob(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._publishAsAzureContainerAppJobInternal()); + publishAsAzureContainerAppJob(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsAzureContainerAppJobInternal()); } /** @internal */ - private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { - const configureId = configure ? registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = configure ? registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); - const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; + const arg2 = wrapIfHandle(arg2Data) as ContainerAppJobHandle; await configure(arg1, arg2); }) : undefined; const rpcArgs: Record = { resource: this._handle, cronExpression }; if (configure !== undefined) rpcArgs.configure = configureId; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredScheduledAzureContainerAppJob', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ - publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): CSharpAppResourcePromise { + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): JavaScriptAppResourcePromise { const configure = options?.configure; - return new CSharpAppResourcePromise(this._publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression, configure)); + return new JavaScriptAppResourcePromise(this._publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression, configure)); } /** @internal */ - private async _publishAsScheduledAzureContainerAppJobInternal(cronExpression: string): Promise { + private async _publishAsScheduledAzureContainerAppJobInternal(cronExpression: string): Promise { const rpcArgs: Record = { resource: this._handle, cronExpression }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.AppContainers/publishAsScheduledAzureContainerAppJob', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Configures the compute resource as a scheduled Azure Container App Job */ - publishAsScheduledAzureContainerAppJob(cronExpression: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._publishAsScheduledAzureContainerAppJobInternal(cronExpression)); + publishAsScheduledAzureContainerAppJob(cronExpression: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsScheduledAzureContainerAppJobInternal(cronExpression)); } /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } /** @internal */ - private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure/withEnvironmentFromOutput', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); } /** @internal */ - private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, name, secretReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); } /** @internal */ - private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withUserAssignedIdentityAzureUserAssignedIdentity', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); } /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); } /** @internal */ @@ -22508,175 +33224,165 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); } } /** - * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * Thenable wrapper for JavaScriptAppResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class CSharpAppResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class JavaScriptAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: JavaScriptAppResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -22685,163 +33391,168 @@ export class CSharpAppResourcePromise implements PromiseLike } /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -22849,598 +33560,535 @@ export class CSharpAppResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } - /** Configures the project resource to be published as an Azure Container App */ - publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerApp(configure))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Configures the compute resource as an Azure Container App Job with custom configuration */ - publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Configures the compute resource as a manually triggered Azure Container App Job */ - publishAsAzureContainerAppJob(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerAppJob())); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ - publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsConfiguredScheduledAzureContainerAppJob(cronExpression, options))); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** Configures the compute resource as a scheduled Azure Container App Job */ - publishAsScheduledAzureContainerAppJob(cronExpression: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsScheduledAzureContainerAppJob(cronExpression))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); } - /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBun(options))); } - /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); } - /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); } - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); } - /** Gets the Azure Container Registry associated with a compute environment resource. */ - getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); } - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); } -} - -// ============================================================================ -// DotnetToolResource -// ============================================================================ - -export class DotnetToolResource extends ResourceBuilderBase { - constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Configures the executable resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerApp(configure))); } - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerAppJob())); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsConfiguredScheduledAzureContainerAppJob(cronExpression, options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsScheduledAzureContainerAppJob(cronExpression))); } - /** @internal */ - private async _withToolPackageInternal(packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPackage', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); } - /** @internal */ - private async _withToolVersionInternal(version: string): Promise { - const rpcArgs: Record = { builder: this._handle, version }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolVersion', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); } - /** @internal */ - private async _withToolPrereleaseInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPrerelease', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); } - /** @internal */ - private async _withToolSourceInternal(source: string): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolSource', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); +} + +// ============================================================================ +// NodeAppResource +// ============================================================================ + +export class NodeAppResource extends ResourceBuilderBase { + constructor(handle: NodeAppResourceHandle, client: AspireClientRpc) { + super(handle, client); } + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withToolIgnoreExistingFeedsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreExistingFeeds', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withToolIgnoreFailedSourcesInternal(): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreFailedSources', + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new NodeAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _publishAsDockerFileInternal(): Promise { + private async _publishAsDockerFileInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { const configureId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; const obj = new ContainerResource(objHandle, this._client); await configure(obj); }); const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withExecutableCommandInternal(command: string): Promise { + private async _withExecutableCommandInternal(command: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { const rpcArgs: Record = { builder: this._handle, workingDirectory }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { const path = options?.path; const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + return new NodeAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { + private async _withOtlpExporterInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { const helpLink = options?.helpLink; - return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } - - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + return new NodeAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new NodeAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -23450,15 +34098,15 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -23467,72 +34115,72 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new NodeAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new NodeAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -23545,278 +34193,323 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + return new NodeAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new NodeAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { const exitCode = options?.exitCode; - return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new NodeAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new NodeAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -23824,130 +34517,130 @@ export class DotnetToolResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { const commandOptions = options?.commandOptions; - return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new NodeAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { const password = options?.password; - return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new NodeAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { const iconVariant = options?.iconVariant; - return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new NodeAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -23956,15 +34649,15 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -23972,56 +34665,56 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -24032,242 +34725,468 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new NodeAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withYarnInternal(install, installArgs)); + } + + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withPnpmInternal(install, installArgs)); + } + + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', rpcArgs ); + return new NodeAppResource(result, this._client); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + const browser = options?.browser; + return new NodeAppResourcePromise(this._withBrowserDebuggerInternal(browser)); } /** @internal */ - private async _publishAsAzureContainerAppInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): Promise { - const configureId = registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + private async _publishAsAzureContainerAppInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); - const arg2 = wrapIfHandle(args.p1) as ContainerAppHandle; + const arg2 = wrapIfHandle(arg2Data) as ContainerAppHandle; await configure(arg1, arg2); }); const rpcArgs: Record = { executable: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.AppContainers/publishExecutableAsAzureContainerApp', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Configures the executable resource to be published as an Azure Container App */ - publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsAzureContainerAppInternal(configure)); + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsAzureContainerAppInternal(configure)); } /** @internal */ - private async _publishAsConfiguredAzureContainerAppJobInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { - const configureId = registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + private async _publishAsConfiguredAzureContainerAppJobInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); - const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; + const arg2 = wrapIfHandle(arg2Data) as ContainerAppJobHandle; await configure(arg1, arg2); }); const rpcArgs: Record = { resource: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredAzureContainerAppJob', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Configures the compute resource as an Azure Container App Job with custom configuration */ - publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsConfiguredAzureContainerAppJobInternal(configure)); + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsConfiguredAzureContainerAppJobInternal(configure)); } /** @internal */ - private async _publishAsAzureContainerAppJobInternal(): Promise { + private async _publishAsAzureContainerAppJobInternal(): Promise { const rpcArgs: Record = { resource: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.AppContainers/publishAsAzureContainerAppJob', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Configures the compute resource as a manually triggered Azure Container App Job */ - publishAsAzureContainerAppJob(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsAzureContainerAppJobInternal()); + publishAsAzureContainerAppJob(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsAzureContainerAppJobInternal()); } /** @internal */ - private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { - const configureId = configure ? registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = configure ? registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); - const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; + const arg2 = wrapIfHandle(arg2Data) as ContainerAppJobHandle; await configure(arg1, arg2); }) : undefined; const rpcArgs: Record = { resource: this._handle, cronExpression }; if (configure !== undefined) rpcArgs.configure = configureId; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredScheduledAzureContainerAppJob', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ - publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): DotnetToolResourcePromise { + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): NodeAppResourcePromise { const configure = options?.configure; - return new DotnetToolResourcePromise(this._publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression, configure)); + return new NodeAppResourcePromise(this._publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression, configure)); } /** @internal */ - private async _publishAsScheduledAzureContainerAppJobInternal(cronExpression: string): Promise { + private async _publishAsScheduledAzureContainerAppJobInternal(cronExpression: string): Promise { const rpcArgs: Record = { resource: this._handle, cronExpression }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.AppContainers/publishAsScheduledAzureContainerAppJob', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Configures the compute resource as a scheduled Azure Container App Job */ - publishAsScheduledAzureContainerAppJob(cronExpression: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsScheduledAzureContainerAppJobInternal(cronExpression)); + publishAsScheduledAzureContainerAppJob(cronExpression: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsScheduledAzureContainerAppJobInternal(cronExpression)); } /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } /** @internal */ - private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure/withEnvironmentFromOutput', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); } /** @internal */ - private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, name, secretReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); } /** @internal */ - private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withUserAssignedIdentityAzureUserAssignedIdentity', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); } /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); } /** @internal */ @@ -24286,215 +35205,165 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); } } /** - * Thenable wrapper for DotnetToolResource that enables fluent chaining. + * Thenable wrapper for NodeAppResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class DotnetToolResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class NodeAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: NodeAppResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); - } - - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); - } - - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); - } - - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); - } - - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); - } - - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); - } - - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -24503,158 +35372,173 @@ export class DotnetToolResourcePromise implements PromiseLike obj.asHttp2Service())); + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -24662,819 +35546,345 @@ export class DotnetToolResourcePromise implements PromiseLike obj.getResourceName()); } - /** Configures the executable resource to be published as an Azure Container App */ - publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerApp(configure))); - } - - /** Configures the compute resource as an Azure Container App Job with custom configuration */ - publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); - } - - /** Configures the compute resource as a manually triggered Azure Container App Job */ - publishAsAzureContainerAppJob(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerAppJob())); - } - - /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ - publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsConfiguredScheduledAzureContainerAppJob(cronExpression, options))); - } - - /** Configures the compute resource as a scheduled Azure Container App Job */ - publishAsScheduledAzureContainerAppJob(cronExpression: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsScheduledAzureContainerAppJob(cronExpression))); - } - - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); - } - - /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); - } - - /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); - } - - /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); - } - - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); - } - - /** Gets the Azure Container Registry associated with a compute environment resource. */ - getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); - } - - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); - } - -} - -// ============================================================================ -// ExecutableResource -// ============================================================================ - -export class ExecutableResource extends ResourceBuilderBase { - constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { - super(handle, client); - } - - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); - } - - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); - } - - /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); - } - - /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterInternal()); - } - - /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); - } - - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - const helpLink = options?.helpLink; - return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } - - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); - } - - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); - } - - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); - } - - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); - } - - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsInternal(args)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); } - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBun(options))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures the executable resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerApp(configure))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerAppJob())); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsConfiguredScheduledAzureContainerAppJob(cronExpression, options))); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsScheduledAzureContainerAppJob(cronExpression))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Configures a compute environment resource to use an Azure Container Registry. */ + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Gets the Azure Container Registry associated with a compute environment resource. */ + getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { + return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', rpcArgs ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); - } - - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromManifestInternal()); - } - - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForInternal(dependency)); - } - - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); - } - - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); - } - - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExplicitStartInternal()); - } - - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { - const exitCode = options?.exitCode; - return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); - } - - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -25482,204 +35892,83 @@ export class ExecutableResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { const commandOptions = options?.commandOptions; - return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); - } - - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); - } - - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); - } - - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { - const password = options?.password; - return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); - } - - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { const iconVariant = options?.iconVariant; - return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); - } - - /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromMcpInternal()); - } - - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -25690,60 +35979,60 @@ export class ExecutableResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -25756,154 +36045,113 @@ export class ExecutableResource extends ResourceBuilderBase Promise): Promise { - const configureId = registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; - const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); - const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; - await configure(arg1, arg2); + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { resource: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredAzureContainerAppJob', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Configures the compute resource as an Azure Container App Job with custom configuration */ - publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._publishAsConfiguredAzureContainerAppJobInternal(configure)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _publishAsAzureContainerAppJobInternal(): Promise { - const rpcArgs: Record = { resource: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.AppContainers/publishAsAzureContainerAppJob', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Configures the compute resource as a manually triggered Azure Container App Job */ - publishAsAzureContainerAppJob(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._publishAsAzureContainerAppJobInternal()); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { - const configureId = configure ? registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; - const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); - const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; - await configure(arg1, arg2); - }) : undefined; - const rpcArgs: Record = { resource: this._handle, cronExpression }; - if (configure !== undefined) rpcArgs.configure = configureId; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredScheduledAzureContainerAppJob', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ - publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): ExecutableResourcePromise { - const configure = options?.configure; - return new ExecutableResourcePromise(this._publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression, configure)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _publishAsScheduledAzureContainerAppJobInternal(cronExpression: string): Promise { - const rpcArgs: Record = { resource: this._handle, cronExpression }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.AppContainers/publishAsScheduledAzureContainerAppJob', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Configures the compute resource as a scheduled Azure Container App Job */ - publishAsScheduledAzureContainerAppJob(cronExpression: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._publishAsScheduledAzureContainerAppJobInternal(cronExpression)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); - } - - /** @internal */ - private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withEnvironmentFromOutput', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); - } - - /** @internal */ - private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, name, secretReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); - } - - /** @internal */ - private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { - const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ParameterResourcePromise { + return new ParameterResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ParameterResourcePromise { + return new ParameterResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); } /** @internal */ @@ -25922,325 +36170,135 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ParameterResource(result, this._client); } /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); } } /** - * Thenable wrapper for ExecutableResource that enables fluent chaining. + * Thenable wrapper for ParameterResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ExecutableResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); - } - - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); - } - - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); - } - - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); - } - - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); - } - - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); - } - - /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); - } - - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); - } - - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); - } - - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); - } - - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); - } - - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); - } - - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); - } - - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); - } - - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); - } - - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); - } - - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); - } - - /** Configures resource for HTTP/2 */ - asHttp2Service(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } - - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } - - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); - } - - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); - } - - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); - } - - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } - - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); - } - - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); - } - - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); - } - - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); - } - - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); - } - - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); - } - - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -26248,49 +36306,34 @@ export class ExecutableResourcePromise implements PromiseLike obj.getResourceName()); } - /** Configures the compute resource as an Azure Container App Job with custom configuration */ - publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Configures the compute resource as a manually triggered Azure Container App Job */ - publishAsAzureContainerAppJob(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerAppJob())); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ - publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsConfiguredScheduledAzureContainerAppJob(cronExpression, options))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Configures the compute resource as a scheduled Azure Container App Job */ - publishAsScheduledAzureContainerAppJob(cronExpression: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsScheduledAzureContainerAppJob(cronExpression))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); - } - - /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); - } - - /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); - } - - /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); } /** Gets the Azure Container Registry associated with a compute environment resource. */ @@ -26299,965 +36342,972 @@ export class ExecutableResourcePromise implements PromiseLike obj.withContainerRegistryRoleAssignments(target, roles))); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); } } // ============================================================================ -// ExternalServiceResource +// ProjectResource // ============================================================================ -export class ExternalServiceResource extends ResourceBuilderBase { - constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { const path = options?.path; - const statusCode = options?.statusCode; - return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + const configure = options?.configure; + return new ProjectResourcePromise(this._publishAsDockerFileInternal(configure)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { const helpLink = options?.helpLink; - return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - const commandOptions = options?.commandOptions; - return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - const iconVariant = options?.iconVariant; - return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new ExternalServiceResource(result, this._client); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new ProjectResource(result, this._client); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { - const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _getAzureContainerRegistryInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/getAzureContainerRegistry', + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new AzureContainerRegistryResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Gets the Azure Container Registry associated with a compute environment resource. */ - getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._getAzureContainerRegistryInternal()); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); - return new ExternalServiceResource(result, this._client); - } - - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); - } - -} - -/** - * Thenable wrapper for ExternalServiceResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ExternalServiceResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); - } - - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); - } - - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); - } - - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + return new ProjectResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); - } - - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); - } - - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); - } - - /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); - } - - /** Gets the Azure Container Registry associated with a compute environment resource. */ - getAzureContainerRegistry(): AzureContainerRegistryResourcePromise { - return new AzureContainerRegistryResourcePromise(this._promise.then(obj => obj.getAzureContainerRegistry())); - } - - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); - } - -} - -// ============================================================================ -// ParameterResource -// ============================================================================ - -export class ParameterResource extends ResourceBuilderBase { - constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { - super(handle, client); + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, description }; - if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDescription', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - const enableMarkdown = options?.enableMarkdown; - return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - const helpLink = options?.helpLink; - return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromManifestInternal()); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._withExplicitStartInternal()); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - const commandOptions = options?.commandOptions; - return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { const iconVariant = options?.iconVariant; - return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -27268,60 +37318,60 @@ export class ParameterResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -27334,33 +37384,273 @@ export class ParameterResource extends ResourceBuilderBase { + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _publishAsAzureContainerAppInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(arg2Data) as ContainerAppHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { project: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishProjectAsAzureContainerApp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the project resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishAsAzureContainerAppInternal(configure)); + } + + /** @internal */ + private async _publishAsConfiguredAzureContainerAppJobInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(arg2Data) as ContainerAppJobHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { resource: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredAzureContainerAppJob', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishAsConfiguredAzureContainerAppJobInternal(configure)); + } + + /** @internal */ + private async _publishAsAzureContainerAppJobInternal(): Promise { + const rpcArgs: Record = { resource: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsAzureContainerAppJob', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishAsAzureContainerAppJobInternal()); + } + + /** @internal */ + private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = configure ? registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(arg2Data) as ContainerAppJobHandle; + await configure(arg1, arg2); + }) : undefined; + const rpcArgs: Record = { resource: this._handle, cronExpression }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredScheduledAzureContainerAppJob', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): ProjectResourcePromise { + const configure = options?.configure; + return new ProjectResourcePromise(this._publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression, configure)); + } + + /** @internal */ + private async _publishAsScheduledAzureContainerAppJobInternal(cronExpression: string): Promise { + const rpcArgs: Record = { resource: this._handle, cronExpression }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishAsScheduledAzureContainerAppJob', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishAsScheduledAzureContainerAppJobInternal(cronExpression)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ParameterResourcePromise { - return new ParameterResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + } + + /** @internal */ + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + } + + /** @internal */ + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withUserAssignedIdentityAzureUserAssignedIdentity', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + } + + /** @internal */ + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ParameterResourcePromise { - return new ParameterResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); } /** @internal */ @@ -27379,145 +37669,325 @@ export class ParameterResource extends ResourceBuilderBase { + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); + } + + /** Assigns Azure Container Registry roles to a resource. */ + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ParameterResourcePromise { - return new ParameterResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } -} + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } -/** - * Thenable wrapper for ParameterResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ParameterResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } - then( - onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -27525,14 +37995,79 @@ export class ParameterResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures the project resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerApp(configure))); + } + + /** Configures the compute resource as an Azure Container App Job with custom configuration */ + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); + } + + /** Configures the compute resource as a manually triggered Azure Container App Job */ + publishAsAzureContainerAppJob(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerAppJob())); + } + + /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsConfiguredScheduledAzureContainerAppJob(cronExpression, options))); + } + + /** Configures the compute resource as a scheduled Azure Container App Job */ + publishAsScheduledAzureContainerAppJob(cronExpression: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsScheduledAzureContainerAppJob(cronExpression))); + } + /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); } /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); } /** Gets the Azure Container Registry associated with a compute environment resource. */ @@ -27541,387 +38076,419 @@ export class ParameterResourcePromise implements PromiseLike } /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); } } // ============================================================================ -// ProjectResource +// ViteAppResource // ============================================================================ -export class ProjectResource extends ResourceBuilderBase { - constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { +export class ViteAppResource extends ResourceBuilderBase { + constructor(handle: ViteAppResourceHandle, client: AspireClientRpc) { super(handle, client); } + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ViteAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _publishAsDockerFileInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterInternal()); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - const helpLink = options?.helpLink; - return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ViteAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { + const helpLink = options?.helpLink; + return new ViteAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ViteAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -27931,15 +38498,15 @@ export class ProjectResource extends ResourceBuilderBase if (isProxied !== undefined) rpcArgs.isProxied = isProxied; if (isExternal !== undefined) rpcArgs.isExternal = isExternal; if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -27948,72 +38515,72 @@ export class ProjectResource extends ResourceBuilderBase const isProxied = options?.isProxied; const isExternal = options?.isExternal; const protocol = options?.protocol; - return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + return new ViteAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -28026,293 +38593,308 @@ export class ProjectResource extends ResourceBuilderBase } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _clearContainerFilesSourcesInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { const exitCode = options?.exitCode; - return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ViteAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new ViteAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -28320,130 +38902,130 @@ export class ProjectResource extends ResourceBuilderBase }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { const commandOptions = options?.commandOptions; - return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ViteAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { const password = options?.password; - return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new ViteAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { const iconVariant = options?.iconVariant; - return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ViteAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -28452,15 +39034,15 @@ export class ProjectResource extends ResourceBuilderBase if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -28468,56 +39050,56 @@ export class ProjectResource extends ResourceBuilderBase const failureThreshold = options?.failureThreshold; const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new ViteAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -28528,60 +39110,60 @@ export class ProjectResource extends ResourceBuilderBase if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; if (tags !== undefined) rpcArgs.tags = tags; if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ViteAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -28594,154 +39176,417 @@ export class ProjectResource extends ResourceBuilderBase } /** @internal */ - private async _publishAsConfiguredAzureContainerAppJobInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { - const configureId = registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withViteConfigInternal(configPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, configPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withViteConfig', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withViteConfigInternal(configPath)); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withYarnInternal(install, installArgs)); + } + + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withPnpmInternal(install, installArgs)); + } + + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withRunScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + const browser = options?.browser; + return new ViteAppResourcePromise(this._withBrowserDebuggerInternal(browser)); + } + + /** @internal */ + private async _publishAsAzureContainerAppInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; + const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); + const arg2 = wrapIfHandle(arg2Data) as ContainerAppHandle; + await configure(arg1, arg2); + }); + const rpcArgs: Record = { executable: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.AppContainers/publishExecutableAsAzureContainerApp', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures the executable resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsAzureContainerAppInternal(configure)); + } + + /** @internal */ + private async _publishAsConfiguredAzureContainerAppJobInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); - const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; + const arg2 = wrapIfHandle(arg2Data) as ContainerAppJobHandle; await configure(arg1, arg2); }); const rpcArgs: Record = { resource: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredAzureContainerAppJob', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures the compute resource as an Azure Container App Job with custom configuration */ - publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._publishAsConfiguredAzureContainerAppJobInternal(configure)); + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsConfiguredAzureContainerAppJobInternal(configure)); } /** @internal */ - private async _publishAsAzureContainerAppJobInternal(): Promise { + private async _publishAsAzureContainerAppJobInternal(): Promise { const rpcArgs: Record = { resource: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.AppContainers/publishAsAzureContainerAppJob', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures the compute resource as a manually triggered Azure Container App Job */ - publishAsAzureContainerAppJob(): ProjectResourcePromise { - return new ProjectResourcePromise(this._publishAsAzureContainerAppJobInternal()); + publishAsAzureContainerAppJob(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsAzureContainerAppJobInternal()); } /** @internal */ - private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { - const configureId = configure ? registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { + const configureId = configure ? registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); - const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; + const arg2 = wrapIfHandle(arg2Data) as ContainerAppJobHandle; await configure(arg1, arg2); }) : undefined; const rpcArgs: Record = { resource: this._handle, cronExpression }; if (configure !== undefined) rpcArgs.configure = configureId; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.AppContainers/publishAsConfiguredScheduledAzureContainerAppJob', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ - publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): ProjectResourcePromise { + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): ViteAppResourcePromise { const configure = options?.configure; - return new ProjectResourcePromise(this._publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression, configure)); + return new ViteAppResourcePromise(this._publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression, configure)); } /** @internal */ - private async _publishAsScheduledAzureContainerAppJobInternal(cronExpression: string): Promise { + private async _publishAsScheduledAzureContainerAppJobInternal(cronExpression: string): Promise { const rpcArgs: Record = { resource: this._handle, cronExpression }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.AppContainers/publishAsScheduledAzureContainerAppJob', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures the compute resource as a scheduled Azure Container App Job */ - publishAsScheduledAzureContainerAppJob(cronExpression: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._publishAsScheduledAzureContainerAppJobInternal(cronExpression)); + publishAsScheduledAzureContainerAppJob(cronExpression: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsScheduledAzureContainerAppJobInternal(cronExpression)); } /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } /** @internal */ - private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure/withEnvironmentFromOutput', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); } /** @internal */ - private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, name, secretReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); } /** @internal */ - private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withUserAssignedIdentityAzureUserAssignedIdentity', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); } /** @internal */ - private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { + private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { const rpcArgs: Record = { builder: this._handle, registryBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withAzureContainerRegistryInternal(registryBuilder)); } /** @internal */ @@ -28760,165 +39605,165 @@ export class ProjectResource extends ResourceBuilderBase } /** @internal */ - private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { + private async _withContainerRegistryRoleAssignmentsInternal(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryRoleAssignments', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerRegistryRoleAssignmentsInternal(target, roles)); } } /** - * Thenable wrapper for ProjectResource that enables fluent chaining. + * Thenable wrapper for ViteAppResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ProjectResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ViteAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ViteAppResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -28927,163 +39772,168 @@ export class ProjectResourcePromise implements PromiseLike { } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -29091,49 +39941,119 @@ export class ProjectResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withViteConfig(configPath))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + + /** Configures the executable resource to be published as an Azure Container App */ + publishAsAzureContainerApp(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppHandle) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerApp(configure))); + } + /** Configures the compute resource as an Azure Container App Job with custom configuration */ - publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); + publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); } /** Configures the compute resource as a manually triggered Azure Container App Job */ - publishAsAzureContainerAppJob(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerAppJob())); + publishAsAzureContainerAppJob(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsAzureContainerAppJob())); } /** Configures the compute resource as a scheduled Azure Container App Job with custom configuration */ - publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsConfiguredScheduledAzureContainerAppJob(cronExpression, options))); + publishAsConfiguredScheduledAzureContainerAppJob(cronExpression: string, options?: PublishAsConfiguredScheduledAzureContainerAppJobOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsConfiguredScheduledAzureContainerAppJob(cronExpression, options))); } /** Configures the compute resource as a scheduled Azure Container App Job */ - publishAsScheduledAzureContainerAppJob(cronExpression: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsScheduledAzureContainerAppJob(cronExpression))); + publishAsScheduledAzureContainerAppJob(cronExpression: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsScheduledAzureContainerAppJob(cronExpression))); } /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); } /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); } /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); } /** Configures a compute environment resource to use an Azure Container Registry. */ - withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); + withAzureContainerRegistry(registryBuilder: AzureContainerRegistryResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withAzureContainerRegistry(registryBuilder))); } /** Gets the Azure Container Registry associated with a compute environment resource. */ @@ -29142,8 +40062,8 @@ export class ProjectResourcePromise implements PromiseLike { } /** Assigns Azure Container Registry roles to a resource. */ - withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); + withContainerRegistryRoleAssignments(target: AzureContainerRegistryResource, roles: AzureContainerRegistryRole[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerRegistryRoleAssignments(target, roles))); } } @@ -29269,13 +40189,13 @@ export class AzureResource extends ResourceBuilderBase { private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/asExisting', + 'Aspire.Hosting.Azure/asExistingFromParameters', rpcArgs ); return new AzureResource(result, this._client); } - /** Marks an Azure resource as existing in both run and publish modes */ + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureResourcePromise { return new AzureResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); } @@ -29337,7 +40257,7 @@ export class AzureResourcePromise implements PromiseLike { return new AzureResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); } - /** Marks an Azure resource as existing in both run and publish modes */ + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureResourcePromise { return new AzureResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); } @@ -29353,13 +40273,42 @@ export class ComputeResource extends ResourceBuilderBase super(handle, client); } + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + /** @internal */ private async _publishAsConfiguredAzureContainerAppJobInternal(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { - const configureId = registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); - const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; + const arg2 = wrapIfHandle(arg2Data) as ContainerAppJobHandle; await configure(arg1, arg2); }); const rpcArgs: Record = { resource: this._handle, configure: configureId }; @@ -29392,11 +40341,10 @@ export class ComputeResource extends ResourceBuilderBase /** @internal */ private async _publishAsConfiguredScheduledAzureContainerAppJobInternal(cronExpression: string, configure?: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): Promise { - const configureId = configure ? registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as AzureResourceInfrastructureHandle; + const configureId = configure ? registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as AzureResourceInfrastructureHandle; const arg1 = new AzureResourceInfrastructure(arg1Handle, this._client); - const arg2 = wrapIfHandle(args.p1) as ContainerAppJobHandle; + const arg2 = wrapIfHandle(arg2Data) as ContainerAppJobHandle; await configure(arg1, arg2); }) : undefined; const rpcArgs: Record = { resource: this._handle, cronExpression }; @@ -29433,7 +40381,7 @@ export class ComputeResource extends ResourceBuilderBase private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + 'Aspire.Hosting.Azure/withUserAssignedIdentityAzureUserAssignedIdentity', rpcArgs ); return new ComputeResource(result, this._client); @@ -29461,6 +40409,16 @@ export class ComputeResourcePromise implements PromiseLike { return this._promise.then(onfulfilled, onrejected); } + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + /** Configures the compute resource as an Azure Container App Job with custom configuration */ publishAsConfiguredAzureContainerAppJob(configure: (arg1: AzureResourceInfrastructure, arg2: ContainerAppJobHandle) => Promise): ComputeResourcePromise { return new ComputeResourcePromise(this._promise.then(obj => obj.publishAsConfiguredAzureContainerAppJob(configure))); @@ -29501,7 +40459,7 @@ export class ContainerFilesDestinationResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); return new ContainerFilesDestinationResource(result, this._client); @@ -29760,7 +40718,7 @@ export class Resource extends ResourceBuilderBase { private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new Resource(result, this._client); @@ -29775,7 +40733,7 @@ export class Resource extends ResourceBuilderBase { private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new Resource(result, this._client); @@ -29818,36 +40776,6 @@ export class Resource extends ResourceBuilderBase { return new ResourcePromise(this._excludeFromMcpInternal()); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -29925,6 +40853,86 @@ export class Resource extends ResourceBuilderBase { ); } + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceReadyInternal(callback)); + } + /** @internal */ private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; @@ -29944,7 +40952,7 @@ export class Resource extends ResourceBuilderBase { private async _withAzureContainerRegistryInternal(registryBuilder: AzureContainerRegistryResource): Promise { const rpcArgs: Record = { builder: this._handle, registryBuilder }; const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.ContainerRegistry/withAzureContainerRegistry', + 'Aspire.Hosting.Azure.ContainerRegistry/withContainerRegistryAzureContainerRegistry', rpcArgs ); return new Resource(result, this._client); @@ -30082,16 +41090,6 @@ export class ResourcePromise implements PromiseLike { return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); @@ -30112,6 +41110,26 @@ export class ResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + /** Assigns Azure Storage roles to a resource */ withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ResourcePromise { return new ResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); @@ -30271,6 +41289,35 @@ export class ResourceWithConnectionString extends ResourceBuilderBase { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._onConnectionStringAvailableInternal(callback)); + } + } /** @@ -30298,6 +41345,16 @@ export class ResourceWithConnectionStringPromise implements PromiseLike obj.withConnectionPropertyValue(name, value))); } + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + } // ============================================================================ @@ -30586,6 +41643,26 @@ export class ResourceWithEndpoints extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + } /** @@ -30653,6 +41730,11 @@ export class ResourceWithEndpointsPromise implements PromiseLike obj.withHttpProbe(probeType, options))); } + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + } // ============================================================================ @@ -30695,41 +41777,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -30740,43 +41792,38 @@ export class ResourceWithEnvironment extends ResourceBuilderBase Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -30810,10 +41857,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -30825,37 +41873,8 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -30938,7 +41957,7 @@ export class ResourceWithEnvironment extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ResourceWithEnvironment(result, this._client); @@ -31022,31 +42041,21 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withOtlpExporterProtocol(protocol))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -31062,16 +42071,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -31119,34 +42118,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike { - constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { - super(handle, client); - } - -} - -/** - * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ResourceWithServiceDiscoveryPromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - -} - // ============================================================================ // ResourceWithWaitSupport // ============================================================================ @@ -31160,7 +42131,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -31190,7 +42161,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -31221,7 +42192,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -31340,7 +42311,7 @@ export async function createBuilder(options?: CreateBuilderOptions): Promise { const error = reason instanceof Error ? reason : new Error(String(reason)); - if (reason instanceof CapabilityError) { + if (reason instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else if (reason instanceof CapabilityError) { console.error(`\n❌ Capability Error: ${error.message}`); console.error(` Code: ${(reason as CapabilityError).code}`); if ((reason as CapabilityError).capability) { @@ -31371,8 +42344,12 @@ process.on('unhandledRejection', (reason: unknown) => { }); process.on('uncaughtException', (error: Error) => { - console.error(`\n❌ Uncaught Exception: ${error.message}`); - if (error.stack) { + if (error instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + } + if (!(error instanceof AppHostUsageError) && error.stack) { console.error(error.stack); } process.exit(1); @@ -31383,23 +42360,46 @@ process.on('uncaughtException', (error: Error) => { // ============================================================================ // Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent', (handle, client) => new AfterResourcesCreatedEvent(handle as AfterResourcesCreatedEventHandle, client)); registerHandleWrapper('Aspire.Hosting.Azure/Aspire.Hosting.Azure.AzureResourceInfrastructure', (handle, client) => new AzureResourceInfrastructure(handle as AzureResourceInfrastructureHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent', (handle, client) => new BeforeResourceStartedEvent(handle as BeforeResourceStartedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent', (handle, client) => new BeforeStartEvent(handle as BeforeStartEventHandle, client)); registerHandleWrapper('Aspire.Hosting.Azure/Aspire.Hosting.Azure.BicepOutputReference', (handle, client) => new BicepOutputReference(handle as BicepOutputReferenceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent', (handle, client) => new ConnectionStringAvailableEvent(handle as ConnectionStringAvailableEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel', (handle, client) => new DistributedApplicationModel(handle as DistributedApplicationModelHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent', (handle, client) => new InitializeResourceEvent(handle as InitializeResourceEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext', (handle, client) => new PipelineContext(handle as PipelineContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext', (handle, client) => new PipelineStepFactoryContext(handle as PipelineStepFactoryContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary', (handle, client) => new PipelineSummary(handle as PipelineSummaryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent', (handle, client) => new ResourceEndpointsAllocatedEvent(handle as ResourceEndpointsAllocatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService', (handle, client) => new ResourceLoggerService(handle as ResourceLoggerServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService', (handle, client) => new ResourceNotificationService(handle as ResourceNotificationServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent', (handle, client) => new ResourceReadyEvent(handle as ResourceReadyEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent', (handle, client) => new ResourceStoppedEvent(handle as ResourceStoppedEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext', (handle, client) => new UpdateCommandStateContext(handle as UpdateCommandStateContextHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration', (handle, client) => new Configuration(handle as IConfigurationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment', (handle, client) => new HostEnvironment(handle as IHostEnvironmentHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger', (handle, client) => new Logger(handle as ILoggerHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory', (handle, client) => new LoggerFactory(handle as ILoggerFactoryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep', (handle, client) => new ReportingStep(handle as IReportingStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask', (handle, client) => new ReportingTask(handle as IReportingTaskHandle, client)); +registerHandleWrapper('System.ComponentModel/System.IServiceProvider', (handle, client) => new ServiceProvider(handle as IServiceProviderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IUserSecretsManager', (handle, client) => new UserSecretsManager(handle as IUserSecretsManagerHandle, client)); registerHandleWrapper('Aspire.Hosting.Azure/Aspire.Hosting.Azure.AzureBicepResource', (handle, client) => new AzureBicepResource(handle as AzureBicepResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureBlobStorageContainerResource', (handle, client) => new AzureBlobStorageContainerResource(handle as AzureBlobStorageContainerResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureBlobStorageResource', (handle, client) => new AzureBlobStorageResource(handle as AzureBlobStorageResourceHandle, client)); @@ -31424,8 +42424,11 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppR registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource', (handle, client) => new JavaScriptAppResource(handle as JavaScriptAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource', (handle, client) => new NodeAppResource(handle as NodeAppResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource', (handle, client) => new ViteAppResource(handle as ViteAppResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.Azure/Aspire.Hosting.ApplicationModel.IAzureResource', (handle, client) => new AzureResource(handle as IAzureResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource', (handle, client) => new ComputeResource(handle as IComputeResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); @@ -31435,6 +42438,5 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceW registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); diff --git a/samples/aspire-with-azure-functions/ts/.modules/base.ts b/samples/aspire-with-azure-functions/ts/.modules/base.ts index 7778b0f1..b3d8b8be 100644 --- a/samples/aspire-with-azure-functions/ts/.modules/base.ts +++ b/samples/aspire-with-azure-functions/ts/.modules/base.ts @@ -1,8 +1,8 @@ -// aspire.ts - Core Aspire types: base classes, ReferenceExpression -import { Handle, AspireClient, MarshalledHandle } from './transport.js'; +// base.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle, CancellationToken, registerCancellation, registerHandleWrapper, unregisterCancellation } from './transport.js'; // Re-export transport types for convenience -export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export { Handle, AspireClient, CapabilityError, CancellationToken, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; @@ -43,22 +43,46 @@ export class ReferenceExpression { private readonly _format?: string; private readonly _valueProviders?: unknown[]; + // Conditional mode fields + private readonly _condition?: unknown; + private readonly _whenTrue?: ReferenceExpression; + private readonly _whenFalse?: ReferenceExpression; + private readonly _matchValue?: string; + // Handle mode fields (when wrapping a server-returned handle) private readonly _handle?: Handle; private readonly _client?: AspireClient; constructor(format: string, valueProviders: unknown[]); constructor(handle: Handle, client: AspireClient); - constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { - if (typeof handleOrFormat === 'string') { - this._format = handleOrFormat; - this._valueProviders = clientOrValueProviders as unknown[]; + constructor(condition: unknown, matchValue: string, whenTrue: ReferenceExpression, whenFalse: ReferenceExpression); + constructor( + handleOrFormatOrCondition: Handle | string | unknown, + clientOrValueProvidersOrMatchValue: AspireClient | unknown[] | string, + whenTrueOrWhenFalse?: ReferenceExpression, + whenFalse?: ReferenceExpression + ) { + if (typeof handleOrFormatOrCondition === 'string') { + this._format = handleOrFormatOrCondition; + this._valueProviders = clientOrValueProvidersOrMatchValue as unknown[]; + } else if (handleOrFormatOrCondition instanceof Handle) { + this._handle = handleOrFormatOrCondition; + this._client = clientOrValueProvidersOrMatchValue as AspireClient; } else { - this._handle = handleOrFormat; - this._client = clientOrValueProviders as AspireClient; + this._condition = handleOrFormatOrCondition; + this._matchValue = (clientOrValueProvidersOrMatchValue as string) ?? 'True'; + this._whenTrue = whenTrueOrWhenFalse; + this._whenFalse = whenFalse; } } + /** + * Gets whether this reference expression is conditional. + */ + get isConditional(): boolean { + return this._condition !== undefined; + } + /** * Creates a reference expression from a tagged template literal. * @@ -82,16 +106,46 @@ export class ReferenceExpression { return new ReferenceExpression(format, valueProviders); } + /** + * Creates a conditional reference expression from its constituent parts. + * + * @param condition - A value provider whose result is compared to matchValue + * @param whenTrue - The expression to use when the condition matches + * @param whenFalse - The expression to use when the condition does not match + * @param matchValue - The value to compare the condition against (defaults to "True") + * @returns A ReferenceExpression instance in conditional mode + */ + static createConditional( + condition: unknown, + matchValue: string, + whenTrue: ReferenceExpression, + whenFalse: ReferenceExpression + ): ReferenceExpression { + return new ReferenceExpression(condition, matchValue, whenTrue, whenFalse); + } + /** * Serializes the reference expression for JSON-RPC transport. - * In template-literal mode, uses the $expr format. + * In expression mode, uses the $expr format with format + valueProviders. + * In conditional mode, uses the $expr format with condition + whenTrue + whenFalse. * In handle mode, delegates to the handle's serialization. */ - toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } | { condition: unknown; whenTrue: unknown; whenFalse: unknown; matchValue: string } } | MarshalledHandle { if (this._handle) { return this._handle.toJSON(); } + if (this.isConditional) { + return { + $expr: { + condition: extractHandleForExpr(this._condition), + whenTrue: this._whenTrue!.toJSON(), + whenFalse: this._whenFalse!.toJSON(), + matchValue: this._matchValue! + } + }; + } + return { $expr: { format: this._format!, @@ -100,6 +154,30 @@ export class ReferenceExpression { }; } + /** + * Resolves the expression to its string value on the server. + * Only available on server-returned ReferenceExpression instances (handle mode). + * + * @param cancellationToken - Optional AbortSignal or CancellationToken for cancellation support + * @returns The resolved string value, or null if the expression resolves to null + */ + async getValue(cancellationToken?: AbortSignal | CancellationToken): Promise { + if (!this._handle || !this._client) { + throw new Error('getValue is only available on server-returned ReferenceExpression instances'); + } + const cancellationTokenId = registerCancellation(this._client, cancellationToken); + try { + const rpcArgs: Record = { context: this._handle }; + if (cancellationTokenId !== undefined) rpcArgs.cancellationToken = cancellationTokenId; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValue', + rpcArgs + ); + } finally { + unregisterCancellation(cancellationTokenId); + } + } + /** * String representation for debugging. */ @@ -107,10 +185,17 @@ export class ReferenceExpression { if (this._handle) { return `ReferenceExpression(handle)`; } + if (this.isConditional) { + return `ReferenceExpression(conditional)`; + } return `ReferenceExpression(${this._format})`; } } +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression', (handle, client) => + new ReferenceExpression(handle, client) +); + /** * Extracts a value for use in reference expressions. * Supports handles (objects) and string literals. @@ -136,15 +221,15 @@ function extractHandleForExpr(value: unknown): unknown { return value.toJSON(); } - // Objects with $handle property (already in handle format) - if (typeof value === 'object' && value !== null && '$handle' in value) { + // Objects with marshalled expression/handle payloads + if (typeof value === 'object' && value !== null && ('$handle' in value || '$expr' in value)) { return value; } - // Objects with toJSON that returns a handle + // Objects with toJSON that returns a marshalled expression or handle if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { const json = value.toJSON(); - if (json && typeof json === 'object' && '$handle' in json) { + if (json && typeof json === 'object' && ('$handle' in json || '$expr' in json)) { return json; } } @@ -307,11 +392,20 @@ export class AspireList { }) as T[]; } - toJSON(): MarshalledHandle { - if (this._resolvedHandle) { - return this._resolvedHandle.toJSON(); + async toTransportValue(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireList must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); } - return this._handleOrContext.toJSON(); + + return this._resolvedHandle.toJSON(); } } @@ -466,8 +560,19 @@ export class AspireDict { }) as Record; } - async toJSON(): Promise { + async toTransportValue(): Promise { const handle = await this._ensureHandle(); return handle.toJSON(); } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireDict must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); + } + + return this._resolvedHandle.toJSON(); + } } diff --git a/samples/aspire-with-azure-functions/ts/.modules/transport.ts b/samples/aspire-with-azure-functions/ts/.modules/transport.ts index 7bddd74b..6d29cf28 100644 --- a/samples/aspire-with-azure-functions/ts/.modules/transport.ts +++ b/samples/aspire-with-azure-functions/ts/.modules/transport.ts @@ -77,7 +77,8 @@ export function isAtsError(value: unknown): value is { $error: AtsError } { value !== null && typeof value === 'object' && '$error' in value && - typeof (value as { $error: unknown }).$error === 'object' + typeof (value as { $error: unknown }).$error === 'object' && + (value as { $error: unknown }).$error !== null ); } @@ -93,6 +94,47 @@ export function isMarshalledHandle(value: unknown): value is MarshalledHandle { ); } +function isAbortSignal(value: unknown): value is AbortSignal { + return ( + value !== null && + typeof value === 'object' && + 'aborted' in value && + 'addEventListener' in value && + 'removeEventListener' in value + ); +} + +function isPlainObject(value: unknown): value is Record { + if (value === null || typeof value !== 'object') { + return false; + } + + const prototype = Object.getPrototypeOf(value); + return prototype === Object.prototype || prototype === null; +} + +function hasTransportValue(value: unknown): value is { toTransportValue(): unknown | Promise } { + return ( + value !== null && + typeof value === 'object' && + 'toTransportValue' in value && + typeof (value as { toTransportValue?: unknown }).toTransportValue === 'function' + ); +} + +function createAbortError(message: string): Error { + const error = new Error(message); + error.name = 'AbortError'; + return error; +} + +function createCircularReferenceError(capabilityId: string, path: string): AppHostUsageError { + return new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' contains a circular reference. ` + + 'Circular references are not supported by the AppHost transport.' + ); +} + // ============================================================================ // Handle // ============================================================================ @@ -136,6 +178,92 @@ export class Handle { } } +// ============================================================================ +// CancellationToken +// ============================================================================ + +/** + * Represents a transport-safe cancellation token value for the generated SDK. + * + * Use a plain {@link AbortSignal} when you create cancellation in user code. + * Generated APIs accept either an {@link AbortSignal} or a {@link CancellationToken}. + * + * Values returned from generated callbacks and context/property getters are + * {@link CancellationToken} instances because they may reference remote + * cancellation token handles received from the AppHost. + * + * @example + * ```typescript + * const controller = new AbortController(); + * await connectionStringExpression.getValue(controller.signal); + * ``` + * + * @example + * ```typescript + * const cancellationToken = await context.cancellationToken.get(); + * const connectionStringExpression = await db.uriExpression.get(); + * const connectionString = await connectionStringExpression.getValue(cancellationToken); + * ``` + */ +export class CancellationToken { + private readonly _signal?: AbortSignal; + private readonly _remoteTokenId?: string; + + constructor(signal?: AbortSignal); + constructor(tokenId?: string); + constructor(value?: AbortSignal | string | null) { + if (typeof value === 'string') { + this._remoteTokenId = value; + } else if (isAbortSignal(value)) { + this._signal = value; + } + } + + /** + * Creates a cancellation token from a local {@link AbortSignal}. + */ + static from(signal?: AbortSignal): CancellationToken { + return new CancellationToken(signal); + } + + /** + * Creates a cancellation token from a transport value. + * Generated code uses this to materialize values that come from the AppHost. + */ + static fromValue(value: unknown): CancellationToken { + if (value instanceof CancellationToken) { + return value; + } + + if (typeof value === 'string') { + return new CancellationToken(value); + } + + if (isAbortSignal(value)) { + return new CancellationToken(value); + } + + return new CancellationToken(); + } + + /** + * Serializes the token for JSON-RPC transport. + */ + toJSON(): string | undefined { + return this._remoteTokenId; + } + + register(client?: AspireClient): string | undefined { + if (this._remoteTokenId !== undefined) { + return this._remoteTokenId; + } + + return client + ? registerCancellation(client, this._signal) + : registerCancellation(this._signal); + } +} + // ============================================================================ // Handle Wrapper Registry // ============================================================================ @@ -167,22 +295,35 @@ export function registerHandleWrapper(typeId: string, factory: HandleWrapperFact * @param client - Optional client for creating typed wrapper instances */ export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { - if (value && typeof value === 'object') { - if (isMarshalledHandle(value)) { - const handle = new Handle(value); - const typeId = value.$type; - - // Try to find a registered wrapper factory for this type - if (typeId && client) { - const factory = handleWrapperRegistry.get(typeId); - if (factory) { - return factory(handle, client); - } + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); } + } + + return handle; + } - return handle; + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + value[i] = wrapIfHandle(value[i], client); + } + + return value; + } + + if (isPlainObject(value)) { + for (const [key, nestedValue] of Object.entries(value)) { + value[key] = wrapIfHandle(nestedValue, client); } } + return value; } @@ -213,6 +354,76 @@ export class CapabilityError extends Error { } } +/** + * Error thrown when the AppHost script uses the generated SDK incorrectly. + */ +export class AppHostUsageError extends Error { + constructor(message: string) { + super(message); + this.name = 'AppHostUsageError'; + } +} + +function isPromiseLike(value: unknown): value is PromiseLike { + return ( + value !== null && + (typeof value === 'object' || typeof value === 'function') && + 'then' in value && + typeof (value as { then?: unknown }).then === 'function' + ); +} + +function validateCapabilityArgs( + capabilityId: string, + args?: Record +): void { + if (!args) { + return; + } + + const validateValue = (value: unknown, path: string, ancestors: Set): void => { + if (value === null || value === undefined) { + return; + } + + if (isPromiseLike(value)) { + throw new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' is a Promise-like value. ` + + `This usually means an async builder call was not awaited. ` + + `Did you forget 'await' on a call like builder.addPostgres(...) or resource.addDatabase(...)?` + ); + } + + if (typeof value !== 'object') { + return; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + ancestors.add(value); + try { + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + validateValue(value[i], `${path}[${i}]`, ancestors); + } + return; + } + + for (const [key, nestedValue] of Object.entries(value)) { + validateValue(nestedValue, `${path}.${key}`, ancestors); + } + } finally { + ancestors.delete(value); + } + }; + + for (const [key, value] of Object.entries(args)) { + validateValue(value, key, new Set()); + } +} + // ============================================================================ // Callback Registry // ============================================================================ @@ -324,21 +535,50 @@ export function getCallbackCount(): number { */ const cancellationRegistry = new Map void>(); let cancellationIdCounter = 0; +const connectedClients = new Set(); -/** - * A reference to the current AspireClient for sending cancel requests. - * Set by AspireClient.connect(). - */ -let currentClient: AspireClient | null = null; +function resolveCancellationClient(client?: AspireClient): AspireClient { + if (client) { + return client; + } + + if (connectedClients.size === 1) { + return connectedClients.values().next().value as AspireClient; + } + + if (connectedClients.size === 0) { + throw new Error( + 'registerCancellation(signal) requires a connected AspireClient. ' + + 'Pass the client explicitly or connect the client first.' + ); + } + + throw new Error( + 'registerCancellation(signal) is ambiguous when multiple AspireClient instances are connected. ' + + 'Pass the client explicitly.' + ); +} /** - * Register an AbortSignal for cancellation support. - * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * Registers cancellation support for a local signal or SDK cancellation token. + * Returns a cancellation ID that should be passed to methods accepting cancellation input. * * When the AbortSignal is aborted, sends a cancelToken request to the host. * - * @param signal - The AbortSignal to register (optional) - * @returns The cancellation ID, or undefined if no signal provided + * @param client - The AspireClient that should route the cancellation request + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + */ +export function registerCancellation(client: AspireClient, signalOrToken?: AbortSignal | CancellationToken): string | undefined; +/** + * Registers cancellation support using the single connected AspireClient. + * + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + * + * @example + * const controller = new AbortController(); + * await expression.getValue(controller.signal); * * @example * const controller = new AbortController(); @@ -346,14 +586,29 @@ let currentClient: AspireClient | null = null; * // Pass id to capability invocation * // Later: controller.abort() will cancel the operation */ -export function registerCancellation(signal?: AbortSignal): string | undefined { - if (!signal) { +export function registerCancellation(signalOrToken?: AbortSignal | CancellationToken): string | undefined; +export function registerCancellation( + clientOrSignalOrToken?: AspireClient | AbortSignal | CancellationToken, + maybeSignalOrToken?: AbortSignal | CancellationToken +): string | undefined { + const client = clientOrSignalOrToken instanceof AspireClient ? clientOrSignalOrToken : undefined; + const signalOrToken = client + ? maybeSignalOrToken + : clientOrSignalOrToken as AbortSignal | CancellationToken | undefined; + + if (!signalOrToken) { return undefined; } - // Already aborted? Don't register + if (signalOrToken instanceof CancellationToken) { + return signalOrToken.register(client); + } + + const signal = signalOrToken; + const cancellationClient = resolveCancellationClient(client); + if (signal.aborted) { - return undefined; + throw createAbortError('The operation was aborted before it was sent to the AppHost.'); } const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; @@ -361,8 +616,8 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { // Set up the abort listener const onAbort = () => { // Send cancel request to host - if (currentClient?.connected) { - currentClient.cancelToken(cancellationId).catch(() => { + if (cancellationClient.connected) { + cancellationClient.cancelToken(cancellationId).catch(() => { // Ignore errors - the operation may have already completed }); } @@ -381,6 +636,56 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { return cancellationId; } +async function marshalTransportValue( + value: unknown, + client: AspireClient, + cancellationIds: string[], + capabilityId: string, + path: string = 'args', + ancestors: Set = new Set() +): Promise { + if (value === null || value === undefined || typeof value !== 'object') { + return value; + } + + if (value instanceof CancellationToken) { + const cancellationId = value.register(client); + if (cancellationId !== undefined) { + cancellationIds.push(cancellationId); + } + + return cancellationId; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + const nextAncestors = new Set(ancestors); + nextAncestors.add(value); + + if (hasTransportValue(value)) { + return await marshalTransportValue(await value.toTransportValue(), client, cancellationIds, capabilityId, path, nextAncestors); + } + + if (Array.isArray(value)) { + return await Promise.all( + value.map((item, index) => marshalTransportValue(item, client, cancellationIds, capabilityId, `${path}[${index}]`, nextAncestors)) + ); + } + + if (isPlainObject(value)) { + const entries = await Promise.all( + Object.entries(value).map(async ([key, nestedValue]) => + [key, await marshalTransportValue(nestedValue, client, cancellationIds, capabilityId, `${path}.${key}`, nextAncestors)] as const) + ); + + return Object.fromEntries(entries); + } + + return value; +} + /** * Unregister a cancellation token by its ID. * Call this when the operation completes to clean up resources. @@ -411,6 +716,8 @@ export class AspireClient { private socket: net.Socket | null = null; private disconnectCallbacks: (() => void)[] = []; private _pendingCalls = 0; + private _connectPromise: Promise | null = null; + private _disconnectNotified = false; constructor(private socketPath: string) { } @@ -422,6 +729,12 @@ export class AspireClient { } private notifyDisconnect(): void { + if (this._disconnectNotified) { + return; + } + + this._disconnectNotified = true; + for (const callback of this.disconnectCallbacks) { try { callback(); @@ -432,30 +745,106 @@ export class AspireClient { } connect(timeoutMs: number = 5000): Promise { - return new Promise((resolve, reject) => { - const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + if (this.connected) { + return Promise.resolve(); + } + + if (this._connectPromise) { + return this._connectPromise; + } + + this._disconnectNotified = false; + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this._connectPromise = new Promise((resolve, reject) => { + const socket = net.createConnection(pipePath); + this.socket = socket; - // On Windows, use named pipes; on Unix, use Unix domain sockets - const isWindows = process.platform === 'win32'; - const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + let settled = false; - this.socket = net.createConnection(pipePath); + const cleanupPendingListeners = () => { + socket.removeListener('connect', onConnect); + socket.removeListener('error', onPendingError); + socket.removeListener('close', onPendingClose); + }; - this.socket.once('error', (error: Error) => { + const failConnect = (error: Error) => { + if (settled) { + return; + } + + settled = true; clearTimeout(timeout); + cleanupPendingListeners(); + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + if (!socket.destroyed) { + socket.destroy(); + } + reject(error); - }); + }; + + const onConnectedSocketError = (error: Error) => { + console.error('Socket error:', error); + }; + + const onConnectedSocketClose = () => { + socket.removeListener('error', onConnectedSocketError); + + if (this.socket && this.socket !== socket) { + return; + } + + const connection = this.connection; + this.connection = null; + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + this.notifyDisconnect(); + }; + + const onPendingError = (error: Error) => { + failConnect(error); + }; + + const onPendingClose = () => { + failConnect(new Error('Connection closed before JSON-RPC was established')); + }; + + const onConnect = async () => { + if (settled) { + return; + } - this.socket.once('connect', () => { clearTimeout(timeout); + cleanupPendingListeners(); + try { - const reader = new rpc.SocketMessageReader(this.socket!); - const writer = new rpc.SocketMessageWriter(this.socket!); + const reader = new rpc.SocketMessageReader(socket); + const writer = new rpc.SocketMessageWriter(socket); this.connection = rpc.createMessageConnection(reader, writer); this.connection.onClose(() => { this.connection = null; - this.notifyDisconnect(); }); this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); @@ -475,26 +864,39 @@ export class AspireClient { } }); + socket.on('error', onConnectedSocketError); + socket.on('close', onConnectedSocketClose); + + const authToken = process.env.ASPIRE_REMOTE_APPHOST_TOKEN; + if (!authToken) { + throw new Error('ASPIRE_REMOTE_APPHOST_TOKEN environment variable is not set.'); + } this.connection.listen(); + const authenticated = await this.connection.sendRequest('authenticate', authToken); + if (!authenticated) { + throw new Error('Failed to authenticate to the AppHost server.'); + } - // Set the current client for cancellation registry - currentClient = this; + connectedClients.add(this); + this._connectPromise = null; + settled = true; resolve(); - } catch (e) { - reject(e); + } catch (error) { + failConnect(error instanceof Error ? error : new Error(String(error))); } - }); + }; - this.socket.on('close', () => { - this.connection?.dispose(); - this.connection = null; - if (currentClient === this) { - currentClient = null; - } - this.notifyDisconnect(); - }); + const timeout = setTimeout(() => { + failConnect(new Error('Connection timeout')); + }, timeoutMs); + + socket.once('error', onPendingError); + socket.once('close', onPendingClose); + socket.once('connect', onConnect); }); + + return this._connectPromise; } ping(): Promise { @@ -533,39 +935,66 @@ export class AspireClient { throw new Error('Not connected to AppHost'); } - // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. - // We ref() during RPC calls so the process doesn't exit mid-call, and - // unref() when idle so the process can exit naturally after all work completes. - if (this._pendingCalls === 0) { - this.socket?.ref(); - } - this._pendingCalls++; + validateCapabilityArgs(capabilityId, args); + const cancellationIds: string[] = []; try { - const result = await this.connection.sendRequest( - 'invokeCapability', - capabilityId, - args ?? null - ); + const rpcArgs = await marshalTransportValue(args ?? null, this, cancellationIds, capabilityId); - // Check for structured error response - if (isAtsError(result)) { - throw new CapabilityError(result.$error); + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); } + this._pendingCalls++; - // Wrap handles automatically - return wrapIfHandle(result, this) as T; + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + rpcArgs + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } } finally { - this._pendingCalls--; - if (this._pendingCalls === 0) { - this.socket?.unref(); + for (const cancellationId of cancellationIds) { + unregisterCancellation(cancellationId); } } } disconnect(): void { - try { this.connection?.dispose(); } finally { this.connection = null; } - try { this.socket?.end(); } finally { this.socket = null; } + const connection = this.connection; + const socket = this.socket; + + this.connection = null; + this.socket = null; + this._connectPromise = null; + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + if (socket && !socket.destroyed) { + socket.end(); + socket.destroy(); + } } get connected(): boolean { diff --git a/samples/aspire-with-azure-functions/ts/apphost.run.json b/samples/aspire-with-azure-functions/ts/aspire.config.json similarity index 50% rename from samples/aspire-with-azure-functions/ts/apphost.run.json rename to samples/aspire-with-azure-functions/ts/aspire.config.json index cec92c29..bda29478 100644 --- a/samples/aspire-with-azure-functions/ts/apphost.run.json +++ b/samples/aspire-with-azure-functions/ts/aspire.config.json @@ -1,4 +1,14 @@ { + "appHost": { + "path": "apphost.ts", + "language": "typescript/nodejs" + }, + "packages": { + "Aspire.Hosting.JavaScript": "13.2.0", + "Aspire.Hosting.Azure.AppContainers": "13.2.0", + "Aspire.Hosting.Azure.Storage": "13.2.0", + "Aspire.Hosting.Azure.Functions": "13.2.0" + }, "profiles": { "https": { "applicationUrl": "https://localhost:11916;http://localhost:45612", @@ -8,4 +18,4 @@ } } } -} \ No newline at end of file +} diff --git a/samples/aspire-with-javascript/ts/.aspire/settings.json b/samples/aspire-with-javascript/ts/.aspire/settings.json deleted file mode 100644 index 7f9e3027..00000000 --- a/samples/aspire-with-javascript/ts/.aspire/settings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "appHostPath": "../apphost.ts", - "language": "typescript/nodejs", - "channel": "staging", - "sdkVersion": "13.2.0-preview.1.26159.1", - "packages": { - "Aspire.Hosting.JavaScript": "13.2.0-preview.1.26159.1" - } -} \ No newline at end of file diff --git a/samples/aspire-with-javascript/ts/.modules/.codegen-hash b/samples/aspire-with-javascript/ts/.modules/.codegen-hash index 0eea8b04..d112ad8d 100644 --- a/samples/aspire-with-javascript/ts/.modules/.codegen-hash +++ b/samples/aspire-with-javascript/ts/.modules/.codegen-hash @@ -1 +1 @@ -88ADA13426D51D77887AE37D013F598E646AE7698A68086919B880C18973924A \ No newline at end of file +54ABC5F6F3238E45FD69B96BCCB0C6A5BB14B11F3C267B90DC987EFF3E1B7E45 \ No newline at end of file diff --git a/samples/aspire-with-javascript/ts/.modules/aspire.ts b/samples/aspire-with-javascript/ts/.modules/aspire.ts index 9bad32d3..802979fb 100644 --- a/samples/aspire-with-javascript/ts/.modules/aspire.ts +++ b/samples/aspire-with-javascript/ts/.modules/aspire.ts @@ -8,6 +8,8 @@ import { AspireClient as AspireClientRpc, Handle, MarshalledHandle, + AppHostUsageError, + CancellationToken, CapabilityError, registerCallback, wrapIfHandle, @@ -35,9 +37,21 @@ type NodeAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.Ja /** Handle to ViteAppResource */ type ViteAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource'>; +/** Handle to AfterResourcesCreatedEvent */ +type AfterResourcesCreatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent'>; + +/** Handle to BeforeResourceStartedEvent */ +type BeforeResourceStartedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent'>; + +/** Handle to BeforeStartEvent */ +type BeforeStartEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent'>; + /** Handle to CommandLineArgsCallbackContext */ type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; +/** Handle to ConnectionStringAvailableEvent */ +type ConnectionStringAvailableEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent'>; + /** Handle to ContainerRegistryResource */ type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; @@ -47,6 +61,9 @@ type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Application /** Handle to CSharpAppResource */ type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; +/** Handle to DistributedApplicationModel */ +type DistributedApplicationModelHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel'>; + /** Handle to DotnetToolResource */ type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; @@ -65,9 +82,15 @@ type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicatio /** Handle to ExecuteCommandContext */ type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; +/** Handle to IComputeResource */ +type IComputeResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource'>; + /** Handle to IContainerFilesDestinationResource */ type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; +/** Handle to InitializeResourceEvent */ +type InitializeResourceEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent'>; + /** Handle to IResource */ type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; @@ -98,15 +121,27 @@ type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicati /** Handle to ReferenceExpressionBuilder */ type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; +/** Handle to ResourceEndpointsAllocatedEvent */ +type ResourceEndpointsAllocatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent'>; + /** Handle to ResourceLoggerService */ type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; /** Handle to ResourceNotificationService */ type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; +/** Handle to ResourceReadyEvent */ +type ResourceReadyEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent'>; + +/** Handle to ResourceStoppedEvent */ +type ResourceStoppedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent'>; + /** Handle to ResourceUrlsCallbackContext */ type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; +/** Handle to UpdateCommandStateContext */ +type UpdateCommandStateContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext'>; + /** Handle to ConnectionStringResource */ type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; @@ -131,18 +166,33 @@ type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hostin /** Handle to IResourceWithContainerFiles */ type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; -/** Handle to IResourceWithServiceDiscovery */ -type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; +/** Handle to IUserSecretsManager */ +type IUserSecretsManagerHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IUserSecretsManager'>; + +/** Handle to IReportingStep */ +type IReportingStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep'>; + +/** Handle to IReportingTask */ +type IReportingTaskHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask'>; /** Handle to PipelineConfigurationContext */ type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; +/** Handle to PipelineContext */ +type PipelineContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext'>; + /** Handle to PipelineStep */ type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; /** Handle to PipelineStepContext */ type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; +/** Handle to PipelineStepFactoryContext */ +type PipelineStepFactoryContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext'>; + +/** Handle to PipelineSummary */ +type PipelineSummaryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary'>; + /** Handle to ProjectResourceOptions */ type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; @@ -155,12 +205,18 @@ type ListanyHandle = Handle<'Aspire.Hosting/List'>; /** Handle to IConfiguration */ type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; +/** Handle to IConfigurationSection */ +type IConfigurationSectionHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfigurationSection'>; + /** Handle to IHostEnvironment */ type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; /** Handle to ILogger */ type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; +/** Handle to ILoggerFactory */ +type ILoggerFactoryHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory'>; + /** Handle to string[] */ type stringArrayHandle = Handle<'string[]'>; @@ -200,6 +256,7 @@ export enum EndpointProperty { Scheme = "Scheme", TargetPort = "TargetPort", HostAndPort = "HostAndPort", + TlsEnabled = "TlsEnabled", } /** Enum type for IconVariant */ @@ -331,6 +388,10 @@ export interface AddConnectionStringOptions { environmentVariableName?: string; } +export interface AddContainerRegistryFromStringOptions { + repository?: string; +} + export interface AddContainerRegistryOptions { repository?: ParameterResource; } @@ -352,6 +413,11 @@ export interface AddParameterOptions { secret?: boolean; } +export interface AddParameterWithValueOptions { + publishValueAsDefault?: boolean; + secret?: boolean; +} + export interface AddViteAppOptions { runScriptName?: string; } @@ -364,18 +430,72 @@ export interface AppendValueProviderOptions { format?: string; } +export interface CompleteStepMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteStepOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskOptions { + completionMessage?: string; + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateMarkdownTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + export interface GetValueAsyncOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface PublishAsDockerFileOptions { + configure?: (obj: ContainerResource) => Promise; +} + +export interface PublishResourceUpdateOptions { + state?: string; + stateStyle?: string; } export interface RunOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface SaveStateJsonOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskMarkdownOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; } export interface WaitForCompletionOptions { exitCode?: number; } +export interface WaitForResourceStateOptions { + targetState?: string; +} + export interface WithBindMountOptions { isReadOnly?: boolean; } @@ -497,6 +617,7 @@ export interface WithPnpmOptions { export interface WithReferenceOptions { connectionName?: string; optional?: boolean; + name?: string; } export interface WithRequiredCommandOptions { @@ -525,6 +646,117 @@ export interface WithYarnOptions { installArgs?: string[]; } +// ============================================================================ +// AfterResourcesCreatedEvent +// ============================================================================ + +/** + * Type class for AfterResourcesCreatedEvent. + */ +export class AfterResourcesCreatedEvent { + constructor(private _handle: AfterResourcesCreatedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeResourceStartedEvent +// ============================================================================ + +/** + * Type class for BeforeResourceStartedEvent. + */ +export class BeforeResourceStartedEvent { + constructor(private _handle: BeforeResourceStartedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeStartEvent +// ============================================================================ + +/** + * Type class for BeforeStartEvent. + */ +export class BeforeStartEvent { + constructor(private _handle: BeforeStartEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + // ============================================================================ // CommandLineArgsCallbackContext // ============================================================================ @@ -554,11 +786,12 @@ export class CommandLineArgsCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, }; @@ -573,6 +806,65 @@ export class CommandLineArgsCallbackContext { }, }; + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ConnectionStringAvailableEvent +// ============================================================================ + +/** + * Type class for ConnectionStringAvailableEvent. + */ +export class ConnectionStringAvailableEvent { + constructor(private _handle: ConnectionStringAvailableEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + } // ============================================================================ @@ -590,9 +882,9 @@ export class DistributedApplication { /** Runs the distributed application */ /** @internal */ - async _runInternal(cancellationToken?: AbortSignal): Promise { + async _runInternal(cancellationToken?: AbortSignal | CancellationToken): Promise { const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); await this._client.invokeCapability( 'Aspire.Hosting/run', rpcArgs @@ -666,6 +958,17 @@ export class DistributedApplicationExecutionContext { }, }; + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the IsPublishMode property */ isPublishMode = { get: async (): Promise => { @@ -688,6 +991,70 @@ export class DistributedApplicationExecutionContext { } +// ============================================================================ +// DistributedApplicationModel +// ============================================================================ + +/** + * Type class for DistributedApplicationModel. + */ +export class DistributedApplicationModel { + constructor(private _handle: DistributedApplicationModelHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets resources from the distributed application model */ + async getResources(): Promise { + const rpcArgs: Record = { model: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResources', + rpcArgs + ); + } + + /** Finds a resource by name */ + /** @internal */ + async _findResourceByNameInternal(name: string): Promise { + const rpcArgs: Record = { model: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/findResourceByName', + rpcArgs + ); + return new Resource(result, this._client); + } + + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._findResourceByNameInternal(name)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationModel that enables fluent chaining. + */ +export class DistributedApplicationModelPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationModel) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets resources from the distributed application model */ + getResources(): Promise { + return this._promise.then(obj => obj.getResources()); + } + + /** Finds a resource by name */ + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.findResourceByName(name))); + } + +} + // ============================================================================ // EndpointReference // ============================================================================ @@ -701,6 +1068,17 @@ export class EndpointReference { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.resource', + { context: this._handle } + ); + return new ResourceWithEndpoints(handle, this._client); + }, + }; + /** Gets the EndpointName property */ endpointName = { get: async (): Promise => { @@ -767,6 +1145,16 @@ export class EndpointReference { }, }; + /** Gets the TlsEnabled property */ + tlsEnabled = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.tlsEnabled', + { context: this._handle } + ); + }, + }; + /** Gets the Port property */ port = { get: async (): Promise => { @@ -821,13 +1209,22 @@ export class EndpointReference { async getValueAsync(options?: GetValueAsyncOptions): Promise { const cancellationToken = options?.cancellationToken; const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); return await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/getValueAsync', rpcArgs ); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + async getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + const rpcArgs: Record = { context: this._handle, enabledValue, disabledValue }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.getTlsValue', + rpcArgs + ); + } + } /** @@ -848,6 +1245,11 @@ export class EndpointReferencePromise implements PromiseLike return this._promise.then(obj => obj.getValueAsync(options)); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + return this._promise.then(obj => obj.getTlsValue(enabledValue, disabledValue)); + } + } // ============================================================================ @@ -925,11 +1327,34 @@ export class EnvironmentCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; @@ -959,6 +1384,17 @@ export class ExecuteCommandContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the ResourceName property */ resourceName = { get: async (): Promise => { @@ -977,16 +1413,17 @@ export class ExecuteCommandContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, - set: async (value: AbortSignal): Promise => { + set: async (value: AbortSignal | CancellationToken): Promise => { await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', - { context: this._handle, value } + { context: this._handle, value: CancellationToken.fromValue(value) } ); } }; @@ -994,44 +1431,136 @@ export class ExecuteCommandContext { } // ============================================================================ -// PipelineConfigurationContext +// InitializeResourceEvent // ============================================================================ /** - * Type class for PipelineConfigurationContext. + * Type class for InitializeResourceEvent. */ -export class PipelineConfigurationContext { - constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} +export class InitializeResourceEvent { + constructor(private _handle: InitializeResourceEventHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the Steps property */ - steps = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.resource', { context: this._handle } ); + return new Resource(handle, this._client); }, - set: async (value: PipelineStep[]): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', - { context: this._handle, value } - ); - } }; - /** Gets pipeline steps with the specified tag */ - async getStepsByTag(tag: string): Promise { - const rpcArgs: Record = { context: this._handle, tag }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Pipelines/getStepsByTag', - rpcArgs - ); - } - -} + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Notifications property */ + notifications = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.notifications', + { context: this._handle } + ); + return new ResourceNotificationService(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + { context: this._handle } + ); + }, + set: async (value: PipelineStep[]): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', + { context: this._handle, value } + ); + } + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + + /** Gets pipeline steps with the specified tag */ + async getStepsByTag(tag: string): Promise { + const rpcArgs: Record = { context: this._handle, tag }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/getStepsByTag', + rpcArgs + ); + } + +} /** * Thenable wrapper for PipelineConfigurationContext that enables fluent chaining. @@ -1053,6 +1582,93 @@ export class PipelineConfigurationContextPromise implements PromiseLike => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + set: async (value: AbortSignal | CancellationToken): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.setCancellationToken', + { context: this._handle, value: CancellationToken.fromValue(value) } + ); + } + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + // ============================================================================ // PipelineStep // ============================================================================ @@ -1140,6 +1756,17 @@ export class PipelineStep { return this._tags; } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + /** Adds a dependency on another step by name */ /** @internal */ async _dependsOnInternal(stepName: string): Promise { @@ -1210,6 +1837,39 @@ export class PipelineStepContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the ReportingStep property */ + reportingStep = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.reportingStep', + { context: this._handle } + ); + return new ReportingStep(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + /** Gets the ExecutionContext property */ executionContext = { get: async (): Promise => { @@ -1221,18 +1881,159 @@ export class PipelineStepContext { }, }; + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineStepFactoryContext +// ============================================================================ + +/** + * Type class for PipelineStepFactoryContext. + */ +export class PipelineStepFactoryContext { + constructor(private _handle: PipelineStepFactoryContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; } +// ============================================================================ +// PipelineSummary +// ============================================================================ + +/** + * Type class for PipelineSummary. + */ +export class PipelineSummary { + constructor(private _handle: PipelineSummaryHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Add method */ + /** @internal */ + async _addInternal(key: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, key, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineSummary.add', + rpcArgs + ); + return this; + } + + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addInternal(key, value)); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + /** @internal */ + async _addMarkdownInternal(key: string, markdownString: string): Promise { + const rpcArgs: Record = { summary: this._handle, key, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/addMarkdown', + rpcArgs + ); + return this; + } + + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addMarkdownInternal(key, markdownString)); + } + +} + +/** + * Thenable wrapper for PipelineSummary that enables fluent chaining. + */ +export class PipelineSummaryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineSummary) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Add method */ + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.add(key, value))); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.addMarkdown(key, markdownString))); + } + +} + // ============================================================================ // ProjectResourceOptions // ============================================================================ @@ -1415,86 +2216,381 @@ export class ReferenceExpressionBuilderPromise implements PromiseLike; - get urls(): AspireList { - if (!this._urls) { - this._urls = new AspireList( - this._handle, - this._client, - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' - ); - } - return this._urls; - } - - /** Gets the CancellationToken property */ - cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.resource', { context: this._handle } ); + return new Resource(handle, this._client); }, }; - /** Gets the ExecutionContext property */ - executionContext = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.services', { context: this._handle } ); - return new DistributedApplicationExecutionContext(handle, this._client); + return new ServiceProvider(handle, this._client); }, }; } // ============================================================================ -// DistributedApplicationBuilder +// ResourceLoggerService // ============================================================================ /** - * Type class for DistributedApplicationBuilder. + * Type class for ResourceLoggerService. */ -export class DistributedApplicationBuilder { - constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} +export class ResourceLoggerService { + constructor(private _handle: ResourceLoggerServiceHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the AppHostDirectory property */ - appHostDirectory = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', - { context: this._handle } - ); - }, + /** Completes the log stream for a resource */ + /** @internal */ + async _completeLogInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { loggerService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLog', + rpcArgs + ); + return this; + } + + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogInternal(resource)); + } + + /** Completes the log stream by resource name */ + /** @internal */ + async _completeLogByNameInternal(resourceName: string): Promise { + const rpcArgs: Record = { loggerService: this._handle, resourceName }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLogByName', + rpcArgs + ); + return this; + } + + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogByNameInternal(resourceName)); + } + +} + +/** + * Thenable wrapper for ResourceLoggerService that enables fluent chaining. + */ +export class ResourceLoggerServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceLoggerService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Completes the log stream for a resource */ + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLog(resource))); + } + + /** Completes the log stream by resource name */ + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLogByName(resourceName))); + } + +} + +// ============================================================================ +// ResourceNotificationService +// ============================================================================ + +/** + * Type class for ResourceNotificationService. + */ +export class ResourceNotificationService { + constructor(private _handle: ResourceNotificationServiceHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Waits for a resource to reach a specified state */ + /** @internal */ + async _waitForResourceStateInternal(resourceName: string, targetState?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + if (targetState !== undefined) rpcArgs.targetState = targetState; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceState', + rpcArgs + ); + return this; + } + + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + const targetState = options?.targetState; + return new ResourceNotificationServicePromise(this._waitForResourceStateInternal(resourceName, targetState)); + } + + /** Waits for a resource to reach one of the specified states */ + async waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName, targetStates }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStates', + rpcArgs + ); + } + + /** Waits for a resource to become healthy */ + async waitForResourceHealthy(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceHealthy', + rpcArgs + ); + } + + /** Waits for all dependencies of a resource to be ready */ + /** @internal */ + async _waitForDependenciesInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForDependencies', + rpcArgs + ); + return this; + } + + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._waitForDependenciesInternal(resource)); + } + + /** Tries to get the current state of a resource */ + async tryGetResourceState(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/tryGetResourceState', + rpcArgs + ); + } + + /** Publishes an update for a resource's state */ + /** @internal */ + async _publishResourceUpdateInternal(resource: ResourceBuilderBase, state?: string, stateStyle?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + if (state !== undefined) rpcArgs.state = state; + if (stateStyle !== undefined) rpcArgs.stateStyle = stateStyle; + await this._client.invokeCapability( + 'Aspire.Hosting/publishResourceUpdate', + rpcArgs + ); + return this; + } + + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + const state = options?.state; + const stateStyle = options?.stateStyle; + return new ResourceNotificationServicePromise(this._publishResourceUpdateInternal(resource, state, stateStyle)); + } + +} + +/** + * Thenable wrapper for ResourceNotificationService that enables fluent chaining. + */ +export class ResourceNotificationServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceNotificationService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Waits for a resource to reach a specified state */ + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForResourceState(resourceName, options))); + } + + /** Waits for a resource to reach one of the specified states */ + waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + return this._promise.then(obj => obj.waitForResourceStates(resourceName, targetStates)); + } + + /** Waits for a resource to become healthy */ + waitForResourceHealthy(resourceName: string): Promise { + return this._promise.then(obj => obj.waitForResourceHealthy(resourceName)); + } + + /** Waits for all dependencies of a resource to be ready */ + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForDependencies(resource))); + } + + /** Tries to get the current state of a resource */ + tryGetResourceState(resourceName: string): Promise { + return this._promise.then(obj => obj.tryGetResourceState(resourceName)); + } + + /** Publishes an update for a resource's state */ + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.publishResourceUpdate(resource, options))); + } + +} + +// ============================================================================ +// ResourceReadyEvent +// ============================================================================ + +/** + * Type class for ResourceReadyEvent. + */ +export class ResourceReadyEvent { + constructor(private _handle: ResourceReadyEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, }; - /** Gets the Eventing property */ - eventing = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.services', { context: this._handle } ); - return new DistributedApplicationEventing(handle, this._client); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ResourceStoppedEvent +// ============================================================================ + +/** + * Type class for ResourceStoppedEvent. + */ +export class ResourceStoppedEvent { + constructor(private _handle: ResourceStoppedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ResourceUrlsCallbackContext +// ============================================================================ + +/** + * Type class for ResourceUrlsCallbackContext. + */ +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); }, }; @@ -1502,467 +2598,1634 @@ export class DistributedApplicationBuilder { executionContext = { get: async (): Promise => { const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', { context: this._handle } ); return new DistributedApplicationExecutionContext(handle, this._client); }, }; - /** Builds the distributed application */ - /** @internal */ - async _buildInternal(): Promise { - const rpcArgs: Record = { context: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/build', +} + +// ============================================================================ +// UpdateCommandStateContext +// ============================================================================ + +/** + * Type class for UpdateCommandStateContext. + */ +export class UpdateCommandStateContext { + constructor(private _handle: UpdateCommandStateContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/UpdateCommandStateContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// Configuration +// ============================================================================ + +/** + * Type class for Configuration. + */ +export class Configuration { + constructor(private _handle: IConfigurationHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets a configuration value by key */ + async getConfigValue(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConfigValue', rpcArgs ); - return new DistributedApplication(result, this._client); } - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._buildInternal()); + /** Gets a connection string by name */ + async getConnectionString(name: string): Promise { + const rpcArgs: Record = { configuration: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionString', + rpcArgs + ); } - /** Adds a connection string with a builder callback */ - /** @internal */ - async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { - const connectionStringBuilderId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; - const obj = new ReferenceExpressionBuilder(objHandle, this._client); - await connectionStringBuilder(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionStringBuilder', + /** Gets a configuration section by key */ + async getSection(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getSection', rpcArgs ); - return new ConnectionStringResource(result, this._client); } - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + /** Gets child configuration sections */ + async getChildren(): Promise { + const rpcArgs: Record = { configuration: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getChildren', + rpcArgs + ); } - /** Adds a container registry resource */ + /** Checks whether a configuration section exists */ + async exists(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/exists', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for Configuration that enables fluent chaining. + */ +export class ConfigurationPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Configuration) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets a configuration value by key */ + getConfigValue(key: string): Promise { + return this._promise.then(obj => obj.getConfigValue(key)); + } + + /** Gets a connection string by name */ + getConnectionString(name: string): Promise { + return this._promise.then(obj => obj.getConnectionString(name)); + } + + /** Gets a configuration section by key */ + getSection(key: string): Promise { + return this._promise.then(obj => obj.getSection(key)); + } + + /** Gets child configuration sections */ + getChildren(): Promise { + return this._promise.then(obj => obj.getChildren()); + } + + /** Checks whether a configuration section exists */ + exists(key: string): Promise { + return this._promise.then(obj => obj.exists(key)); + } + +} + +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Environment property */ + environment = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.environment', + { context: this._handle } + ); + return new HostEnvironment(handle, this._client); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the UserSecretsManager property */ + userSecretsManager = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.userSecretsManager', + { context: this._handle } + ); + return new UserSecretsManager(handle, this._client); + }, + }; + + /** Builds the distributed application */ + /** @internal */ + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', + rpcArgs + ); + return new DistributedApplication(result, this._client); + } + + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); + } + + /** Adds a connection string with a reference expression */ + /** @internal */ + async _addConnectionStringExpressionInternal(name: string, connectionStringExpression: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, connectionStringExpression }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionStringExpression', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringExpressionInternal(name, connectionStringExpression)); + } + + /** Adds a connection string with a builder callback */ + /** @internal */ + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionStringBuilder', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + } + + /** Adds a container registry resource */ + /** @internal */ + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + } + + /** Adds a container registry with string endpoint */ + /** @internal */ + async _addContainerRegistryFromStringInternal(name: string, endpoint: string, repository?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistryFromString', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryFromStringInternal(name, endpoint, repository)); + } + + /** Adds a container resource */ + /** @internal */ + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); + } + + /** Adds a container resource built from a Dockerfile */ + /** @internal */ + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); + } + + /** Adds a .NET tool resource */ + /** @internal */ + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + } + + /** Adds an executable resource */ + /** @internal */ + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + } + + /** Adds an external service resource */ + /** @internal */ + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); + } + + /** Adds an external service with a URI */ + /** @internal */ + async _addExternalServiceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceUri', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceUriInternal(name, uri)); + } + + /** Adds an external service with a parameter URL */ + /** @internal */ + async _addExternalServiceParameterInternal(name: string, urlParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, urlParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceParameter', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceParameterInternal(name, urlParameter)); + } + + /** Adds a parameter resource */ + /** @internal */ + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); + } + + /** Adds a parameter with a default value */ + /** @internal */ + async _addParameterWithValueInternal(name: string, value: string, publishValueAsDefault?: boolean, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + if (publishValueAsDefault !== undefined) rpcArgs.publishValueAsDefault = publishValueAsDefault; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterWithValue', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + const publishValueAsDefault = options?.publishValueAsDefault; + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterWithValueInternal(name, value, publishValueAsDefault, secret)); + } + + /** Adds a parameter sourced from configuration */ + /** @internal */ + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + } + + /** Adds a connection string resource */ + /** @internal */ + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + } + + /** Adds a .NET project resource */ + /** @internal */ + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + } + + /** Adds a project resource with configuration options */ + /** @internal */ + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + } + + /** Adds a C# application resource */ + /** @internal */ + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + } + + /** Adds a C# application resource with configuration options */ + /** @internal */ + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + } + + /** Gets the application configuration */ + /** @internal */ + async _getConfigurationInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getConfiguration', + rpcArgs + ); + return new Configuration(result, this._client); + } + + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._getConfigurationInternal()); + } + + /** Subscribes to the BeforeStart event */ + async subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeStartEventHandle; + const arg = new BeforeStartEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeBeforeStart', + rpcArgs + ); + } + + /** Subscribes to the AfterResourcesCreated event */ + async subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as AfterResourcesCreatedEventHandle; + const arg = new AfterResourcesCreatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeAfterResourcesCreated', + rpcArgs + ); + } + + /** Adds a Node.js application resource */ + /** @internal */ + async _addNodeAppInternal(name: string, appDirectory: string, scriptPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory, scriptPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addNodeApp', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._addNodeAppInternal(name, appDirectory, scriptPath)); + } + + /** Adds a JavaScript application resource */ + /** @internal */ + async _addJavaScriptAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addJavaScriptApp', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + const runScriptName = options?.runScriptName; + return new JavaScriptAppResourcePromise(this._addJavaScriptAppInternal(name, appDirectory, runScriptName)); + } + + /** Adds a Vite application resource */ + /** @internal */ + async _addViteAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addViteApp', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + const runScriptName = options?.runScriptName; + return new ViteAppResourcePromise(this._addViteAppInternal(name, appDirectory, runScriptName)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + */ +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); + } + + /** Adds a connection string with a reference expression */ + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringExpression(name, connectionStringExpression))); + } + + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + } + + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + } + + /** Adds a container registry with string endpoint */ + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistryFromString(name, endpoint, options))); + } + + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + } + + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + } + + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + } + + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); + } + + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + } + + /** Adds an external service with a URI */ + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceUri(name, uri))); + } + + /** Adds an external service with a parameter URL */ + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceParameter(name, urlParameter))); + } + + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); + } + + /** Adds a parameter with a default value */ + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterWithValue(name, value, options))); + } + + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + } + + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); + } + + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); + } + + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); + } + + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); + } + + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); + } + + /** Gets the application configuration */ + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._promise.then(obj => obj.getConfiguration())); + } + + /** Subscribes to the BeforeStart event */ + subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeBeforeStart(callback)); + } + + /** Subscribes to the AfterResourcesCreated event */ + subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeAfterResourcesCreated(callback)); + } + + /** Adds a Node.js application resource */ + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.addNodeApp(name, appDirectory, scriptPath))); + } + + /** Adds a JavaScript application resource */ + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.addJavaScriptApp(name, appDirectory, options))); + } + + /** Adds a Vite application resource */ + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.addViteApp(name, appDirectory, options))); + } + +} + +// ============================================================================ +// DistributedApplicationEventing +// ============================================================================ + +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Unsubscribe method */ + /** @internal */ + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + rpcArgs + ); + return this; + } + + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + } + +} + +// ============================================================================ +// HostEnvironment +// ============================================================================ + +/** + * Type class for HostEnvironment. + */ +export class HostEnvironment { + constructor(private _handle: IHostEnvironmentHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Checks if running in Development environment */ + async isDevelopment(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isDevelopment', + rpcArgs + ); + } + + /** Checks if running in Production environment */ + async isProduction(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isProduction', + rpcArgs + ); + } + + /** Checks if running in Staging environment */ + async isStaging(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isStaging', + rpcArgs + ); + } + + /** Checks if the environment matches the specified name */ + async isEnvironment(environmentName: string): Promise { + const rpcArgs: Record = { environment: this._handle, environmentName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isEnvironment', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for HostEnvironment that enables fluent chaining. + */ +export class HostEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: HostEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Checks if running in Development environment */ + isDevelopment(): Promise { + return this._promise.then(obj => obj.isDevelopment()); + } + + /** Checks if running in Production environment */ + isProduction(): Promise { + return this._promise.then(obj => obj.isProduction()); + } + + /** Checks if running in Staging environment */ + isStaging(): Promise { + return this._promise.then(obj => obj.isStaging()); + } + + /** Checks if the environment matches the specified name */ + isEnvironment(environmentName: string): Promise { + return this._promise.then(obj => obj.isEnvironment(environmentName)); + } + +} + +// ============================================================================ +// Logger +// ============================================================================ + +/** + * Type class for Logger. + */ +export class Logger { + constructor(private _handle: ILoggerHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Logs an information message */ + /** @internal */ + async _logInformationInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logInformation', + rpcArgs + ); + return this; + } + + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._logInformationInternal(message)); + } + + /** Logs a warning message */ + /** @internal */ + async _logWarningInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logWarning', + rpcArgs + ); + return this; + } + + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._logWarningInternal(message)); + } + + /** Logs an error message */ + /** @internal */ + async _logErrorInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logError', + rpcArgs + ); + return this; + } + + logError(message: string): LoggerPromise { + return new LoggerPromise(this._logErrorInternal(message)); + } + + /** Logs a debug message */ + /** @internal */ + async _logDebugInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logDebug', + rpcArgs + ); + return this; + } + + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._logDebugInternal(message)); + } + + /** Logs a message with specified level */ + /** @internal */ + async _logInternal(level: string, message: string): Promise { + const rpcArgs: Record = { logger: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/log', + rpcArgs + ); + return this; + } + + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._logInternal(level, message)); + } + +} + +/** + * Thenable wrapper for Logger that enables fluent chaining. + */ +export class LoggerPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Logger) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Logs an information message */ + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logInformation(message))); + } + + /** Logs a warning message */ + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logWarning(message))); + } + + /** Logs an error message */ + logError(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logError(message))); + } + + /** Logs a debug message */ + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logDebug(message))); + } + + /** Logs a message with specified level */ + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.log(level, message))); + } + +} + +// ============================================================================ +// LoggerFactory +// ============================================================================ + +/** + * Type class for LoggerFactory. + */ +export class LoggerFactory { + constructor(private _handle: ILoggerFactoryHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Creates a logger for a category */ + /** @internal */ + async _createLoggerInternal(categoryName: string): Promise { + const rpcArgs: Record = { loggerFactory: this._handle, categoryName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createLogger', + rpcArgs + ); + return new Logger(result, this._client); + } + + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._createLoggerInternal(categoryName)); + } + +} + +/** + * Thenable wrapper for LoggerFactory that enables fluent chaining. + */ +export class LoggerFactoryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: LoggerFactory) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Creates a logger for a category */ + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.createLogger(categoryName))); + } + +} + +// ============================================================================ +// ReportingStep +// ============================================================================ + +/** + * Type class for ReportingStep. + */ +export class ReportingStep { + constructor(private _handle: IReportingStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Creates a reporting task with plain-text status text */ /** @internal */ - async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpoint }; - if (repository !== undefined) rpcArgs.repository = repository; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainerRegistry', + async _createTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createTask', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ReportingTask(result, this._client); } - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - const repository = options?.repository; - return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createTaskInternal(statusText, cancellationToken)); } - /** Adds a container resource */ + /** Creates a reporting task with Markdown-formatted status text */ /** @internal */ - async _addContainerInternal(name: string, image: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, image }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainer', + async _createMarkdownTaskInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createMarkdownTask', rpcArgs ); - return new ContainerResource(result, this._client); + return new ReportingTask(result, this._client); } - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._addContainerInternal(name, image)); + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createMarkdownTaskInternal(markdownString, cancellationToken)); } - /** Adds a container resource built from a Dockerfile */ + /** Logs a plain-text message for the reporting step */ /** @internal */ - async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDockerfile', + async _logStepInternal(level: string, message: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStep', rpcArgs ); - return new ContainerResource(result, this._client); + return this; } - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepInternal(level, message)); } - /** Adds a .NET tool resource */ + /** Logs a Markdown-formatted message for the reporting step */ /** @internal */ - async _addDotnetToolInternal(name: string, packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDotnetTool', + async _logStepMarkdownInternal(level: string, markdownString: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStepMarkdown', rpcArgs ); - return new DotnetToolResource(result, this._client); + return this; } - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepMarkdownInternal(level, markdownString)); } - /** Adds an executable resource */ + /** Completes the reporting step with plain-text completion text */ /** @internal */ - async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExecutable', + async _completeStepInternal(completionText: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, completionText }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStep', rpcArgs ); - return new ExecutableResource(result, this._client); + return this; } - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepInternal(completionText, completionState, cancellationToken)); } - /** Adds an external service resource */ + /** Completes the reporting step with Markdown-formatted completion text */ /** @internal */ - async _addExternalServiceInternal(name: string, url: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, url }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExternalService', + async _completeStepMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStepMarkdown', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return this; } - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepMarkdownInternal(markdownString, completionState, cancellationToken)); } - /** Adds a parameter resource */ - /** @internal */ - async _addParameterInternal(name: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameter', - rpcArgs - ); - return new ParameterResource(result, this._client); - } +} - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterInternal(name, secret)); +/** + * Thenable wrapper for ReportingStep that enables fluent chaining. + */ +export class ReportingStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReportingStep) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a parameter sourced from configuration */ - /** @internal */ - async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name, configurationKey }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameterFromConfiguration', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Creates a reporting task with plain-text status text */ + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createTask(statusText, options))); } - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + /** Creates a reporting task with Markdown-formatted status text */ + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createMarkdownTask(markdownString, options))); } - /** Adds a connection string resource */ - /** @internal */ - async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionString', - rpcArgs - ); - return new ResourceWithConnectionString(result, this._client); + /** Logs a plain-text message for the reporting step */ + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStep(level, message))); } - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - const environmentVariableName = options?.environmentVariableName; - return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + /** Logs a Markdown-formatted message for the reporting step */ + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStepMarkdown(level, markdownString))); } - /** Adds a .NET project resource */ - /** @internal */ - async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProject', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Completes the reporting step with plain-text completion text */ + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStep(completionText, options))); } - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + /** Completes the reporting step with Markdown-formatted completion text */ + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStepMarkdown(markdownString, options))); } - /** Adds a project resource with configuration options */ +} + +// ============================================================================ +// ReportingTask +// ============================================================================ + +/** + * Type class for ReportingTask. + */ +export class ReportingTask { + constructor(private _handle: IReportingTaskHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Updates the reporting task with plain-text status text */ /** @internal */ - async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProjectWithOptions', + async _updateTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTask', rpcArgs ); - return new ProjectResource(result, this._client); + return this; } - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskInternal(statusText, cancellationToken)); } - /** Adds a C# application resource */ + /** Updates the reporting task with Markdown-formatted status text */ /** @internal */ - async _addCSharpAppInternal(name: string, path: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, path }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpApp', + async _updateTaskMarkdownInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTaskMarkdown', rpcArgs ); - return new ProjectResource(result, this._client); + return this; } - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskMarkdownInternal(markdownString, cancellationToken)); } - /** Adds a C# application resource with configuration options */ + /** Completes the reporting task with plain-text completion text */ /** @internal */ - async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpAppWithOptions', + async _completeTaskInternal(completionMessage?: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle }; + if (completionMessage !== undefined) rpcArgs.completionMessage = completionMessage; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTask', rpcArgs ); - return new CSharpAppResource(result, this._client); + return this; } - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + const completionMessage = options?.completionMessage; + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskInternal(completionMessage, completionState, cancellationToken)); } - /** Adds a Node.js application resource */ + /** Completes the reporting task with Markdown-formatted completion text */ /** @internal */ - async _addNodeAppInternal(name: string, appDirectory: string, scriptPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, appDirectory, scriptPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.JavaScript/addNodeApp', + async _completeTaskMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTaskMarkdown', rpcArgs ); - return new NodeAppResource(result, this._client); + return this; } - addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._addNodeAppInternal(name, appDirectory, scriptPath)); + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskMarkdownInternal(markdownString, completionState, cancellationToken)); } - /** Adds a JavaScript application resource */ - /** @internal */ - async _addJavaScriptAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, appDirectory }; - if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.JavaScript/addJavaScriptApp', - rpcArgs - ); - return new JavaScriptAppResource(result, this._client); +} + +/** + * Thenable wrapper for ReportingTask that enables fluent chaining. + */ +export class ReportingTaskPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReportingTask) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { - const runScriptName = options?.runScriptName; - return new JavaScriptAppResourcePromise(this._addJavaScriptAppInternal(name, appDirectory, runScriptName)); + /** Updates the reporting task with plain-text status text */ + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTask(statusText, options))); } - /** Adds a Vite application resource */ - /** @internal */ - async _addViteAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, appDirectory }; - if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.JavaScript/addViteApp', - rpcArgs - ); - return new ViteAppResource(result, this._client); + /** Updates the reporting task with Markdown-formatted status text */ + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTaskMarkdown(markdownString, options))); } - addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { - const runScriptName = options?.runScriptName; - return new ViteAppResourcePromise(this._addViteAppInternal(name, appDirectory, runScriptName)); + /** Completes the reporting task with plain-text completion text */ + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTask(options))); + } + + /** Completes the reporting task with Markdown-formatted completion text */ + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTaskMarkdown(markdownString, options))); } } +// ============================================================================ +// ServiceProvider +// ============================================================================ + /** - * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + * Type class for ServiceProvider. */ -export class DistributedApplicationBuilderPromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ServiceProvider { + constructor(private _handle: IServiceProviderHandle, private _client: AspireClientRpc) {} - then( - onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the distributed application eventing service from the service provider */ + /** @internal */ + async _getEventingInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getEventing', + rpcArgs + ); + return new DistributedApplicationEventing(result, this._client); } - /** Builds the distributed application */ - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._getEventingInternal()); } - /** Adds a connection string with a builder callback */ - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + /** Gets the logger factory from the service provider */ + /** @internal */ + async _getLoggerFactoryInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getLoggerFactory', + rpcArgs + ); + return new LoggerFactory(result, this._client); } - /** Adds a container registry resource */ - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._getLoggerFactoryInternal()); + } + + /** Gets the resource logger service from the service provider */ + /** @internal */ + async _getResourceLoggerServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceLoggerService', + rpcArgs + ); + return new ResourceLoggerService(result, this._client); } - /** Adds a container resource */ - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._getResourceLoggerServiceInternal()); } - /** Adds a container resource built from a Dockerfile */ - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + /** Gets the distributed application model from the service provider */ + /** @internal */ + async _getDistributedApplicationModelInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getDistributedApplicationModel', + rpcArgs + ); + return new DistributedApplicationModel(result, this._client); } - /** Adds a .NET tool resource */ - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._getDistributedApplicationModelInternal()); } - /** Adds an executable resource */ - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); + /** Gets the resource notification service from the service provider */ + /** @internal */ + async _getResourceNotificationServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceNotificationService', + rpcArgs + ); + return new ResourceNotificationService(result, this._client); } - /** Adds an external service resource */ - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._getResourceNotificationServiceInternal()); } - /** Adds a parameter resource */ - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); + /** Gets the user secrets manager from the service provider */ + /** @internal */ + async _getUserSecretsManagerInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getUserSecretsManager', + rpcArgs + ); + return new UserSecretsManager(result, this._client); } - /** Adds a parameter sourced from configuration */ - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getUserSecretsManagerInternal()); } - /** Adds a connection string resource */ - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); - } +} - /** Adds a .NET project resource */ - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); +/** + * Thenable wrapper for ServiceProvider that enables fluent chaining. + */ +export class ServiceProviderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ServiceProvider) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a project resource with configuration options */ - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); + /** Gets the distributed application eventing service from the service provider */ + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.getEventing())); } - /** Adds a C# application resource */ - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); + /** Gets the logger factory from the service provider */ + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._promise.then(obj => obj.getLoggerFactory())); } - /** Adds a C# application resource with configuration options */ - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); + /** Gets the resource logger service from the service provider */ + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.getResourceLoggerService())); } - /** Adds a Node.js application resource */ - addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._promise.then(obj => obj.addNodeApp(name, appDirectory, scriptPath))); + /** Gets the distributed application model from the service provider */ + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._promise.then(obj => obj.getDistributedApplicationModel())); } - /** Adds a JavaScript application resource */ - addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.addJavaScriptApp(name, appDirectory, options))); + /** Gets the resource notification service from the service provider */ + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.getResourceNotificationService())); } - /** Adds a Vite application resource */ - addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.addViteApp(name, appDirectory, options))); + /** Gets the user secrets manager from the service provider */ + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getUserSecretsManager())); } } // ============================================================================ -// DistributedApplicationEventing +// UserSecretsManager // ============================================================================ /** - * Type class for DistributedApplicationEventing. + * Type class for UserSecretsManager. */ -export class DistributedApplicationEventing { - constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} +export class UserSecretsManager { + constructor(private _handle: IUserSecretsManagerHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Invokes the Unsubscribe method */ + /** Gets the IsAvailable property */ + isAvailable = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.isAvailable', + { context: this._handle } + ); + }, + }; + + /** Gets the FilePath property */ + filePath = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.filePath', + { context: this._handle } + ); + }, + }; + + /** Attempts to set a user secret value */ + async trySetSecret(name: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, name, value }; + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.trySetSecret', + rpcArgs + ); + } + + /** Saves state to user secrets from a JSON string */ /** @internal */ - async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { - const rpcArgs: Record = { context: this._handle, subscription }; + async _saveStateJsonInternal(json: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, json }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); await this._client.invokeCapability( - 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + 'Aspire.Hosting/saveStateJson', rpcArgs ); return this; } - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + const cancellationToken = options?.cancellationToken; + return new UserSecretsManagerPromise(this._saveStateJsonInternal(json, cancellationToken)); + } + + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ + /** @internal */ + async _getOrSetSecretInternal(resourceBuilder: ResourceBuilderBase, name: string, value: string): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, resourceBuilder, name, value }; + await this._client.invokeCapability( + 'Aspire.Hosting/getOrSetSecret', + rpcArgs + ); + return this; + } + + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getOrSetSecretInternal(resourceBuilder, name, value)); } } /** - * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + * Thenable wrapper for UserSecretsManager that enables fluent chaining. */ -export class DistributedApplicationEventingPromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class UserSecretsManagerPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: UserSecretsManager) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Invokes the Unsubscribe method */ - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + /** Attempts to set a user secret value */ + trySetSecret(name: string, value: string): Promise { + return this._promise.then(obj => obj.trySetSecret(name, value)); + } + + /** Saves state to user secrets from a JSON string */ + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.saveStateJson(json, options))); + } + + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getOrSetSecret(resourceBuilder, name, value))); } } @@ -2057,6 +4320,15 @@ export class ConnectionStringResource extends ResourceBuilderBase { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + /** @internal */ private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { @@ -2169,7 +4441,7 @@ export class ConnectionStringResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ConnectionStringResource(result, this._client); @@ -2199,7 +4471,7 @@ export class ConnectionStringResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ConnectionStringResource(result, this._client); @@ -2245,7 +4517,7 @@ export class ConnectionStringResource extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ConnectionStringResource(result, this._client); @@ -2298,7 +4570,7 @@ export class ConnectionStringResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new ConnectionStringResource(result, this._client); @@ -2313,7 +4585,7 @@ export class ConnectionStringResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new ConnectionStringResource(result, this._client); @@ -2356,36 +4628,6 @@ export class ConnectionStringResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -2463,6 +4705,106 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onConnectionStringAvailableInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -2505,6 +4847,11 @@ export class ConnectionStringResourcePromise implements PromiseLike obj.withConnectionPropertyValue(name, value))); } + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + /** Customizes displayed URLs via callback */ withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); @@ -2595,16 +4942,6 @@ export class ConnectionStringResourcePromise implements PromiseLike obj.excludeFromMcp())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); @@ -2625,6 +4962,31 @@ export class ConnectionStringResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -2851,7 +5213,7 @@ export class ContainerRegistryResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new ContainerRegistryResource(result, this._client); @@ -2866,7 +5228,7 @@ export class ContainerRegistryResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new ContainerRegistryResource(result, this._client); @@ -2889,54 +5251,24 @@ export class ContainerRegistryResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); - } - - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); return new ContainerRegistryResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ @@ -3016,6 +5348,86 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -3113,16 +5525,6 @@ export class ContainerRegistryResourcePromise implements PromiseLike obj.excludeFromMcp())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); @@ -3143,6 +5545,26 @@ export class ContainerRegistryResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -3361,7 +5783,7 @@ export class ContainerResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); return new ContainerResource(result, this._client); @@ -3376,7 +5798,7 @@ export class ContainerResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); return new ContainerResource(result, this._client); @@ -3518,41 +5940,11 @@ export class ContainerResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -3563,43 +5955,38 @@ export class ContainerResource extends ResourceBuilderBase Promise): ContainerResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -3688,10 +6075,11 @@ export class ContainerResource extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -3703,37 +6091,8 @@ export class ContainerResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -4033,7 +6392,7 @@ export class ContainerResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ContainerResource(result, this._client); @@ -4063,7 +6422,7 @@ export class ContainerResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ContainerResource(result, this._client); @@ -4109,7 +6468,7 @@ export class ContainerResource extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ContainerResource(result, this._client); @@ -4214,7 +6573,7 @@ export class ContainerResource extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ContainerResource(result, this._client); @@ -4245,7 +6604,7 @@ export class ContainerResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new ContainerResource(result, this._client); @@ -4260,7 +6619,7 @@ export class ContainerResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new ContainerResource(result, this._client); @@ -4363,99 +6722,199 @@ export class ContainerResource extends ResourceBuilderBase Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + 'Aspire.Hosting/onResourceStopped', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + 'Aspire.Hosting/onInitializeResource', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', + 'Aspire.Hosting/onResourceReady', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); - } - - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceReadyInternal(callback)); } } @@ -4590,31 +7049,21 @@ export class ContainerResourcePromise implements PromiseLike return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -4645,16 +7094,6 @@ export class ContainerResourcePromise implements PromiseLike return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -4860,6 +7299,31 @@ export class ContainerResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -4985,58 +7449,50 @@ export class CSharpAppResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new CSharpAppResource(result, this._client); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - const helpLink = options?.helpLink; - return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } - - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configure !== undefined) rpcArgs.configure = configureId; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + const configure = options?.configure; + return new CSharpAppResourcePromise(this._publishAsDockerFileInternal(configure)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -5047,43 +7503,38 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): CSharpAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -5172,10 +7623,11 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -5187,37 +7639,8 @@ export class CSharpAppResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new CSharpAppResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new CSharpAppResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -5502,7 +7925,7 @@ export class CSharpAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); return new CSharpAppResource(result, this._client); @@ -5532,7 +7955,7 @@ export class CSharpAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new CSharpAppResource(result, this._client); @@ -5562,7 +7985,7 @@ export class CSharpAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new CSharpAppResource(result, this._client); @@ -5608,7 +8031,7 @@ export class CSharpAppResource extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new CSharpAppResource(result, this._client); @@ -5713,7 +8136,7 @@ export class CSharpAppResource extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new CSharpAppResource(result, this._client); @@ -5744,7 +8167,7 @@ export class CSharpAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new CSharpAppResource(result, this._client); @@ -5759,7 +8182,7 @@ export class CSharpAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new CSharpAppResource(result, this._client); @@ -5938,6 +8361,106 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -5990,36 +8513,31 @@ export class CSharpAppResourcePromise implements PromiseLike return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); } + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); + } + /** Adds a required command dependency */ withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -6050,16 +8568,6 @@ export class CSharpAppResourcePromise implements PromiseLike return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -6260,9 +8768,34 @@ export class CSharpAppResourcePromise implements PromiseLike return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } } @@ -6532,41 +9065,11 @@ export class DotnetToolResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -6577,43 +9080,38 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -6702,10 +9200,11 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -6717,37 +9216,8 @@ export class DotnetToolResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -7047,7 +9517,7 @@ export class DotnetToolResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new DotnetToolResource(result, this._client); @@ -7077,7 +9547,7 @@ export class DotnetToolResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new DotnetToolResource(result, this._client); @@ -7123,7 +9593,7 @@ export class DotnetToolResource extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new DotnetToolResource(result, this._client); @@ -7228,7 +9698,7 @@ export class DotnetToolResource extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new DotnetToolResource(result, this._client); @@ -7259,7 +9729,7 @@ export class DotnetToolResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new DotnetToolResource(result, this._client); @@ -7274,7 +9744,7 @@ export class DotnetToolResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new DotnetToolResource(result, this._client); @@ -7453,6 +9923,106 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -7550,31 +10120,21 @@ export class DotnetToolResourcePromise implements PromiseLike obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -7605,16 +10165,6 @@ export class DotnetToolResourcePromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -7815,6 +10365,31 @@ export class DotnetToolResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -7860,6 +10435,71 @@ export class ExecutableResource extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + /** @internal */ private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; @@ -7923,61 +10563,11 @@ export class ExecutableResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); @@ -7985,15 +10575,15 @@ export class ExecutableResource extends ResourceBuilderBase = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -8011,6 +10601,21 @@ export class ExecutableResource extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + } + /** @internal */ private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; @@ -8097,10 +10702,11 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -8112,37 +10718,8 @@ export class ExecutableResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -8442,7 +11019,7 @@ export class ExecutableResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ExecutableResource(result, this._client); @@ -8472,7 +11049,7 @@ export class ExecutableResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ExecutableResource(result, this._client); @@ -8518,7 +11095,7 @@ export class ExecutableResource extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ExecutableResource(result, this._client); @@ -8623,7 +11200,7 @@ export class ExecutableResource extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ExecutableResource(result, this._client); @@ -8654,7 +11231,7 @@ export class ExecutableResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new ExecutableResource(result, this._client); @@ -8669,7 +11246,7 @@ export class ExecutableResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new ExecutableResource(result, this._client); @@ -8848,6 +11425,106 @@ export class ExecutableResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -8875,6 +11552,26 @@ export class ExecutableResourcePromise implements PromiseLike obj.withDockerfileBaseImage(options))); } + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + /** Configures an MCP server endpoint on the resource */ withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); @@ -8895,31 +11592,21 @@ export class ExecutableResourcePromise implements PromiseLike obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -8950,16 +11637,6 @@ export class ExecutableResourcePromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ExecutableResourcePromise { return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -9160,6 +11837,31 @@ export class ExecutableResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -9405,7 +12107,7 @@ export class ExternalServiceResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new ExternalServiceResource(result, this._client); @@ -9420,7 +12122,7 @@ export class ExternalServiceResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new ExternalServiceResource(result, this._client); @@ -9463,36 +12165,6 @@ export class ExternalServiceResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -9570,6 +12242,86 @@ export class ExternalServiceResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -9672,16 +12424,6 @@ export class ExternalServiceResourcePromise implements PromiseLike obj.excludeFromMcp())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); @@ -9702,6 +12444,26 @@ export class ExternalServiceResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -9713,6 +12475,36 @@ export class JavaScriptAppResource extends ResourceBuilderBase => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; @@ -9879,41 +12671,11 @@ export class JavaScriptAppResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new JavaScriptAppResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new JavaScriptAppResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -9924,43 +12686,38 @@ export class JavaScriptAppResource extends ResourceBuilderBase Promise): JavaScriptAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { return new JavaScriptAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new JavaScriptAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new JavaScriptAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -10049,10 +12806,11 @@ export class JavaScriptAppResource extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -10064,37 +12822,8 @@ export class JavaScriptAppResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new JavaScriptAppResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new JavaScriptAppResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new JavaScriptAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -10424,7 +13153,7 @@ export class JavaScriptAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new JavaScriptAppResource(result, this._client); @@ -10454,7 +13183,7 @@ export class JavaScriptAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new JavaScriptAppResource(result, this._client); @@ -10500,7 +13229,7 @@ export class JavaScriptAppResource extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new JavaScriptAppResource(result, this._client); @@ -10605,7 +13334,7 @@ export class JavaScriptAppResource extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new JavaScriptAppResource(result, this._client); @@ -10636,7 +13365,7 @@ export class JavaScriptAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new JavaScriptAppResource(result, this._client); @@ -10651,7 +13380,7 @@ export class JavaScriptAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new JavaScriptAppResource(result, this._client); @@ -10772,62 +13501,291 @@ export class JavaScriptAppResource extends ResourceBuilderBase Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new JavaScriptAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new JavaScriptAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withYarnInternal(install, installArgs)); + } + + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withPnpmInternal(install, installArgs)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + 'Aspire.Hosting.JavaScript/withBuildScript', rpcArgs ); return new JavaScriptAppResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + 'Aspire.Hosting.JavaScript/withRunScript', rpcArgs ); return new JavaScriptAppResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', rpcArgs ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + const browser = options?.browser; + return new JavaScriptAppResourcePromise(this._withBrowserDebuggerInternal(browser)); } } @@ -10897,31 +13855,21 @@ export class JavaScriptAppResourcePromise implements PromiseLike obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -10952,16 +13900,6 @@ export class JavaScriptAppResourcePromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -11172,6 +14110,66 @@ export class JavaScriptAppResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + } // ============================================================================ @@ -11379,41 +14377,11 @@ export class NodeAppResource extends ResourceBuilderBase } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new NodeAppResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new NodeAppResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -11424,43 +14392,38 @@ export class NodeAppResource extends ResourceBuilderBase } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { return new NodeAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new NodeAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new NodeAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -11549,10 +14512,11 @@ export class NodeAppResource extends ResourceBuilderBase } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -11564,37 +14528,8 @@ export class NodeAppResource extends ResourceBuilderBase withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new NodeAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new NodeAppResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new NodeAppResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new NodeAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -11879,7 +14814,7 @@ export class NodeAppResource extends ResourceBuilderBase private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); return new NodeAppResource(result, this._client); @@ -11939,7 +14874,7 @@ export class NodeAppResource extends ResourceBuilderBase private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new NodeAppResource(result, this._client); @@ -11969,7 +14904,7 @@ export class NodeAppResource extends ResourceBuilderBase private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new NodeAppResource(result, this._client); @@ -12015,7 +14950,7 @@ export class NodeAppResource extends ResourceBuilderBase const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new NodeAppResource(result, this._client); @@ -12120,7 +15055,7 @@ export class NodeAppResource extends ResourceBuilderBase const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new NodeAppResource(result, this._client); @@ -12151,7 +15086,7 @@ export class NodeAppResource extends ResourceBuilderBase private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new NodeAppResource(result, this._client); @@ -12166,7 +15101,7 @@ export class NodeAppResource extends ResourceBuilderBase private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new NodeAppResource(result, this._client); @@ -12345,6 +15280,106 @@ export class NodeAppResource extends ResourceBuilderBase ); } + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceReadyInternal(callback)); + } + /** @internal */ private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { const rpcArgs: Record = { resource: this._handle }; @@ -12453,38 +15488,8 @@ export class NodeAppResource extends ResourceBuilderBase /** Specifies an npm script to run during development */ withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { - const args = options?.args; - return new NodeAppResourcePromise(this._withRunScriptInternal(scriptName, args)); - } - - /** @internal */ - private async _withScriptDebuggingInternal(scriptPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, scriptPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.JavaScript/withScriptDebugging', - rpcArgs - ); - return new NodeAppResource(result, this._client); - } - - /** Enables debugging support for a Node.js application with an explicit script path */ - withScriptDebugging(scriptPath: string): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withScriptDebuggingInternal(scriptPath)); - } - - /** @internal */ - private async _withDebuggingInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.JavaScript/withDebugging', - rpcArgs - ); - return new NodeAppResource(result, this._client); - } - - /** Enables debugging support for a JavaScript application */ - withDebugging(): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withDebuggingInternal()); + const args = options?.args; + return new NodeAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } /** @internal */ @@ -12498,7 +15503,7 @@ export class NodeAppResource extends ResourceBuilderBase return new NodeAppResource(result, this._client); } - /** Configures browser debugging support */ + /** Configures a browser debugger for the JavaScript application */ withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { const browser = options?.browser; return new NodeAppResourcePromise(this._withBrowserDebuggerInternal(browser)); @@ -12571,31 +15576,21 @@ export class NodeAppResourcePromise implements PromiseLike { return new NodeAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -12626,16 +15621,6 @@ export class NodeAppResourcePromise implements PromiseLike { return new NodeAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): NodeAppResourcePromise { return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -12851,6 +15836,31 @@ export class NodeAppResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + /** Configures npm as the package manager */ withNpm(options?: WithNpmOptions): NodeAppResourcePromise { return new NodeAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); @@ -12881,17 +15891,7 @@ export class NodeAppResourcePromise implements PromiseLike { return new NodeAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); } - /** Enables debugging support for a Node.js application with an explicit script path */ - withScriptDebugging(scriptPath: string): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._promise.then(obj => obj.withScriptDebugging(scriptPath))); - } - - /** Enables debugging support for a JavaScript application */ - withDebugging(): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._promise.then(obj => obj.withDebugging())); - } - - /** Configures browser debugging support */ + /** Configures a browser debugger for the JavaScript application */ withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { return new NodeAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); } @@ -13139,7 +16139,7 @@ export class ParameterResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new ParameterResource(result, this._client); @@ -13154,7 +16154,7 @@ export class ParameterResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new ParameterResource(result, this._client); @@ -13197,36 +16197,6 @@ export class ParameterResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ParameterResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ParameterResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -13304,6 +16274,86 @@ export class ParameterResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -13406,16 +16456,6 @@ export class ParameterResourcePromise implements PromiseLike return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); @@ -13436,6 +16476,26 @@ export class ParameterResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -13531,74 +16591,76 @@ export class ProjectResource extends ResourceBuilderBase } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + 'Aspire.Hosting/withReplicas', rpcArgs ); return new ProjectResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - const helpLink = options?.helpLink; - return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReplicasInternal(replicas)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + 'Aspire.Hosting/disableForwardedHeaders', rpcArgs ); return new ProjectResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._disableForwardedHeadersInternal()); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configure !== undefined) rpcArgs.configure = configureId; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', rpcArgs ); return new ProjectResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + const configure = options?.configure; + return new ProjectResourcePromise(this._publishAsDockerFileInternal(configure)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); return new ProjectResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); @@ -13606,15 +16668,15 @@ export class ProjectResource extends ResourceBuilderBase }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); return new ProjectResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -13632,6 +16694,21 @@ export class ProjectResource extends ResourceBuilderBase return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + /** @internal */ private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; @@ -13718,10 +16795,11 @@ export class ProjectResource extends ResourceBuilderBase } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -13733,37 +16811,8 @@ export class ProjectResource extends ResourceBuilderBase withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -14048,7 +17097,7 @@ export class ProjectResource extends ResourceBuilderBase private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); return new ProjectResource(result, this._client); @@ -14078,7 +17127,7 @@ export class ProjectResource extends ResourceBuilderBase private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ProjectResource(result, this._client); @@ -14108,7 +17157,7 @@ export class ProjectResource extends ResourceBuilderBase private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ProjectResource(result, this._client); @@ -14154,7 +17203,7 @@ export class ProjectResource extends ResourceBuilderBase const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ProjectResource(result, this._client); @@ -14259,7 +17308,7 @@ export class ProjectResource extends ResourceBuilderBase const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ProjectResource(result, this._client); @@ -14290,7 +17339,7 @@ export class ProjectResource extends ResourceBuilderBase private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new ProjectResource(result, this._client); @@ -14305,7 +17354,7 @@ export class ProjectResource extends ResourceBuilderBase private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new ProjectResource(result, this._client); @@ -14464,24 +17513,124 @@ export class ProjectResource extends ResourceBuilderBase }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); return new ProjectResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceReadyInternal(callback)); } } @@ -14526,29 +17675,29 @@ export class ProjectResourcePromise implements PromiseLike { return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ @@ -14556,6 +17705,11 @@ export class ProjectResourcePromise implements PromiseLike { return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -14586,16 +17740,6 @@ export class ProjectResourcePromise implements PromiseLike { return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ProjectResourcePromise { return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -14801,6 +17945,31 @@ export class ProjectResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -15008,41 +18177,11 @@ export class ViteAppResource extends ResourceBuilderBase } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ViteAppResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ViteAppResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -15053,43 +18192,38 @@ export class ViteAppResource extends ResourceBuilderBase } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { return new ViteAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new ViteAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ViteAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -15178,10 +18312,11 @@ export class ViteAppResource extends ResourceBuilderBase } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -15193,37 +18328,8 @@ export class ViteAppResource extends ResourceBuilderBase withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new ViteAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ViteAppResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ViteAppResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ViteAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -15553,7 +18659,7 @@ export class ViteAppResource extends ResourceBuilderBase private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ViteAppResource(result, this._client); @@ -15583,7 +18689,7 @@ export class ViteAppResource extends ResourceBuilderBase private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ViteAppResource(result, this._client); @@ -15629,7 +18735,7 @@ export class ViteAppResource extends ResourceBuilderBase const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ViteAppResource(result, this._client); @@ -15734,7 +18840,7 @@ export class ViteAppResource extends ResourceBuilderBase const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ViteAppResource(result, this._client); @@ -15765,7 +18871,7 @@ export class ViteAppResource extends ResourceBuilderBase private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new ViteAppResource(result, this._client); @@ -15780,7 +18886,7 @@ export class ViteAppResource extends ResourceBuilderBase private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new ViteAppResource(result, this._client); @@ -15959,6 +19065,106 @@ export class ViteAppResource extends ResourceBuilderBase ); } + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceReadyInternal(callback)); + } + /** @internal */ private async _withViteConfigInternal(configPath: string): Promise { const rpcArgs: Record = { builder: this._handle, configPath }; @@ -16086,21 +19292,6 @@ export class ViteAppResource extends ResourceBuilderBase return new ViteAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } - /** @internal */ - private async _withDebuggingInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.JavaScript/withDebugging', - rpcArgs - ); - return new ViteAppResource(result, this._client); - } - - /** Enables debugging support for a JavaScript application */ - withDebugging(): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._withDebuggingInternal()); - } - /** @internal */ private async _withBrowserDebuggerInternal(browser?: string): Promise { const rpcArgs: Record = { builder: this._handle }; @@ -16112,7 +19303,7 @@ export class ViteAppResource extends ResourceBuilderBase return new ViteAppResource(result, this._client); } - /** Configures browser debugging support */ + /** Configures a browser debugger for the JavaScript application */ withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { const browser = options?.browser; return new ViteAppResourcePromise(this._withBrowserDebuggerInternal(browser)); @@ -16185,31 +19376,21 @@ export class ViteAppResourcePromise implements PromiseLike { return new ViteAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -16240,16 +19421,6 @@ export class ViteAppResourcePromise implements PromiseLike { return new ViteAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ViteAppResourcePromise { return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -16460,6 +19631,31 @@ export class ViteAppResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + /** Configures a custom Vite configuration file */ withViteConfig(configPath: string): ViteAppResourcePromise { return new ViteAppResourcePromise(this._promise.then(obj => obj.withViteConfig(configPath))); @@ -16485,24 +19681,87 @@ export class ViteAppResourcePromise implements PromiseLike { return new ViteAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); } - /** Specifies an npm script to run before starting the application */ - withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + +} + +// ============================================================================ +// ComputeResource +// ============================================================================ + +export class ComputeResource extends ResourceBuilderBase { + constructor(handle: IComputeResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Specifies an npm script to run during development */ - withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); +} + +/** + * Thenable wrapper for ComputeResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ComputeResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ComputeResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Enables debugging support for a JavaScript application */ - withDebugging(): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withDebugging())); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Configures browser debugging support */ - withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } } @@ -16520,7 +19779,7 @@ export class ContainerFilesDestinationResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); return new ContainerFilesDestinationResource(result, this._client); @@ -16779,7 +20038,7 @@ export class Resource extends ResourceBuilderBase { private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new Resource(result, this._client); @@ -16794,7 +20053,7 @@ export class Resource extends ResourceBuilderBase { private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new Resource(result, this._client); @@ -16837,36 +20096,6 @@ export class Resource extends ResourceBuilderBase { return new ResourcePromise(this._excludeFromMcpInternal()); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -16944,6 +20173,86 @@ export class Resource extends ResourceBuilderBase { ); } + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -17041,16 +20350,6 @@ export class ResourcePromise implements PromiseLike { return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); @@ -17071,6 +20370,26 @@ export class ResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -17210,6 +20529,35 @@ export class ResourceWithConnectionString extends ResourceBuilderBase { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._onConnectionStringAvailableInternal(callback)); + } + } /** @@ -17237,6 +20585,16 @@ export class ResourceWithConnectionStringPromise implements PromiseLike obj.withConnectionPropertyValue(name, value))); } + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + } // ============================================================================ @@ -17525,6 +20883,26 @@ export class ResourceWithEndpoints extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + } /** @@ -17592,6 +20970,11 @@ export class ResourceWithEndpointsPromise implements PromiseLike obj.withHttpProbe(probeType, options))); } + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + } // ============================================================================ @@ -17634,41 +21017,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -17679,43 +21032,38 @@ export class ResourceWithEnvironment extends ResourceBuilderBase Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -17749,10 +21097,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -17764,37 +21113,8 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -17877,7 +21197,7 @@ export class ResourceWithEnvironment extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ResourceWithEnvironment(result, this._client); @@ -17931,31 +21251,21 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withOtlpExporterProtocol(protocol))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -17971,16 +21281,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -18018,34 +21318,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike { - constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { - super(handle, client); - } - -} - -/** - * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ResourceWithServiceDiscoveryPromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - -} - // ============================================================================ // ResourceWithWaitSupport // ============================================================================ @@ -18059,7 +21331,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -18089,7 +21361,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -18120,7 +21392,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -18239,7 +21511,7 @@ export async function createBuilder(options?: CreateBuilderOptions): Promise { const error = reason instanceof Error ? reason : new Error(String(reason)); - if (reason instanceof CapabilityError) { + if (reason instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else if (reason instanceof CapabilityError) { console.error(`\n❌ Capability Error: ${error.message}`); console.error(` Code: ${(reason as CapabilityError).code}`); if ((reason as CapabilityError).capability) { @@ -18270,8 +21544,12 @@ process.on('unhandledRejection', (reason: unknown) => { }); process.on('uncaughtException', (error: Error) => { - console.error(`\n❌ Uncaught Exception: ${error.message}`); - if (error.stack) { + if (error instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + } + if (!(error instanceof AppHostUsageError) && error.stack) { console.error(error.stack); } process.exit(1); @@ -18282,21 +21560,44 @@ process.on('uncaughtException', (error: Error) => { // ============================================================================ // Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent', (handle, client) => new AfterResourcesCreatedEvent(handle as AfterResourcesCreatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent', (handle, client) => new BeforeResourceStartedEvent(handle as BeforeResourceStartedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent', (handle, client) => new BeforeStartEvent(handle as BeforeStartEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent', (handle, client) => new ConnectionStringAvailableEvent(handle as ConnectionStringAvailableEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel', (handle, client) => new DistributedApplicationModel(handle as DistributedApplicationModelHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent', (handle, client) => new InitializeResourceEvent(handle as InitializeResourceEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext', (handle, client) => new PipelineContext(handle as PipelineContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext', (handle, client) => new PipelineStepFactoryContext(handle as PipelineStepFactoryContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary', (handle, client) => new PipelineSummary(handle as PipelineSummaryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent', (handle, client) => new ResourceEndpointsAllocatedEvent(handle as ResourceEndpointsAllocatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService', (handle, client) => new ResourceLoggerService(handle as ResourceLoggerServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService', (handle, client) => new ResourceNotificationService(handle as ResourceNotificationServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent', (handle, client) => new ResourceReadyEvent(handle as ResourceReadyEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent', (handle, client) => new ResourceStoppedEvent(handle as ResourceStoppedEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext', (handle, client) => new UpdateCommandStateContext(handle as UpdateCommandStateContextHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration', (handle, client) => new Configuration(handle as IConfigurationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment', (handle, client) => new HostEnvironment(handle as IHostEnvironmentHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger', (handle, client) => new Logger(handle as ILoggerHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory', (handle, client) => new LoggerFactory(handle as ILoggerFactoryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep', (handle, client) => new ReportingStep(handle as IReportingStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask', (handle, client) => new ReportingTask(handle as IReportingTaskHandle, client)); +registerHandleWrapper('System.ComponentModel/System.IServiceProvider', (handle, client) => new ServiceProvider(handle as IServiceProviderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IUserSecretsManager', (handle, client) => new UserSecretsManager(handle as IUserSecretsManagerHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); @@ -18309,6 +21610,7 @@ registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeA registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource', (handle, client) => new ViteAppResource(handle as ViteAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource', (handle, client) => new ComputeResource(handle as IComputeResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); @@ -18316,6 +21618,5 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceW registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); diff --git a/samples/aspire-with-javascript/ts/.modules/base.ts b/samples/aspire-with-javascript/ts/.modules/base.ts index 7778b0f1..b3d8b8be 100644 --- a/samples/aspire-with-javascript/ts/.modules/base.ts +++ b/samples/aspire-with-javascript/ts/.modules/base.ts @@ -1,8 +1,8 @@ -// aspire.ts - Core Aspire types: base classes, ReferenceExpression -import { Handle, AspireClient, MarshalledHandle } from './transport.js'; +// base.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle, CancellationToken, registerCancellation, registerHandleWrapper, unregisterCancellation } from './transport.js'; // Re-export transport types for convenience -export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export { Handle, AspireClient, CapabilityError, CancellationToken, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; @@ -43,22 +43,46 @@ export class ReferenceExpression { private readonly _format?: string; private readonly _valueProviders?: unknown[]; + // Conditional mode fields + private readonly _condition?: unknown; + private readonly _whenTrue?: ReferenceExpression; + private readonly _whenFalse?: ReferenceExpression; + private readonly _matchValue?: string; + // Handle mode fields (when wrapping a server-returned handle) private readonly _handle?: Handle; private readonly _client?: AspireClient; constructor(format: string, valueProviders: unknown[]); constructor(handle: Handle, client: AspireClient); - constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { - if (typeof handleOrFormat === 'string') { - this._format = handleOrFormat; - this._valueProviders = clientOrValueProviders as unknown[]; + constructor(condition: unknown, matchValue: string, whenTrue: ReferenceExpression, whenFalse: ReferenceExpression); + constructor( + handleOrFormatOrCondition: Handle | string | unknown, + clientOrValueProvidersOrMatchValue: AspireClient | unknown[] | string, + whenTrueOrWhenFalse?: ReferenceExpression, + whenFalse?: ReferenceExpression + ) { + if (typeof handleOrFormatOrCondition === 'string') { + this._format = handleOrFormatOrCondition; + this._valueProviders = clientOrValueProvidersOrMatchValue as unknown[]; + } else if (handleOrFormatOrCondition instanceof Handle) { + this._handle = handleOrFormatOrCondition; + this._client = clientOrValueProvidersOrMatchValue as AspireClient; } else { - this._handle = handleOrFormat; - this._client = clientOrValueProviders as AspireClient; + this._condition = handleOrFormatOrCondition; + this._matchValue = (clientOrValueProvidersOrMatchValue as string) ?? 'True'; + this._whenTrue = whenTrueOrWhenFalse; + this._whenFalse = whenFalse; } } + /** + * Gets whether this reference expression is conditional. + */ + get isConditional(): boolean { + return this._condition !== undefined; + } + /** * Creates a reference expression from a tagged template literal. * @@ -82,16 +106,46 @@ export class ReferenceExpression { return new ReferenceExpression(format, valueProviders); } + /** + * Creates a conditional reference expression from its constituent parts. + * + * @param condition - A value provider whose result is compared to matchValue + * @param whenTrue - The expression to use when the condition matches + * @param whenFalse - The expression to use when the condition does not match + * @param matchValue - The value to compare the condition against (defaults to "True") + * @returns A ReferenceExpression instance in conditional mode + */ + static createConditional( + condition: unknown, + matchValue: string, + whenTrue: ReferenceExpression, + whenFalse: ReferenceExpression + ): ReferenceExpression { + return new ReferenceExpression(condition, matchValue, whenTrue, whenFalse); + } + /** * Serializes the reference expression for JSON-RPC transport. - * In template-literal mode, uses the $expr format. + * In expression mode, uses the $expr format with format + valueProviders. + * In conditional mode, uses the $expr format with condition + whenTrue + whenFalse. * In handle mode, delegates to the handle's serialization. */ - toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } | { condition: unknown; whenTrue: unknown; whenFalse: unknown; matchValue: string } } | MarshalledHandle { if (this._handle) { return this._handle.toJSON(); } + if (this.isConditional) { + return { + $expr: { + condition: extractHandleForExpr(this._condition), + whenTrue: this._whenTrue!.toJSON(), + whenFalse: this._whenFalse!.toJSON(), + matchValue: this._matchValue! + } + }; + } + return { $expr: { format: this._format!, @@ -100,6 +154,30 @@ export class ReferenceExpression { }; } + /** + * Resolves the expression to its string value on the server. + * Only available on server-returned ReferenceExpression instances (handle mode). + * + * @param cancellationToken - Optional AbortSignal or CancellationToken for cancellation support + * @returns The resolved string value, or null if the expression resolves to null + */ + async getValue(cancellationToken?: AbortSignal | CancellationToken): Promise { + if (!this._handle || !this._client) { + throw new Error('getValue is only available on server-returned ReferenceExpression instances'); + } + const cancellationTokenId = registerCancellation(this._client, cancellationToken); + try { + const rpcArgs: Record = { context: this._handle }; + if (cancellationTokenId !== undefined) rpcArgs.cancellationToken = cancellationTokenId; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValue', + rpcArgs + ); + } finally { + unregisterCancellation(cancellationTokenId); + } + } + /** * String representation for debugging. */ @@ -107,10 +185,17 @@ export class ReferenceExpression { if (this._handle) { return `ReferenceExpression(handle)`; } + if (this.isConditional) { + return `ReferenceExpression(conditional)`; + } return `ReferenceExpression(${this._format})`; } } +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression', (handle, client) => + new ReferenceExpression(handle, client) +); + /** * Extracts a value for use in reference expressions. * Supports handles (objects) and string literals. @@ -136,15 +221,15 @@ function extractHandleForExpr(value: unknown): unknown { return value.toJSON(); } - // Objects with $handle property (already in handle format) - if (typeof value === 'object' && value !== null && '$handle' in value) { + // Objects with marshalled expression/handle payloads + if (typeof value === 'object' && value !== null && ('$handle' in value || '$expr' in value)) { return value; } - // Objects with toJSON that returns a handle + // Objects with toJSON that returns a marshalled expression or handle if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { const json = value.toJSON(); - if (json && typeof json === 'object' && '$handle' in json) { + if (json && typeof json === 'object' && ('$handle' in json || '$expr' in json)) { return json; } } @@ -307,11 +392,20 @@ export class AspireList { }) as T[]; } - toJSON(): MarshalledHandle { - if (this._resolvedHandle) { - return this._resolvedHandle.toJSON(); + async toTransportValue(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireList must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); } - return this._handleOrContext.toJSON(); + + return this._resolvedHandle.toJSON(); } } @@ -466,8 +560,19 @@ export class AspireDict { }) as Record; } - async toJSON(): Promise { + async toTransportValue(): Promise { const handle = await this._ensureHandle(); return handle.toJSON(); } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireDict must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); + } + + return this._resolvedHandle.toJSON(); + } } diff --git a/samples/aspire-with-javascript/ts/.modules/transport.ts b/samples/aspire-with-javascript/ts/.modules/transport.ts index 7bddd74b..6d29cf28 100644 --- a/samples/aspire-with-javascript/ts/.modules/transport.ts +++ b/samples/aspire-with-javascript/ts/.modules/transport.ts @@ -77,7 +77,8 @@ export function isAtsError(value: unknown): value is { $error: AtsError } { value !== null && typeof value === 'object' && '$error' in value && - typeof (value as { $error: unknown }).$error === 'object' + typeof (value as { $error: unknown }).$error === 'object' && + (value as { $error: unknown }).$error !== null ); } @@ -93,6 +94,47 @@ export function isMarshalledHandle(value: unknown): value is MarshalledHandle { ); } +function isAbortSignal(value: unknown): value is AbortSignal { + return ( + value !== null && + typeof value === 'object' && + 'aborted' in value && + 'addEventListener' in value && + 'removeEventListener' in value + ); +} + +function isPlainObject(value: unknown): value is Record { + if (value === null || typeof value !== 'object') { + return false; + } + + const prototype = Object.getPrototypeOf(value); + return prototype === Object.prototype || prototype === null; +} + +function hasTransportValue(value: unknown): value is { toTransportValue(): unknown | Promise } { + return ( + value !== null && + typeof value === 'object' && + 'toTransportValue' in value && + typeof (value as { toTransportValue?: unknown }).toTransportValue === 'function' + ); +} + +function createAbortError(message: string): Error { + const error = new Error(message); + error.name = 'AbortError'; + return error; +} + +function createCircularReferenceError(capabilityId: string, path: string): AppHostUsageError { + return new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' contains a circular reference. ` + + 'Circular references are not supported by the AppHost transport.' + ); +} + // ============================================================================ // Handle // ============================================================================ @@ -136,6 +178,92 @@ export class Handle { } } +// ============================================================================ +// CancellationToken +// ============================================================================ + +/** + * Represents a transport-safe cancellation token value for the generated SDK. + * + * Use a plain {@link AbortSignal} when you create cancellation in user code. + * Generated APIs accept either an {@link AbortSignal} or a {@link CancellationToken}. + * + * Values returned from generated callbacks and context/property getters are + * {@link CancellationToken} instances because they may reference remote + * cancellation token handles received from the AppHost. + * + * @example + * ```typescript + * const controller = new AbortController(); + * await connectionStringExpression.getValue(controller.signal); + * ``` + * + * @example + * ```typescript + * const cancellationToken = await context.cancellationToken.get(); + * const connectionStringExpression = await db.uriExpression.get(); + * const connectionString = await connectionStringExpression.getValue(cancellationToken); + * ``` + */ +export class CancellationToken { + private readonly _signal?: AbortSignal; + private readonly _remoteTokenId?: string; + + constructor(signal?: AbortSignal); + constructor(tokenId?: string); + constructor(value?: AbortSignal | string | null) { + if (typeof value === 'string') { + this._remoteTokenId = value; + } else if (isAbortSignal(value)) { + this._signal = value; + } + } + + /** + * Creates a cancellation token from a local {@link AbortSignal}. + */ + static from(signal?: AbortSignal): CancellationToken { + return new CancellationToken(signal); + } + + /** + * Creates a cancellation token from a transport value. + * Generated code uses this to materialize values that come from the AppHost. + */ + static fromValue(value: unknown): CancellationToken { + if (value instanceof CancellationToken) { + return value; + } + + if (typeof value === 'string') { + return new CancellationToken(value); + } + + if (isAbortSignal(value)) { + return new CancellationToken(value); + } + + return new CancellationToken(); + } + + /** + * Serializes the token for JSON-RPC transport. + */ + toJSON(): string | undefined { + return this._remoteTokenId; + } + + register(client?: AspireClient): string | undefined { + if (this._remoteTokenId !== undefined) { + return this._remoteTokenId; + } + + return client + ? registerCancellation(client, this._signal) + : registerCancellation(this._signal); + } +} + // ============================================================================ // Handle Wrapper Registry // ============================================================================ @@ -167,22 +295,35 @@ export function registerHandleWrapper(typeId: string, factory: HandleWrapperFact * @param client - Optional client for creating typed wrapper instances */ export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { - if (value && typeof value === 'object') { - if (isMarshalledHandle(value)) { - const handle = new Handle(value); - const typeId = value.$type; - - // Try to find a registered wrapper factory for this type - if (typeId && client) { - const factory = handleWrapperRegistry.get(typeId); - if (factory) { - return factory(handle, client); - } + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); } + } + + return handle; + } - return handle; + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + value[i] = wrapIfHandle(value[i], client); + } + + return value; + } + + if (isPlainObject(value)) { + for (const [key, nestedValue] of Object.entries(value)) { + value[key] = wrapIfHandle(nestedValue, client); } } + return value; } @@ -213,6 +354,76 @@ export class CapabilityError extends Error { } } +/** + * Error thrown when the AppHost script uses the generated SDK incorrectly. + */ +export class AppHostUsageError extends Error { + constructor(message: string) { + super(message); + this.name = 'AppHostUsageError'; + } +} + +function isPromiseLike(value: unknown): value is PromiseLike { + return ( + value !== null && + (typeof value === 'object' || typeof value === 'function') && + 'then' in value && + typeof (value as { then?: unknown }).then === 'function' + ); +} + +function validateCapabilityArgs( + capabilityId: string, + args?: Record +): void { + if (!args) { + return; + } + + const validateValue = (value: unknown, path: string, ancestors: Set): void => { + if (value === null || value === undefined) { + return; + } + + if (isPromiseLike(value)) { + throw new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' is a Promise-like value. ` + + `This usually means an async builder call was not awaited. ` + + `Did you forget 'await' on a call like builder.addPostgres(...) or resource.addDatabase(...)?` + ); + } + + if (typeof value !== 'object') { + return; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + ancestors.add(value); + try { + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + validateValue(value[i], `${path}[${i}]`, ancestors); + } + return; + } + + for (const [key, nestedValue] of Object.entries(value)) { + validateValue(nestedValue, `${path}.${key}`, ancestors); + } + } finally { + ancestors.delete(value); + } + }; + + for (const [key, value] of Object.entries(args)) { + validateValue(value, key, new Set()); + } +} + // ============================================================================ // Callback Registry // ============================================================================ @@ -324,21 +535,50 @@ export function getCallbackCount(): number { */ const cancellationRegistry = new Map void>(); let cancellationIdCounter = 0; +const connectedClients = new Set(); -/** - * A reference to the current AspireClient for sending cancel requests. - * Set by AspireClient.connect(). - */ -let currentClient: AspireClient | null = null; +function resolveCancellationClient(client?: AspireClient): AspireClient { + if (client) { + return client; + } + + if (connectedClients.size === 1) { + return connectedClients.values().next().value as AspireClient; + } + + if (connectedClients.size === 0) { + throw new Error( + 'registerCancellation(signal) requires a connected AspireClient. ' + + 'Pass the client explicitly or connect the client first.' + ); + } + + throw new Error( + 'registerCancellation(signal) is ambiguous when multiple AspireClient instances are connected. ' + + 'Pass the client explicitly.' + ); +} /** - * Register an AbortSignal for cancellation support. - * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * Registers cancellation support for a local signal or SDK cancellation token. + * Returns a cancellation ID that should be passed to methods accepting cancellation input. * * When the AbortSignal is aborted, sends a cancelToken request to the host. * - * @param signal - The AbortSignal to register (optional) - * @returns The cancellation ID, or undefined if no signal provided + * @param client - The AspireClient that should route the cancellation request + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + */ +export function registerCancellation(client: AspireClient, signalOrToken?: AbortSignal | CancellationToken): string | undefined; +/** + * Registers cancellation support using the single connected AspireClient. + * + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + * + * @example + * const controller = new AbortController(); + * await expression.getValue(controller.signal); * * @example * const controller = new AbortController(); @@ -346,14 +586,29 @@ let currentClient: AspireClient | null = null; * // Pass id to capability invocation * // Later: controller.abort() will cancel the operation */ -export function registerCancellation(signal?: AbortSignal): string | undefined { - if (!signal) { +export function registerCancellation(signalOrToken?: AbortSignal | CancellationToken): string | undefined; +export function registerCancellation( + clientOrSignalOrToken?: AspireClient | AbortSignal | CancellationToken, + maybeSignalOrToken?: AbortSignal | CancellationToken +): string | undefined { + const client = clientOrSignalOrToken instanceof AspireClient ? clientOrSignalOrToken : undefined; + const signalOrToken = client + ? maybeSignalOrToken + : clientOrSignalOrToken as AbortSignal | CancellationToken | undefined; + + if (!signalOrToken) { return undefined; } - // Already aborted? Don't register + if (signalOrToken instanceof CancellationToken) { + return signalOrToken.register(client); + } + + const signal = signalOrToken; + const cancellationClient = resolveCancellationClient(client); + if (signal.aborted) { - return undefined; + throw createAbortError('The operation was aborted before it was sent to the AppHost.'); } const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; @@ -361,8 +616,8 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { // Set up the abort listener const onAbort = () => { // Send cancel request to host - if (currentClient?.connected) { - currentClient.cancelToken(cancellationId).catch(() => { + if (cancellationClient.connected) { + cancellationClient.cancelToken(cancellationId).catch(() => { // Ignore errors - the operation may have already completed }); } @@ -381,6 +636,56 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { return cancellationId; } +async function marshalTransportValue( + value: unknown, + client: AspireClient, + cancellationIds: string[], + capabilityId: string, + path: string = 'args', + ancestors: Set = new Set() +): Promise { + if (value === null || value === undefined || typeof value !== 'object') { + return value; + } + + if (value instanceof CancellationToken) { + const cancellationId = value.register(client); + if (cancellationId !== undefined) { + cancellationIds.push(cancellationId); + } + + return cancellationId; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + const nextAncestors = new Set(ancestors); + nextAncestors.add(value); + + if (hasTransportValue(value)) { + return await marshalTransportValue(await value.toTransportValue(), client, cancellationIds, capabilityId, path, nextAncestors); + } + + if (Array.isArray(value)) { + return await Promise.all( + value.map((item, index) => marshalTransportValue(item, client, cancellationIds, capabilityId, `${path}[${index}]`, nextAncestors)) + ); + } + + if (isPlainObject(value)) { + const entries = await Promise.all( + Object.entries(value).map(async ([key, nestedValue]) => + [key, await marshalTransportValue(nestedValue, client, cancellationIds, capabilityId, `${path}.${key}`, nextAncestors)] as const) + ); + + return Object.fromEntries(entries); + } + + return value; +} + /** * Unregister a cancellation token by its ID. * Call this when the operation completes to clean up resources. @@ -411,6 +716,8 @@ export class AspireClient { private socket: net.Socket | null = null; private disconnectCallbacks: (() => void)[] = []; private _pendingCalls = 0; + private _connectPromise: Promise | null = null; + private _disconnectNotified = false; constructor(private socketPath: string) { } @@ -422,6 +729,12 @@ export class AspireClient { } private notifyDisconnect(): void { + if (this._disconnectNotified) { + return; + } + + this._disconnectNotified = true; + for (const callback of this.disconnectCallbacks) { try { callback(); @@ -432,30 +745,106 @@ export class AspireClient { } connect(timeoutMs: number = 5000): Promise { - return new Promise((resolve, reject) => { - const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + if (this.connected) { + return Promise.resolve(); + } + + if (this._connectPromise) { + return this._connectPromise; + } + + this._disconnectNotified = false; + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this._connectPromise = new Promise((resolve, reject) => { + const socket = net.createConnection(pipePath); + this.socket = socket; - // On Windows, use named pipes; on Unix, use Unix domain sockets - const isWindows = process.platform === 'win32'; - const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + let settled = false; - this.socket = net.createConnection(pipePath); + const cleanupPendingListeners = () => { + socket.removeListener('connect', onConnect); + socket.removeListener('error', onPendingError); + socket.removeListener('close', onPendingClose); + }; - this.socket.once('error', (error: Error) => { + const failConnect = (error: Error) => { + if (settled) { + return; + } + + settled = true; clearTimeout(timeout); + cleanupPendingListeners(); + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + if (!socket.destroyed) { + socket.destroy(); + } + reject(error); - }); + }; + + const onConnectedSocketError = (error: Error) => { + console.error('Socket error:', error); + }; + + const onConnectedSocketClose = () => { + socket.removeListener('error', onConnectedSocketError); + + if (this.socket && this.socket !== socket) { + return; + } + + const connection = this.connection; + this.connection = null; + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + this.notifyDisconnect(); + }; + + const onPendingError = (error: Error) => { + failConnect(error); + }; + + const onPendingClose = () => { + failConnect(new Error('Connection closed before JSON-RPC was established')); + }; + + const onConnect = async () => { + if (settled) { + return; + } - this.socket.once('connect', () => { clearTimeout(timeout); + cleanupPendingListeners(); + try { - const reader = new rpc.SocketMessageReader(this.socket!); - const writer = new rpc.SocketMessageWriter(this.socket!); + const reader = new rpc.SocketMessageReader(socket); + const writer = new rpc.SocketMessageWriter(socket); this.connection = rpc.createMessageConnection(reader, writer); this.connection.onClose(() => { this.connection = null; - this.notifyDisconnect(); }); this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); @@ -475,26 +864,39 @@ export class AspireClient { } }); + socket.on('error', onConnectedSocketError); + socket.on('close', onConnectedSocketClose); + + const authToken = process.env.ASPIRE_REMOTE_APPHOST_TOKEN; + if (!authToken) { + throw new Error('ASPIRE_REMOTE_APPHOST_TOKEN environment variable is not set.'); + } this.connection.listen(); + const authenticated = await this.connection.sendRequest('authenticate', authToken); + if (!authenticated) { + throw new Error('Failed to authenticate to the AppHost server.'); + } - // Set the current client for cancellation registry - currentClient = this; + connectedClients.add(this); + this._connectPromise = null; + settled = true; resolve(); - } catch (e) { - reject(e); + } catch (error) { + failConnect(error instanceof Error ? error : new Error(String(error))); } - }); + }; - this.socket.on('close', () => { - this.connection?.dispose(); - this.connection = null; - if (currentClient === this) { - currentClient = null; - } - this.notifyDisconnect(); - }); + const timeout = setTimeout(() => { + failConnect(new Error('Connection timeout')); + }, timeoutMs); + + socket.once('error', onPendingError); + socket.once('close', onPendingClose); + socket.once('connect', onConnect); }); + + return this._connectPromise; } ping(): Promise { @@ -533,39 +935,66 @@ export class AspireClient { throw new Error('Not connected to AppHost'); } - // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. - // We ref() during RPC calls so the process doesn't exit mid-call, and - // unref() when idle so the process can exit naturally after all work completes. - if (this._pendingCalls === 0) { - this.socket?.ref(); - } - this._pendingCalls++; + validateCapabilityArgs(capabilityId, args); + const cancellationIds: string[] = []; try { - const result = await this.connection.sendRequest( - 'invokeCapability', - capabilityId, - args ?? null - ); + const rpcArgs = await marshalTransportValue(args ?? null, this, cancellationIds, capabilityId); - // Check for structured error response - if (isAtsError(result)) { - throw new CapabilityError(result.$error); + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); } + this._pendingCalls++; - // Wrap handles automatically - return wrapIfHandle(result, this) as T; + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + rpcArgs + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } } finally { - this._pendingCalls--; - if (this._pendingCalls === 0) { - this.socket?.unref(); + for (const cancellationId of cancellationIds) { + unregisterCancellation(cancellationId); } } } disconnect(): void { - try { this.connection?.dispose(); } finally { this.connection = null; } - try { this.socket?.end(); } finally { this.socket = null; } + const connection = this.connection; + const socket = this.socket; + + this.connection = null; + this.socket = null; + this._connectPromise = null; + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + if (socket && !socket.destroyed) { + socket.end(); + socket.destroy(); + } } get connected(): boolean { diff --git a/samples/aspire-with-javascript/ts/apphost.ts b/samples/aspire-with-javascript/ts/apphost.ts index 7805e25f..07eb012a 100644 --- a/samples/aspire-with-javascript/ts/apphost.ts +++ b/samples/aspire-with-javascript/ts/apphost.ts @@ -6,14 +6,14 @@ const weatherApi = await builder.addProject("weatherapi", "../AspireJavaScript.M .withExternalHttpEndpoints(); await builder.addJavaScriptApp("angular", "../AspireJavaScript.Angular", { runScriptName: "start" }) - .withServiceReference(weatherApi) + .withReference(weatherApi) .waitFor(weatherApi) .withHttpEndpoint({ env: "PORT" }) .withExternalHttpEndpoints() .publishAsDockerFile(); await builder.addJavaScriptApp("react", "../AspireJavaScript.React", { runScriptName: "start" }) - .withServiceReference(weatherApi) + .withReference(weatherApi) .waitFor(weatherApi) .withEnvironment("BROWSER", "none") .withHttpEndpoint({ env: "PORT" }) @@ -21,14 +21,14 @@ await builder.addJavaScriptApp("react", "../AspireJavaScript.React", { runScript .publishAsDockerFile(); await builder.addJavaScriptApp("vue", "../AspireJavaScript.Vue", { runScriptName: "start" }) - .withServiceReference(weatherApi) + .withReference(weatherApi) .waitFor(weatherApi) .withHttpEndpoint({ env: "PORT" }) .withExternalHttpEndpoints() .publishAsDockerFile(); const reactVite = await builder.addViteApp("reactvite", "../AspireJavaScript.Vite") - .withServiceReference(weatherApi) + .withReference(weatherApi) .withEnvironment("BROWSER", "none"); await weatherApi.publishWithContainerFiles(reactVite, "./wwwroot"); diff --git a/samples/aspire-with-javascript/ts/apphost.run.json b/samples/aspire-with-javascript/ts/aspire.config.json similarity index 67% rename from samples/aspire-with-javascript/ts/apphost.run.json rename to samples/aspire-with-javascript/ts/aspire.config.json index ca8c7241..ea3614f7 100644 --- a/samples/aspire-with-javascript/ts/apphost.run.json +++ b/samples/aspire-with-javascript/ts/aspire.config.json @@ -1,4 +1,11 @@ { + "appHost": { + "path": "apphost.ts", + "language": "typescript/nodejs" + }, + "packages": { + "Aspire.Hosting.JavaScript": "13.2.0" + }, "profiles": { "https": { "applicationUrl": "https://localhost:55218;http://localhost:48020", @@ -8,4 +15,4 @@ } } } -} \ No newline at end of file +} diff --git a/samples/aspire-with-node/ts/.aspire/settings.json b/samples/aspire-with-node/ts/.aspire/settings.json deleted file mode 100644 index cd047321..00000000 --- a/samples/aspire-with-node/ts/.aspire/settings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "appHostPath": "../apphost.ts", - "language": "typescript/nodejs", - "channel": "staging", - "sdkVersion": "13.2.0-preview.1.26159.1", - "packages": { - "Aspire.Hosting.JavaScript": "13.2.0-preview.1.26159.1", - "Aspire.Hosting.Redis": "13.2.0-preview.1.26159.1" - } -} \ No newline at end of file diff --git a/samples/aspire-with-node/ts/.modules/.codegen-hash b/samples/aspire-with-node/ts/.modules/.codegen-hash index acfe28db..c1b85188 100644 --- a/samples/aspire-with-node/ts/.modules/.codegen-hash +++ b/samples/aspire-with-node/ts/.modules/.codegen-hash @@ -1 +1 @@ -EB6192B0943AC285615F9DF1CEC9BADC9FFBB83928261DEA3E1A6C58182C1677 \ No newline at end of file +232549D845668E99888EA161E89D6BC6EB464A5D5C1D6A9DB73A589F3F40E39F \ No newline at end of file diff --git a/samples/aspire-with-node/ts/.modules/aspire.ts b/samples/aspire-with-node/ts/.modules/aspire.ts index 1ea516ff..a2888c5b 100644 --- a/samples/aspire-with-node/ts/.modules/aspire.ts +++ b/samples/aspire-with-node/ts/.modules/aspire.ts @@ -8,6 +8,8 @@ import { AspireClient as AspireClientRpc, Handle, MarshalledHandle, + AppHostUsageError, + CancellationToken, CapabilityError, registerCallback, wrapIfHandle, @@ -44,9 +46,21 @@ type RedisCommanderResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting. /** Handle to RedisInsightResource */ type RedisInsightResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisInsightResource'>; +/** Handle to AfterResourcesCreatedEvent */ +type AfterResourcesCreatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent'>; + +/** Handle to BeforeResourceStartedEvent */ +type BeforeResourceStartedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent'>; + +/** Handle to BeforeStartEvent */ +type BeforeStartEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent'>; + /** Handle to CommandLineArgsCallbackContext */ type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; +/** Handle to ConnectionStringAvailableEvent */ +type ConnectionStringAvailableEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent'>; + /** Handle to ContainerRegistryResource */ type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; @@ -56,6 +70,9 @@ type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Application /** Handle to CSharpAppResource */ type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; +/** Handle to DistributedApplicationModel */ +type DistributedApplicationModelHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel'>; + /** Handle to DotnetToolResource */ type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; @@ -74,9 +91,15 @@ type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicatio /** Handle to ExecuteCommandContext */ type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; +/** Handle to IComputeResource */ +type IComputeResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource'>; + /** Handle to IContainerFilesDestinationResource */ type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; +/** Handle to InitializeResourceEvent */ +type InitializeResourceEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent'>; + /** Handle to IResource */ type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; @@ -107,15 +130,27 @@ type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicati /** Handle to ReferenceExpressionBuilder */ type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; +/** Handle to ResourceEndpointsAllocatedEvent */ +type ResourceEndpointsAllocatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent'>; + /** Handle to ResourceLoggerService */ type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; /** Handle to ResourceNotificationService */ type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; +/** Handle to ResourceReadyEvent */ +type ResourceReadyEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent'>; + +/** Handle to ResourceStoppedEvent */ +type ResourceStoppedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent'>; + /** Handle to ResourceUrlsCallbackContext */ type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; +/** Handle to UpdateCommandStateContext */ +type UpdateCommandStateContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext'>; + /** Handle to ConnectionStringResource */ type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; @@ -140,18 +175,33 @@ type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hostin /** Handle to IResourceWithContainerFiles */ type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; -/** Handle to IResourceWithServiceDiscovery */ -type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; +/** Handle to IUserSecretsManager */ +type IUserSecretsManagerHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IUserSecretsManager'>; + +/** Handle to IReportingStep */ +type IReportingStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep'>; + +/** Handle to IReportingTask */ +type IReportingTaskHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask'>; /** Handle to PipelineConfigurationContext */ type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; +/** Handle to PipelineContext */ +type PipelineContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext'>; + /** Handle to PipelineStep */ type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; /** Handle to PipelineStepContext */ type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; +/** Handle to PipelineStepFactoryContext */ +type PipelineStepFactoryContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext'>; + +/** Handle to PipelineSummary */ +type PipelineSummaryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary'>; + /** Handle to ProjectResourceOptions */ type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; @@ -164,12 +214,18 @@ type ListanyHandle = Handle<'Aspire.Hosting/List'>; /** Handle to IConfiguration */ type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; +/** Handle to IConfigurationSection */ +type IConfigurationSectionHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfigurationSection'>; + /** Handle to IHostEnvironment */ type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; /** Handle to ILogger */ type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; +/** Handle to ILoggerFactory */ +type ILoggerFactoryHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory'>; + /** Handle to string[] */ type stringArrayHandle = Handle<'string[]'>; @@ -209,6 +265,7 @@ export enum EndpointProperty { Scheme = "Scheme", TargetPort = "TargetPort", HostAndPort = "HostAndPort", + TlsEnabled = "TlsEnabled", } /** Enum type for IconVariant */ @@ -340,6 +397,10 @@ export interface AddConnectionStringOptions { environmentVariableName?: string; } +export interface AddContainerRegistryFromStringOptions { + repository?: string; +} + export interface AddContainerRegistryOptions { repository?: ParameterResource; } @@ -361,6 +422,11 @@ export interface AddParameterOptions { secret?: boolean; } +export interface AddParameterWithValueOptions { + publishValueAsDefault?: boolean; + secret?: boolean; +} + export interface AddRedisOptions { port?: number; password?: ParameterResource; @@ -382,18 +448,72 @@ export interface AppendValueProviderOptions { format?: string; } +export interface CompleteStepMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteStepOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskOptions { + completionMessage?: string; + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateMarkdownTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + export interface GetValueAsyncOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface PublishAsDockerFileOptions { + configure?: (obj: ContainerResource) => Promise; +} + +export interface PublishResourceUpdateOptions { + state?: string; + stateStyle?: string; } export interface RunOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface SaveStateJsonOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskMarkdownOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; } export interface WaitForCompletionOptions { exitCode?: number; } +export interface WaitForResourceStateOptions { + targetState?: string; +} + export interface WithBindMountOptions { isReadOnly?: boolean; } @@ -543,6 +663,7 @@ export interface WithRedisInsightOptions { export interface WithReferenceOptions { connectionName?: string; optional?: boolean; + name?: string; } export interface WithRequiredCommandOptions { @@ -571,6 +692,117 @@ export interface WithYarnOptions { installArgs?: string[]; } +// ============================================================================ +// AfterResourcesCreatedEvent +// ============================================================================ + +/** + * Type class for AfterResourcesCreatedEvent. + */ +export class AfterResourcesCreatedEvent { + constructor(private _handle: AfterResourcesCreatedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeResourceStartedEvent +// ============================================================================ + +/** + * Type class for BeforeResourceStartedEvent. + */ +export class BeforeResourceStartedEvent { + constructor(private _handle: BeforeResourceStartedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeStartEvent +// ============================================================================ + +/** + * Type class for BeforeStartEvent. + */ +export class BeforeStartEvent { + constructor(private _handle: BeforeStartEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + // ============================================================================ // CommandLineArgsCallbackContext // ============================================================================ @@ -600,11 +832,12 @@ export class CommandLineArgsCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, }; @@ -619,6 +852,65 @@ export class CommandLineArgsCallbackContext { }, }; + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ConnectionStringAvailableEvent +// ============================================================================ + +/** + * Type class for ConnectionStringAvailableEvent. + */ +export class ConnectionStringAvailableEvent { + constructor(private _handle: ConnectionStringAvailableEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + } // ============================================================================ @@ -636,9 +928,9 @@ export class DistributedApplication { /** Runs the distributed application */ /** @internal */ - async _runInternal(cancellationToken?: AbortSignal): Promise { + async _runInternal(cancellationToken?: AbortSignal | CancellationToken): Promise { const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); await this._client.invokeCapability( 'Aspire.Hosting/run', rpcArgs @@ -712,6 +1004,17 @@ export class DistributedApplicationExecutionContext { }, }; + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the IsPublishMode property */ isPublishMode = { get: async (): Promise => { @@ -734,6 +1037,70 @@ export class DistributedApplicationExecutionContext { } +// ============================================================================ +// DistributedApplicationModel +// ============================================================================ + +/** + * Type class for DistributedApplicationModel. + */ +export class DistributedApplicationModel { + constructor(private _handle: DistributedApplicationModelHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets resources from the distributed application model */ + async getResources(): Promise { + const rpcArgs: Record = { model: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResources', + rpcArgs + ); + } + + /** Finds a resource by name */ + /** @internal */ + async _findResourceByNameInternal(name: string): Promise { + const rpcArgs: Record = { model: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/findResourceByName', + rpcArgs + ); + return new Resource(result, this._client); + } + + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._findResourceByNameInternal(name)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationModel that enables fluent chaining. + */ +export class DistributedApplicationModelPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationModel) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets resources from the distributed application model */ + getResources(): Promise { + return this._promise.then(obj => obj.getResources()); + } + + /** Finds a resource by name */ + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.findResourceByName(name))); + } + +} + // ============================================================================ // EndpointReference // ============================================================================ @@ -747,6 +1114,17 @@ export class EndpointReference { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.resource', + { context: this._handle } + ); + return new ResourceWithEndpoints(handle, this._client); + }, + }; + /** Gets the EndpointName property */ endpointName = { get: async (): Promise => { @@ -813,6 +1191,16 @@ export class EndpointReference { }, }; + /** Gets the TlsEnabled property */ + tlsEnabled = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.tlsEnabled', + { context: this._handle } + ); + }, + }; + /** Gets the Port property */ port = { get: async (): Promise => { @@ -867,13 +1255,22 @@ export class EndpointReference { async getValueAsync(options?: GetValueAsyncOptions): Promise { const cancellationToken = options?.cancellationToken; const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); return await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/getValueAsync', rpcArgs ); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + async getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + const rpcArgs: Record = { context: this._handle, enabledValue, disabledValue }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.getTlsValue', + rpcArgs + ); + } + } /** @@ -894,6 +1291,11 @@ export class EndpointReferencePromise implements PromiseLike return this._promise.then(obj => obj.getValueAsync(options)); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + return this._promise.then(obj => obj.getTlsValue(enabledValue, disabledValue)); + } + } // ============================================================================ @@ -971,11 +1373,34 @@ export class EnvironmentCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; @@ -1005,6 +1430,17 @@ export class ExecuteCommandContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the ResourceName property */ resourceName = { get: async (): Promise => { @@ -1023,16 +1459,17 @@ export class ExecuteCommandContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, - set: async (value: AbortSignal): Promise => { + set: async (value: AbortSignal | CancellationToken): Promise => { await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', - { context: this._handle, value } + { context: this._handle, value: CancellationToken.fromValue(value) } ); } }; @@ -1040,42 +1477,134 @@ export class ExecuteCommandContext { } // ============================================================================ -// PipelineConfigurationContext +// InitializeResourceEvent // ============================================================================ /** - * Type class for PipelineConfigurationContext. + * Type class for InitializeResourceEvent. */ -export class PipelineConfigurationContext { - constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} +export class InitializeResourceEvent { + constructor(private _handle: InitializeResourceEventHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the Steps property */ - steps = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.resource', { context: this._handle } ); + return new Resource(handle, this._client); }, - set: async (value: PipelineStep[]): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', - { context: this._handle, value } - ); - } }; - /** Gets pipeline steps with the specified tag */ - async getStepsByTag(tag: string): Promise { - const rpcArgs: Record = { context: this._handle, tag }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Pipelines/getStepsByTag', - rpcArgs - ); - } + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Notifications property */ + notifications = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.notifications', + { context: this._handle } + ); + return new ResourceNotificationService(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + { context: this._handle } + ); + }, + set: async (value: PipelineStep[]): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', + { context: this._handle, value } + ); + } + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + + /** Gets pipeline steps with the specified tag */ + async getStepsByTag(tag: string): Promise { + const rpcArgs: Record = { context: this._handle, tag }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/getStepsByTag', + rpcArgs + ); + } } @@ -1099,6 +1628,93 @@ export class PipelineConfigurationContextPromise implements PromiseLike => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + set: async (value: AbortSignal | CancellationToken): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.setCancellationToken', + { context: this._handle, value: CancellationToken.fromValue(value) } + ); + } + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + // ============================================================================ // PipelineStep // ============================================================================ @@ -1186,6 +1802,17 @@ export class PipelineStep { return this._tags; } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + /** Adds a dependency on another step by name */ /** @internal */ async _dependsOnInternal(stepName: string): Promise { @@ -1256,6 +1883,39 @@ export class PipelineStepContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the ReportingStep property */ + reportingStep = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.reportingStep', + { context: this._handle } + ); + return new ReportingStep(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + /** Gets the ExecutionContext property */ executionContext = { get: async (): Promise => { @@ -1267,18 +1927,159 @@ export class PipelineStepContext { }, }; + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineStepFactoryContext +// ============================================================================ + +/** + * Type class for PipelineStepFactoryContext. + */ +export class PipelineStepFactoryContext { + constructor(private _handle: PipelineStepFactoryContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; } +// ============================================================================ +// PipelineSummary +// ============================================================================ + +/** + * Type class for PipelineSummary. + */ +export class PipelineSummary { + constructor(private _handle: PipelineSummaryHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Add method */ + /** @internal */ + async _addInternal(key: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, key, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineSummary.add', + rpcArgs + ); + return this; + } + + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addInternal(key, value)); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + /** @internal */ + async _addMarkdownInternal(key: string, markdownString: string): Promise { + const rpcArgs: Record = { summary: this._handle, key, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/addMarkdown', + rpcArgs + ); + return this; + } + + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addMarkdownInternal(key, markdownString)); + } + +} + +/** + * Thenable wrapper for PipelineSummary that enables fluent chaining. + */ +export class PipelineSummaryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineSummary) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Add method */ + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.add(key, value))); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.addMarkdown(key, markdownString))); + } + +} + // ============================================================================ // ProjectResourceOptions // ============================================================================ @@ -1461,600 +2262,2062 @@ export class ReferenceExpressionBuilderPromise implements PromiseLike; - get urls(): AspireList { - if (!this._urls) { - this._urls = new AspireList( - this._handle, - this._client, - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' - ); - } - return this._urls; - } - - /** Gets the CancellationToken property */ - cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.resource', { context: this._handle } ); + return new Resource(handle, this._client); }, }; - /** Gets the ExecutionContext property */ - executionContext = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.services', { context: this._handle } ); - return new DistributedApplicationExecutionContext(handle, this._client); + return new ServiceProvider(handle, this._client); }, }; } // ============================================================================ -// DistributedApplicationBuilder +// ResourceLoggerService // ============================================================================ /** - * Type class for DistributedApplicationBuilder. + * Type class for ResourceLoggerService. */ -export class DistributedApplicationBuilder { - constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} +export class ResourceLoggerService { + constructor(private _handle: ResourceLoggerServiceHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the AppHostDirectory property */ - appHostDirectory = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', - { context: this._handle } - ); - }, - }; - - /** Gets the Eventing property */ - eventing = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + /** Completes the log stream for a resource */ + /** @internal */ + async _completeLogInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { loggerService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLog', + rpcArgs + ); + return this; + } + + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogInternal(resource)); + } + + /** Completes the log stream by resource name */ + /** @internal */ + async _completeLogByNameInternal(resourceName: string): Promise { + const rpcArgs: Record = { loggerService: this._handle, resourceName }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLogByName', + rpcArgs + ); + return this; + } + + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogByNameInternal(resourceName)); + } + +} + +/** + * Thenable wrapper for ResourceLoggerService that enables fluent chaining. + */ +export class ResourceLoggerServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceLoggerService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Completes the log stream for a resource */ + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLog(resource))); + } + + /** Completes the log stream by resource name */ + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLogByName(resourceName))); + } + +} + +// ============================================================================ +// ResourceNotificationService +// ============================================================================ + +/** + * Type class for ResourceNotificationService. + */ +export class ResourceNotificationService { + constructor(private _handle: ResourceNotificationServiceHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Waits for a resource to reach a specified state */ + /** @internal */ + async _waitForResourceStateInternal(resourceName: string, targetState?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + if (targetState !== undefined) rpcArgs.targetState = targetState; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceState', + rpcArgs + ); + return this; + } + + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + const targetState = options?.targetState; + return new ResourceNotificationServicePromise(this._waitForResourceStateInternal(resourceName, targetState)); + } + + /** Waits for a resource to reach one of the specified states */ + async waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName, targetStates }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStates', + rpcArgs + ); + } + + /** Waits for a resource to become healthy */ + async waitForResourceHealthy(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceHealthy', + rpcArgs + ); + } + + /** Waits for all dependencies of a resource to be ready */ + /** @internal */ + async _waitForDependenciesInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForDependencies', + rpcArgs + ); + return this; + } + + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._waitForDependenciesInternal(resource)); + } + + /** Tries to get the current state of a resource */ + async tryGetResourceState(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/tryGetResourceState', + rpcArgs + ); + } + + /** Publishes an update for a resource's state */ + /** @internal */ + async _publishResourceUpdateInternal(resource: ResourceBuilderBase, state?: string, stateStyle?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + if (state !== undefined) rpcArgs.state = state; + if (stateStyle !== undefined) rpcArgs.stateStyle = stateStyle; + await this._client.invokeCapability( + 'Aspire.Hosting/publishResourceUpdate', + rpcArgs + ); + return this; + } + + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + const state = options?.state; + const stateStyle = options?.stateStyle; + return new ResourceNotificationServicePromise(this._publishResourceUpdateInternal(resource, state, stateStyle)); + } + +} + +/** + * Thenable wrapper for ResourceNotificationService that enables fluent chaining. + */ +export class ResourceNotificationServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceNotificationService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Waits for a resource to reach a specified state */ + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForResourceState(resourceName, options))); + } + + /** Waits for a resource to reach one of the specified states */ + waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + return this._promise.then(obj => obj.waitForResourceStates(resourceName, targetStates)); + } + + /** Waits for a resource to become healthy */ + waitForResourceHealthy(resourceName: string): Promise { + return this._promise.then(obj => obj.waitForResourceHealthy(resourceName)); + } + + /** Waits for all dependencies of a resource to be ready */ + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForDependencies(resource))); + } + + /** Tries to get the current state of a resource */ + tryGetResourceState(resourceName: string): Promise { + return this._promise.then(obj => obj.tryGetResourceState(resourceName)); + } + + /** Publishes an update for a resource's state */ + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.publishResourceUpdate(resource, options))); + } + +} + +// ============================================================================ +// ResourceReadyEvent +// ============================================================================ + +/** + * Type class for ResourceReadyEvent. + */ +export class ResourceReadyEvent { + constructor(private _handle: ResourceReadyEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.resource', { context: this._handle } ); - return new DistributedApplicationEventing(handle, this._client); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ResourceStoppedEvent +// ============================================================================ + +/** + * Type class for ResourceStoppedEvent. + */ +export class ResourceStoppedEvent { + constructor(private _handle: ResourceStoppedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ResourceUrlsCallbackContext +// ============================================================================ + +/** + * Type class for ResourceUrlsCallbackContext. + */ +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// UpdateCommandStateContext +// ============================================================================ + +/** + * Type class for UpdateCommandStateContext. + */ +export class UpdateCommandStateContext { + constructor(private _handle: UpdateCommandStateContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/UpdateCommandStateContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); }, }; - /** Gets the ExecutionContext property */ - executionContext = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', - { context: this._handle } - ); - return new DistributedApplicationExecutionContext(handle, this._client); - }, - }; +} + +// ============================================================================ +// Configuration +// ============================================================================ + +/** + * Type class for Configuration. + */ +export class Configuration { + constructor(private _handle: IConfigurationHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets a configuration value by key */ + async getConfigValue(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConfigValue', + rpcArgs + ); + } + + /** Gets a connection string by name */ + async getConnectionString(name: string): Promise { + const rpcArgs: Record = { configuration: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionString', + rpcArgs + ); + } + + /** Gets a configuration section by key */ + async getSection(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getSection', + rpcArgs + ); + } + + /** Gets child configuration sections */ + async getChildren(): Promise { + const rpcArgs: Record = { configuration: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getChildren', + rpcArgs + ); + } + + /** Checks whether a configuration section exists */ + async exists(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/exists', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for Configuration that enables fluent chaining. + */ +export class ConfigurationPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Configuration) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets a configuration value by key */ + getConfigValue(key: string): Promise { + return this._promise.then(obj => obj.getConfigValue(key)); + } + + /** Gets a connection string by name */ + getConnectionString(name: string): Promise { + return this._promise.then(obj => obj.getConnectionString(name)); + } + + /** Gets a configuration section by key */ + getSection(key: string): Promise { + return this._promise.then(obj => obj.getSection(key)); + } + + /** Gets child configuration sections */ + getChildren(): Promise { + return this._promise.then(obj => obj.getChildren()); + } + + /** Checks whether a configuration section exists */ + exists(key: string): Promise { + return this._promise.then(obj => obj.exists(key)); + } + +} + +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Environment property */ + environment = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.environment', + { context: this._handle } + ); + return new HostEnvironment(handle, this._client); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the UserSecretsManager property */ + userSecretsManager = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.userSecretsManager', + { context: this._handle } + ); + return new UserSecretsManager(handle, this._client); + }, + }; + + /** Builds the distributed application */ + /** @internal */ + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', + rpcArgs + ); + return new DistributedApplication(result, this._client); + } + + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); + } + + /** Adds a connection string with a reference expression */ + /** @internal */ + async _addConnectionStringExpressionInternal(name: string, connectionStringExpression: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, connectionStringExpression }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionStringExpression', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringExpressionInternal(name, connectionStringExpression)); + } + + /** Adds a connection string with a builder callback */ + /** @internal */ + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionStringBuilder', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + } + + /** Adds a container registry resource */ + /** @internal */ + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + } + + /** Adds a container registry with string endpoint */ + /** @internal */ + async _addContainerRegistryFromStringInternal(name: string, endpoint: string, repository?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistryFromString', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryFromStringInternal(name, endpoint, repository)); + } + + /** Adds a container resource */ + /** @internal */ + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); + } + + /** Adds a container resource built from a Dockerfile */ + /** @internal */ + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); + } + + /** Adds a .NET tool resource */ + /** @internal */ + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + } + + /** Adds an executable resource */ + /** @internal */ + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + } + + /** Adds an external service resource */ + /** @internal */ + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); + } + + /** Adds an external service with a URI */ + /** @internal */ + async _addExternalServiceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceUri', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceUriInternal(name, uri)); + } + + /** Adds an external service with a parameter URL */ + /** @internal */ + async _addExternalServiceParameterInternal(name: string, urlParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, urlParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceParameter', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceParameterInternal(name, urlParameter)); + } + + /** Adds a parameter resource */ + /** @internal */ + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); + } + + /** Adds a parameter with a default value */ + /** @internal */ + async _addParameterWithValueInternal(name: string, value: string, publishValueAsDefault?: boolean, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + if (publishValueAsDefault !== undefined) rpcArgs.publishValueAsDefault = publishValueAsDefault; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterWithValue', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + const publishValueAsDefault = options?.publishValueAsDefault; + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterWithValueInternal(name, value, publishValueAsDefault, secret)); + } + + /** Adds a parameter sourced from configuration */ + /** @internal */ + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + } + + /** Adds a connection string resource */ + /** @internal */ + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + } + + /** Adds a .NET project resource */ + /** @internal */ + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + } + + /** Adds a project resource with configuration options */ + /** @internal */ + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + } + + /** Adds a C# application resource */ + /** @internal */ + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + } + + /** Adds a C# application resource with configuration options */ + /** @internal */ + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + } + + /** Gets the application configuration */ + /** @internal */ + async _getConfigurationInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getConfiguration', + rpcArgs + ); + return new Configuration(result, this._client); + } + + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._getConfigurationInternal()); + } + + /** Subscribes to the BeforeStart event */ + async subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeStartEventHandle; + const arg = new BeforeStartEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeBeforeStart', + rpcArgs + ); + } + + /** Subscribes to the AfterResourcesCreated event */ + async subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as AfterResourcesCreatedEventHandle; + const arg = new AfterResourcesCreatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeAfterResourcesCreated', + rpcArgs + ); + } + + /** Adds a Node.js application resource */ + /** @internal */ + async _addNodeAppInternal(name: string, appDirectory: string, scriptPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory, scriptPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addNodeApp', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._addNodeAppInternal(name, appDirectory, scriptPath)); + } + + /** Adds a JavaScript application resource */ + /** @internal */ + async _addJavaScriptAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addJavaScriptApp', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + const runScriptName = options?.runScriptName; + return new JavaScriptAppResourcePromise(this._addJavaScriptAppInternal(name, appDirectory, runScriptName)); + } + + /** Adds a Vite application resource */ + /** @internal */ + async _addViteAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addViteApp', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + const runScriptName = options?.runScriptName; + return new ViteAppResourcePromise(this._addViteAppInternal(name, appDirectory, runScriptName)); + } + + /** Adds a Redis container resource with specific port */ + /** @internal */ + async _addRedisWithPortInternal(name: string, port?: number): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/addRedisWithPort', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { + const port = options?.port; + return new RedisResourcePromise(this._addRedisWithPortInternal(name, port)); + } + + /** Adds a Redis container resource */ + /** @internal */ + async _addRedisInternal(name: string, port?: number, password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (port !== undefined) rpcArgs.port = port; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/addRedis', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { + const port = options?.port; + const password = options?.password; + return new RedisResourcePromise(this._addRedisInternal(name, port, password)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + */ +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); + } + + /** Adds a connection string with a reference expression */ + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringExpression(name, connectionStringExpression))); + } + + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + } + + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + } + + /** Adds a container registry with string endpoint */ + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistryFromString(name, endpoint, options))); + } + + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + } + + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + } + + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + } + + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); + } + + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + } + + /** Adds an external service with a URI */ + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceUri(name, uri))); + } + + /** Adds an external service with a parameter URL */ + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceParameter(name, urlParameter))); + } + + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); + } + + /** Adds a parameter with a default value */ + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterWithValue(name, value, options))); + } + + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + } + + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); + } - /** Builds the distributed application */ + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); + } + + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); + } + + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); + } + + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); + } + + /** Gets the application configuration */ + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._promise.then(obj => obj.getConfiguration())); + } + + /** Subscribes to the BeforeStart event */ + subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeBeforeStart(callback)); + } + + /** Subscribes to the AfterResourcesCreated event */ + subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeAfterResourcesCreated(callback)); + } + + /** Adds a Node.js application resource */ + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.addNodeApp(name, appDirectory, scriptPath))); + } + + /** Adds a JavaScript application resource */ + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.addJavaScriptApp(name, appDirectory, options))); + } + + /** Adds a Vite application resource */ + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.addViteApp(name, appDirectory, options))); + } + + /** Adds a Redis container resource with specific port */ + addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.addRedisWithPort(name, options))); + } + + /** Adds a Redis container resource */ + addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.addRedis(name, options))); + } + +} + +// ============================================================================ +// DistributedApplicationEventing +// ============================================================================ + +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Unsubscribe method */ /** @internal */ - async _buildInternal(): Promise { - const rpcArgs: Record = { context: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/build', + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', rpcArgs ); - return new DistributedApplication(result, this._client); + return this; } - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._buildInternal()); + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); } - /** Adds a connection string with a builder callback */ +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + } + +} + +// ============================================================================ +// HostEnvironment +// ============================================================================ + +/** + * Type class for HostEnvironment. + */ +export class HostEnvironment { + constructor(private _handle: IHostEnvironmentHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Checks if running in Development environment */ + async isDevelopment(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isDevelopment', + rpcArgs + ); + } + + /** Checks if running in Production environment */ + async isProduction(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isProduction', + rpcArgs + ); + } + + /** Checks if running in Staging environment */ + async isStaging(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isStaging', + rpcArgs + ); + } + + /** Checks if the environment matches the specified name */ + async isEnvironment(environmentName: string): Promise { + const rpcArgs: Record = { environment: this._handle, environmentName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isEnvironment', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for HostEnvironment that enables fluent chaining. + */ +export class HostEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: HostEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Checks if running in Development environment */ + isDevelopment(): Promise { + return this._promise.then(obj => obj.isDevelopment()); + } + + /** Checks if running in Production environment */ + isProduction(): Promise { + return this._promise.then(obj => obj.isProduction()); + } + + /** Checks if running in Staging environment */ + isStaging(): Promise { + return this._promise.then(obj => obj.isStaging()); + } + + /** Checks if the environment matches the specified name */ + isEnvironment(environmentName: string): Promise { + return this._promise.then(obj => obj.isEnvironment(environmentName)); + } + +} + +// ============================================================================ +// Logger +// ============================================================================ + +/** + * Type class for Logger. + */ +export class Logger { + constructor(private _handle: ILoggerHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Logs an information message */ /** @internal */ - async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { - const connectionStringBuilderId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; - const obj = new ReferenceExpressionBuilder(objHandle, this._client); - await connectionStringBuilder(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionStringBuilder', + async _logInformationInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logInformation', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return this; } - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._logInformationInternal(message)); } - /** Adds a container registry resource */ + /** Logs a warning message */ /** @internal */ - async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpoint }; - if (repository !== undefined) rpcArgs.repository = repository; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainerRegistry', + async _logWarningInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logWarning', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - const repository = options?.repository; - return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._logWarningInternal(message)); } - /** Adds a container resource */ + /** Logs an error message */ /** @internal */ - async _addContainerInternal(name: string, image: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, image }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainer', + async _logErrorInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logError', rpcArgs ); - return new ContainerResource(result, this._client); + return this; } - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._addContainerInternal(name, image)); + logError(message: string): LoggerPromise { + return new LoggerPromise(this._logErrorInternal(message)); } - /** Adds a container resource built from a Dockerfile */ + /** Logs a debug message */ /** @internal */ - async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDockerfile', + async _logDebugInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logDebug', rpcArgs ); - return new ContainerResource(result, this._client); + return this; } - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._logDebugInternal(message)); + } + + /** Logs a message with specified level */ + /** @internal */ + async _logInternal(level: string, message: string): Promise { + const rpcArgs: Record = { logger: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/log', + rpcArgs + ); + return this; + } + + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._logInternal(level, message)); + } + +} + +/** + * Thenable wrapper for Logger that enables fluent chaining. + */ +export class LoggerPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Logger) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Logs an information message */ + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logInformation(message))); + } + + /** Logs a warning message */ + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logWarning(message))); + } + + /** Logs an error message */ + logError(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logError(message))); + } + + /** Logs a debug message */ + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logDebug(message))); + } + + /** Logs a message with specified level */ + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.log(level, message))); } - /** Adds a .NET tool resource */ +} + +// ============================================================================ +// LoggerFactory +// ============================================================================ + +/** + * Type class for LoggerFactory. + */ +export class LoggerFactory { + constructor(private _handle: ILoggerFactoryHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Creates a logger for a category */ /** @internal */ - async _addDotnetToolInternal(name: string, packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDotnetTool', + async _createLoggerInternal(categoryName: string): Promise { + const rpcArgs: Record = { loggerFactory: this._handle, categoryName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createLogger', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new Logger(result, this._client); } - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._createLoggerInternal(categoryName)); } - /** Adds an executable resource */ - /** @internal */ - async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExecutable', - rpcArgs - ); - return new ExecutableResource(result, this._client); +} + +/** + * Thenable wrapper for LoggerFactory that enables fluent chaining. + */ +export class LoggerFactoryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: LoggerFactory) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + /** Creates a logger for a category */ + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.createLogger(categoryName))); } - /** Adds an external service resource */ +} + +// ============================================================================ +// ReportingStep +// ============================================================================ + +/** + * Type class for ReportingStep. + */ +export class ReportingStep { + constructor(private _handle: IReportingStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Creates a reporting task with plain-text status text */ /** @internal */ - async _addExternalServiceInternal(name: string, url: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, url }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExternalService', + async _createTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createTask', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ReportingTask(result, this._client); } - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createTaskInternal(statusText, cancellationToken)); } - /** Adds a parameter resource */ + /** Creates a reporting task with Markdown-formatted status text */ /** @internal */ - async _addParameterInternal(name: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameter', + async _createMarkdownTaskInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createMarkdownTask', rpcArgs ); - return new ParameterResource(result, this._client); + return new ReportingTask(result, this._client); } - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterInternal(name, secret)); + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createMarkdownTaskInternal(markdownString, cancellationToken)); } - /** Adds a parameter sourced from configuration */ + /** Logs a plain-text message for the reporting step */ /** @internal */ - async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name, configurationKey }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameterFromConfiguration', + async _logStepInternal(level: string, message: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStep', rpcArgs ); - return new ParameterResource(result, this._client); + return this; } - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepInternal(level, message)); } - /** Adds a connection string resource */ + /** Logs a Markdown-formatted message for the reporting step */ /** @internal */ - async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionString', + async _logStepMarkdownInternal(level: string, markdownString: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStepMarkdown', rpcArgs ); - return new ResourceWithConnectionString(result, this._client); + return this; } - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - const environmentVariableName = options?.environmentVariableName; - return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepMarkdownInternal(level, markdownString)); } - /** Adds a .NET project resource */ + /** Completes the reporting step with plain-text completion text */ /** @internal */ - async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProject', + async _completeStepInternal(completionText: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, completionText }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStep', rpcArgs ); - return new ProjectResource(result, this._client); + return this; } - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepInternal(completionText, completionState, cancellationToken)); } - /** Adds a project resource with configuration options */ + /** Completes the reporting step with Markdown-formatted completion text */ /** @internal */ - async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProjectWithOptions', + async _completeStepMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStepMarkdown', rpcArgs ); - return new ProjectResource(result, this._client); + return this; } - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepMarkdownInternal(markdownString, completionState, cancellationToken)); } - /** Adds a C# application resource */ - /** @internal */ - async _addCSharpAppInternal(name: string, path: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, path }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpApp', - rpcArgs - ); - return new ProjectResource(result, this._client); +} + +/** + * Thenable wrapper for ReportingStep that enables fluent chaining. + */ +export class ReportingStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReportingStep) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + /** Creates a reporting task with plain-text status text */ + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createTask(statusText, options))); } - /** Adds a C# application resource with configuration options */ - /** @internal */ - async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpAppWithOptions', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Creates a reporting task with Markdown-formatted status text */ + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createMarkdownTask(markdownString, options))); } - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + /** Logs a plain-text message for the reporting step */ + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStep(level, message))); } - /** Adds a Node.js application resource */ - /** @internal */ - async _addNodeAppInternal(name: string, appDirectory: string, scriptPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, appDirectory, scriptPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.JavaScript/addNodeApp', - rpcArgs - ); - return new NodeAppResource(result, this._client); + /** Logs a Markdown-formatted message for the reporting step */ + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStepMarkdown(level, markdownString))); } - addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._addNodeAppInternal(name, appDirectory, scriptPath)); + /** Completes the reporting step with plain-text completion text */ + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStep(completionText, options))); } - /** Adds a JavaScript application resource */ + /** Completes the reporting step with Markdown-formatted completion text */ + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStepMarkdown(markdownString, options))); + } + +} + +// ============================================================================ +// ReportingTask +// ============================================================================ + +/** + * Type class for ReportingTask. + */ +export class ReportingTask { + constructor(private _handle: IReportingTaskHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Updates the reporting task with plain-text status text */ /** @internal */ - async _addJavaScriptAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, appDirectory }; - if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.JavaScript/addJavaScriptApp', + async _updateTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTask', rpcArgs ); - return new JavaScriptAppResource(result, this._client); + return this; } - addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { - const runScriptName = options?.runScriptName; - return new JavaScriptAppResourcePromise(this._addJavaScriptAppInternal(name, appDirectory, runScriptName)); + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskInternal(statusText, cancellationToken)); } - /** Adds a Vite application resource */ + /** Updates the reporting task with Markdown-formatted status text */ /** @internal */ - async _addViteAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, appDirectory }; - if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.JavaScript/addViteApp', + async _updateTaskMarkdownInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTaskMarkdown', rpcArgs ); - return new ViteAppResource(result, this._client); + return this; } - addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { - const runScriptName = options?.runScriptName; - return new ViteAppResourcePromise(this._addViteAppInternal(name, appDirectory, runScriptName)); + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskMarkdownInternal(markdownString, cancellationToken)); } - /** Adds a Redis container resource with specific port */ + /** Completes the reporting task with plain-text completion text */ /** @internal */ - async _addRedisWithPortInternal(name: string, port?: number): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/addRedisWithPort', + async _completeTaskInternal(completionMessage?: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle }; + if (completionMessage !== undefined) rpcArgs.completionMessage = completionMessage; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTask', rpcArgs ); - return new RedisResource(result, this._client); + return this; } - addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { - const port = options?.port; - return new RedisResourcePromise(this._addRedisWithPortInternal(name, port)); + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + const completionMessage = options?.completionMessage; + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskInternal(completionMessage, completionState, cancellationToken)); } - /** Adds a Redis container resource */ + /** Completes the reporting task with Markdown-formatted completion text */ /** @internal */ - async _addRedisInternal(name: string, port?: number, password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (port !== undefined) rpcArgs.port = port; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/addRedis', + async _completeTaskMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTaskMarkdown', rpcArgs ); - return new RedisResource(result, this._client); + return this; } - addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { - const port = options?.port; - const password = options?.password; - return new RedisResourcePromise(this._addRedisInternal(name, port, password)); + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskMarkdownInternal(markdownString, completionState, cancellationToken)); } } /** - * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + * Thenable wrapper for ReportingTask that enables fluent chaining. */ -export class DistributedApplicationBuilderPromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ReportingTaskPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ReportingTask) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Builds the distributed application */ - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); + /** Updates the reporting task with plain-text status text */ + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTask(statusText, options))); + } + + /** Updates the reporting task with Markdown-formatted status text */ + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTaskMarkdown(markdownString, options))); + } + + /** Completes the reporting task with plain-text completion text */ + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTask(options))); + } + + /** Completes the reporting task with Markdown-formatted completion text */ + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTaskMarkdown(markdownString, options))); + } + +} + +// ============================================================================ +// ServiceProvider +// ============================================================================ + +/** + * Type class for ServiceProvider. + */ +export class ServiceProvider { + constructor(private _handle: IServiceProviderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the distributed application eventing service from the service provider */ + /** @internal */ + async _getEventingInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getEventing', + rpcArgs + ); + return new DistributedApplicationEventing(result, this._client); } - /** Adds a connection string with a builder callback */ - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._getEventingInternal()); } - /** Adds a container registry resource */ - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + /** Gets the logger factory from the service provider */ + /** @internal */ + async _getLoggerFactoryInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getLoggerFactory', + rpcArgs + ); + return new LoggerFactory(result, this._client); } - /** Adds a container resource */ - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._getLoggerFactoryInternal()); } - /** Adds a container resource built from a Dockerfile */ - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + /** Gets the resource logger service from the service provider */ + /** @internal */ + async _getResourceLoggerServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceLoggerService', + rpcArgs + ); + return new ResourceLoggerService(result, this._client); } - /** Adds a .NET tool resource */ - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._getResourceLoggerServiceInternal()); } - /** Adds an executable resource */ - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); + /** Gets the distributed application model from the service provider */ + /** @internal */ + async _getDistributedApplicationModelInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getDistributedApplicationModel', + rpcArgs + ); + return new DistributedApplicationModel(result, this._client); } - /** Adds an external service resource */ - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._getDistributedApplicationModelInternal()); } - /** Adds a parameter resource */ - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); + /** Gets the resource notification service from the service provider */ + /** @internal */ + async _getResourceNotificationServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceNotificationService', + rpcArgs + ); + return new ResourceNotificationService(result, this._client); } - /** Adds a parameter sourced from configuration */ - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._getResourceNotificationServiceInternal()); } - /** Adds a connection string resource */ - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); + /** Gets the user secrets manager from the service provider */ + /** @internal */ + async _getUserSecretsManagerInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getUserSecretsManager', + rpcArgs + ); + return new UserSecretsManager(result, this._client); } - /** Adds a .NET project resource */ - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getUserSecretsManagerInternal()); } - /** Adds a project resource with configuration options */ - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); - } +} - /** Adds a C# application resource */ - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); +/** + * Thenable wrapper for ServiceProvider that enables fluent chaining. + */ +export class ServiceProviderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ServiceProvider) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a C# application resource with configuration options */ - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); + /** Gets the distributed application eventing service from the service provider */ + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.getEventing())); } - /** Adds a Node.js application resource */ - addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._promise.then(obj => obj.addNodeApp(name, appDirectory, scriptPath))); + /** Gets the logger factory from the service provider */ + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._promise.then(obj => obj.getLoggerFactory())); } - /** Adds a JavaScript application resource */ - addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.addJavaScriptApp(name, appDirectory, options))); + /** Gets the resource logger service from the service provider */ + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.getResourceLoggerService())); } - /** Adds a Vite application resource */ - addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.addViteApp(name, appDirectory, options))); + /** Gets the distributed application model from the service provider */ + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._promise.then(obj => obj.getDistributedApplicationModel())); } - /** Adds a Redis container resource with specific port */ - addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.addRedisWithPort(name, options))); + /** Gets the resource notification service from the service provider */ + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.getResourceNotificationService())); } - /** Adds a Redis container resource */ - addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.addRedis(name, options))); + /** Gets the user secrets manager from the service provider */ + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getUserSecretsManager())); } } // ============================================================================ -// DistributedApplicationEventing +// UserSecretsManager // ============================================================================ /** - * Type class for DistributedApplicationEventing. + * Type class for UserSecretsManager. */ -export class DistributedApplicationEventing { - constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} +export class UserSecretsManager { + constructor(private _handle: IUserSecretsManagerHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Invokes the Unsubscribe method */ + /** Gets the IsAvailable property */ + isAvailable = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.isAvailable', + { context: this._handle } + ); + }, + }; + + /** Gets the FilePath property */ + filePath = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.filePath', + { context: this._handle } + ); + }, + }; + + /** Attempts to set a user secret value */ + async trySetSecret(name: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, name, value }; + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.trySetSecret', + rpcArgs + ); + } + + /** Saves state to user secrets from a JSON string */ /** @internal */ - async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { - const rpcArgs: Record = { context: this._handle, subscription }; + async _saveStateJsonInternal(json: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, json }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); await this._client.invokeCapability( - 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + 'Aspire.Hosting/saveStateJson', rpcArgs ); return this; } - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + const cancellationToken = options?.cancellationToken; + return new UserSecretsManagerPromise(this._saveStateJsonInternal(json, cancellationToken)); + } + + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ + /** @internal */ + async _getOrSetSecretInternal(resourceBuilder: ResourceBuilderBase, name: string, value: string): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, resourceBuilder, name, value }; + await this._client.invokeCapability( + 'Aspire.Hosting/getOrSetSecret', + rpcArgs + ); + return this; + } + + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getOrSetSecretInternal(resourceBuilder, name, value)); } } /** - * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + * Thenable wrapper for UserSecretsManager that enables fluent chaining. */ -export class DistributedApplicationEventingPromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class UserSecretsManagerPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: UserSecretsManager) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Invokes the Unsubscribe method */ - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + /** Attempts to set a user secret value */ + trySetSecret(name: string, value: string): Promise { + return this._promise.then(obj => obj.trySetSecret(name, value)); + } + + /** Saves state to user secrets from a JSON string */ + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.saveStateJson(json, options))); + } + + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getOrSetSecret(resourceBuilder, name, value))); } } @@ -2149,6 +4412,15 @@ export class ConnectionStringResource extends ResourceBuilderBase { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + /** @internal */ private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { @@ -2261,7 +4533,7 @@ export class ConnectionStringResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ConnectionStringResource(result, this._client); @@ -2291,7 +4563,7 @@ export class ConnectionStringResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ConnectionStringResource(result, this._client); @@ -2337,7 +4609,7 @@ export class ConnectionStringResource extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ConnectionStringResource(result, this._client); @@ -2390,7 +4662,7 @@ export class ConnectionStringResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new ConnectionStringResource(result, this._client); @@ -2405,7 +4677,7 @@ export class ConnectionStringResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new ConnectionStringResource(result, this._client); @@ -2448,36 +4720,6 @@ export class ConnectionStringResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -2555,6 +4797,106 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onConnectionStringAvailableInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -2597,6 +4939,11 @@ export class ConnectionStringResourcePromise implements PromiseLike obj.withConnectionPropertyValue(name, value))); } + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + /** Customizes displayed URLs via callback */ withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); @@ -2687,34 +5034,49 @@ export class ConnectionStringResourcePromise implements PromiseLike obj.excludeFromMcp())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } } @@ -2943,7 +5305,7 @@ export class ContainerRegistryResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new ContainerRegistryResource(result, this._client); @@ -2958,7 +5320,7 @@ export class ContainerRegistryResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new ContainerRegistryResource(result, this._client); @@ -3001,36 +5363,6 @@ export class ContainerRegistryResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -3108,6 +5440,86 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -3195,70 +5607,313 @@ export class ContainerRegistryResourcePromise implements PromiseLike obj.withChildRelationship(child))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// ContainerResource +// ============================================================================ + +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', + rpcArgs + ); + return new ContainerResource(result, this._client); } -} + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + } -// ============================================================================ -// ContainerResource -// ============================================================================ + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', + rpcArgs + ); + return new ContainerResource(result, this._client); + } -export class ContainerResource extends ResourceBuilderBase { - constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ @@ -3280,6 +5935,21 @@ export class ContainerResource extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + /** @internal */ private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; @@ -3330,58 +6000,43 @@ export class ContainerResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - const helpLink = options?.helpLink; - return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } - - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + 'Aspire.Hosting/publishAsConnectionString', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -3392,43 +6047,38 @@ export class ContainerResource extends ResourceBuilderBase Promise): ContainerResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -3517,10 +6167,11 @@ export class ContainerResource extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -3532,37 +6183,8 @@ export class ContainerResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -3862,7 +6484,7 @@ export class ContainerResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ContainerResource(result, this._client); @@ -3892,7 +6514,7 @@ export class ContainerResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ContainerResource(result, this._client); @@ -3938,7 +6560,7 @@ export class ContainerResource extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ContainerResource(result, this._client); @@ -4043,7 +6665,7 @@ export class ContainerResource extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ContainerResource(result, this._client); @@ -4074,7 +6696,7 @@ export class ContainerResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new ContainerResource(result, this._client); @@ -4089,7 +6711,7 @@ export class ContainerResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new ContainerResource(result, this._client); @@ -4259,6 +6881,25 @@ export class ContainerResource extends ResourceBuilderBase { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + /** Gets the resource name */ async getResourceName(): Promise { const rpcArgs: Record = { resource: this._handle }; @@ -4268,6 +6909,106 @@ export class ContainerResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -4290,11 +7031,91 @@ export class ContainerResourcePromise implements PromiseLike return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + /** Sets the base image for a Dockerfile build */ withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + /** Configures an MCP server endpoint on the resource */ withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); @@ -4310,36 +7131,31 @@ export class ContainerResourcePromise implements PromiseLike return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + /** Adds a required command dependency */ withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -4370,16 +7186,6 @@ export class ContainerResourcePromise implements PromiseLike return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -4575,11 +7381,41 @@ export class ContainerResourcePromise implements PromiseLike return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + /** Gets the resource name */ getResourceName(): Promise { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -4705,58 +7541,50 @@ export class CSharpAppResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new CSharpAppResource(result, this._client); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - const helpLink = options?.helpLink; - return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } - - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configure !== undefined) rpcArgs.configure = configureId; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + const configure = options?.configure; + return new CSharpAppResourcePromise(this._publishAsDockerFileInternal(configure)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -4767,43 +7595,38 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): CSharpAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -4892,10 +7715,11 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -4907,37 +7731,8 @@ export class CSharpAppResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new CSharpAppResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new CSharpAppResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -5222,7 +8017,7 @@ export class CSharpAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); return new CSharpAppResource(result, this._client); @@ -5252,7 +8047,7 @@ export class CSharpAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new CSharpAppResource(result, this._client); @@ -5282,7 +8077,7 @@ export class CSharpAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new CSharpAppResource(result, this._client); @@ -5328,7 +8123,7 @@ export class CSharpAppResource extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new CSharpAppResource(result, this._client); @@ -5433,7 +8228,7 @@ export class CSharpAppResource extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new CSharpAppResource(result, this._client); @@ -5464,7 +8259,7 @@ export class CSharpAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new CSharpAppResource(result, this._client); @@ -5479,7 +8274,7 @@ export class CSharpAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new CSharpAppResource(result, this._client); @@ -5658,6 +8453,106 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -5710,36 +8605,31 @@ export class CSharpAppResourcePromise implements PromiseLike return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); } + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); + } + /** Adds a required command dependency */ withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -5770,16 +8660,6 @@ export class CSharpAppResourcePromise implements PromiseLike return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -5975,14 +8855,39 @@ export class CSharpAppResourcePromise implements PromiseLike return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } } @@ -6252,41 +9157,11 @@ export class DotnetToolResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -6297,43 +9172,38 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -6422,10 +9292,11 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -6437,37 +9308,8 @@ export class DotnetToolResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -6767,7 +9609,7 @@ export class DotnetToolResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new DotnetToolResource(result, this._client); @@ -6797,7 +9639,7 @@ export class DotnetToolResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new DotnetToolResource(result, this._client); @@ -6843,7 +9685,7 @@ export class DotnetToolResource extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new DotnetToolResource(result, this._client); @@ -6948,7 +9790,7 @@ export class DotnetToolResource extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new DotnetToolResource(result, this._client); @@ -6979,7 +9821,7 @@ export class DotnetToolResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new DotnetToolResource(result, this._client); @@ -6994,7 +9836,7 @@ export class DotnetToolResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new DotnetToolResource(result, this._client); @@ -7173,6 +10015,106 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -7270,31 +10212,21 @@ export class DotnetToolResourcePromise implements PromiseLike obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -7325,16 +10257,6 @@ export class DotnetToolResourcePromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -7535,6 +10457,31 @@ export class DotnetToolResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -7581,123 +10528,138 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _publishAsDockerFileInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - const helpLink = options?.helpLink; - return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + 'Aspire.Hosting/withMcpServer', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); @@ -7705,15 +10667,15 @@ export class ExecutableResource extends ResourceBuilderBase = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -7731,6 +10693,21 @@ export class ExecutableResource extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + } + /** @internal */ private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; @@ -7817,10 +10794,11 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -7832,37 +10810,8 @@ export class ExecutableResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -8162,7 +11111,7 @@ export class ExecutableResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ExecutableResource(result, this._client); @@ -8192,7 +11141,7 @@ export class ExecutableResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ExecutableResource(result, this._client); @@ -8238,7 +11187,7 @@ export class ExecutableResource extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ExecutableResource(result, this._client); @@ -8343,7 +11292,7 @@ export class ExecutableResource extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ExecutableResource(result, this._client); @@ -8374,7 +11323,7 @@ export class ExecutableResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new ExecutableResource(result, this._client); @@ -8389,7 +11338,7 @@ export class ExecutableResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new ExecutableResource(result, this._client); @@ -8568,6 +11517,106 @@ export class ExecutableResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -8595,6 +11644,26 @@ export class ExecutableResourcePromise implements PromiseLike obj.withDockerfileBaseImage(options))); } + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + /** Configures an MCP server endpoint on the resource */ withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); @@ -8615,31 +11684,21 @@ export class ExecutableResourcePromise implements PromiseLike obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -8670,16 +11729,6 @@ export class ExecutableResourcePromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ExecutableResourcePromise { return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -8880,6 +11929,31 @@ export class ExecutableResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -9125,7 +12199,7 @@ export class ExternalServiceResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new ExternalServiceResource(result, this._client); @@ -9140,7 +12214,7 @@ export class ExternalServiceResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new ExternalServiceResource(result, this._client); @@ -9183,36 +12257,6 @@ export class ExternalServiceResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -9290,6 +12334,86 @@ export class ExternalServiceResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -9392,16 +12516,6 @@ export class ExternalServiceResourcePromise implements PromiseLike obj.excludeFromMcp())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); @@ -9422,16 +12536,66 @@ export class ExternalServiceResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ // JavaScriptAppResource // ============================================================================ -export class JavaScriptAppResource extends ResourceBuilderBase { - constructor(handle: JavaScriptAppResourceHandle, client: AspireClientRpc) { - super(handle, client); - } +export class JavaScriptAppResource extends ResourceBuilderBase { + constructor(handle: JavaScriptAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; /** @internal */ private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { @@ -9599,41 +12763,11 @@ export class JavaScriptAppResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new JavaScriptAppResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new JavaScriptAppResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -9644,43 +12778,38 @@ export class JavaScriptAppResource extends ResourceBuilderBase Promise): JavaScriptAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { return new JavaScriptAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new JavaScriptAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new JavaScriptAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -9769,10 +12898,11 @@ export class JavaScriptAppResource extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -9784,37 +12914,8 @@ export class JavaScriptAppResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new JavaScriptAppResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new JavaScriptAppResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new JavaScriptAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -10144,7 +13245,7 @@ export class JavaScriptAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new JavaScriptAppResource(result, this._client); @@ -10174,7 +13275,7 @@ export class JavaScriptAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new JavaScriptAppResource(result, this._client); @@ -10220,7 +13321,7 @@ export class JavaScriptAppResource extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new JavaScriptAppResource(result, this._client); @@ -10325,7 +13426,7 @@ export class JavaScriptAppResource extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new JavaScriptAppResource(result, this._client); @@ -10356,7 +13457,7 @@ export class JavaScriptAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new JavaScriptAppResource(result, this._client); @@ -10371,7 +13472,7 @@ export class JavaScriptAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new JavaScriptAppResource(result, this._client); @@ -10510,44 +13611,273 @@ export class JavaScriptAppResource extends ResourceBuilderBase = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withYarnInternal(install, installArgs)); + } + + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withPnpmInternal(install, installArgs)); + } + + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', rpcArgs ); return new JavaScriptAppResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + 'Aspire.Hosting.JavaScript/withRunScript', rpcArgs ); return new JavaScriptAppResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', rpcArgs ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + const browser = options?.browser; + return new JavaScriptAppResourcePromise(this._withBrowserDebuggerInternal(browser)); } } @@ -10617,31 +13947,21 @@ export class JavaScriptAppResourcePromise implements PromiseLike obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -10672,16 +13992,6 @@ export class JavaScriptAppResourcePromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -10892,6 +14202,66 @@ export class JavaScriptAppResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + } // ============================================================================ @@ -11099,41 +14469,11 @@ export class NodeAppResource extends ResourceBuilderBase } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new NodeAppResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new NodeAppResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -11144,43 +14484,38 @@ export class NodeAppResource extends ResourceBuilderBase } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { return new NodeAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new NodeAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new NodeAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -11269,10 +14604,11 @@ export class NodeAppResource extends ResourceBuilderBase } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -11284,37 +14620,8 @@ export class NodeAppResource extends ResourceBuilderBase withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new NodeAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new NodeAppResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new NodeAppResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new NodeAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -11599,7 +14906,7 @@ export class NodeAppResource extends ResourceBuilderBase private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); return new NodeAppResource(result, this._client); @@ -11659,7 +14966,7 @@ export class NodeAppResource extends ResourceBuilderBase private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new NodeAppResource(result, this._client); @@ -11689,7 +14996,7 @@ export class NodeAppResource extends ResourceBuilderBase private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new NodeAppResource(result, this._client); @@ -11735,7 +15042,7 @@ export class NodeAppResource extends ResourceBuilderBase const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new NodeAppResource(result, this._client); @@ -11840,7 +15147,7 @@ export class NodeAppResource extends ResourceBuilderBase const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new NodeAppResource(result, this._client); @@ -11871,7 +15178,7 @@ export class NodeAppResource extends ResourceBuilderBase private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new NodeAppResource(result, this._client); @@ -11886,7 +15193,7 @@ export class NodeAppResource extends ResourceBuilderBase private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new NodeAppResource(result, this._client); @@ -11989,80 +15296,180 @@ export class NodeAppResource extends ResourceBuilderBase } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new NodeAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + 'Aspire.Hosting/onInitializeResource', rpcArgs ); return new NodeAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new NodeAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); return new NodeAppResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + 'Aspire.Hosting/onResourceReady', rpcArgs ); return new NodeAppResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withPipelineConfigurationInternal(callback)); - } - - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -12177,36 +15584,6 @@ export class NodeAppResource extends ResourceBuilderBase return new NodeAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } - /** @internal */ - private async _withScriptDebuggingInternal(scriptPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, scriptPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.JavaScript/withScriptDebugging', - rpcArgs - ); - return new NodeAppResource(result, this._client); - } - - /** Enables debugging support for a Node.js application with an explicit script path */ - withScriptDebugging(scriptPath: string): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withScriptDebuggingInternal(scriptPath)); - } - - /** @internal */ - private async _withDebuggingInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.JavaScript/withDebugging', - rpcArgs - ); - return new NodeAppResource(result, this._client); - } - - /** Enables debugging support for a JavaScript application */ - withDebugging(): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withDebuggingInternal()); - } - /** @internal */ private async _withBrowserDebuggerInternal(browser?: string): Promise { const rpcArgs: Record = { builder: this._handle }; @@ -12218,7 +15595,7 @@ export class NodeAppResource extends ResourceBuilderBase return new NodeAppResource(result, this._client); } - /** Configures browser debugging support */ + /** Configures a browser debugger for the JavaScript application */ withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { const browser = options?.browser; return new NodeAppResourcePromise(this._withBrowserDebuggerInternal(browser)); @@ -12291,31 +15668,21 @@ export class NodeAppResourcePromise implements PromiseLike { return new NodeAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -12346,16 +15713,6 @@ export class NodeAppResourcePromise implements PromiseLike { return new NodeAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): NodeAppResourcePromise { return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -12571,6 +15928,31 @@ export class NodeAppResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + /** Configures npm as the package manager */ withNpm(options?: WithNpmOptions): NodeAppResourcePromise { return new NodeAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); @@ -12601,17 +15983,7 @@ export class NodeAppResourcePromise implements PromiseLike { return new NodeAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); } - /** Enables debugging support for a Node.js application with an explicit script path */ - withScriptDebugging(scriptPath: string): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._promise.then(obj => obj.withScriptDebugging(scriptPath))); - } - - /** Enables debugging support for a JavaScript application */ - withDebugging(): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._promise.then(obj => obj.withDebugging())); - } - - /** Configures browser debugging support */ + /** Configures a browser debugger for the JavaScript application */ withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { return new NodeAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); } @@ -12859,7 +16231,7 @@ export class ParameterResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new ParameterResource(result, this._client); @@ -12874,7 +16246,7 @@ export class ParameterResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new ParameterResource(result, this._client); @@ -12917,36 +16289,6 @@ export class ParameterResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ParameterResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ParameterResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -13024,6 +16366,86 @@ export class ParameterResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -13126,16 +16548,6 @@ export class ParameterResourcePromise implements PromiseLike return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); @@ -13156,6 +16568,26 @@ export class ParameterResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -13251,74 +16683,76 @@ export class ProjectResource extends ResourceBuilderBase } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + 'Aspire.Hosting/withReplicas', rpcArgs ); return new ProjectResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - const helpLink = options?.helpLink; - return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReplicasInternal(replicas)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + 'Aspire.Hosting/disableForwardedHeaders', rpcArgs ); return new ProjectResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._disableForwardedHeadersInternal()); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configure !== undefined) rpcArgs.configure = configureId; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', rpcArgs ); return new ProjectResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + const configure = options?.configure; + return new ProjectResourcePromise(this._publishAsDockerFileInternal(configure)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); return new ProjectResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); @@ -13326,15 +16760,15 @@ export class ProjectResource extends ResourceBuilderBase }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); return new ProjectResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -13352,6 +16786,21 @@ export class ProjectResource extends ResourceBuilderBase return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + /** @internal */ private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; @@ -13438,10 +16887,11 @@ export class ProjectResource extends ResourceBuilderBase } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -13452,38 +16902,9 @@ export class ProjectResource extends ResourceBuilderBase /** Adds a reference to another resource */ withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { const connectionName = options?.connectionName; - const optional = options?.optional; - return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const optional = options?.optional; + const name = options?.name; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -13768,7 +17189,7 @@ export class ProjectResource extends ResourceBuilderBase private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); return new ProjectResource(result, this._client); @@ -13798,7 +17219,7 @@ export class ProjectResource extends ResourceBuilderBase private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ProjectResource(result, this._client); @@ -13828,7 +17249,7 @@ export class ProjectResource extends ResourceBuilderBase private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ProjectResource(result, this._client); @@ -13874,7 +17295,7 @@ export class ProjectResource extends ResourceBuilderBase const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ProjectResource(result, this._client); @@ -13979,7 +17400,7 @@ export class ProjectResource extends ResourceBuilderBase const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ProjectResource(result, this._client); @@ -14010,7 +17431,7 @@ export class ProjectResource extends ResourceBuilderBase private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new ProjectResource(result, this._client); @@ -14025,7 +17446,7 @@ export class ProjectResource extends ResourceBuilderBase private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new ProjectResource(result, this._client); @@ -14204,6 +17625,106 @@ export class ProjectResource extends ResourceBuilderBase ); } + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -14246,29 +17767,29 @@ export class ProjectResourcePromise implements PromiseLike { return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ @@ -14276,6 +17797,11 @@ export class ProjectResourcePromise implements PromiseLike { return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -14306,16 +17832,6 @@ export class ProjectResourcePromise implements PromiseLike { return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ProjectResourcePromise { return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -14521,6 +18037,31 @@ export class ProjectResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -14739,7 +18280,7 @@ export class RedisCommanderResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); return new RedisCommanderResource(result, this._client); @@ -14754,7 +18295,7 @@ export class RedisCommanderResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); return new RedisCommanderResource(result, this._client); @@ -14896,41 +18437,11 @@ export class RedisCommanderResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -14941,43 +18452,38 @@ export class RedisCommanderResource extends ResourceBuilderBase Promise): RedisCommanderResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { return new RedisCommanderResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new RedisCommanderResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new RedisCommanderResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -15066,10 +18572,11 @@ export class RedisCommanderResource extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -15081,37 +18588,8 @@ export class RedisCommanderResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new RedisCommanderResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -15411,7 +18889,7 @@ export class RedisCommanderResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new RedisCommanderResource(result, this._client); @@ -15441,7 +18919,7 @@ export class RedisCommanderResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new RedisCommanderResource(result, this._client); @@ -15487,7 +18965,7 @@ export class RedisCommanderResource extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new RedisCommanderResource(result, this._client); @@ -15592,7 +19070,7 @@ export class RedisCommanderResource extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new RedisCommanderResource(result, this._client); @@ -15623,7 +19101,7 @@ export class RedisCommanderResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new RedisCommanderResource(result, this._client); @@ -15638,7 +19116,7 @@ export class RedisCommanderResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new RedisCommanderResource(result, this._client); @@ -15753,87 +19231,187 @@ export class RedisCommanderResource extends ResourceBuilderBase( - 'Aspire.Hosting/withPipelineStepFactory', + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisCommanderResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new RedisCommanderResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisCommanderResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisCommanderResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); return new RedisCommanderResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisCommanderResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new RedisCommanderResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + 'Aspire.Hosting/onResourceStopped', rpcArgs ); return new RedisCommanderResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + 'Aspire.Hosting/onInitializeResource', rpcArgs ); return new RedisCommanderResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); return new RedisCommanderResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): RedisCommanderResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new RedisCommanderResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); + return new RedisCommanderResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -15985,31 +19563,21 @@ export class RedisCommanderResourcePromise implements PromiseLike obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): RedisCommanderResourcePromise { return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -16040,16 +19608,6 @@ export class RedisCommanderResourcePromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): RedisCommanderResourcePromise { return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -16255,6 +19813,31 @@ export class RedisCommanderResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + /** Sets the host port for Redis Commander */ withHostPort(options?: WithHostPortOptions): RedisCommanderResourcePromise { return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHostPort(options))); @@ -16478,7 +20061,7 @@ export class RedisInsightResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); return new RedisInsightResource(result, this._client); @@ -16493,7 +20076,7 @@ export class RedisInsightResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); return new RedisInsightResource(result, this._client); @@ -16635,41 +20218,11 @@ export class RedisInsightResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new RedisInsightResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new RedisInsightResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -16680,43 +20233,38 @@ export class RedisInsightResource extends ResourceBuilderBase Promise): RedisInsightResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { return new RedisInsightResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new RedisInsightResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new RedisInsightResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -16805,10 +20353,11 @@ export class RedisInsightResource extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -16820,37 +20369,8 @@ export class RedisInsightResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new RedisInsightResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new RedisInsightResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new RedisInsightResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -17150,7 +20670,7 @@ export class RedisInsightResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new RedisInsightResource(result, this._client); @@ -17180,7 +20700,7 @@ export class RedisInsightResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new RedisInsightResource(result, this._client); @@ -17226,7 +20746,7 @@ export class RedisInsightResource extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new RedisInsightResource(result, this._client); @@ -17331,7 +20851,7 @@ export class RedisInsightResource extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new RedisInsightResource(result, this._client); @@ -17362,7 +20882,7 @@ export class RedisInsightResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new RedisInsightResource(result, this._client); @@ -17377,7 +20897,7 @@ export class RedisInsightResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new RedisInsightResource(result, this._client); @@ -17480,99 +21000,199 @@ export class RedisInsightResource extends ResourceBuilderBase Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisInsightResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new RedisInsightResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisInsightResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + 'Aspire.Hosting/onResourceStopped', rpcArgs ); return new RedisInsightResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisInsightResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new RedisInsightResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + 'Aspire.Hosting/onInitializeResource', rpcArgs ); return new RedisInsightResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); return new RedisInsightResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', + 'Aspire.Hosting/onResourceReady', rpcArgs ); return new RedisInsightResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new RedisInsightResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); - } - - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -17756,31 +21376,21 @@ export class RedisInsightResourcePromise implements PromiseLike obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): RedisInsightResourcePromise { return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -17811,16 +21421,6 @@ export class RedisInsightResourcePromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): RedisInsightResourcePromise { return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -18026,6 +21626,31 @@ export class RedisInsightResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + /** Sets the host port for Redis Insight */ withHostPort(options?: WithHostPortOptions): RedisInsightResourcePromise { return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHostPort(options))); @@ -18085,6 +21710,17 @@ export class RedisResource extends ResourceBuilderBase { }, }; + /** Gets the PasswordParameter property */ + passwordParameter = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.passwordParameter', + { context: this._handle } + ); + return new ParameterResource(handle, this._client); + }, + }; + /** Gets the TlsEnabled property */ tlsEnabled = { get: async (): Promise => { @@ -18093,12 +21729,6 @@ export class RedisResource extends ResourceBuilderBase { { context: this._handle } ); }, - set: async (value: boolean): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.setTlsEnabled', - { context: this._handle, value } - ); - } }; /** Gets the ConnectionStringExpression property */ @@ -18370,7 +22000,7 @@ export class RedisResource extends ResourceBuilderBase { private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); return new RedisResource(result, this._client); @@ -18385,7 +22015,7 @@ export class RedisResource extends ResourceBuilderBase { private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); return new RedisResource(result, this._client); @@ -18527,41 +22157,11 @@ export class RedisResource extends ResourceBuilderBase { } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new RedisResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new RedisResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -18572,43 +22172,38 @@ export class RedisResource extends ResourceBuilderBase { } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { return new RedisResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new RedisResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new RedisResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -18727,10 +22322,11 @@ export class RedisResource extends ResourceBuilderBase { } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -18742,37 +22338,17 @@ export class RedisResource extends ResourceBuilderBase { withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new RedisResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new RedisResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._withServiceReferenceInternal(source)); + const name = options?.name; + return new RedisResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', rpcArgs ); - return new RedisResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisResourcePromise { - return new RedisResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } /** @internal */ @@ -19072,7 +22648,7 @@ export class RedisResource extends ResourceBuilderBase { private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new RedisResource(result, this._client); @@ -19102,7 +22678,7 @@ export class RedisResource extends ResourceBuilderBase { private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new RedisResource(result, this._client); @@ -19148,7 +22724,7 @@ export class RedisResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new RedisResource(result, this._client); @@ -19253,7 +22829,7 @@ export class RedisResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new RedisResource(result, this._client); @@ -19284,7 +22860,7 @@ export class RedisResource extends ResourceBuilderBase { private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new RedisResource(result, this._client); @@ -19299,7 +22875,7 @@ export class RedisResource extends ResourceBuilderBase { private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new RedisResource(result, this._client); @@ -19464,37 +23040,157 @@ export class RedisResource extends ResourceBuilderBase { return new RedisResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onConnectionStringAvailableInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', + 'Aspire.Hosting/onResourceReady', rpcArgs ); return new RedisResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new RedisResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); - } - - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -19764,31 +23460,21 @@ export class RedisResourcePromise implements PromiseLike { return new RedisResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): RedisResourcePromise { return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -19829,14 +23515,9 @@ export class RedisResourcePromise implements PromiseLike { return new RedisResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } /** Adds a reference to a URI */ @@ -20044,6 +23725,36 @@ export class RedisResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + /** Adds Redis Commander management UI */ withRedisCommander(options?: WithRedisCommanderOptions): RedisResourcePromise { return new RedisResourcePromise(this._promise.then(obj => obj.withRedisCommander(options))); @@ -20286,41 +23997,11 @@ export class ViteAppResource extends ResourceBuilderBase } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ViteAppResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ViteAppResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -20331,43 +24012,38 @@ export class ViteAppResource extends ResourceBuilderBase } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { return new ViteAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new ViteAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ViteAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -20456,10 +24132,11 @@ export class ViteAppResource extends ResourceBuilderBase } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -20471,37 +24148,8 @@ export class ViteAppResource extends ResourceBuilderBase withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new ViteAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ViteAppResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ViteAppResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ViteAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -20831,7 +24479,7 @@ export class ViteAppResource extends ResourceBuilderBase private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ViteAppResource(result, this._client); @@ -20861,7 +24509,7 @@ export class ViteAppResource extends ResourceBuilderBase private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ViteAppResource(result, this._client); @@ -20907,7 +24555,7 @@ export class ViteAppResource extends ResourceBuilderBase const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ViteAppResource(result, this._client); @@ -21012,7 +24660,7 @@ export class ViteAppResource extends ResourceBuilderBase const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ViteAppResource(result, this._client); @@ -21043,7 +24691,7 @@ export class ViteAppResource extends ResourceBuilderBase private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new ViteAppResource(result, this._client); @@ -21058,7 +24706,7 @@ export class ViteAppResource extends ResourceBuilderBase private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new ViteAppResource(result, this._client); @@ -21237,6 +24885,106 @@ export class ViteAppResource extends ResourceBuilderBase ); } + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceReadyInternal(callback)); + } + /** @internal */ private async _withViteConfigInternal(configPath: string): Promise { const rpcArgs: Record = { builder: this._handle, configPath }; @@ -21364,21 +25112,6 @@ export class ViteAppResource extends ResourceBuilderBase return new ViteAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } - /** @internal */ - private async _withDebuggingInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.JavaScript/withDebugging', - rpcArgs - ); - return new ViteAppResource(result, this._client); - } - - /** Enables debugging support for a JavaScript application */ - withDebugging(): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._withDebuggingInternal()); - } - /** @internal */ private async _withBrowserDebuggerInternal(browser?: string): Promise { const rpcArgs: Record = { builder: this._handle }; @@ -21390,7 +25123,7 @@ export class ViteAppResource extends ResourceBuilderBase return new ViteAppResource(result, this._client); } - /** Configures browser debugging support */ + /** Configures a browser debugger for the JavaScript application */ withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { const browser = options?.browser; return new ViteAppResourcePromise(this._withBrowserDebuggerInternal(browser)); @@ -21463,31 +25196,21 @@ export class ViteAppResourcePromise implements PromiseLike { return new ViteAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -21518,16 +25241,6 @@ export class ViteAppResourcePromise implements PromiseLike { return new ViteAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ViteAppResourcePromise { return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -21738,6 +25451,31 @@ export class ViteAppResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + /** Configures a custom Vite configuration file */ withViteConfig(configPath: string): ViteAppResourcePromise { return new ViteAppResourcePromise(this._promise.then(obj => obj.withViteConfig(configPath))); @@ -21763,24 +25501,87 @@ export class ViteAppResourcePromise implements PromiseLike { return new ViteAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); } - /** Specifies an npm script to run before starting the application */ - withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + +} + +// ============================================================================ +// ComputeResource +// ============================================================================ + +export class ComputeResource extends ResourceBuilderBase { + constructor(handle: IComputeResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Specifies an npm script to run during development */ - withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); +} + +/** + * Thenable wrapper for ComputeResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ComputeResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ComputeResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Enables debugging support for a JavaScript application */ - withDebugging(): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withDebugging())); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Configures browser debugging support */ - withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } } @@ -21798,7 +25599,7 @@ export class ContainerFilesDestinationResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); return new ContainerFilesDestinationResource(result, this._client); @@ -22057,7 +25858,7 @@ export class Resource extends ResourceBuilderBase { private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new Resource(result, this._client); @@ -22072,7 +25873,7 @@ export class Resource extends ResourceBuilderBase { private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new Resource(result, this._client); @@ -22115,36 +25916,6 @@ export class Resource extends ResourceBuilderBase { return new ResourcePromise(this._excludeFromMcpInternal()); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -22222,6 +25993,86 @@ export class Resource extends ResourceBuilderBase { ); } + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -22319,16 +26170,6 @@ export class ResourcePromise implements PromiseLike { return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); @@ -22349,6 +26190,26 @@ export class ResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -22488,6 +26349,35 @@ export class ResourceWithConnectionString extends ResourceBuilderBase { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._onConnectionStringAvailableInternal(callback)); + } + } /** @@ -22515,6 +26405,16 @@ export class ResourceWithConnectionStringPromise implements PromiseLike obj.withConnectionPropertyValue(name, value))); } + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + } // ============================================================================ @@ -22803,6 +26703,26 @@ export class ResourceWithEndpoints extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + } /** @@ -22870,6 +26790,11 @@ export class ResourceWithEndpointsPromise implements PromiseLike obj.withHttpProbe(probeType, options))); } + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + } // ============================================================================ @@ -22912,41 +26837,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -22957,43 +26852,38 @@ export class ResourceWithEnvironment extends ResourceBuilderBase Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -23027,10 +26917,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -23042,37 +26933,8 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -23155,7 +27017,7 @@ export class ResourceWithEnvironment extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ResourceWithEnvironment(result, this._client); @@ -23209,31 +27071,21 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withOtlpExporterProtocol(protocol))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -23249,16 +27101,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -23296,34 +27138,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike { - constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { - super(handle, client); - } - -} - -/** - * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ResourceWithServiceDiscoveryPromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - -} - // ============================================================================ // ResourceWithWaitSupport // ============================================================================ @@ -23337,7 +27151,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -23367,7 +27181,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -23398,7 +27212,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -23517,7 +27331,7 @@ export async function createBuilder(options?: CreateBuilderOptions): Promise { const error = reason instanceof Error ? reason : new Error(String(reason)); - if (reason instanceof CapabilityError) { + if (reason instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else if (reason instanceof CapabilityError) { console.error(`\n❌ Capability Error: ${error.message}`); console.error(` Code: ${(reason as CapabilityError).code}`); if ((reason as CapabilityError).capability) { @@ -23548,8 +27364,12 @@ process.on('unhandledRejection', (reason: unknown) => { }); process.on('uncaughtException', (error: Error) => { - console.error(`\n❌ Uncaught Exception: ${error.message}`); - if (error.stack) { + if (error instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + } + if (!(error instanceof AppHostUsageError) && error.stack) { console.error(error.stack); } process.exit(1); @@ -23560,21 +27380,44 @@ process.on('uncaughtException', (error: Error) => { // ============================================================================ // Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent', (handle, client) => new AfterResourcesCreatedEvent(handle as AfterResourcesCreatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent', (handle, client) => new BeforeResourceStartedEvent(handle as BeforeResourceStartedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent', (handle, client) => new BeforeStartEvent(handle as BeforeStartEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent', (handle, client) => new ConnectionStringAvailableEvent(handle as ConnectionStringAvailableEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel', (handle, client) => new DistributedApplicationModel(handle as DistributedApplicationModelHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent', (handle, client) => new InitializeResourceEvent(handle as InitializeResourceEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext', (handle, client) => new PipelineContext(handle as PipelineContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext', (handle, client) => new PipelineStepFactoryContext(handle as PipelineStepFactoryContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary', (handle, client) => new PipelineSummary(handle as PipelineSummaryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent', (handle, client) => new ResourceEndpointsAllocatedEvent(handle as ResourceEndpointsAllocatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService', (handle, client) => new ResourceLoggerService(handle as ResourceLoggerServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService', (handle, client) => new ResourceNotificationService(handle as ResourceNotificationServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent', (handle, client) => new ResourceReadyEvent(handle as ResourceReadyEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent', (handle, client) => new ResourceStoppedEvent(handle as ResourceStoppedEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext', (handle, client) => new UpdateCommandStateContext(handle as UpdateCommandStateContextHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration', (handle, client) => new Configuration(handle as IConfigurationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment', (handle, client) => new HostEnvironment(handle as IHostEnvironmentHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger', (handle, client) => new Logger(handle as ILoggerHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory', (handle, client) => new LoggerFactory(handle as ILoggerFactoryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep', (handle, client) => new ReportingStep(handle as IReportingStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask', (handle, client) => new ReportingTask(handle as IReportingTaskHandle, client)); +registerHandleWrapper('System.ComponentModel/System.IServiceProvider', (handle, client) => new ServiceProvider(handle as IServiceProviderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IUserSecretsManager', (handle, client) => new UserSecretsManager(handle as IUserSecretsManagerHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); @@ -23590,6 +27433,7 @@ registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisCommanderR registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisInsightResource', (handle, client) => new RedisInsightResource(handle as RedisInsightResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.ApplicationModel.RedisResource', (handle, client) => new RedisResource(handle as RedisResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource', (handle, client) => new ViteAppResource(handle as ViteAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource', (handle, client) => new ComputeResource(handle as IComputeResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); @@ -23597,6 +27441,5 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceW registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); diff --git a/samples/aspire-with-node/ts/.modules/base.ts b/samples/aspire-with-node/ts/.modules/base.ts index 7778b0f1..b3d8b8be 100644 --- a/samples/aspire-with-node/ts/.modules/base.ts +++ b/samples/aspire-with-node/ts/.modules/base.ts @@ -1,8 +1,8 @@ -// aspire.ts - Core Aspire types: base classes, ReferenceExpression -import { Handle, AspireClient, MarshalledHandle } from './transport.js'; +// base.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle, CancellationToken, registerCancellation, registerHandleWrapper, unregisterCancellation } from './transport.js'; // Re-export transport types for convenience -export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export { Handle, AspireClient, CapabilityError, CancellationToken, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; @@ -43,22 +43,46 @@ export class ReferenceExpression { private readonly _format?: string; private readonly _valueProviders?: unknown[]; + // Conditional mode fields + private readonly _condition?: unknown; + private readonly _whenTrue?: ReferenceExpression; + private readonly _whenFalse?: ReferenceExpression; + private readonly _matchValue?: string; + // Handle mode fields (when wrapping a server-returned handle) private readonly _handle?: Handle; private readonly _client?: AspireClient; constructor(format: string, valueProviders: unknown[]); constructor(handle: Handle, client: AspireClient); - constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { - if (typeof handleOrFormat === 'string') { - this._format = handleOrFormat; - this._valueProviders = clientOrValueProviders as unknown[]; + constructor(condition: unknown, matchValue: string, whenTrue: ReferenceExpression, whenFalse: ReferenceExpression); + constructor( + handleOrFormatOrCondition: Handle | string | unknown, + clientOrValueProvidersOrMatchValue: AspireClient | unknown[] | string, + whenTrueOrWhenFalse?: ReferenceExpression, + whenFalse?: ReferenceExpression + ) { + if (typeof handleOrFormatOrCondition === 'string') { + this._format = handleOrFormatOrCondition; + this._valueProviders = clientOrValueProvidersOrMatchValue as unknown[]; + } else if (handleOrFormatOrCondition instanceof Handle) { + this._handle = handleOrFormatOrCondition; + this._client = clientOrValueProvidersOrMatchValue as AspireClient; } else { - this._handle = handleOrFormat; - this._client = clientOrValueProviders as AspireClient; + this._condition = handleOrFormatOrCondition; + this._matchValue = (clientOrValueProvidersOrMatchValue as string) ?? 'True'; + this._whenTrue = whenTrueOrWhenFalse; + this._whenFalse = whenFalse; } } + /** + * Gets whether this reference expression is conditional. + */ + get isConditional(): boolean { + return this._condition !== undefined; + } + /** * Creates a reference expression from a tagged template literal. * @@ -82,16 +106,46 @@ export class ReferenceExpression { return new ReferenceExpression(format, valueProviders); } + /** + * Creates a conditional reference expression from its constituent parts. + * + * @param condition - A value provider whose result is compared to matchValue + * @param whenTrue - The expression to use when the condition matches + * @param whenFalse - The expression to use when the condition does not match + * @param matchValue - The value to compare the condition against (defaults to "True") + * @returns A ReferenceExpression instance in conditional mode + */ + static createConditional( + condition: unknown, + matchValue: string, + whenTrue: ReferenceExpression, + whenFalse: ReferenceExpression + ): ReferenceExpression { + return new ReferenceExpression(condition, matchValue, whenTrue, whenFalse); + } + /** * Serializes the reference expression for JSON-RPC transport. - * In template-literal mode, uses the $expr format. + * In expression mode, uses the $expr format with format + valueProviders. + * In conditional mode, uses the $expr format with condition + whenTrue + whenFalse. * In handle mode, delegates to the handle's serialization. */ - toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } | { condition: unknown; whenTrue: unknown; whenFalse: unknown; matchValue: string } } | MarshalledHandle { if (this._handle) { return this._handle.toJSON(); } + if (this.isConditional) { + return { + $expr: { + condition: extractHandleForExpr(this._condition), + whenTrue: this._whenTrue!.toJSON(), + whenFalse: this._whenFalse!.toJSON(), + matchValue: this._matchValue! + } + }; + } + return { $expr: { format: this._format!, @@ -100,6 +154,30 @@ export class ReferenceExpression { }; } + /** + * Resolves the expression to its string value on the server. + * Only available on server-returned ReferenceExpression instances (handle mode). + * + * @param cancellationToken - Optional AbortSignal or CancellationToken for cancellation support + * @returns The resolved string value, or null if the expression resolves to null + */ + async getValue(cancellationToken?: AbortSignal | CancellationToken): Promise { + if (!this._handle || !this._client) { + throw new Error('getValue is only available on server-returned ReferenceExpression instances'); + } + const cancellationTokenId = registerCancellation(this._client, cancellationToken); + try { + const rpcArgs: Record = { context: this._handle }; + if (cancellationTokenId !== undefined) rpcArgs.cancellationToken = cancellationTokenId; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValue', + rpcArgs + ); + } finally { + unregisterCancellation(cancellationTokenId); + } + } + /** * String representation for debugging. */ @@ -107,10 +185,17 @@ export class ReferenceExpression { if (this._handle) { return `ReferenceExpression(handle)`; } + if (this.isConditional) { + return `ReferenceExpression(conditional)`; + } return `ReferenceExpression(${this._format})`; } } +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression', (handle, client) => + new ReferenceExpression(handle, client) +); + /** * Extracts a value for use in reference expressions. * Supports handles (objects) and string literals. @@ -136,15 +221,15 @@ function extractHandleForExpr(value: unknown): unknown { return value.toJSON(); } - // Objects with $handle property (already in handle format) - if (typeof value === 'object' && value !== null && '$handle' in value) { + // Objects with marshalled expression/handle payloads + if (typeof value === 'object' && value !== null && ('$handle' in value || '$expr' in value)) { return value; } - // Objects with toJSON that returns a handle + // Objects with toJSON that returns a marshalled expression or handle if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { const json = value.toJSON(); - if (json && typeof json === 'object' && '$handle' in json) { + if (json && typeof json === 'object' && ('$handle' in json || '$expr' in json)) { return json; } } @@ -307,11 +392,20 @@ export class AspireList { }) as T[]; } - toJSON(): MarshalledHandle { - if (this._resolvedHandle) { - return this._resolvedHandle.toJSON(); + async toTransportValue(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireList must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); } - return this._handleOrContext.toJSON(); + + return this._resolvedHandle.toJSON(); } } @@ -466,8 +560,19 @@ export class AspireDict { }) as Record; } - async toJSON(): Promise { + async toTransportValue(): Promise { const handle = await this._ensureHandle(); return handle.toJSON(); } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireDict must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); + } + + return this._resolvedHandle.toJSON(); + } } diff --git a/samples/aspire-with-node/ts/.modules/transport.ts b/samples/aspire-with-node/ts/.modules/transport.ts index 7bddd74b..6d29cf28 100644 --- a/samples/aspire-with-node/ts/.modules/transport.ts +++ b/samples/aspire-with-node/ts/.modules/transport.ts @@ -77,7 +77,8 @@ export function isAtsError(value: unknown): value is { $error: AtsError } { value !== null && typeof value === 'object' && '$error' in value && - typeof (value as { $error: unknown }).$error === 'object' + typeof (value as { $error: unknown }).$error === 'object' && + (value as { $error: unknown }).$error !== null ); } @@ -93,6 +94,47 @@ export function isMarshalledHandle(value: unknown): value is MarshalledHandle { ); } +function isAbortSignal(value: unknown): value is AbortSignal { + return ( + value !== null && + typeof value === 'object' && + 'aborted' in value && + 'addEventListener' in value && + 'removeEventListener' in value + ); +} + +function isPlainObject(value: unknown): value is Record { + if (value === null || typeof value !== 'object') { + return false; + } + + const prototype = Object.getPrototypeOf(value); + return prototype === Object.prototype || prototype === null; +} + +function hasTransportValue(value: unknown): value is { toTransportValue(): unknown | Promise } { + return ( + value !== null && + typeof value === 'object' && + 'toTransportValue' in value && + typeof (value as { toTransportValue?: unknown }).toTransportValue === 'function' + ); +} + +function createAbortError(message: string): Error { + const error = new Error(message); + error.name = 'AbortError'; + return error; +} + +function createCircularReferenceError(capabilityId: string, path: string): AppHostUsageError { + return new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' contains a circular reference. ` + + 'Circular references are not supported by the AppHost transport.' + ); +} + // ============================================================================ // Handle // ============================================================================ @@ -136,6 +178,92 @@ export class Handle { } } +// ============================================================================ +// CancellationToken +// ============================================================================ + +/** + * Represents a transport-safe cancellation token value for the generated SDK. + * + * Use a plain {@link AbortSignal} when you create cancellation in user code. + * Generated APIs accept either an {@link AbortSignal} or a {@link CancellationToken}. + * + * Values returned from generated callbacks and context/property getters are + * {@link CancellationToken} instances because they may reference remote + * cancellation token handles received from the AppHost. + * + * @example + * ```typescript + * const controller = new AbortController(); + * await connectionStringExpression.getValue(controller.signal); + * ``` + * + * @example + * ```typescript + * const cancellationToken = await context.cancellationToken.get(); + * const connectionStringExpression = await db.uriExpression.get(); + * const connectionString = await connectionStringExpression.getValue(cancellationToken); + * ``` + */ +export class CancellationToken { + private readonly _signal?: AbortSignal; + private readonly _remoteTokenId?: string; + + constructor(signal?: AbortSignal); + constructor(tokenId?: string); + constructor(value?: AbortSignal | string | null) { + if (typeof value === 'string') { + this._remoteTokenId = value; + } else if (isAbortSignal(value)) { + this._signal = value; + } + } + + /** + * Creates a cancellation token from a local {@link AbortSignal}. + */ + static from(signal?: AbortSignal): CancellationToken { + return new CancellationToken(signal); + } + + /** + * Creates a cancellation token from a transport value. + * Generated code uses this to materialize values that come from the AppHost. + */ + static fromValue(value: unknown): CancellationToken { + if (value instanceof CancellationToken) { + return value; + } + + if (typeof value === 'string') { + return new CancellationToken(value); + } + + if (isAbortSignal(value)) { + return new CancellationToken(value); + } + + return new CancellationToken(); + } + + /** + * Serializes the token for JSON-RPC transport. + */ + toJSON(): string | undefined { + return this._remoteTokenId; + } + + register(client?: AspireClient): string | undefined { + if (this._remoteTokenId !== undefined) { + return this._remoteTokenId; + } + + return client + ? registerCancellation(client, this._signal) + : registerCancellation(this._signal); + } +} + // ============================================================================ // Handle Wrapper Registry // ============================================================================ @@ -167,22 +295,35 @@ export function registerHandleWrapper(typeId: string, factory: HandleWrapperFact * @param client - Optional client for creating typed wrapper instances */ export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { - if (value && typeof value === 'object') { - if (isMarshalledHandle(value)) { - const handle = new Handle(value); - const typeId = value.$type; - - // Try to find a registered wrapper factory for this type - if (typeId && client) { - const factory = handleWrapperRegistry.get(typeId); - if (factory) { - return factory(handle, client); - } + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); } + } + + return handle; + } - return handle; + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + value[i] = wrapIfHandle(value[i], client); + } + + return value; + } + + if (isPlainObject(value)) { + for (const [key, nestedValue] of Object.entries(value)) { + value[key] = wrapIfHandle(nestedValue, client); } } + return value; } @@ -213,6 +354,76 @@ export class CapabilityError extends Error { } } +/** + * Error thrown when the AppHost script uses the generated SDK incorrectly. + */ +export class AppHostUsageError extends Error { + constructor(message: string) { + super(message); + this.name = 'AppHostUsageError'; + } +} + +function isPromiseLike(value: unknown): value is PromiseLike { + return ( + value !== null && + (typeof value === 'object' || typeof value === 'function') && + 'then' in value && + typeof (value as { then?: unknown }).then === 'function' + ); +} + +function validateCapabilityArgs( + capabilityId: string, + args?: Record +): void { + if (!args) { + return; + } + + const validateValue = (value: unknown, path: string, ancestors: Set): void => { + if (value === null || value === undefined) { + return; + } + + if (isPromiseLike(value)) { + throw new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' is a Promise-like value. ` + + `This usually means an async builder call was not awaited. ` + + `Did you forget 'await' on a call like builder.addPostgres(...) or resource.addDatabase(...)?` + ); + } + + if (typeof value !== 'object') { + return; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + ancestors.add(value); + try { + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + validateValue(value[i], `${path}[${i}]`, ancestors); + } + return; + } + + for (const [key, nestedValue] of Object.entries(value)) { + validateValue(nestedValue, `${path}.${key}`, ancestors); + } + } finally { + ancestors.delete(value); + } + }; + + for (const [key, value] of Object.entries(args)) { + validateValue(value, key, new Set()); + } +} + // ============================================================================ // Callback Registry // ============================================================================ @@ -324,21 +535,50 @@ export function getCallbackCount(): number { */ const cancellationRegistry = new Map void>(); let cancellationIdCounter = 0; +const connectedClients = new Set(); -/** - * A reference to the current AspireClient for sending cancel requests. - * Set by AspireClient.connect(). - */ -let currentClient: AspireClient | null = null; +function resolveCancellationClient(client?: AspireClient): AspireClient { + if (client) { + return client; + } + + if (connectedClients.size === 1) { + return connectedClients.values().next().value as AspireClient; + } + + if (connectedClients.size === 0) { + throw new Error( + 'registerCancellation(signal) requires a connected AspireClient. ' + + 'Pass the client explicitly or connect the client first.' + ); + } + + throw new Error( + 'registerCancellation(signal) is ambiguous when multiple AspireClient instances are connected. ' + + 'Pass the client explicitly.' + ); +} /** - * Register an AbortSignal for cancellation support. - * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * Registers cancellation support for a local signal or SDK cancellation token. + * Returns a cancellation ID that should be passed to methods accepting cancellation input. * * When the AbortSignal is aborted, sends a cancelToken request to the host. * - * @param signal - The AbortSignal to register (optional) - * @returns The cancellation ID, or undefined if no signal provided + * @param client - The AspireClient that should route the cancellation request + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + */ +export function registerCancellation(client: AspireClient, signalOrToken?: AbortSignal | CancellationToken): string | undefined; +/** + * Registers cancellation support using the single connected AspireClient. + * + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + * + * @example + * const controller = new AbortController(); + * await expression.getValue(controller.signal); * * @example * const controller = new AbortController(); @@ -346,14 +586,29 @@ let currentClient: AspireClient | null = null; * // Pass id to capability invocation * // Later: controller.abort() will cancel the operation */ -export function registerCancellation(signal?: AbortSignal): string | undefined { - if (!signal) { +export function registerCancellation(signalOrToken?: AbortSignal | CancellationToken): string | undefined; +export function registerCancellation( + clientOrSignalOrToken?: AspireClient | AbortSignal | CancellationToken, + maybeSignalOrToken?: AbortSignal | CancellationToken +): string | undefined { + const client = clientOrSignalOrToken instanceof AspireClient ? clientOrSignalOrToken : undefined; + const signalOrToken = client + ? maybeSignalOrToken + : clientOrSignalOrToken as AbortSignal | CancellationToken | undefined; + + if (!signalOrToken) { return undefined; } - // Already aborted? Don't register + if (signalOrToken instanceof CancellationToken) { + return signalOrToken.register(client); + } + + const signal = signalOrToken; + const cancellationClient = resolveCancellationClient(client); + if (signal.aborted) { - return undefined; + throw createAbortError('The operation was aborted before it was sent to the AppHost.'); } const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; @@ -361,8 +616,8 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { // Set up the abort listener const onAbort = () => { // Send cancel request to host - if (currentClient?.connected) { - currentClient.cancelToken(cancellationId).catch(() => { + if (cancellationClient.connected) { + cancellationClient.cancelToken(cancellationId).catch(() => { // Ignore errors - the operation may have already completed }); } @@ -381,6 +636,56 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { return cancellationId; } +async function marshalTransportValue( + value: unknown, + client: AspireClient, + cancellationIds: string[], + capabilityId: string, + path: string = 'args', + ancestors: Set = new Set() +): Promise { + if (value === null || value === undefined || typeof value !== 'object') { + return value; + } + + if (value instanceof CancellationToken) { + const cancellationId = value.register(client); + if (cancellationId !== undefined) { + cancellationIds.push(cancellationId); + } + + return cancellationId; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + const nextAncestors = new Set(ancestors); + nextAncestors.add(value); + + if (hasTransportValue(value)) { + return await marshalTransportValue(await value.toTransportValue(), client, cancellationIds, capabilityId, path, nextAncestors); + } + + if (Array.isArray(value)) { + return await Promise.all( + value.map((item, index) => marshalTransportValue(item, client, cancellationIds, capabilityId, `${path}[${index}]`, nextAncestors)) + ); + } + + if (isPlainObject(value)) { + const entries = await Promise.all( + Object.entries(value).map(async ([key, nestedValue]) => + [key, await marshalTransportValue(nestedValue, client, cancellationIds, capabilityId, `${path}.${key}`, nextAncestors)] as const) + ); + + return Object.fromEntries(entries); + } + + return value; +} + /** * Unregister a cancellation token by its ID. * Call this when the operation completes to clean up resources. @@ -411,6 +716,8 @@ export class AspireClient { private socket: net.Socket | null = null; private disconnectCallbacks: (() => void)[] = []; private _pendingCalls = 0; + private _connectPromise: Promise | null = null; + private _disconnectNotified = false; constructor(private socketPath: string) { } @@ -422,6 +729,12 @@ export class AspireClient { } private notifyDisconnect(): void { + if (this._disconnectNotified) { + return; + } + + this._disconnectNotified = true; + for (const callback of this.disconnectCallbacks) { try { callback(); @@ -432,30 +745,106 @@ export class AspireClient { } connect(timeoutMs: number = 5000): Promise { - return new Promise((resolve, reject) => { - const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + if (this.connected) { + return Promise.resolve(); + } + + if (this._connectPromise) { + return this._connectPromise; + } + + this._disconnectNotified = false; + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this._connectPromise = new Promise((resolve, reject) => { + const socket = net.createConnection(pipePath); + this.socket = socket; - // On Windows, use named pipes; on Unix, use Unix domain sockets - const isWindows = process.platform === 'win32'; - const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + let settled = false; - this.socket = net.createConnection(pipePath); + const cleanupPendingListeners = () => { + socket.removeListener('connect', onConnect); + socket.removeListener('error', onPendingError); + socket.removeListener('close', onPendingClose); + }; - this.socket.once('error', (error: Error) => { + const failConnect = (error: Error) => { + if (settled) { + return; + } + + settled = true; clearTimeout(timeout); + cleanupPendingListeners(); + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + if (!socket.destroyed) { + socket.destroy(); + } + reject(error); - }); + }; + + const onConnectedSocketError = (error: Error) => { + console.error('Socket error:', error); + }; + + const onConnectedSocketClose = () => { + socket.removeListener('error', onConnectedSocketError); + + if (this.socket && this.socket !== socket) { + return; + } + + const connection = this.connection; + this.connection = null; + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + this.notifyDisconnect(); + }; + + const onPendingError = (error: Error) => { + failConnect(error); + }; + + const onPendingClose = () => { + failConnect(new Error('Connection closed before JSON-RPC was established')); + }; + + const onConnect = async () => { + if (settled) { + return; + } - this.socket.once('connect', () => { clearTimeout(timeout); + cleanupPendingListeners(); + try { - const reader = new rpc.SocketMessageReader(this.socket!); - const writer = new rpc.SocketMessageWriter(this.socket!); + const reader = new rpc.SocketMessageReader(socket); + const writer = new rpc.SocketMessageWriter(socket); this.connection = rpc.createMessageConnection(reader, writer); this.connection.onClose(() => { this.connection = null; - this.notifyDisconnect(); }); this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); @@ -475,26 +864,39 @@ export class AspireClient { } }); + socket.on('error', onConnectedSocketError); + socket.on('close', onConnectedSocketClose); + + const authToken = process.env.ASPIRE_REMOTE_APPHOST_TOKEN; + if (!authToken) { + throw new Error('ASPIRE_REMOTE_APPHOST_TOKEN environment variable is not set.'); + } this.connection.listen(); + const authenticated = await this.connection.sendRequest('authenticate', authToken); + if (!authenticated) { + throw new Error('Failed to authenticate to the AppHost server.'); + } - // Set the current client for cancellation registry - currentClient = this; + connectedClients.add(this); + this._connectPromise = null; + settled = true; resolve(); - } catch (e) { - reject(e); + } catch (error) { + failConnect(error instanceof Error ? error : new Error(String(error))); } - }); + }; - this.socket.on('close', () => { - this.connection?.dispose(); - this.connection = null; - if (currentClient === this) { - currentClient = null; - } - this.notifyDisconnect(); - }); + const timeout = setTimeout(() => { + failConnect(new Error('Connection timeout')); + }, timeoutMs); + + socket.once('error', onPendingError); + socket.once('close', onPendingClose); + socket.once('connect', onConnect); }); + + return this._connectPromise; } ping(): Promise { @@ -533,39 +935,66 @@ export class AspireClient { throw new Error('Not connected to AppHost'); } - // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. - // We ref() during RPC calls so the process doesn't exit mid-call, and - // unref() when idle so the process can exit naturally after all work completes. - if (this._pendingCalls === 0) { - this.socket?.ref(); - } - this._pendingCalls++; + validateCapabilityArgs(capabilityId, args); + const cancellationIds: string[] = []; try { - const result = await this.connection.sendRequest( - 'invokeCapability', - capabilityId, - args ?? null - ); + const rpcArgs = await marshalTransportValue(args ?? null, this, cancellationIds, capabilityId); - // Check for structured error response - if (isAtsError(result)) { - throw new CapabilityError(result.$error); + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); } + this._pendingCalls++; - // Wrap handles automatically - return wrapIfHandle(result, this) as T; + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + rpcArgs + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } } finally { - this._pendingCalls--; - if (this._pendingCalls === 0) { - this.socket?.unref(); + for (const cancellationId of cancellationIds) { + unregisterCancellation(cancellationId); } } } disconnect(): void { - try { this.connection?.dispose(); } finally { this.connection = null; } - try { this.socket?.end(); } finally { this.socket = null; } + const connection = this.connection; + const socket = this.socket; + + this.connection = null; + this.socket = null; + this._connectPromise = null; + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + if (socket && !socket.destroyed) { + socket.end(); + socket.destroy(); + } } get connected(): boolean { diff --git a/samples/aspire-with-node/ts/apphost.ts b/samples/aspire-with-node/ts/apphost.ts index c900b535..3f803917 100644 --- a/samples/aspire-with-node/ts/apphost.ts +++ b/samples/aspire-with-node/ts/apphost.ts @@ -18,7 +18,7 @@ await builder.addNodeApp("frontend", "../NodeFrontend", "./app.js") .withHttpHealthCheck({ path: "/health" }) - .withServiceReference(weatherapi).waitFor(weatherapi) + .withReference(weatherapi).waitFor(weatherapi) .withReference(cache).waitFor(cache); await builder.build().run(); diff --git a/samples/aspire-with-node/ts/apphost.run.json b/samples/aspire-with-node/ts/aspire.config.json similarity index 62% rename from samples/aspire-with-node/ts/apphost.run.json rename to samples/aspire-with-node/ts/aspire.config.json index 0acb796c..7e06a4ea 100644 --- a/samples/aspire-with-node/ts/apphost.run.json +++ b/samples/aspire-with-node/ts/aspire.config.json @@ -1,4 +1,12 @@ { + "appHost": { + "path": "apphost.ts", + "language": "typescript/nodejs" + }, + "packages": { + "Aspire.Hosting.JavaScript": "13.2.0", + "Aspire.Hosting.Redis": "13.2.0" + }, "profiles": { "https": { "applicationUrl": "https://localhost:63189;http://localhost:12348", @@ -8,4 +16,4 @@ } } } -} \ No newline at end of file +} diff --git a/samples/aspire-with-python/ts/.aspire/settings.json b/samples/aspire-with-python/ts/.aspire/settings.json deleted file mode 100644 index 740f2867..00000000 --- a/samples/aspire-with-python/ts/.aspire/settings.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "appHostPath": "../apphost.ts", - "language": "typescript/nodejs", - "channel": "staging", - "sdkVersion": "13.2.0-preview.1.26159.1", - "packages": { - "Aspire.Hosting.JavaScript": "13.2.0-preview.1.26159.1", - "Aspire.Hosting.Python": "13.2.0-preview.1.26159.1", - "Aspire.Hosting.Redis": "13.2.0-preview.1.26159.1" - } -} \ No newline at end of file diff --git a/samples/aspire-with-python/ts/.modules/.codegen-hash b/samples/aspire-with-python/ts/.modules/.codegen-hash index ed9b5088..585f3079 100644 --- a/samples/aspire-with-python/ts/.modules/.codegen-hash +++ b/samples/aspire-with-python/ts/.modules/.codegen-hash @@ -1 +1 @@ -88B06DEE25ADD164A343C2F31075632DBD4CAB744AC0C87242FF6092F9CF600A \ No newline at end of file +6E28BBD84CA2176C907306241955B495AF257A9C87E75375AE81902CBC6D6C7C \ No newline at end of file diff --git a/samples/aspire-with-python/ts/.modules/aspire.ts b/samples/aspire-with-python/ts/.modules/aspire.ts index d858410b..bdcf96f6 100644 --- a/samples/aspire-with-python/ts/.modules/aspire.ts +++ b/samples/aspire-with-python/ts/.modules/aspire.ts @@ -8,6 +8,8 @@ import { AspireClient as AspireClientRpc, Handle, MarshalledHandle, + AppHostUsageError, + CancellationToken, CapabilityError, registerCallback, wrapIfHandle, @@ -50,9 +52,21 @@ type RedisCommanderResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting. /** Handle to RedisInsightResource */ type RedisInsightResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisInsightResource'>; +/** Handle to AfterResourcesCreatedEvent */ +type AfterResourcesCreatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent'>; + +/** Handle to BeforeResourceStartedEvent */ +type BeforeResourceStartedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent'>; + +/** Handle to BeforeStartEvent */ +type BeforeStartEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent'>; + /** Handle to CommandLineArgsCallbackContext */ type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; +/** Handle to ConnectionStringAvailableEvent */ +type ConnectionStringAvailableEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent'>; + /** Handle to ContainerRegistryResource */ type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; @@ -62,6 +76,9 @@ type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Application /** Handle to CSharpAppResource */ type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; +/** Handle to DistributedApplicationModel */ +type DistributedApplicationModelHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel'>; + /** Handle to DotnetToolResource */ type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; @@ -80,9 +97,15 @@ type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicatio /** Handle to ExecuteCommandContext */ type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; +/** Handle to IComputeResource */ +type IComputeResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource'>; + /** Handle to IContainerFilesDestinationResource */ type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; +/** Handle to InitializeResourceEvent */ +type InitializeResourceEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent'>; + /** Handle to IResource */ type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; @@ -113,15 +136,27 @@ type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicati /** Handle to ReferenceExpressionBuilder */ type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; +/** Handle to ResourceEndpointsAllocatedEvent */ +type ResourceEndpointsAllocatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent'>; + /** Handle to ResourceLoggerService */ type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; /** Handle to ResourceNotificationService */ type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; +/** Handle to ResourceReadyEvent */ +type ResourceReadyEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent'>; + +/** Handle to ResourceStoppedEvent */ +type ResourceStoppedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent'>; + /** Handle to ResourceUrlsCallbackContext */ type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; +/** Handle to UpdateCommandStateContext */ +type UpdateCommandStateContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext'>; + /** Handle to ConnectionStringResource */ type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; @@ -146,18 +181,33 @@ type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hostin /** Handle to IResourceWithContainerFiles */ type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; -/** Handle to IResourceWithServiceDiscovery */ -type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; +/** Handle to IUserSecretsManager */ +type IUserSecretsManagerHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IUserSecretsManager'>; + +/** Handle to IReportingStep */ +type IReportingStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep'>; + +/** Handle to IReportingTask */ +type IReportingTaskHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask'>; /** Handle to PipelineConfigurationContext */ type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; +/** Handle to PipelineContext */ +type PipelineContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext'>; + /** Handle to PipelineStep */ type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; /** Handle to PipelineStepContext */ type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; +/** Handle to PipelineStepFactoryContext */ +type PipelineStepFactoryContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext'>; + +/** Handle to PipelineSummary */ +type PipelineSummaryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary'>; + /** Handle to ProjectResourceOptions */ type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; @@ -170,12 +220,18 @@ type ListanyHandle = Handle<'Aspire.Hosting/List'>; /** Handle to IConfiguration */ type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; +/** Handle to IConfigurationSection */ +type IConfigurationSectionHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfigurationSection'>; + /** Handle to IHostEnvironment */ type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; /** Handle to ILogger */ type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; +/** Handle to ILoggerFactory */ +type ILoggerFactoryHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory'>; + /** Handle to string[] */ type stringArrayHandle = Handle<'string[]'>; @@ -215,6 +271,7 @@ export enum EndpointProperty { Scheme = "Scheme", TargetPort = "TargetPort", HostAndPort = "HostAndPort", + TlsEnabled = "TlsEnabled", } /** Enum type for EntrypointType */ @@ -353,6 +410,10 @@ export interface AddConnectionStringOptions { environmentVariableName?: string; } +export interface AddContainerRegistryFromStringOptions { + repository?: string; +} + export interface AddContainerRegistryOptions { repository?: ParameterResource; } @@ -374,6 +435,11 @@ export interface AddParameterOptions { secret?: boolean; } +export interface AddParameterWithValueOptions { + publishValueAsDefault?: boolean; + secret?: boolean; +} + export interface AddRedisOptions { port?: number; password?: ParameterResource; @@ -395,18 +461,72 @@ export interface AppendValueProviderOptions { format?: string; } +export interface CompleteStepMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteStepOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskOptions { + completionMessage?: string; + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateMarkdownTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + export interface GetValueAsyncOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface PublishAsDockerFileOptions { + configure?: (obj: ContainerResource) => Promise; +} + +export interface PublishResourceUpdateOptions { + state?: string; + stateStyle?: string; } export interface RunOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface SaveStateJsonOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskMarkdownOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; } export interface WaitForCompletionOptions { exitCode?: number; } +export interface WaitForResourceStateOptions { + targetState?: string; +} + export interface WithBindMountOptions { isReadOnly?: boolean; } @@ -561,6 +681,7 @@ export interface WithRedisInsightOptions { export interface WithReferenceOptions { connectionName?: string; optional?: boolean; + name?: string; } export interface WithRequiredCommandOptions { @@ -598,6 +719,117 @@ export interface WithYarnOptions { installArgs?: string[]; } +// ============================================================================ +// AfterResourcesCreatedEvent +// ============================================================================ + +/** + * Type class for AfterResourcesCreatedEvent. + */ +export class AfterResourcesCreatedEvent { + constructor(private _handle: AfterResourcesCreatedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeResourceStartedEvent +// ============================================================================ + +/** + * Type class for BeforeResourceStartedEvent. + */ +export class BeforeResourceStartedEvent { + constructor(private _handle: BeforeResourceStartedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeStartEvent +// ============================================================================ + +/** + * Type class for BeforeStartEvent. + */ +export class BeforeStartEvent { + constructor(private _handle: BeforeStartEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + // ============================================================================ // CommandLineArgsCallbackContext // ============================================================================ @@ -627,11 +859,12 @@ export class CommandLineArgsCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, }; @@ -646,6 +879,65 @@ export class CommandLineArgsCallbackContext { }, }; + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ConnectionStringAvailableEvent +// ============================================================================ + +/** + * Type class for ConnectionStringAvailableEvent. + */ +export class ConnectionStringAvailableEvent { + constructor(private _handle: ConnectionStringAvailableEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + } // ============================================================================ @@ -663,9 +955,9 @@ export class DistributedApplication { /** Runs the distributed application */ /** @internal */ - async _runInternal(cancellationToken?: AbortSignal): Promise { + async _runInternal(cancellationToken?: AbortSignal | CancellationToken): Promise { const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); await this._client.invokeCapability( 'Aspire.Hosting/run', rpcArgs @@ -739,6 +1031,17 @@ export class DistributedApplicationExecutionContext { }, }; + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the IsPublishMode property */ isPublishMode = { get: async (): Promise => { @@ -761,6 +1064,70 @@ export class DistributedApplicationExecutionContext { } +// ============================================================================ +// DistributedApplicationModel +// ============================================================================ + +/** + * Type class for DistributedApplicationModel. + */ +export class DistributedApplicationModel { + constructor(private _handle: DistributedApplicationModelHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets resources from the distributed application model */ + async getResources(): Promise { + const rpcArgs: Record = { model: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResources', + rpcArgs + ); + } + + /** Finds a resource by name */ + /** @internal */ + async _findResourceByNameInternal(name: string): Promise { + const rpcArgs: Record = { model: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/findResourceByName', + rpcArgs + ); + return new Resource(result, this._client); + } + + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._findResourceByNameInternal(name)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationModel that enables fluent chaining. + */ +export class DistributedApplicationModelPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationModel) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets resources from the distributed application model */ + getResources(): Promise { + return this._promise.then(obj => obj.getResources()); + } + + /** Finds a resource by name */ + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.findResourceByName(name))); + } + +} + // ============================================================================ // EndpointReference // ============================================================================ @@ -774,6 +1141,17 @@ export class EndpointReference { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.resource', + { context: this._handle } + ); + return new ResourceWithEndpoints(handle, this._client); + }, + }; + /** Gets the EndpointName property */ endpointName = { get: async (): Promise => { @@ -840,6 +1218,16 @@ export class EndpointReference { }, }; + /** Gets the TlsEnabled property */ + tlsEnabled = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.tlsEnabled', + { context: this._handle } + ); + }, + }; + /** Gets the Port property */ port = { get: async (): Promise => { @@ -894,13 +1282,22 @@ export class EndpointReference { async getValueAsync(options?: GetValueAsyncOptions): Promise { const cancellationToken = options?.cancellationToken; const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); return await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/getValueAsync', rpcArgs ); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + async getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + const rpcArgs: Record = { context: this._handle, enabledValue, disabledValue }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.getTlsValue', + rpcArgs + ); + } + } /** @@ -921,6 +1318,11 @@ export class EndpointReferencePromise implements PromiseLike return this._promise.then(obj => obj.getValueAsync(options)); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + return this._promise.then(obj => obj.getTlsValue(enabledValue, disabledValue)); + } + } // ============================================================================ @@ -998,11 +1400,34 @@ export class EnvironmentCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; @@ -1032,6 +1457,17 @@ export class ExecuteCommandContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the ResourceName property */ resourceName = { get: async (): Promise => { @@ -1050,16 +1486,17 @@ export class ExecuteCommandContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, - set: async (value: AbortSignal): Promise => { + set: async (value: AbortSignal | CancellationToken): Promise => { await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', - { context: this._handle, value } + { context: this._handle, value: CancellationToken.fromValue(value) } ); } }; @@ -1067,42 +1504,134 @@ export class ExecuteCommandContext { } // ============================================================================ -// PipelineConfigurationContext +// InitializeResourceEvent // ============================================================================ /** - * Type class for PipelineConfigurationContext. + * Type class for InitializeResourceEvent. */ -export class PipelineConfigurationContext { - constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} +export class InitializeResourceEvent { + constructor(private _handle: InitializeResourceEventHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the Steps property */ - steps = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.resource', { context: this._handle } ); + return new Resource(handle, this._client); }, - set: async (value: PipelineStep[]): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', - { context: this._handle, value } - ); - } }; - /** Gets pipeline steps with the specified tag */ - async getStepsByTag(tag: string): Promise { - const rpcArgs: Record = { context: this._handle, tag }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Pipelines/getStepsByTag', - rpcArgs - ); - } + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Notifications property */ + notifications = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.notifications', + { context: this._handle } + ); + return new ResourceNotificationService(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + { context: this._handle } + ); + }, + set: async (value: PipelineStep[]): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', + { context: this._handle, value } + ); + } + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + + /** Gets pipeline steps with the specified tag */ + async getStepsByTag(tag: string): Promise { + const rpcArgs: Record = { context: this._handle, tag }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/getStepsByTag', + rpcArgs + ); + } } @@ -1126,6 +1655,93 @@ export class PipelineConfigurationContextPromise implements PromiseLike => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + set: async (value: AbortSignal | CancellationToken): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.setCancellationToken', + { context: this._handle, value: CancellationToken.fromValue(value) } + ); + } + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + // ============================================================================ // PipelineStep // ============================================================================ @@ -1213,6 +1829,17 @@ export class PipelineStep { return this._tags; } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + /** Adds a dependency on another step by name */ /** @internal */ async _dependsOnInternal(stepName: string): Promise { @@ -1283,6 +1910,39 @@ export class PipelineStepContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the ReportingStep property */ + reportingStep = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.reportingStep', + { context: this._handle } + ); + return new ReportingStep(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + /** Gets the ExecutionContext property */ executionContext = { get: async (): Promise => { @@ -1294,18 +1954,159 @@ export class PipelineStepContext { }, }; + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineStepFactoryContext +// ============================================================================ + +/** + * Type class for PipelineStepFactoryContext. + */ +export class PipelineStepFactoryContext { + constructor(private _handle: PipelineStepFactoryContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; } +// ============================================================================ +// PipelineSummary +// ============================================================================ + +/** + * Type class for PipelineSummary. + */ +export class PipelineSummary { + constructor(private _handle: PipelineSummaryHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Add method */ + /** @internal */ + async _addInternal(key: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, key, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineSummary.add', + rpcArgs + ); + return this; + } + + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addInternal(key, value)); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + /** @internal */ + async _addMarkdownInternal(key: string, markdownString: string): Promise { + const rpcArgs: Record = { summary: this._handle, key, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/addMarkdown', + rpcArgs + ); + return this; + } + + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addMarkdownInternal(key, markdownString)); + } + +} + +/** + * Thenable wrapper for PipelineSummary that enables fluent chaining. + */ +export class PipelineSummaryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineSummary) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Add method */ + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.add(key, value))); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.addMarkdown(key, markdownString))); + } + +} + // ============================================================================ // ProjectResourceOptions // ============================================================================ @@ -1488,86 +2289,381 @@ export class ReferenceExpressionBuilderPromise implements PromiseLike; - get urls(): AspireList { - if (!this._urls) { - this._urls = new AspireList( - this._handle, - this._client, - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' - ); - } - return this._urls; - } - - /** Gets the CancellationToken property */ - cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.resource', { context: this._handle } ); + return new Resource(handle, this._client); }, }; - /** Gets the ExecutionContext property */ - executionContext = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.services', { context: this._handle } ); - return new DistributedApplicationExecutionContext(handle, this._client); + return new ServiceProvider(handle, this._client); }, }; } // ============================================================================ -// DistributedApplicationBuilder +// ResourceLoggerService // ============================================================================ /** - * Type class for DistributedApplicationBuilder. + * Type class for ResourceLoggerService. */ -export class DistributedApplicationBuilder { - constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} +export class ResourceLoggerService { + constructor(private _handle: ResourceLoggerServiceHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the AppHostDirectory property */ - appHostDirectory = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', - { context: this._handle } - ); - }, - }; - - /** Gets the Eventing property */ - eventing = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + /** Completes the log stream for a resource */ + /** @internal */ + async _completeLogInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { loggerService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLog', + rpcArgs + ); + return this; + } + + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogInternal(resource)); + } + + /** Completes the log stream by resource name */ + /** @internal */ + async _completeLogByNameInternal(resourceName: string): Promise { + const rpcArgs: Record = { loggerService: this._handle, resourceName }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLogByName', + rpcArgs + ); + return this; + } + + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogByNameInternal(resourceName)); + } + +} + +/** + * Thenable wrapper for ResourceLoggerService that enables fluent chaining. + */ +export class ResourceLoggerServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceLoggerService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Completes the log stream for a resource */ + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLog(resource))); + } + + /** Completes the log stream by resource name */ + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLogByName(resourceName))); + } + +} + +// ============================================================================ +// ResourceNotificationService +// ============================================================================ + +/** + * Type class for ResourceNotificationService. + */ +export class ResourceNotificationService { + constructor(private _handle: ResourceNotificationServiceHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Waits for a resource to reach a specified state */ + /** @internal */ + async _waitForResourceStateInternal(resourceName: string, targetState?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + if (targetState !== undefined) rpcArgs.targetState = targetState; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceState', + rpcArgs + ); + return this; + } + + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + const targetState = options?.targetState; + return new ResourceNotificationServicePromise(this._waitForResourceStateInternal(resourceName, targetState)); + } + + /** Waits for a resource to reach one of the specified states */ + async waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName, targetStates }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStates', + rpcArgs + ); + } + + /** Waits for a resource to become healthy */ + async waitForResourceHealthy(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceHealthy', + rpcArgs + ); + } + + /** Waits for all dependencies of a resource to be ready */ + /** @internal */ + async _waitForDependenciesInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForDependencies', + rpcArgs + ); + return this; + } + + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._waitForDependenciesInternal(resource)); + } + + /** Tries to get the current state of a resource */ + async tryGetResourceState(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/tryGetResourceState', + rpcArgs + ); + } + + /** Publishes an update for a resource's state */ + /** @internal */ + async _publishResourceUpdateInternal(resource: ResourceBuilderBase, state?: string, stateStyle?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + if (state !== undefined) rpcArgs.state = state; + if (stateStyle !== undefined) rpcArgs.stateStyle = stateStyle; + await this._client.invokeCapability( + 'Aspire.Hosting/publishResourceUpdate', + rpcArgs + ); + return this; + } + + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + const state = options?.state; + const stateStyle = options?.stateStyle; + return new ResourceNotificationServicePromise(this._publishResourceUpdateInternal(resource, state, stateStyle)); + } + +} + +/** + * Thenable wrapper for ResourceNotificationService that enables fluent chaining. + */ +export class ResourceNotificationServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceNotificationService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Waits for a resource to reach a specified state */ + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForResourceState(resourceName, options))); + } + + /** Waits for a resource to reach one of the specified states */ + waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + return this._promise.then(obj => obj.waitForResourceStates(resourceName, targetStates)); + } + + /** Waits for a resource to become healthy */ + waitForResourceHealthy(resourceName: string): Promise { + return this._promise.then(obj => obj.waitForResourceHealthy(resourceName)); + } + + /** Waits for all dependencies of a resource to be ready */ + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForDependencies(resource))); + } + + /** Tries to get the current state of a resource */ + tryGetResourceState(resourceName: string): Promise { + return this._promise.then(obj => obj.tryGetResourceState(resourceName)); + } + + /** Publishes an update for a resource's state */ + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.publishResourceUpdate(resource, options))); + } + +} + +// ============================================================================ +// ResourceReadyEvent +// ============================================================================ + +/** + * Type class for ResourceReadyEvent. + */ +export class ResourceReadyEvent { + constructor(private _handle: ResourceReadyEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.resource', { context: this._handle } ); - return new DistributedApplicationEventing(handle, this._client); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ResourceStoppedEvent +// ============================================================================ + +/** + * Type class for ResourceStoppedEvent. + */ +export class ResourceStoppedEvent { + constructor(private _handle: ResourceStoppedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ResourceUrlsCallbackContext +// ============================================================================ + +/** + * Type class for ResourceUrlsCallbackContext. + */ +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); }, }; @@ -1575,593 +2671,1760 @@ export class DistributedApplicationBuilder { executionContext = { get: async (): Promise => { const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', { context: this._handle } ); return new DistributedApplicationExecutionContext(handle, this._client); }, }; - /** Builds the distributed application */ +} + +// ============================================================================ +// UpdateCommandStateContext +// ============================================================================ + +/** + * Type class for UpdateCommandStateContext. + */ +export class UpdateCommandStateContext { + constructor(private _handle: UpdateCommandStateContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/UpdateCommandStateContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// Configuration +// ============================================================================ + +/** + * Type class for Configuration. + */ +export class Configuration { + constructor(private _handle: IConfigurationHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets a configuration value by key */ + async getConfigValue(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConfigValue', + rpcArgs + ); + } + + /** Gets a connection string by name */ + async getConnectionString(name: string): Promise { + const rpcArgs: Record = { configuration: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionString', + rpcArgs + ); + } + + /** Gets a configuration section by key */ + async getSection(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getSection', + rpcArgs + ); + } + + /** Gets child configuration sections */ + async getChildren(): Promise { + const rpcArgs: Record = { configuration: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getChildren', + rpcArgs + ); + } + + /** Checks whether a configuration section exists */ + async exists(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/exists', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for Configuration that enables fluent chaining. + */ +export class ConfigurationPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Configuration) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets a configuration value by key */ + getConfigValue(key: string): Promise { + return this._promise.then(obj => obj.getConfigValue(key)); + } + + /** Gets a connection string by name */ + getConnectionString(name: string): Promise { + return this._promise.then(obj => obj.getConnectionString(name)); + } + + /** Gets a configuration section by key */ + getSection(key: string): Promise { + return this._promise.then(obj => obj.getSection(key)); + } + + /** Gets child configuration sections */ + getChildren(): Promise { + return this._promise.then(obj => obj.getChildren()); + } + + /** Checks whether a configuration section exists */ + exists(key: string): Promise { + return this._promise.then(obj => obj.exists(key)); + } + +} + +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Environment property */ + environment = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.environment', + { context: this._handle } + ); + return new HostEnvironment(handle, this._client); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the UserSecretsManager property */ + userSecretsManager = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.userSecretsManager', + { context: this._handle } + ); + return new UserSecretsManager(handle, this._client); + }, + }; + + /** Builds the distributed application */ + /** @internal */ + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', + rpcArgs + ); + return new DistributedApplication(result, this._client); + } + + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); + } + + /** Adds a connection string with a reference expression */ + /** @internal */ + async _addConnectionStringExpressionInternal(name: string, connectionStringExpression: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, connectionStringExpression }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionStringExpression', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringExpressionInternal(name, connectionStringExpression)); + } + + /** Adds a connection string with a builder callback */ + /** @internal */ + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionStringBuilder', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + } + + /** Adds a container registry resource */ + /** @internal */ + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + } + + /** Adds a container registry with string endpoint */ + /** @internal */ + async _addContainerRegistryFromStringInternal(name: string, endpoint: string, repository?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistryFromString', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryFromStringInternal(name, endpoint, repository)); + } + + /** Adds a container resource */ + /** @internal */ + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); + } + + /** Adds a container resource built from a Dockerfile */ + /** @internal */ + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); + } + + /** Adds a .NET tool resource */ + /** @internal */ + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + } + + /** Adds an executable resource */ + /** @internal */ + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + } + + /** Adds an external service resource */ + /** @internal */ + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); + } + + /** Adds an external service with a URI */ + /** @internal */ + async _addExternalServiceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceUri', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceUriInternal(name, uri)); + } + + /** Adds an external service with a parameter URL */ + /** @internal */ + async _addExternalServiceParameterInternal(name: string, urlParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, urlParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceParameter', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceParameterInternal(name, urlParameter)); + } + + /** Adds a parameter resource */ + /** @internal */ + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); + } + + /** Adds a parameter with a default value */ + /** @internal */ + async _addParameterWithValueInternal(name: string, value: string, publishValueAsDefault?: boolean, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + if (publishValueAsDefault !== undefined) rpcArgs.publishValueAsDefault = publishValueAsDefault; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterWithValue', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + const publishValueAsDefault = options?.publishValueAsDefault; + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterWithValueInternal(name, value, publishValueAsDefault, secret)); + } + + /** Adds a parameter sourced from configuration */ + /** @internal */ + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + } + + /** Adds a connection string resource */ + /** @internal */ + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + } + + /** Adds a .NET project resource */ + /** @internal */ + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + } + + /** Adds a project resource with configuration options */ + /** @internal */ + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + } + + /** Adds a C# application resource */ + /** @internal */ + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + } + + /** Adds a C# application resource with configuration options */ + /** @internal */ + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + } + + /** Gets the application configuration */ + /** @internal */ + async _getConfigurationInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getConfiguration', + rpcArgs + ); + return new Configuration(result, this._client); + } + + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._getConfigurationInternal()); + } + + /** Subscribes to the BeforeStart event */ + async subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeStartEventHandle; + const arg = new BeforeStartEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeBeforeStart', + rpcArgs + ); + } + + /** Subscribes to the AfterResourcesCreated event */ + async subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as AfterResourcesCreatedEventHandle; + const arg = new AfterResourcesCreatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeAfterResourcesCreated', + rpcArgs + ); + } + + /** Adds a Node.js application resource */ + /** @internal */ + async _addNodeAppInternal(name: string, appDirectory: string, scriptPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory, scriptPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addNodeApp', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._addNodeAppInternal(name, appDirectory, scriptPath)); + } + + /** Adds a JavaScript application resource */ + /** @internal */ + async _addJavaScriptAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addJavaScriptApp', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + const runScriptName = options?.runScriptName; + return new JavaScriptAppResourcePromise(this._addJavaScriptAppInternal(name, appDirectory, runScriptName)); + } + + /** Adds a Vite application resource */ + /** @internal */ + async _addViteAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addViteApp', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + const runScriptName = options?.runScriptName; + return new ViteAppResourcePromise(this._addViteAppInternal(name, appDirectory, runScriptName)); + } + + /** Adds a Python script application resource */ + /** @internal */ + async _addPythonAppInternal(name: string, appDirectory: string, scriptPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory, scriptPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Python/addPythonApp', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + addPythonApp(name: string, appDirectory: string, scriptPath: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._addPythonAppInternal(name, appDirectory, scriptPath)); + } + + /** Adds a Python module application resource */ + /** @internal */ + async _addPythonModuleInternal(name: string, appDirectory: string, moduleName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory, moduleName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Python/addPythonModule', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + addPythonModule(name: string, appDirectory: string, moduleName: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._addPythonModuleInternal(name, appDirectory, moduleName)); + } + + /** Adds a Python executable application resource */ + /** @internal */ + async _addPythonExecutableInternal(name: string, appDirectory: string, executableName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory, executableName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Python/addPythonExecutable', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + addPythonExecutable(name: string, appDirectory: string, executableName: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._addPythonExecutableInternal(name, appDirectory, executableName)); + } + + /** Adds a Uvicorn-based Python application resource */ + /** @internal */ + async _addUvicornAppInternal(name: string, appDirectory: string, app: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory, app }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Python/addUvicornApp', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + addUvicornApp(name: string, appDirectory: string, app: string): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._addUvicornAppInternal(name, appDirectory, app)); + } + + /** Adds a Redis container resource with specific port */ + /** @internal */ + async _addRedisWithPortInternal(name: string, port?: number): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/addRedisWithPort', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { + const port = options?.port; + return new RedisResourcePromise(this._addRedisWithPortInternal(name, port)); + } + + /** Adds a Redis container resource */ + /** @internal */ + async _addRedisInternal(name: string, port?: number, password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (port !== undefined) rpcArgs.port = port; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/addRedis', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { + const port = options?.port; + const password = options?.password; + return new RedisResourcePromise(this._addRedisInternal(name, port, password)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + */ +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); + } + + /** Adds a connection string with a reference expression */ + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringExpression(name, connectionStringExpression))); + } + + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + } + + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + } + + /** Adds a container registry with string endpoint */ + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistryFromString(name, endpoint, options))); + } + + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + } + + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + } + + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + } + + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); + } + + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + } + + /** Adds an external service with a URI */ + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceUri(name, uri))); + } + + /** Adds an external service with a parameter URL */ + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceParameter(name, urlParameter))); + } + + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); + } + + /** Adds a parameter with a default value */ + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterWithValue(name, value, options))); + } + + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + } + + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); + } + + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); + } + + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); + } + + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); + } + + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); + } + + /** Gets the application configuration */ + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._promise.then(obj => obj.getConfiguration())); + } + + /** Subscribes to the BeforeStart event */ + subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeBeforeStart(callback)); + } + + /** Subscribes to the AfterResourcesCreated event */ + subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeAfterResourcesCreated(callback)); + } + + /** Adds a Node.js application resource */ + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.addNodeApp(name, appDirectory, scriptPath))); + } + + /** Adds a JavaScript application resource */ + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.addJavaScriptApp(name, appDirectory, options))); + } + + /** Adds a Vite application resource */ + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.addViteApp(name, appDirectory, options))); + } + + /** Adds a Python script application resource */ + addPythonApp(name: string, appDirectory: string, scriptPath: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.addPythonApp(name, appDirectory, scriptPath))); + } + + /** Adds a Python module application resource */ + addPythonModule(name: string, appDirectory: string, moduleName: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.addPythonModule(name, appDirectory, moduleName))); + } + + /** Adds a Python executable application resource */ + addPythonExecutable(name: string, appDirectory: string, executableName: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.addPythonExecutable(name, appDirectory, executableName))); + } + + /** Adds a Uvicorn-based Python application resource */ + addUvicornApp(name: string, appDirectory: string, app: string): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.addUvicornApp(name, appDirectory, app))); + } + + /** Adds a Redis container resource with specific port */ + addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.addRedisWithPort(name, options))); + } + + /** Adds a Redis container resource */ + addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.addRedis(name, options))); + } + +} + +// ============================================================================ +// DistributedApplicationEventing +// ============================================================================ + +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Unsubscribe method */ /** @internal */ - async _buildInternal(): Promise { - const rpcArgs: Record = { context: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/build', + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', rpcArgs ); - return new DistributedApplication(result, this._client); + return this; } - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._buildInternal()); + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); } - /** Adds a connection string with a builder callback */ - /** @internal */ - async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { - const connectionStringBuilderId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; - const obj = new ReferenceExpressionBuilder(objHandle, this._client); - await connectionStringBuilder(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionStringBuilder', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); } - /** Adds a container registry resource */ - /** @internal */ - async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpoint }; - if (repository !== undefined) rpcArgs.repository = repository; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainerRegistry', +} + +// ============================================================================ +// HostEnvironment +// ============================================================================ + +/** + * Type class for HostEnvironment. + */ +export class HostEnvironment { + constructor(private _handle: IHostEnvironmentHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Checks if running in Development environment */ + async isDevelopment(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isDevelopment', rpcArgs ); - return new ContainerRegistryResource(result, this._client); - } - - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - const repository = options?.repository; - return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); } - /** Adds a container resource */ - /** @internal */ - async _addContainerInternal(name: string, image: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, image }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainer', + /** Checks if running in Production environment */ + async isProduction(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isProduction', rpcArgs ); - return new ContainerResource(result, this._client); } - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._addContainerInternal(name, image)); + /** Checks if running in Staging environment */ + async isStaging(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isStaging', + rpcArgs + ); } - /** Adds a container resource built from a Dockerfile */ - /** @internal */ - async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDockerfile', + /** Checks if the environment matches the specified name */ + async isEnvironment(environmentName: string): Promise { + const rpcArgs: Record = { environment: this._handle, environmentName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isEnvironment', rpcArgs ); - return new ContainerResource(result, this._client); } - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); +} + +/** + * Thenable wrapper for HostEnvironment that enables fluent chaining. + */ +export class HostEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: HostEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a .NET tool resource */ - /** @internal */ - async _addDotnetToolInternal(name: string, packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDotnetTool', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Checks if running in Development environment */ + isDevelopment(): Promise { + return this._promise.then(obj => obj.isDevelopment()); } - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + /** Checks if running in Production environment */ + isProduction(): Promise { + return this._promise.then(obj => obj.isProduction()); } - /** Adds an executable resource */ + /** Checks if running in Staging environment */ + isStaging(): Promise { + return this._promise.then(obj => obj.isStaging()); + } + + /** Checks if the environment matches the specified name */ + isEnvironment(environmentName: string): Promise { + return this._promise.then(obj => obj.isEnvironment(environmentName)); + } + +} + +// ============================================================================ +// Logger +// ============================================================================ + +/** + * Type class for Logger. + */ +export class Logger { + constructor(private _handle: ILoggerHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Logs an information message */ /** @internal */ - async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExecutable', + async _logInformationInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logInformation', rpcArgs ); - return new ExecutableResource(result, this._client); + return this; } - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._logInformationInternal(message)); } - /** Adds an external service resource */ + /** Logs a warning message */ /** @internal */ - async _addExternalServiceInternal(name: string, url: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, url }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExternalService', + async _logWarningInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logWarning', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return this; } - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._logWarningInternal(message)); } - /** Adds a parameter resource */ + /** Logs an error message */ /** @internal */ - async _addParameterInternal(name: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameter', + async _logErrorInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logError', rpcArgs ); - return new ParameterResource(result, this._client); + return this; } - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterInternal(name, secret)); + logError(message: string): LoggerPromise { + return new LoggerPromise(this._logErrorInternal(message)); } - /** Adds a parameter sourced from configuration */ + /** Logs a debug message */ /** @internal */ - async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name, configurationKey }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameterFromConfiguration', + async _logDebugInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logDebug', rpcArgs ); - return new ParameterResource(result, this._client); + return this; } - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._logDebugInternal(message)); } - /** Adds a connection string resource */ + /** Logs a message with specified level */ /** @internal */ - async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionString', + async _logInternal(level: string, message: string): Promise { + const rpcArgs: Record = { logger: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/log', rpcArgs ); - return new ResourceWithConnectionString(result, this._client); + return this; } - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - const environmentVariableName = options?.environmentVariableName; - return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._logInternal(level, message)); } - /** Adds a .NET project resource */ +} + +/** + * Thenable wrapper for Logger that enables fluent chaining. + */ +export class LoggerPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Logger) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Logs an information message */ + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logInformation(message))); + } + + /** Logs a warning message */ + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logWarning(message))); + } + + /** Logs an error message */ + logError(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logError(message))); + } + + /** Logs a debug message */ + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logDebug(message))); + } + + /** Logs a message with specified level */ + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.log(level, message))); + } + +} + +// ============================================================================ +// LoggerFactory +// ============================================================================ + +/** + * Type class for LoggerFactory. + */ +export class LoggerFactory { + constructor(private _handle: ILoggerFactoryHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Creates a logger for a category */ /** @internal */ - async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProject', + async _createLoggerInternal(categoryName: string): Promise { + const rpcArgs: Record = { loggerFactory: this._handle, categoryName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createLogger', rpcArgs ); - return new ProjectResource(result, this._client); + return new Logger(result, this._client); } - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._createLoggerInternal(categoryName)); } - /** Adds a project resource with configuration options */ - /** @internal */ - async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProjectWithOptions', +} + +/** + * Thenable wrapper for LoggerFactory that enables fluent chaining. + */ +export class LoggerFactoryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: LoggerFactory) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Creates a logger for a category */ + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.createLogger(categoryName))); + } + +} + +// ============================================================================ +// ReportingStep +// ============================================================================ + +/** + * Type class for ReportingStep. + */ +export class ReportingStep { + constructor(private _handle: IReportingStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Creates a reporting task with plain-text status text */ + /** @internal */ + async _createTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createTask', rpcArgs ); - return new ProjectResource(result, this._client); + return new ReportingTask(result, this._client); } - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createTaskInternal(statusText, cancellationToken)); } - /** Adds a C# application resource */ + /** Creates a reporting task with Markdown-formatted status text */ /** @internal */ - async _addCSharpAppInternal(name: string, path: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, path }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpApp', + async _createMarkdownTaskInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createMarkdownTask', rpcArgs ); - return new ProjectResource(result, this._client); + return new ReportingTask(result, this._client); } - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createMarkdownTaskInternal(markdownString, cancellationToken)); } - /** Adds a C# application resource with configuration options */ + /** Logs a plain-text message for the reporting step */ /** @internal */ - async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpAppWithOptions', + async _logStepInternal(level: string, message: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStep', rpcArgs ); - return new CSharpAppResource(result, this._client); + return this; } - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepInternal(level, message)); } - /** Adds a Node.js application resource */ + /** Logs a Markdown-formatted message for the reporting step */ /** @internal */ - async _addNodeAppInternal(name: string, appDirectory: string, scriptPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, appDirectory, scriptPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.JavaScript/addNodeApp', + async _logStepMarkdownInternal(level: string, markdownString: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStepMarkdown', rpcArgs ); - return new NodeAppResource(result, this._client); + return this; } - addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._addNodeAppInternal(name, appDirectory, scriptPath)); + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepMarkdownInternal(level, markdownString)); } - /** Adds a JavaScript application resource */ + /** Completes the reporting step with plain-text completion text */ /** @internal */ - async _addJavaScriptAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, appDirectory }; - if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.JavaScript/addJavaScriptApp', + async _completeStepInternal(completionText: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, completionText }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStep', rpcArgs ); - return new JavaScriptAppResource(result, this._client); + return this; } - addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { - const runScriptName = options?.runScriptName; - return new JavaScriptAppResourcePromise(this._addJavaScriptAppInternal(name, appDirectory, runScriptName)); + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepInternal(completionText, completionState, cancellationToken)); } - /** Adds a Vite application resource */ + /** Completes the reporting step with Markdown-formatted completion text */ /** @internal */ - async _addViteAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, appDirectory }; - if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.JavaScript/addViteApp', + async _completeStepMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStepMarkdown', rpcArgs ); - return new ViteAppResource(result, this._client); + return this; } - addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { - const runScriptName = options?.runScriptName; - return new ViteAppResourcePromise(this._addViteAppInternal(name, appDirectory, runScriptName)); + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepMarkdownInternal(markdownString, completionState, cancellationToken)); } - /** Adds a Python script application resource */ - /** @internal */ - async _addPythonAppInternal(name: string, appDirectory: string, scriptPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, appDirectory, scriptPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Python/addPythonApp', - rpcArgs - ); - return new PythonAppResource(result, this._client); +} + +/** + * Thenable wrapper for ReportingStep that enables fluent chaining. + */ +export class ReportingStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReportingStep) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - addPythonApp(name: string, appDirectory: string, scriptPath: string): PythonAppResourcePromise { - return new PythonAppResourcePromise(this._addPythonAppInternal(name, appDirectory, scriptPath)); + /** Creates a reporting task with plain-text status text */ + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createTask(statusText, options))); } - /** Adds a Python module application resource */ - /** @internal */ - async _addPythonModuleInternal(name: string, appDirectory: string, moduleName: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, appDirectory, moduleName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Python/addPythonModule', - rpcArgs - ); - return new PythonAppResource(result, this._client); + /** Creates a reporting task with Markdown-formatted status text */ + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createMarkdownTask(markdownString, options))); } - addPythonModule(name: string, appDirectory: string, moduleName: string): PythonAppResourcePromise { - return new PythonAppResourcePromise(this._addPythonModuleInternal(name, appDirectory, moduleName)); + /** Logs a plain-text message for the reporting step */ + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStep(level, message))); } - /** Adds a Python executable application resource */ + /** Logs a Markdown-formatted message for the reporting step */ + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStepMarkdown(level, markdownString))); + } + + /** Completes the reporting step with plain-text completion text */ + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStep(completionText, options))); + } + + /** Completes the reporting step with Markdown-formatted completion text */ + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStepMarkdown(markdownString, options))); + } + +} + +// ============================================================================ +// ReportingTask +// ============================================================================ + +/** + * Type class for ReportingTask. + */ +export class ReportingTask { + constructor(private _handle: IReportingTaskHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Updates the reporting task with plain-text status text */ /** @internal */ - async _addPythonExecutableInternal(name: string, appDirectory: string, executableName: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, appDirectory, executableName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Python/addPythonExecutable', + async _updateTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTask', rpcArgs ); - return new PythonAppResource(result, this._client); + return this; } - addPythonExecutable(name: string, appDirectory: string, executableName: string): PythonAppResourcePromise { - return new PythonAppResourcePromise(this._addPythonExecutableInternal(name, appDirectory, executableName)); + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskInternal(statusText, cancellationToken)); } - /** Adds a Uvicorn-based Python application resource */ + /** Updates the reporting task with Markdown-formatted status text */ /** @internal */ - async _addUvicornAppInternal(name: string, appDirectory: string, app: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, appDirectory, app }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Python/addUvicornApp', + async _updateTaskMarkdownInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTaskMarkdown', rpcArgs ); - return new UvicornAppResource(result, this._client); + return this; } - addUvicornApp(name: string, appDirectory: string, app: string): UvicornAppResourcePromise { - return new UvicornAppResourcePromise(this._addUvicornAppInternal(name, appDirectory, app)); + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskMarkdownInternal(markdownString, cancellationToken)); } - /** Adds a Redis container resource with specific port */ + /** Completes the reporting task with plain-text completion text */ /** @internal */ - async _addRedisWithPortInternal(name: string, port?: number): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/addRedisWithPort', + async _completeTaskInternal(completionMessage?: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle }; + if (completionMessage !== undefined) rpcArgs.completionMessage = completionMessage; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTask', rpcArgs ); - return new RedisResource(result, this._client); + return this; } - addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { - const port = options?.port; - return new RedisResourcePromise(this._addRedisWithPortInternal(name, port)); + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + const completionMessage = options?.completionMessage; + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskInternal(completionMessage, completionState, cancellationToken)); } - /** Adds a Redis container resource */ + /** Completes the reporting task with Markdown-formatted completion text */ /** @internal */ - async _addRedisInternal(name: string, port?: number, password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (port !== undefined) rpcArgs.port = port; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/addRedis', + async _completeTaskMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTaskMarkdown', rpcArgs ); - return new RedisResource(result, this._client); + return this; } - addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { - const port = options?.port; - const password = options?.password; - return new RedisResourcePromise(this._addRedisInternal(name, port, password)); + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskMarkdownInternal(markdownString, completionState, cancellationToken)); } } /** - * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + * Thenable wrapper for ReportingTask that enables fluent chaining. */ -export class DistributedApplicationBuilderPromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ReportingTaskPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ReportingTask) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Builds the distributed application */ - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); + /** Updates the reporting task with plain-text status text */ + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTask(statusText, options))); } - /** Adds a connection string with a builder callback */ - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + /** Updates the reporting task with Markdown-formatted status text */ + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTaskMarkdown(markdownString, options))); } - /** Adds a container registry resource */ - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + /** Completes the reporting task with plain-text completion text */ + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTask(options))); } - /** Adds a container resource */ - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + /** Completes the reporting task with Markdown-formatted completion text */ + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTaskMarkdown(markdownString, options))); } - /** Adds a container resource built from a Dockerfile */ - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); - } +} - /** Adds a .NET tool resource */ - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); +// ============================================================================ +// ServiceProvider +// ============================================================================ + +/** + * Type class for ServiceProvider. + */ +export class ServiceProvider { + constructor(private _handle: IServiceProviderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the distributed application eventing service from the service provider */ + /** @internal */ + async _getEventingInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getEventing', + rpcArgs + ); + return new DistributedApplicationEventing(result, this._client); } - /** Adds an executable resource */ - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._getEventingInternal()); } - /** Adds an external service resource */ - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + /** Gets the logger factory from the service provider */ + /** @internal */ + async _getLoggerFactoryInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getLoggerFactory', + rpcArgs + ); + return new LoggerFactory(result, this._client); } - /** Adds a parameter resource */ - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._getLoggerFactoryInternal()); } - /** Adds a parameter sourced from configuration */ - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + /** Gets the resource logger service from the service provider */ + /** @internal */ + async _getResourceLoggerServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceLoggerService', + rpcArgs + ); + return new ResourceLoggerService(result, this._client); } - /** Adds a connection string resource */ - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._getResourceLoggerServiceInternal()); } - /** Adds a .NET project resource */ - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); + /** Gets the distributed application model from the service provider */ + /** @internal */ + async _getDistributedApplicationModelInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getDistributedApplicationModel', + rpcArgs + ); + return new DistributedApplicationModel(result, this._client); } - /** Adds a project resource with configuration options */ - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._getDistributedApplicationModelInternal()); } - /** Adds a C# application resource */ - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); + /** Gets the resource notification service from the service provider */ + /** @internal */ + async _getResourceNotificationServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceNotificationService', + rpcArgs + ); + return new ResourceNotificationService(result, this._client); } - /** Adds a C# application resource with configuration options */ - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._getResourceNotificationServiceInternal()); } - /** Adds a Node.js application resource */ - addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._promise.then(obj => obj.addNodeApp(name, appDirectory, scriptPath))); + /** Gets the user secrets manager from the service provider */ + /** @internal */ + async _getUserSecretsManagerInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getUserSecretsManager', + rpcArgs + ); + return new UserSecretsManager(result, this._client); } - /** Adds a JavaScript application resource */ - addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.addJavaScriptApp(name, appDirectory, options))); + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getUserSecretsManagerInternal()); } - /** Adds a Vite application resource */ - addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.addViteApp(name, appDirectory, options))); +} + +/** + * Thenable wrapper for ServiceProvider that enables fluent chaining. + */ +export class ServiceProviderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ServiceProvider) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a Python script application resource */ - addPythonApp(name: string, appDirectory: string, scriptPath: string): PythonAppResourcePromise { - return new PythonAppResourcePromise(this._promise.then(obj => obj.addPythonApp(name, appDirectory, scriptPath))); + /** Gets the distributed application eventing service from the service provider */ + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.getEventing())); } - /** Adds a Python module application resource */ - addPythonModule(name: string, appDirectory: string, moduleName: string): PythonAppResourcePromise { - return new PythonAppResourcePromise(this._promise.then(obj => obj.addPythonModule(name, appDirectory, moduleName))); + /** Gets the logger factory from the service provider */ + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._promise.then(obj => obj.getLoggerFactory())); } - /** Adds a Python executable application resource */ - addPythonExecutable(name: string, appDirectory: string, executableName: string): PythonAppResourcePromise { - return new PythonAppResourcePromise(this._promise.then(obj => obj.addPythonExecutable(name, appDirectory, executableName))); + /** Gets the resource logger service from the service provider */ + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.getResourceLoggerService())); } - /** Adds a Uvicorn-based Python application resource */ - addUvicornApp(name: string, appDirectory: string, app: string): UvicornAppResourcePromise { - return new UvicornAppResourcePromise(this._promise.then(obj => obj.addUvicornApp(name, appDirectory, app))); + /** Gets the distributed application model from the service provider */ + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._promise.then(obj => obj.getDistributedApplicationModel())); } - /** Adds a Redis container resource with specific port */ - addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.addRedisWithPort(name, options))); + /** Gets the resource notification service from the service provider */ + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.getResourceNotificationService())); } - /** Adds a Redis container resource */ - addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.addRedis(name, options))); + /** Gets the user secrets manager from the service provider */ + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getUserSecretsManager())); } } // ============================================================================ -// DistributedApplicationEventing +// UserSecretsManager // ============================================================================ /** - * Type class for DistributedApplicationEventing. + * Type class for UserSecretsManager. */ -export class DistributedApplicationEventing { - constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} +export class UserSecretsManager { + constructor(private _handle: IUserSecretsManagerHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Invokes the Unsubscribe method */ + /** Gets the IsAvailable property */ + isAvailable = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.isAvailable', + { context: this._handle } + ); + }, + }; + + /** Gets the FilePath property */ + filePath = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.filePath', + { context: this._handle } + ); + }, + }; + + /** Attempts to set a user secret value */ + async trySetSecret(name: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, name, value }; + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.trySetSecret', + rpcArgs + ); + } + + /** Saves state to user secrets from a JSON string */ /** @internal */ - async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { - const rpcArgs: Record = { context: this._handle, subscription }; + async _saveStateJsonInternal(json: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, json }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); await this._client.invokeCapability( - 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + 'Aspire.Hosting/saveStateJson', rpcArgs ); return this; } - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + const cancellationToken = options?.cancellationToken; + return new UserSecretsManagerPromise(this._saveStateJsonInternal(json, cancellationToken)); + } + + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ + /** @internal */ + async _getOrSetSecretInternal(resourceBuilder: ResourceBuilderBase, name: string, value: string): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, resourceBuilder, name, value }; + await this._client.invokeCapability( + 'Aspire.Hosting/getOrSetSecret', + rpcArgs + ); + return this; + } + + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getOrSetSecretInternal(resourceBuilder, name, value)); } } /** - * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + * Thenable wrapper for UserSecretsManager that enables fluent chaining. */ -export class DistributedApplicationEventingPromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class UserSecretsManagerPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: UserSecretsManager) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Invokes the Unsubscribe method */ - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + /** Attempts to set a user secret value */ + trySetSecret(name: string, value: string): Promise { + return this._promise.then(obj => obj.trySetSecret(name, value)); + } + + /** Saves state to user secrets from a JSON string */ + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.saveStateJson(json, options))); + } + + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getOrSetSecret(resourceBuilder, name, value))); } } @@ -2256,6 +4519,15 @@ export class ConnectionStringResource extends ResourceBuilderBase { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + /** @internal */ private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { @@ -2368,7 +4640,7 @@ export class ConnectionStringResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ConnectionStringResource(result, this._client); @@ -2398,7 +4670,7 @@ export class ConnectionStringResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ConnectionStringResource(result, this._client); @@ -2444,7 +4716,7 @@ export class ConnectionStringResource extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ConnectionStringResource(result, this._client); @@ -2497,7 +4769,7 @@ export class ConnectionStringResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new ConnectionStringResource(result, this._client); @@ -2512,7 +4784,7 @@ export class ConnectionStringResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new ConnectionStringResource(result, this._client); @@ -2555,36 +4827,6 @@ export class ConnectionStringResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -2662,6 +4904,106 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onConnectionStringAvailableInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -2704,6 +5046,11 @@ export class ConnectionStringResourcePromise implements PromiseLike obj.withConnectionPropertyValue(name, value))); } + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + /** Customizes displayed URLs via callback */ withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); @@ -2794,16 +5141,6 @@ export class ConnectionStringResourcePromise implements PromiseLike obj.excludeFromMcp())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); @@ -2824,6 +5161,31 @@ export class ConnectionStringResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -3050,7 +5412,7 @@ export class ContainerRegistryResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new ContainerRegistryResource(result, this._client); @@ -3065,7 +5427,7 @@ export class ContainerRegistryResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new ContainerRegistryResource(result, this._client); @@ -3108,36 +5470,6 @@ export class ContainerRegistryResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -3215,6 +5547,86 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -3312,16 +5724,6 @@ export class ContainerRegistryResourcePromise implements PromiseLike obj.excludeFromMcp())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); @@ -3342,6 +5744,26 @@ export class ContainerRegistryResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -3368,6 +5790,239 @@ export class ContainerResource extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + /** @internal */ private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; @@ -3387,6 +6042,21 @@ export class ContainerResource extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + /** @internal */ private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; @@ -3437,74 +6107,39 @@ export class ContainerResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - const helpLink = options?.helpLink; - return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } - - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + 'Aspire.Hosting/publishAsConnectionString', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); @@ -3512,15 +6147,15 @@ export class ContainerResource extends ResourceBuilderBase = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -3538,6 +6173,21 @@ export class ContainerResource extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + /** @internal */ private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; @@ -3624,10 +6274,11 @@ export class ContainerResource extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -3639,37 +6290,8 @@ export class ContainerResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -3969,7 +6591,7 @@ export class ContainerResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ContainerResource(result, this._client); @@ -3999,7 +6621,7 @@ export class ContainerResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ContainerResource(result, this._client); @@ -4045,7 +6667,7 @@ export class ContainerResource extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ContainerResource(result, this._client); @@ -4150,7 +6772,7 @@ export class ContainerResource extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ContainerResource(result, this._client); @@ -4181,7 +6803,7 @@ export class ContainerResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new ContainerResource(result, this._client); @@ -4196,7 +6818,7 @@ export class ContainerResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new ContainerResource(result, this._client); @@ -4366,6 +6988,25 @@ export class ContainerResource extends ResourceBuilderBase { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + /** Gets the resource name */ async getResourceName(): Promise { const rpcArgs: Record = { resource: this._handle }; @@ -4375,6 +7016,106 @@ export class ContainerResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -4397,11 +7138,91 @@ export class ContainerResourcePromise implements PromiseLike return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + /** Sets the base image for a Dockerfile build */ withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + /** Configures an MCP server endpoint on the resource */ withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); @@ -4417,36 +7238,31 @@ export class ContainerResourcePromise implements PromiseLike return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + /** Adds a required command dependency */ withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -4477,16 +7293,6 @@ export class ContainerResourcePromise implements PromiseLike return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -4682,11 +7488,41 @@ export class ContainerResourcePromise implements PromiseLike return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + /** Gets the resource name */ getResourceName(): Promise { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -4812,58 +7648,50 @@ export class CSharpAppResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new CSharpAppResource(result, this._client); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - const helpLink = options?.helpLink; - return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } - - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configure !== undefined) rpcArgs.configure = configureId; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + const configure = options?.configure; + return new CSharpAppResourcePromise(this._publishAsDockerFileInternal(configure)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -4874,43 +7702,38 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): CSharpAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -4999,10 +7822,11 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -5014,37 +7838,8 @@ export class CSharpAppResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new CSharpAppResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new CSharpAppResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -5329,7 +8124,7 @@ export class CSharpAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); return new CSharpAppResource(result, this._client); @@ -5359,7 +8154,7 @@ export class CSharpAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new CSharpAppResource(result, this._client); @@ -5389,7 +8184,7 @@ export class CSharpAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new CSharpAppResource(result, this._client); @@ -5435,7 +8230,7 @@ export class CSharpAppResource extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new CSharpAppResource(result, this._client); @@ -5540,7 +8335,7 @@ export class CSharpAppResource extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new CSharpAppResource(result, this._client); @@ -5571,7 +8366,7 @@ export class CSharpAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new CSharpAppResource(result, this._client); @@ -5586,7 +8381,7 @@ export class CSharpAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new CSharpAppResource(result, this._client); @@ -5765,6 +8560,106 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -5817,36 +8712,31 @@ export class CSharpAppResourcePromise implements PromiseLike return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); } + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); + } + /** Adds a required command dependency */ withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -5877,16 +8767,6 @@ export class CSharpAppResourcePromise implements PromiseLike return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -6092,6 +8972,31 @@ export class CSharpAppResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -6359,41 +9264,11 @@ export class DotnetToolResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -6404,43 +9279,38 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -6529,10 +9399,11 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -6544,37 +9415,8 @@ export class DotnetToolResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -6874,7 +9716,7 @@ export class DotnetToolResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new DotnetToolResource(result, this._client); @@ -6904,7 +9746,7 @@ export class DotnetToolResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new DotnetToolResource(result, this._client); @@ -6950,7 +9792,7 @@ export class DotnetToolResource extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new DotnetToolResource(result, this._client); @@ -7055,7 +9897,7 @@ export class DotnetToolResource extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new DotnetToolResource(result, this._client); @@ -7086,7 +9928,7 @@ export class DotnetToolResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new DotnetToolResource(result, this._client); @@ -7101,7 +9943,7 @@ export class DotnetToolResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new DotnetToolResource(result, this._client); @@ -7280,6 +10122,106 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -7377,31 +10319,21 @@ export class DotnetToolResourcePromise implements PromiseLike obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -7432,16 +10364,6 @@ export class DotnetToolResourcePromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -7642,6 +10564,31 @@ export class DotnetToolResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -7687,6 +10634,71 @@ export class ExecutableResource extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + /** @internal */ private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; @@ -7754,41 +10766,11 @@ export class ExecutableResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -7799,43 +10781,38 @@ export class ExecutableResource extends ResourceBuilderBase Promise): ExecutableResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -7924,10 +10901,11 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -7939,37 +10917,8 @@ export class ExecutableResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -8269,7 +11218,7 @@ export class ExecutableResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ExecutableResource(result, this._client); @@ -8299,7 +11248,7 @@ export class ExecutableResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ExecutableResource(result, this._client); @@ -8345,7 +11294,7 @@ export class ExecutableResource extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ExecutableResource(result, this._client); @@ -8450,7 +11399,7 @@ export class ExecutableResource extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ExecutableResource(result, this._client); @@ -8481,7 +11430,7 @@ export class ExecutableResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new ExecutableResource(result, this._client); @@ -8496,7 +11445,7 @@ export class ExecutableResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new ExecutableResource(result, this._client); @@ -8578,101 +11527,201 @@ export class ExecutableResource extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + 'Aspire.Hosting/onResourceStopped', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + 'Aspire.Hosting/onInitializeResource', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + 'Aspire.Hosting/onResourceReady', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); - } - - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceReadyInternal(callback)); } } @@ -8702,6 +11751,26 @@ export class ExecutableResourcePromise implements PromiseLike obj.withDockerfileBaseImage(options))); } + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + /** Configures an MCP server endpoint on the resource */ withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); @@ -8722,31 +11791,21 @@ export class ExecutableResourcePromise implements PromiseLike obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -8777,16 +11836,6 @@ export class ExecutableResourcePromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ExecutableResourcePromise { return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -8987,6 +12036,31 @@ export class ExecutableResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -9232,7 +12306,7 @@ export class ExternalServiceResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new ExternalServiceResource(result, this._client); @@ -9247,7 +12321,7 @@ export class ExternalServiceResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new ExternalServiceResource(result, this._client); @@ -9290,36 +12364,6 @@ export class ExternalServiceResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -9397,6 +12441,86 @@ export class ExternalServiceResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -9499,16 +12623,6 @@ export class ExternalServiceResourcePromise implements PromiseLike obj.excludeFromMcp())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); @@ -9529,6 +12643,26 @@ export class ExternalServiceResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -9540,6 +12674,36 @@ export class JavaScriptAppResource extends ResourceBuilderBase => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; @@ -9698,65 +12862,15 @@ export class JavaScriptAppResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new JavaScriptAppResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new JavaScriptAppResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new JavaScriptAppResource(result, this._client); - } - - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + const helpLink = options?.helpLink; + return new JavaScriptAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); @@ -9764,15 +12878,15 @@ export class JavaScriptAppResource extends ResourceBuilderBase = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); return new JavaScriptAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -9790,6 +12904,21 @@ export class JavaScriptAppResource extends ResourceBuilderBase { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + /** @internal */ private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; @@ -9876,10 +13005,11 @@ export class JavaScriptAppResource extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -9891,37 +13021,8 @@ export class JavaScriptAppResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new JavaScriptAppResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new JavaScriptAppResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new JavaScriptAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -10251,7 +13352,7 @@ export class JavaScriptAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new JavaScriptAppResource(result, this._client); @@ -10281,7 +13382,7 @@ export class JavaScriptAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new JavaScriptAppResource(result, this._client); @@ -10327,7 +13428,7 @@ export class JavaScriptAppResource extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new JavaScriptAppResource(result, this._client); @@ -10432,7 +13533,7 @@ export class JavaScriptAppResource extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new JavaScriptAppResource(result, this._client); @@ -10463,7 +13564,7 @@ export class JavaScriptAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new JavaScriptAppResource(result, this._client); @@ -10478,7 +13579,7 @@ export class JavaScriptAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new JavaScriptAppResource(result, this._client); @@ -10657,6 +13758,235 @@ export class JavaScriptAppResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withYarnInternal(install, installArgs)); + } + + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withPnpmInternal(install, installArgs)); + } + + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withRunScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + const browser = options?.browser; + return new JavaScriptAppResourcePromise(this._withBrowserDebuggerInternal(browser)); + } + } /** @@ -10724,31 +14054,21 @@ export class JavaScriptAppResourcePromise implements PromiseLike obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -10779,16 +14099,6 @@ export class JavaScriptAppResourcePromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): JavaScriptAppResourcePromise { - return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -10999,6 +14309,66 @@ export class JavaScriptAppResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + } // ============================================================================ @@ -11206,41 +14576,11 @@ export class NodeAppResource extends ResourceBuilderBase } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new NodeAppResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new NodeAppResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -11251,43 +14591,38 @@ export class NodeAppResource extends ResourceBuilderBase } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { return new NodeAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new NodeAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new NodeAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -11376,10 +14711,11 @@ export class NodeAppResource extends ResourceBuilderBase } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -11391,37 +14727,8 @@ export class NodeAppResource extends ResourceBuilderBase withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new NodeAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new NodeAppResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new NodeAppResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new NodeAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -11706,7 +15013,7 @@ export class NodeAppResource extends ResourceBuilderBase private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); return new NodeAppResource(result, this._client); @@ -11766,7 +15073,7 @@ export class NodeAppResource extends ResourceBuilderBase private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new NodeAppResource(result, this._client); @@ -11796,7 +15103,7 @@ export class NodeAppResource extends ResourceBuilderBase private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new NodeAppResource(result, this._client); @@ -11842,7 +15149,7 @@ export class NodeAppResource extends ResourceBuilderBase const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new NodeAppResource(result, this._client); @@ -11947,7 +15254,7 @@ export class NodeAppResource extends ResourceBuilderBase const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new NodeAppResource(result, this._client); @@ -11978,7 +15285,7 @@ export class NodeAppResource extends ResourceBuilderBase private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new NodeAppResource(result, this._client); @@ -11993,7 +15300,7 @@ export class NodeAppResource extends ResourceBuilderBase private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new NodeAppResource(result, this._client); @@ -12172,6 +15479,106 @@ export class NodeAppResource extends ResourceBuilderBase ); } + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceReadyInternal(callback)); + } + /** @internal */ private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { const rpcArgs: Record = { resource: this._handle }; @@ -12284,36 +15691,6 @@ export class NodeAppResource extends ResourceBuilderBase return new NodeAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } - /** @internal */ - private async _withScriptDebuggingInternal(scriptPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, scriptPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.JavaScript/withScriptDebugging', - rpcArgs - ); - return new NodeAppResource(result, this._client); - } - - /** Enables debugging support for a Node.js application with an explicit script path */ - withScriptDebugging(scriptPath: string): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withScriptDebuggingInternal(scriptPath)); - } - - /** @internal */ - private async _withDebuggingInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.JavaScript/withDebugging', - rpcArgs - ); - return new NodeAppResource(result, this._client); - } - - /** Enables debugging support for a JavaScript application */ - withDebugging(): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._withDebuggingInternal()); - } - /** @internal */ private async _withBrowserDebuggerInternal(browser?: string): Promise { const rpcArgs: Record = { builder: this._handle }; @@ -12325,7 +15702,7 @@ export class NodeAppResource extends ResourceBuilderBase return new NodeAppResource(result, this._client); } - /** Configures browser debugging support */ + /** Configures a browser debugger for the JavaScript application */ withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { const browser = options?.browser; return new NodeAppResourcePromise(this._withBrowserDebuggerInternal(browser)); @@ -12398,31 +15775,21 @@ export class NodeAppResourcePromise implements PromiseLike { return new NodeAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -12453,16 +15820,6 @@ export class NodeAppResourcePromise implements PromiseLike { return new NodeAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): NodeAppResourcePromise { return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -12678,6 +16035,31 @@ export class NodeAppResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + /** Configures npm as the package manager */ withNpm(options?: WithNpmOptions): NodeAppResourcePromise { return new NodeAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); @@ -12708,17 +16090,7 @@ export class NodeAppResourcePromise implements PromiseLike { return new NodeAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); } - /** Enables debugging support for a Node.js application with an explicit script path */ - withScriptDebugging(scriptPath: string): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._promise.then(obj => obj.withScriptDebugging(scriptPath))); - } - - /** Enables debugging support for a JavaScript application */ - withDebugging(): NodeAppResourcePromise { - return new NodeAppResourcePromise(this._promise.then(obj => obj.withDebugging())); - } - - /** Configures browser debugging support */ + /** Configures a browser debugger for the JavaScript application */ withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { return new NodeAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); } @@ -12966,7 +16338,7 @@ export class ParameterResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new ParameterResource(result, this._client); @@ -12981,7 +16353,7 @@ export class ParameterResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new ParameterResource(result, this._client); @@ -13024,36 +16396,6 @@ export class ParameterResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ParameterResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ParameterResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -13131,6 +16473,86 @@ export class ParameterResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -13233,16 +16655,6 @@ export class ParameterResourcePromise implements PromiseLike return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); @@ -13263,6 +16675,26 @@ export class ParameterResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -13358,74 +16790,76 @@ export class ProjectResource extends ResourceBuilderBase } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + 'Aspire.Hosting/withReplicas', rpcArgs ); return new ProjectResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - const helpLink = options?.helpLink; - return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReplicasInternal(replicas)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + 'Aspire.Hosting/disableForwardedHeaders', rpcArgs ); return new ProjectResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._disableForwardedHeadersInternal()); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configure !== undefined) rpcArgs.configure = configureId; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', rpcArgs ); return new ProjectResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + const configure = options?.configure; + return new ProjectResourcePromise(this._publishAsDockerFileInternal(configure)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); return new ProjectResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); @@ -13433,15 +16867,15 @@ export class ProjectResource extends ResourceBuilderBase }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); return new ProjectResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -13459,6 +16893,21 @@ export class ProjectResource extends ResourceBuilderBase return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + /** @internal */ private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; @@ -13545,10 +16994,11 @@ export class ProjectResource extends ResourceBuilderBase } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -13560,37 +17010,8 @@ export class ProjectResource extends ResourceBuilderBase withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -13875,7 +17296,7 @@ export class ProjectResource extends ResourceBuilderBase private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); return new ProjectResource(result, this._client); @@ -13905,7 +17326,7 @@ export class ProjectResource extends ResourceBuilderBase private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ProjectResource(result, this._client); @@ -13935,7 +17356,7 @@ export class ProjectResource extends ResourceBuilderBase private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ProjectResource(result, this._client); @@ -13981,7 +17402,7 @@ export class ProjectResource extends ResourceBuilderBase const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ProjectResource(result, this._client); @@ -14086,7 +17507,7 @@ export class ProjectResource extends ResourceBuilderBase const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ProjectResource(result, this._client); @@ -14117,7 +17538,7 @@ export class ProjectResource extends ResourceBuilderBase private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new ProjectResource(result, this._client); @@ -14132,7 +17553,7 @@ export class ProjectResource extends ResourceBuilderBase private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new ProjectResource(result, this._client); @@ -14311,6 +17732,106 @@ export class ProjectResource extends ResourceBuilderBase ); } + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -14353,29 +17874,29 @@ export class ProjectResourcePromise implements PromiseLike { return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ @@ -14383,6 +17904,11 @@ export class ProjectResourcePromise implements PromiseLike { return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -14413,16 +17939,6 @@ export class ProjectResourcePromise implements PromiseLike { return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ProjectResourcePromise { return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -14628,6 +18144,31 @@ export class ProjectResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -14805,41 +18346,11 @@ export class PythonAppResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new PythonAppResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): PythonAppResourcePromise { - return new PythonAppResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new PythonAppResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): PythonAppResourcePromise { - return new PythonAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -14850,43 +18361,38 @@ export class PythonAppResource extends ResourceBuilderBase Promise): PythonAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): PythonAppResourcePromise { return new PythonAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new PythonAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PythonAppResourcePromise { - return new PythonAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new PythonAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PythonAppResourcePromise { - return new PythonAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -14975,10 +18481,11 @@ export class PythonAppResource extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -14990,37 +18497,8 @@ export class PythonAppResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new PythonAppResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): PythonAppResourcePromise { - return new PythonAppResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new PythonAppResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PythonAppResourcePromise { - return new PythonAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new PythonAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -15305,7 +18783,7 @@ export class PythonAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); return new PythonAppResource(result, this._client); @@ -15335,7 +18813,7 @@ export class PythonAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new PythonAppResource(result, this._client); @@ -15365,7 +18843,7 @@ export class PythonAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new PythonAppResource(result, this._client); @@ -15411,7 +18889,7 @@ export class PythonAppResource extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new PythonAppResource(result, this._client); @@ -15516,7 +18994,7 @@ export class PythonAppResource extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new PythonAppResource(result, this._client); @@ -15547,7 +19025,7 @@ export class PythonAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new PythonAppResource(result, this._client); @@ -15562,7 +19040,7 @@ export class PythonAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new PythonAppResource(result, this._client); @@ -15741,6 +19219,191 @@ export class PythonAppResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withVirtualEnvironmentInternal(virtualEnvironmentPath: string, createIfNotExists?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, virtualEnvironmentPath }; + if (createIfNotExists !== undefined) rpcArgs.createIfNotExists = createIfNotExists; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Python/withVirtualEnvironment', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Configures the virtual environment for a Python application */ + withVirtualEnvironment(virtualEnvironmentPath: string, options?: WithVirtualEnvironmentOptions): PythonAppResourcePromise { + const createIfNotExists = options?.createIfNotExists; + return new PythonAppResourcePromise(this._withVirtualEnvironmentInternal(virtualEnvironmentPath, createIfNotExists)); + } + + /** @internal */ + private async _withDebuggingInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Python/withDebugging', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Enables debugging support for a Python application */ + withDebugging(): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withDebuggingInternal()); + } + + /** @internal */ + private async _withEntrypointInternal(entrypointType: EntrypointType, entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypointType, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Python/withEntrypoint', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Configures the entrypoint for a Python application */ + withEntrypoint(entrypointType: EntrypointType, entrypoint: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._withEntrypointInternal(entrypointType, entrypoint)); + } + + /** @internal */ + private async _withPipInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Python/withPip', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Configures pip package installation for a Python application */ + withPip(options?: WithPipOptions): PythonAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new PythonAppResourcePromise(this._withPipInternal(install, installArgs)); + } + + /** @internal */ + private async _withUvInternal(install?: boolean, args?: string[]): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Python/withUv', + rpcArgs + ); + return new PythonAppResource(result, this._client); + } + + /** Configures uv package management for a Python application */ + withUv(options?: WithUvOptions): PythonAppResourcePromise { + const install = options?.install; + const args = options?.args; + return new PythonAppResourcePromise(this._withUvInternal(install, args)); + } + } /** @@ -15808,31 +19471,21 @@ export class PythonAppResourcePromise implements PromiseLike return new PythonAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): PythonAppResourcePromise { - return new PythonAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): PythonAppResourcePromise { - return new PythonAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PythonAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): PythonAppResourcePromise { return new PythonAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PythonAppResourcePromise { - return new PythonAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PythonAppResourcePromise { return new PythonAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): PythonAppResourcePromise { return new PythonAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -15863,16 +19516,6 @@ export class PythonAppResourcePromise implements PromiseLike return new PythonAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): PythonAppResourcePromise { - return new PythonAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PythonAppResourcePromise { - return new PythonAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): PythonAppResourcePromise { return new PythonAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -16078,6 +19721,56 @@ export class PythonAppResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures the virtual environment for a Python application */ + withVirtualEnvironment(virtualEnvironmentPath: string, options?: WithVirtualEnvironmentOptions): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withVirtualEnvironment(virtualEnvironmentPath, options))); + } + + /** Enables debugging support for a Python application */ + withDebugging(): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withDebugging())); + } + + /** Configures the entrypoint for a Python application */ + withEntrypoint(entrypointType: EntrypointType, entrypoint: string): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypointType, entrypoint))); + } + + /** Configures pip package installation for a Python application */ + withPip(options?: WithPipOptions): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withPip(options))); + } + + /** Configures uv package management for a Python application */ + withUv(options?: WithUvOptions): PythonAppResourcePromise { + return new PythonAppResourcePromise(this._promise.then(obj => obj.withUv(options))); + } + } // ============================================================================ @@ -16296,7 +19989,7 @@ export class RedisCommanderResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); return new RedisCommanderResource(result, this._client); @@ -16311,7 +20004,7 @@ export class RedisCommanderResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); return new RedisCommanderResource(result, this._client); @@ -16453,41 +20146,11 @@ export class RedisCommanderResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -16498,43 +20161,38 @@ export class RedisCommanderResource extends ResourceBuilderBase Promise): RedisCommanderResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { return new RedisCommanderResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new RedisCommanderResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new RedisCommanderResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -16608,67 +20266,39 @@ export class RedisCommanderResource extends ResourceBuilderBase = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); - } - - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withArgsCallbackAsyncInternal(callback)); - } - - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); - } - - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisCommanderResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new RedisCommanderResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); return new RedisCommanderResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withServiceReferenceInternal(source)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + 'Aspire.Hosting/withReference', rpcArgs ); return new RedisCommanderResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisCommanderResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new RedisCommanderResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -16968,7 +20598,7 @@ export class RedisCommanderResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new RedisCommanderResource(result, this._client); @@ -16998,7 +20628,7 @@ export class RedisCommanderResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new RedisCommanderResource(result, this._client); @@ -17044,7 +20674,7 @@ export class RedisCommanderResource extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new RedisCommanderResource(result, this._client); @@ -17149,7 +20779,7 @@ export class RedisCommanderResource extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new RedisCommanderResource(result, this._client); @@ -17180,7 +20810,7 @@ export class RedisCommanderResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new RedisCommanderResource(result, this._client); @@ -17195,7 +20825,7 @@ export class RedisCommanderResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new RedisCommanderResource(result, this._client); @@ -17393,6 +21023,106 @@ export class RedisCommanderResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._onResourceReadyInternal(callback)); + } + /** @internal */ private async _withHostPortInternal(port?: number): Promise { const rpcArgs: Record = { builder: this._handle }; @@ -17542,31 +21272,21 @@ export class RedisCommanderResourcePromise implements PromiseLike obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): RedisCommanderResourcePromise { return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -17597,16 +21317,6 @@ export class RedisCommanderResourcePromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): RedisCommanderResourcePromise { return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -17812,6 +21522,31 @@ export class RedisCommanderResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + /** Sets the host port for Redis Commander */ withHostPort(options?: WithHostPortOptions): RedisCommanderResourcePromise { return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHostPort(options))); @@ -18035,7 +21770,7 @@ export class RedisInsightResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); return new RedisInsightResource(result, this._client); @@ -18050,7 +21785,7 @@ export class RedisInsightResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); return new RedisInsightResource(result, this._client); @@ -18192,41 +21927,11 @@ export class RedisInsightResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new RedisInsightResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new RedisInsightResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -18237,43 +21942,38 @@ export class RedisInsightResource extends ResourceBuilderBase Promise): RedisInsightResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { return new RedisInsightResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new RedisInsightResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new RedisInsightResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -18362,10 +22062,11 @@ export class RedisInsightResource extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -18377,37 +22078,8 @@ export class RedisInsightResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new RedisInsightResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new RedisInsightResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new RedisInsightResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -18707,7 +22379,7 @@ export class RedisInsightResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new RedisInsightResource(result, this._client); @@ -18737,7 +22409,7 @@ export class RedisInsightResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new RedisInsightResource(result, this._client); @@ -18783,7 +22455,7 @@ export class RedisInsightResource extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new RedisInsightResource(result, this._client); @@ -18888,7 +22560,7 @@ export class RedisInsightResource extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new RedisInsightResource(result, this._client); @@ -18919,7 +22591,7 @@ export class RedisInsightResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new RedisInsightResource(result, this._client); @@ -18934,7 +22606,7 @@ export class RedisInsightResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new RedisInsightResource(result, this._client); @@ -19093,43 +22765,143 @@ export class RedisInsightResource extends ResourceBuilderBase = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisInsightResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); return new RedisInsightResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', + 'Aspire.Hosting/onResourceReady', rpcArgs ); return new RedisInsightResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new RedisInsightResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); - } - - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -19313,31 +23085,21 @@ export class RedisInsightResourcePromise implements PromiseLike obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): RedisInsightResourcePromise { return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -19368,16 +23130,6 @@ export class RedisInsightResourcePromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): RedisInsightResourcePromise { return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -19583,6 +23335,31 @@ export class RedisInsightResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + /** Sets the host port for Redis Insight */ withHostPort(options?: WithHostPortOptions): RedisInsightResourcePromise { return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHostPort(options))); @@ -19642,6 +23419,17 @@ export class RedisResource extends ResourceBuilderBase { }, }; + /** Gets the PasswordParameter property */ + passwordParameter = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.passwordParameter', + { context: this._handle } + ); + return new ParameterResource(handle, this._client); + }, + }; + /** Gets the TlsEnabled property */ tlsEnabled = { get: async (): Promise => { @@ -19650,12 +23438,6 @@ export class RedisResource extends ResourceBuilderBase { { context: this._handle } ); }, - set: async (value: boolean): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.setTlsEnabled', - { context: this._handle, value } - ); - } }; /** Gets the ConnectionStringExpression property */ @@ -19927,7 +23709,7 @@ export class RedisResource extends ResourceBuilderBase { private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); return new RedisResource(result, this._client); @@ -19942,7 +23724,7 @@ export class RedisResource extends ResourceBuilderBase { private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); return new RedisResource(result, this._client); @@ -20084,41 +23866,11 @@ export class RedisResource extends ResourceBuilderBase { } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new RedisResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new RedisResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -20129,43 +23881,38 @@ export class RedisResource extends ResourceBuilderBase { } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { return new RedisResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new RedisResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new RedisResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -20284,10 +24031,11 @@ export class RedisResource extends ResourceBuilderBase { } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -20299,37 +24047,17 @@ export class RedisResource extends ResourceBuilderBase { withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new RedisResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new RedisResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._withServiceReferenceInternal(source)); + const name = options?.name; + return new RedisResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', rpcArgs ); - return new RedisResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisResourcePromise { - return new RedisResourcePromise(this._withServiceReferenceNamedInternal(source, name)); } /** @internal */ @@ -20629,7 +24357,7 @@ export class RedisResource extends ResourceBuilderBase { private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new RedisResource(result, this._client); @@ -20659,7 +24387,7 @@ export class RedisResource extends ResourceBuilderBase { private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new RedisResource(result, this._client); @@ -20705,7 +24433,7 @@ export class RedisResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new RedisResource(result, this._client); @@ -20810,7 +24538,7 @@ export class RedisResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new RedisResource(result, this._client); @@ -20841,7 +24569,7 @@ export class RedisResource extends ResourceBuilderBase { private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new RedisResource(result, this._client); @@ -20856,7 +24584,7 @@ export class RedisResource extends ResourceBuilderBase { private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new RedisResource(result, this._client); @@ -20932,126 +24660,246 @@ export class RedisResource extends ResourceBuilderBase { private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisResourcePromise { + return new RedisResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisResourcePromise { + return new RedisResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new RedisResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); return new RedisResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): RedisResourcePromise { - return new RedisResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + 'Aspire.Hosting/onResourceStopped', rpcArgs ); return new RedisResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): RedisResourcePromise { - return new RedisResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + 'Aspire.Hosting/onConnectionStringAvailable', rpcArgs ); return new RedisResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new RedisResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onConnectionStringAvailableInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + 'Aspire.Hosting/onInitializeResource', rpcArgs ); return new RedisResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); return new RedisResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', + 'Aspire.Hosting/onResourceReady', rpcArgs ); return new RedisResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new RedisResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); - } - - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -21321,31 +25169,21 @@ export class RedisResourcePromise implements PromiseLike { return new RedisResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): RedisResourcePromise { return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -21386,14 +25224,9 @@ export class RedisResourcePromise implements PromiseLike { return new RedisResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } /** Adds a reference to a URI */ @@ -21601,6 +25434,36 @@ export class RedisResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + /** Adds Redis Commander management UI */ withRedisCommander(options?: WithRedisCommanderOptions): RedisResourcePromise { return new RedisResourcePromise(this._promise.then(obj => obj.withRedisCommander(options))); @@ -21813,41 +25676,11 @@ export class UvicornAppResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new UvicornAppResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): UvicornAppResourcePromise { - return new UvicornAppResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new UvicornAppResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): UvicornAppResourcePromise { - return new UvicornAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -21858,43 +25691,38 @@ export class UvicornAppResource extends ResourceBuilderBase Promise): UvicornAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): UvicornAppResourcePromise { return new UvicornAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new UvicornAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): UvicornAppResourcePromise { - return new UvicornAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new UvicornAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): UvicornAppResourcePromise { - return new UvicornAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -21983,10 +25811,11 @@ export class UvicornAppResource extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -21998,37 +25827,8 @@ export class UvicornAppResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new UvicornAppResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): UvicornAppResourcePromise { - return new UvicornAppResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new UvicornAppResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): UvicornAppResourcePromise { - return new UvicornAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new UvicornAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -22313,7 +26113,7 @@ export class UvicornAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); return new UvicornAppResource(result, this._client); @@ -22343,7 +26143,7 @@ export class UvicornAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new UvicornAppResource(result, this._client); @@ -22373,7 +26173,7 @@ export class UvicornAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new UvicornAppResource(result, this._client); @@ -22419,7 +26219,7 @@ export class UvicornAppResource extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new UvicornAppResource(result, this._client); @@ -22524,7 +26324,7 @@ export class UvicornAppResource extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new UvicornAppResource(result, this._client); @@ -22555,7 +26355,7 @@ export class UvicornAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new UvicornAppResource(result, this._client); @@ -22570,7 +26370,7 @@ export class UvicornAppResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new UvicornAppResource(result, this._client); @@ -22703,50 +26503,150 @@ export class UvicornAppResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new UvicornAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); return new UvicornAppResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): UvicornAppResourcePromise { - return new UvicornAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + 'Aspire.Hosting/onResourceReady', rpcArgs ); return new UvicornAppResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): UvicornAppResourcePromise { - return new UvicornAppResourcePromise(this._withPipelineConfigurationInternal(callback)); - } - - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -22901,31 +26801,21 @@ export class UvicornAppResourcePromise implements PromiseLike obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): UvicornAppResourcePromise { - return new UvicornAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): UvicornAppResourcePromise { - return new UvicornAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): UvicornAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): UvicornAppResourcePromise { return new UvicornAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): UvicornAppResourcePromise { - return new UvicornAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): UvicornAppResourcePromise { return new UvicornAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): UvicornAppResourcePromise { return new UvicornAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -22956,16 +26846,6 @@ export class UvicornAppResourcePromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): UvicornAppResourcePromise { - return new UvicornAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): UvicornAppResourcePromise { - return new UvicornAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): UvicornAppResourcePromise { return new UvicornAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -23171,6 +27051,31 @@ export class UvicornAppResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): UvicornAppResourcePromise { + return new UvicornAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + /** Configures the virtual environment for a Python application */ withVirtualEnvironment(virtualEnvironmentPath: string, options?: WithVirtualEnvironmentOptions): UvicornAppResourcePromise { return new UvicornAppResourcePromise(this._promise.then(obj => obj.withVirtualEnvironment(virtualEnvironmentPath, options))); @@ -23403,41 +27308,11 @@ export class ViteAppResource extends ResourceBuilderBase } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ViteAppResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ViteAppResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -23448,43 +27323,38 @@ export class ViteAppResource extends ResourceBuilderBase } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { return new ViteAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new ViteAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ViteAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -23573,10 +27443,11 @@ export class ViteAppResource extends ResourceBuilderBase } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -23588,37 +27459,8 @@ export class ViteAppResource extends ResourceBuilderBase withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new ViteAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ViteAppResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ViteAppResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ViteAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -23948,7 +27790,7 @@ export class ViteAppResource extends ResourceBuilderBase private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ViteAppResource(result, this._client); @@ -23978,7 +27820,7 @@ export class ViteAppResource extends ResourceBuilderBase private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ViteAppResource(result, this._client); @@ -24024,7 +27866,7 @@ export class ViteAppResource extends ResourceBuilderBase const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ViteAppResource(result, this._client); @@ -24129,7 +27971,7 @@ export class ViteAppResource extends ResourceBuilderBase const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ViteAppResource(result, this._client); @@ -24160,7 +28002,7 @@ export class ViteAppResource extends ResourceBuilderBase private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new ViteAppResource(result, this._client); @@ -24175,7 +28017,7 @@ export class ViteAppResource extends ResourceBuilderBase private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new ViteAppResource(result, this._client); @@ -24354,6 +28196,106 @@ export class ViteAppResource extends ResourceBuilderBase ); } + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceReadyInternal(callback)); + } + /** @internal */ private async _withViteConfigInternal(configPath: string): Promise { const rpcArgs: Record = { builder: this._handle, configPath }; @@ -24481,21 +28423,6 @@ export class ViteAppResource extends ResourceBuilderBase return new ViteAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } - /** @internal */ - private async _withDebuggingInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.JavaScript/withDebugging', - rpcArgs - ); - return new ViteAppResource(result, this._client); - } - - /** Enables debugging support for a JavaScript application */ - withDebugging(): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._withDebuggingInternal()); - } - /** @internal */ private async _withBrowserDebuggerInternal(browser?: string): Promise { const rpcArgs: Record = { builder: this._handle }; @@ -24507,7 +28434,7 @@ export class ViteAppResource extends ResourceBuilderBase return new ViteAppResource(result, this._client); } - /** Configures browser debugging support */ + /** Configures a browser debugger for the JavaScript application */ withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { const browser = options?.browser; return new ViteAppResourcePromise(this._withBrowserDebuggerInternal(browser)); @@ -24580,31 +28507,21 @@ export class ViteAppResourcePromise implements PromiseLike { return new ViteAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -24635,16 +28552,6 @@ export class ViteAppResourcePromise implements PromiseLike { return new ViteAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ViteAppResourcePromise { return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -24855,6 +28762,31 @@ export class ViteAppResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + /** Configures a custom Vite configuration file */ withViteConfig(configPath: string): ViteAppResourcePromise { return new ViteAppResourcePromise(this._promise.then(obj => obj.withViteConfig(configPath))); @@ -24880,24 +28812,87 @@ export class ViteAppResourcePromise implements PromiseLike { return new ViteAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); } - /** Specifies an npm script to run before starting the application */ - withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + +} + +// ============================================================================ +// ComputeResource +// ============================================================================ + +export class ComputeResource extends ResourceBuilderBase { + constructor(handle: IComputeResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Specifies an npm script to run during development */ - withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); +} + +/** + * Thenable wrapper for ComputeResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ComputeResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ComputeResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Enables debugging support for a JavaScript application */ - withDebugging(): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withDebugging())); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Configures browser debugging support */ - withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { - return new ViteAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } } @@ -24915,7 +28910,7 @@ export class ContainerFilesDestinationResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); return new ContainerFilesDestinationResource(result, this._client); @@ -25174,7 +29169,7 @@ export class Resource extends ResourceBuilderBase { private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new Resource(result, this._client); @@ -25189,7 +29184,7 @@ export class Resource extends ResourceBuilderBase { private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new Resource(result, this._client); @@ -25232,36 +29227,6 @@ export class Resource extends ResourceBuilderBase { return new ResourcePromise(this._excludeFromMcpInternal()); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -25339,6 +29304,86 @@ export class Resource extends ResourceBuilderBase { ); } + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -25436,16 +29481,6 @@ export class ResourcePromise implements PromiseLike { return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); @@ -25466,6 +29501,26 @@ export class ResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -25605,6 +29660,35 @@ export class ResourceWithConnectionString extends ResourceBuilderBase { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._onConnectionStringAvailableInternal(callback)); + } + } /** @@ -25632,6 +29716,16 @@ export class ResourceWithConnectionStringPromise implements PromiseLike obj.withConnectionPropertyValue(name, value))); } + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + } // ============================================================================ @@ -25920,6 +30014,26 @@ export class ResourceWithEndpoints extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + } /** @@ -25987,6 +30101,11 @@ export class ResourceWithEndpointsPromise implements PromiseLike obj.withHttpProbe(probeType, options))); } + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + } // ============================================================================ @@ -26029,41 +30148,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -26074,43 +30163,38 @@ export class ResourceWithEnvironment extends ResourceBuilderBase Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -26144,10 +30228,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -26159,37 +30244,8 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -26272,7 +30328,7 @@ export class ResourceWithEnvironment extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ResourceWithEnvironment(result, this._client); @@ -26326,31 +30382,21 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withOtlpExporterProtocol(protocol))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -26366,16 +30412,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -26413,34 +30449,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike { - constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { - super(handle, client); - } - -} - -/** - * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ResourceWithServiceDiscoveryPromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - -} - // ============================================================================ // ResourceWithWaitSupport // ============================================================================ @@ -26454,7 +30462,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -26484,7 +30492,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -26515,7 +30523,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -26634,7 +30642,7 @@ export async function createBuilder(options?: CreateBuilderOptions): Promise { const error = reason instanceof Error ? reason : new Error(String(reason)); - if (reason instanceof CapabilityError) { + if (reason instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else if (reason instanceof CapabilityError) { console.error(`\n❌ Capability Error: ${error.message}`); console.error(` Code: ${(reason as CapabilityError).code}`); if ((reason as CapabilityError).capability) { @@ -26665,8 +30675,12 @@ process.on('unhandledRejection', (reason: unknown) => { }); process.on('uncaughtException', (error: Error) => { - console.error(`\n❌ Uncaught Exception: ${error.message}`); - if (error.stack) { + if (error instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + } + if (!(error instanceof AppHostUsageError) && error.stack) { console.error(error.stack); } process.exit(1); @@ -26677,21 +30691,44 @@ process.on('uncaughtException', (error: Error) => { // ============================================================================ // Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent', (handle, client) => new AfterResourcesCreatedEvent(handle as AfterResourcesCreatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent', (handle, client) => new BeforeResourceStartedEvent(handle as BeforeResourceStartedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent', (handle, client) => new BeforeStartEvent(handle as BeforeStartEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent', (handle, client) => new ConnectionStringAvailableEvent(handle as ConnectionStringAvailableEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel', (handle, client) => new DistributedApplicationModel(handle as DistributedApplicationModelHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent', (handle, client) => new InitializeResourceEvent(handle as InitializeResourceEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext', (handle, client) => new PipelineContext(handle as PipelineContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext', (handle, client) => new PipelineStepFactoryContext(handle as PipelineStepFactoryContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary', (handle, client) => new PipelineSummary(handle as PipelineSummaryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent', (handle, client) => new ResourceEndpointsAllocatedEvent(handle as ResourceEndpointsAllocatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService', (handle, client) => new ResourceLoggerService(handle as ResourceLoggerServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService', (handle, client) => new ResourceNotificationService(handle as ResourceNotificationServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent', (handle, client) => new ResourceReadyEvent(handle as ResourceReadyEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent', (handle, client) => new ResourceStoppedEvent(handle as ResourceStoppedEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext', (handle, client) => new UpdateCommandStateContext(handle as UpdateCommandStateContextHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration', (handle, client) => new Configuration(handle as IConfigurationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment', (handle, client) => new HostEnvironment(handle as IHostEnvironmentHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger', (handle, client) => new Logger(handle as ILoggerHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory', (handle, client) => new LoggerFactory(handle as ILoggerFactoryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep', (handle, client) => new ReportingStep(handle as IReportingStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask', (handle, client) => new ReportingTask(handle as IReportingTaskHandle, client)); +registerHandleWrapper('System.ComponentModel/System.IServiceProvider', (handle, client) => new ServiceProvider(handle as IServiceProviderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IUserSecretsManager', (handle, client) => new UserSecretsManager(handle as IUserSecretsManagerHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); @@ -26709,6 +30746,7 @@ registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisInsightRes registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.ApplicationModel.RedisResource', (handle, client) => new RedisResource(handle as RedisResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.Python/Aspire.Hosting.Python.UvicornAppResource', (handle, client) => new UvicornAppResource(handle as UvicornAppResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource', (handle, client) => new ViteAppResource(handle as ViteAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource', (handle, client) => new ComputeResource(handle as IComputeResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); @@ -26716,6 +30754,5 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceW registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); diff --git a/samples/aspire-with-python/ts/.modules/base.ts b/samples/aspire-with-python/ts/.modules/base.ts index 7778b0f1..b3d8b8be 100644 --- a/samples/aspire-with-python/ts/.modules/base.ts +++ b/samples/aspire-with-python/ts/.modules/base.ts @@ -1,8 +1,8 @@ -// aspire.ts - Core Aspire types: base classes, ReferenceExpression -import { Handle, AspireClient, MarshalledHandle } from './transport.js'; +// base.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle, CancellationToken, registerCancellation, registerHandleWrapper, unregisterCancellation } from './transport.js'; // Re-export transport types for convenience -export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export { Handle, AspireClient, CapabilityError, CancellationToken, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; @@ -43,22 +43,46 @@ export class ReferenceExpression { private readonly _format?: string; private readonly _valueProviders?: unknown[]; + // Conditional mode fields + private readonly _condition?: unknown; + private readonly _whenTrue?: ReferenceExpression; + private readonly _whenFalse?: ReferenceExpression; + private readonly _matchValue?: string; + // Handle mode fields (when wrapping a server-returned handle) private readonly _handle?: Handle; private readonly _client?: AspireClient; constructor(format: string, valueProviders: unknown[]); constructor(handle: Handle, client: AspireClient); - constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { - if (typeof handleOrFormat === 'string') { - this._format = handleOrFormat; - this._valueProviders = clientOrValueProviders as unknown[]; + constructor(condition: unknown, matchValue: string, whenTrue: ReferenceExpression, whenFalse: ReferenceExpression); + constructor( + handleOrFormatOrCondition: Handle | string | unknown, + clientOrValueProvidersOrMatchValue: AspireClient | unknown[] | string, + whenTrueOrWhenFalse?: ReferenceExpression, + whenFalse?: ReferenceExpression + ) { + if (typeof handleOrFormatOrCondition === 'string') { + this._format = handleOrFormatOrCondition; + this._valueProviders = clientOrValueProvidersOrMatchValue as unknown[]; + } else if (handleOrFormatOrCondition instanceof Handle) { + this._handle = handleOrFormatOrCondition; + this._client = clientOrValueProvidersOrMatchValue as AspireClient; } else { - this._handle = handleOrFormat; - this._client = clientOrValueProviders as AspireClient; + this._condition = handleOrFormatOrCondition; + this._matchValue = (clientOrValueProvidersOrMatchValue as string) ?? 'True'; + this._whenTrue = whenTrueOrWhenFalse; + this._whenFalse = whenFalse; } } + /** + * Gets whether this reference expression is conditional. + */ + get isConditional(): boolean { + return this._condition !== undefined; + } + /** * Creates a reference expression from a tagged template literal. * @@ -82,16 +106,46 @@ export class ReferenceExpression { return new ReferenceExpression(format, valueProviders); } + /** + * Creates a conditional reference expression from its constituent parts. + * + * @param condition - A value provider whose result is compared to matchValue + * @param whenTrue - The expression to use when the condition matches + * @param whenFalse - The expression to use when the condition does not match + * @param matchValue - The value to compare the condition against (defaults to "True") + * @returns A ReferenceExpression instance in conditional mode + */ + static createConditional( + condition: unknown, + matchValue: string, + whenTrue: ReferenceExpression, + whenFalse: ReferenceExpression + ): ReferenceExpression { + return new ReferenceExpression(condition, matchValue, whenTrue, whenFalse); + } + /** * Serializes the reference expression for JSON-RPC transport. - * In template-literal mode, uses the $expr format. + * In expression mode, uses the $expr format with format + valueProviders. + * In conditional mode, uses the $expr format with condition + whenTrue + whenFalse. * In handle mode, delegates to the handle's serialization. */ - toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } | { condition: unknown; whenTrue: unknown; whenFalse: unknown; matchValue: string } } | MarshalledHandle { if (this._handle) { return this._handle.toJSON(); } + if (this.isConditional) { + return { + $expr: { + condition: extractHandleForExpr(this._condition), + whenTrue: this._whenTrue!.toJSON(), + whenFalse: this._whenFalse!.toJSON(), + matchValue: this._matchValue! + } + }; + } + return { $expr: { format: this._format!, @@ -100,6 +154,30 @@ export class ReferenceExpression { }; } + /** + * Resolves the expression to its string value on the server. + * Only available on server-returned ReferenceExpression instances (handle mode). + * + * @param cancellationToken - Optional AbortSignal or CancellationToken for cancellation support + * @returns The resolved string value, or null if the expression resolves to null + */ + async getValue(cancellationToken?: AbortSignal | CancellationToken): Promise { + if (!this._handle || !this._client) { + throw new Error('getValue is only available on server-returned ReferenceExpression instances'); + } + const cancellationTokenId = registerCancellation(this._client, cancellationToken); + try { + const rpcArgs: Record = { context: this._handle }; + if (cancellationTokenId !== undefined) rpcArgs.cancellationToken = cancellationTokenId; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValue', + rpcArgs + ); + } finally { + unregisterCancellation(cancellationTokenId); + } + } + /** * String representation for debugging. */ @@ -107,10 +185,17 @@ export class ReferenceExpression { if (this._handle) { return `ReferenceExpression(handle)`; } + if (this.isConditional) { + return `ReferenceExpression(conditional)`; + } return `ReferenceExpression(${this._format})`; } } +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression', (handle, client) => + new ReferenceExpression(handle, client) +); + /** * Extracts a value for use in reference expressions. * Supports handles (objects) and string literals. @@ -136,15 +221,15 @@ function extractHandleForExpr(value: unknown): unknown { return value.toJSON(); } - // Objects with $handle property (already in handle format) - if (typeof value === 'object' && value !== null && '$handle' in value) { + // Objects with marshalled expression/handle payloads + if (typeof value === 'object' && value !== null && ('$handle' in value || '$expr' in value)) { return value; } - // Objects with toJSON that returns a handle + // Objects with toJSON that returns a marshalled expression or handle if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { const json = value.toJSON(); - if (json && typeof json === 'object' && '$handle' in json) { + if (json && typeof json === 'object' && ('$handle' in json || '$expr' in json)) { return json; } } @@ -307,11 +392,20 @@ export class AspireList { }) as T[]; } - toJSON(): MarshalledHandle { - if (this._resolvedHandle) { - return this._resolvedHandle.toJSON(); + async toTransportValue(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireList must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); } - return this._handleOrContext.toJSON(); + + return this._resolvedHandle.toJSON(); } } @@ -466,8 +560,19 @@ export class AspireDict { }) as Record; } - async toJSON(): Promise { + async toTransportValue(): Promise { const handle = await this._ensureHandle(); return handle.toJSON(); } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireDict must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); + } + + return this._resolvedHandle.toJSON(); + } } diff --git a/samples/aspire-with-python/ts/.modules/transport.ts b/samples/aspire-with-python/ts/.modules/transport.ts index 7bddd74b..6d29cf28 100644 --- a/samples/aspire-with-python/ts/.modules/transport.ts +++ b/samples/aspire-with-python/ts/.modules/transport.ts @@ -77,7 +77,8 @@ export function isAtsError(value: unknown): value is { $error: AtsError } { value !== null && typeof value === 'object' && '$error' in value && - typeof (value as { $error: unknown }).$error === 'object' + typeof (value as { $error: unknown }).$error === 'object' && + (value as { $error: unknown }).$error !== null ); } @@ -93,6 +94,47 @@ export function isMarshalledHandle(value: unknown): value is MarshalledHandle { ); } +function isAbortSignal(value: unknown): value is AbortSignal { + return ( + value !== null && + typeof value === 'object' && + 'aborted' in value && + 'addEventListener' in value && + 'removeEventListener' in value + ); +} + +function isPlainObject(value: unknown): value is Record { + if (value === null || typeof value !== 'object') { + return false; + } + + const prototype = Object.getPrototypeOf(value); + return prototype === Object.prototype || prototype === null; +} + +function hasTransportValue(value: unknown): value is { toTransportValue(): unknown | Promise } { + return ( + value !== null && + typeof value === 'object' && + 'toTransportValue' in value && + typeof (value as { toTransportValue?: unknown }).toTransportValue === 'function' + ); +} + +function createAbortError(message: string): Error { + const error = new Error(message); + error.name = 'AbortError'; + return error; +} + +function createCircularReferenceError(capabilityId: string, path: string): AppHostUsageError { + return new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' contains a circular reference. ` + + 'Circular references are not supported by the AppHost transport.' + ); +} + // ============================================================================ // Handle // ============================================================================ @@ -136,6 +178,92 @@ export class Handle { } } +// ============================================================================ +// CancellationToken +// ============================================================================ + +/** + * Represents a transport-safe cancellation token value for the generated SDK. + * + * Use a plain {@link AbortSignal} when you create cancellation in user code. + * Generated APIs accept either an {@link AbortSignal} or a {@link CancellationToken}. + * + * Values returned from generated callbacks and context/property getters are + * {@link CancellationToken} instances because they may reference remote + * cancellation token handles received from the AppHost. + * + * @example + * ```typescript + * const controller = new AbortController(); + * await connectionStringExpression.getValue(controller.signal); + * ``` + * + * @example + * ```typescript + * const cancellationToken = await context.cancellationToken.get(); + * const connectionStringExpression = await db.uriExpression.get(); + * const connectionString = await connectionStringExpression.getValue(cancellationToken); + * ``` + */ +export class CancellationToken { + private readonly _signal?: AbortSignal; + private readonly _remoteTokenId?: string; + + constructor(signal?: AbortSignal); + constructor(tokenId?: string); + constructor(value?: AbortSignal | string | null) { + if (typeof value === 'string') { + this._remoteTokenId = value; + } else if (isAbortSignal(value)) { + this._signal = value; + } + } + + /** + * Creates a cancellation token from a local {@link AbortSignal}. + */ + static from(signal?: AbortSignal): CancellationToken { + return new CancellationToken(signal); + } + + /** + * Creates a cancellation token from a transport value. + * Generated code uses this to materialize values that come from the AppHost. + */ + static fromValue(value: unknown): CancellationToken { + if (value instanceof CancellationToken) { + return value; + } + + if (typeof value === 'string') { + return new CancellationToken(value); + } + + if (isAbortSignal(value)) { + return new CancellationToken(value); + } + + return new CancellationToken(); + } + + /** + * Serializes the token for JSON-RPC transport. + */ + toJSON(): string | undefined { + return this._remoteTokenId; + } + + register(client?: AspireClient): string | undefined { + if (this._remoteTokenId !== undefined) { + return this._remoteTokenId; + } + + return client + ? registerCancellation(client, this._signal) + : registerCancellation(this._signal); + } +} + // ============================================================================ // Handle Wrapper Registry // ============================================================================ @@ -167,22 +295,35 @@ export function registerHandleWrapper(typeId: string, factory: HandleWrapperFact * @param client - Optional client for creating typed wrapper instances */ export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { - if (value && typeof value === 'object') { - if (isMarshalledHandle(value)) { - const handle = new Handle(value); - const typeId = value.$type; - - // Try to find a registered wrapper factory for this type - if (typeId && client) { - const factory = handleWrapperRegistry.get(typeId); - if (factory) { - return factory(handle, client); - } + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); } + } + + return handle; + } - return handle; + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + value[i] = wrapIfHandle(value[i], client); + } + + return value; + } + + if (isPlainObject(value)) { + for (const [key, nestedValue] of Object.entries(value)) { + value[key] = wrapIfHandle(nestedValue, client); } } + return value; } @@ -213,6 +354,76 @@ export class CapabilityError extends Error { } } +/** + * Error thrown when the AppHost script uses the generated SDK incorrectly. + */ +export class AppHostUsageError extends Error { + constructor(message: string) { + super(message); + this.name = 'AppHostUsageError'; + } +} + +function isPromiseLike(value: unknown): value is PromiseLike { + return ( + value !== null && + (typeof value === 'object' || typeof value === 'function') && + 'then' in value && + typeof (value as { then?: unknown }).then === 'function' + ); +} + +function validateCapabilityArgs( + capabilityId: string, + args?: Record +): void { + if (!args) { + return; + } + + const validateValue = (value: unknown, path: string, ancestors: Set): void => { + if (value === null || value === undefined) { + return; + } + + if (isPromiseLike(value)) { + throw new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' is a Promise-like value. ` + + `This usually means an async builder call was not awaited. ` + + `Did you forget 'await' on a call like builder.addPostgres(...) or resource.addDatabase(...)?` + ); + } + + if (typeof value !== 'object') { + return; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + ancestors.add(value); + try { + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + validateValue(value[i], `${path}[${i}]`, ancestors); + } + return; + } + + for (const [key, nestedValue] of Object.entries(value)) { + validateValue(nestedValue, `${path}.${key}`, ancestors); + } + } finally { + ancestors.delete(value); + } + }; + + for (const [key, value] of Object.entries(args)) { + validateValue(value, key, new Set()); + } +} + // ============================================================================ // Callback Registry // ============================================================================ @@ -324,21 +535,50 @@ export function getCallbackCount(): number { */ const cancellationRegistry = new Map void>(); let cancellationIdCounter = 0; +const connectedClients = new Set(); -/** - * A reference to the current AspireClient for sending cancel requests. - * Set by AspireClient.connect(). - */ -let currentClient: AspireClient | null = null; +function resolveCancellationClient(client?: AspireClient): AspireClient { + if (client) { + return client; + } + + if (connectedClients.size === 1) { + return connectedClients.values().next().value as AspireClient; + } + + if (connectedClients.size === 0) { + throw new Error( + 'registerCancellation(signal) requires a connected AspireClient. ' + + 'Pass the client explicitly or connect the client first.' + ); + } + + throw new Error( + 'registerCancellation(signal) is ambiguous when multiple AspireClient instances are connected. ' + + 'Pass the client explicitly.' + ); +} /** - * Register an AbortSignal for cancellation support. - * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * Registers cancellation support for a local signal or SDK cancellation token. + * Returns a cancellation ID that should be passed to methods accepting cancellation input. * * When the AbortSignal is aborted, sends a cancelToken request to the host. * - * @param signal - The AbortSignal to register (optional) - * @returns The cancellation ID, or undefined if no signal provided + * @param client - The AspireClient that should route the cancellation request + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + */ +export function registerCancellation(client: AspireClient, signalOrToken?: AbortSignal | CancellationToken): string | undefined; +/** + * Registers cancellation support using the single connected AspireClient. + * + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + * + * @example + * const controller = new AbortController(); + * await expression.getValue(controller.signal); * * @example * const controller = new AbortController(); @@ -346,14 +586,29 @@ let currentClient: AspireClient | null = null; * // Pass id to capability invocation * // Later: controller.abort() will cancel the operation */ -export function registerCancellation(signal?: AbortSignal): string | undefined { - if (!signal) { +export function registerCancellation(signalOrToken?: AbortSignal | CancellationToken): string | undefined; +export function registerCancellation( + clientOrSignalOrToken?: AspireClient | AbortSignal | CancellationToken, + maybeSignalOrToken?: AbortSignal | CancellationToken +): string | undefined { + const client = clientOrSignalOrToken instanceof AspireClient ? clientOrSignalOrToken : undefined; + const signalOrToken = client + ? maybeSignalOrToken + : clientOrSignalOrToken as AbortSignal | CancellationToken | undefined; + + if (!signalOrToken) { return undefined; } - // Already aborted? Don't register + if (signalOrToken instanceof CancellationToken) { + return signalOrToken.register(client); + } + + const signal = signalOrToken; + const cancellationClient = resolveCancellationClient(client); + if (signal.aborted) { - return undefined; + throw createAbortError('The operation was aborted before it was sent to the AppHost.'); } const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; @@ -361,8 +616,8 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { // Set up the abort listener const onAbort = () => { // Send cancel request to host - if (currentClient?.connected) { - currentClient.cancelToken(cancellationId).catch(() => { + if (cancellationClient.connected) { + cancellationClient.cancelToken(cancellationId).catch(() => { // Ignore errors - the operation may have already completed }); } @@ -381,6 +636,56 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { return cancellationId; } +async function marshalTransportValue( + value: unknown, + client: AspireClient, + cancellationIds: string[], + capabilityId: string, + path: string = 'args', + ancestors: Set = new Set() +): Promise { + if (value === null || value === undefined || typeof value !== 'object') { + return value; + } + + if (value instanceof CancellationToken) { + const cancellationId = value.register(client); + if (cancellationId !== undefined) { + cancellationIds.push(cancellationId); + } + + return cancellationId; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + const nextAncestors = new Set(ancestors); + nextAncestors.add(value); + + if (hasTransportValue(value)) { + return await marshalTransportValue(await value.toTransportValue(), client, cancellationIds, capabilityId, path, nextAncestors); + } + + if (Array.isArray(value)) { + return await Promise.all( + value.map((item, index) => marshalTransportValue(item, client, cancellationIds, capabilityId, `${path}[${index}]`, nextAncestors)) + ); + } + + if (isPlainObject(value)) { + const entries = await Promise.all( + Object.entries(value).map(async ([key, nestedValue]) => + [key, await marshalTransportValue(nestedValue, client, cancellationIds, capabilityId, `${path}.${key}`, nextAncestors)] as const) + ); + + return Object.fromEntries(entries); + } + + return value; +} + /** * Unregister a cancellation token by its ID. * Call this when the operation completes to clean up resources. @@ -411,6 +716,8 @@ export class AspireClient { private socket: net.Socket | null = null; private disconnectCallbacks: (() => void)[] = []; private _pendingCalls = 0; + private _connectPromise: Promise | null = null; + private _disconnectNotified = false; constructor(private socketPath: string) { } @@ -422,6 +729,12 @@ export class AspireClient { } private notifyDisconnect(): void { + if (this._disconnectNotified) { + return; + } + + this._disconnectNotified = true; + for (const callback of this.disconnectCallbacks) { try { callback(); @@ -432,30 +745,106 @@ export class AspireClient { } connect(timeoutMs: number = 5000): Promise { - return new Promise((resolve, reject) => { - const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + if (this.connected) { + return Promise.resolve(); + } + + if (this._connectPromise) { + return this._connectPromise; + } + + this._disconnectNotified = false; + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this._connectPromise = new Promise((resolve, reject) => { + const socket = net.createConnection(pipePath); + this.socket = socket; - // On Windows, use named pipes; on Unix, use Unix domain sockets - const isWindows = process.platform === 'win32'; - const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + let settled = false; - this.socket = net.createConnection(pipePath); + const cleanupPendingListeners = () => { + socket.removeListener('connect', onConnect); + socket.removeListener('error', onPendingError); + socket.removeListener('close', onPendingClose); + }; - this.socket.once('error', (error: Error) => { + const failConnect = (error: Error) => { + if (settled) { + return; + } + + settled = true; clearTimeout(timeout); + cleanupPendingListeners(); + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + if (!socket.destroyed) { + socket.destroy(); + } + reject(error); - }); + }; + + const onConnectedSocketError = (error: Error) => { + console.error('Socket error:', error); + }; + + const onConnectedSocketClose = () => { + socket.removeListener('error', onConnectedSocketError); + + if (this.socket && this.socket !== socket) { + return; + } + + const connection = this.connection; + this.connection = null; + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + this.notifyDisconnect(); + }; + + const onPendingError = (error: Error) => { + failConnect(error); + }; + + const onPendingClose = () => { + failConnect(new Error('Connection closed before JSON-RPC was established')); + }; + + const onConnect = async () => { + if (settled) { + return; + } - this.socket.once('connect', () => { clearTimeout(timeout); + cleanupPendingListeners(); + try { - const reader = new rpc.SocketMessageReader(this.socket!); - const writer = new rpc.SocketMessageWriter(this.socket!); + const reader = new rpc.SocketMessageReader(socket); + const writer = new rpc.SocketMessageWriter(socket); this.connection = rpc.createMessageConnection(reader, writer); this.connection.onClose(() => { this.connection = null; - this.notifyDisconnect(); }); this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); @@ -475,26 +864,39 @@ export class AspireClient { } }); + socket.on('error', onConnectedSocketError); + socket.on('close', onConnectedSocketClose); + + const authToken = process.env.ASPIRE_REMOTE_APPHOST_TOKEN; + if (!authToken) { + throw new Error('ASPIRE_REMOTE_APPHOST_TOKEN environment variable is not set.'); + } this.connection.listen(); + const authenticated = await this.connection.sendRequest('authenticate', authToken); + if (!authenticated) { + throw new Error('Failed to authenticate to the AppHost server.'); + } - // Set the current client for cancellation registry - currentClient = this; + connectedClients.add(this); + this._connectPromise = null; + settled = true; resolve(); - } catch (e) { - reject(e); + } catch (error) { + failConnect(error instanceof Error ? error : new Error(String(error))); } - }); + }; - this.socket.on('close', () => { - this.connection?.dispose(); - this.connection = null; - if (currentClient === this) { - currentClient = null; - } - this.notifyDisconnect(); - }); + const timeout = setTimeout(() => { + failConnect(new Error('Connection timeout')); + }, timeoutMs); + + socket.once('error', onPendingError); + socket.once('close', onPendingClose); + socket.once('connect', onConnect); }); + + return this._connectPromise; } ping(): Promise { @@ -533,39 +935,66 @@ export class AspireClient { throw new Error('Not connected to AppHost'); } - // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. - // We ref() during RPC calls so the process doesn't exit mid-call, and - // unref() when idle so the process can exit naturally after all work completes. - if (this._pendingCalls === 0) { - this.socket?.ref(); - } - this._pendingCalls++; + validateCapabilityArgs(capabilityId, args); + const cancellationIds: string[] = []; try { - const result = await this.connection.sendRequest( - 'invokeCapability', - capabilityId, - args ?? null - ); + const rpcArgs = await marshalTransportValue(args ?? null, this, cancellationIds, capabilityId); - // Check for structured error response - if (isAtsError(result)) { - throw new CapabilityError(result.$error); + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); } + this._pendingCalls++; - // Wrap handles automatically - return wrapIfHandle(result, this) as T; + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + rpcArgs + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } } finally { - this._pendingCalls--; - if (this._pendingCalls === 0) { - this.socket?.unref(); + for (const cancellationId of cancellationIds) { + unregisterCancellation(cancellationId); } } } disconnect(): void { - try { this.connection?.dispose(); } finally { this.connection = null; } - try { this.socket?.end(); } finally { this.socket = null; } + const connection = this.connection; + const socket = this.socket; + + this.connection = null; + this.socket = null; + this._connectPromise = null; + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + if (socket && !socket.destroyed) { + socket.end(); + socket.destroy(); + } } get connected(): boolean { diff --git a/samples/aspire-with-python/ts/apphost.ts b/samples/aspire-with-python/ts/apphost.ts index 86e166b0..c8091755 100644 --- a/samples/aspire-with-python/ts/apphost.ts +++ b/samples/aspire-with-python/ts/apphost.ts @@ -14,7 +14,7 @@ const app = await builder.addUvicornApp("app", "../app", "main:app") }); const frontend = await builder.addViteApp("frontend", "../frontend") - .withServiceReference(app) + .withReference(app) .waitFor(app); await app.publishWithContainerFiles(frontend, "./static"); diff --git a/samples/aspire-with-python/ts/apphost.run.json b/samples/aspire-with-python/ts/aspire.config.json similarity index 57% rename from samples/aspire-with-python/ts/apphost.run.json rename to samples/aspire-with-python/ts/aspire.config.json index b9409187..894f3053 100644 --- a/samples/aspire-with-python/ts/apphost.run.json +++ b/samples/aspire-with-python/ts/aspire.config.json @@ -1,4 +1,13 @@ { + "appHost": { + "path": "apphost.ts", + "language": "typescript/nodejs" + }, + "packages": { + "Aspire.Hosting.JavaScript": "13.2.0", + "Aspire.Hosting.Python": "13.2.0", + "Aspire.Hosting.Redis": "13.2.0" + }, "profiles": { "https": { "applicationUrl": "https://localhost:29413;http://localhost:62834", @@ -8,4 +17,4 @@ } } } -} \ No newline at end of file +} diff --git a/samples/client-apps-integration/ts/.aspire/settings.json b/samples/client-apps-integration/ts/.aspire/settings.json deleted file mode 100644 index 3c03a3b9..00000000 --- a/samples/client-apps-integration/ts/.aspire/settings.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "appHostPath": "../apphost.ts", - "language": "typescript/nodejs", - "channel": "staging", - "sdkVersion": "13.2.0-preview.1.26159.1" -} \ No newline at end of file diff --git a/samples/client-apps-integration/ts/.modules/.codegen-hash b/samples/client-apps-integration/ts/.modules/.codegen-hash index 1369f62c..d112ad8d 100644 --- a/samples/client-apps-integration/ts/.modules/.codegen-hash +++ b/samples/client-apps-integration/ts/.modules/.codegen-hash @@ -1 +1 @@ -385A37965F5742D9B7F75074E7065C879412F46A58CE04016D535C18DA21950E \ No newline at end of file +54ABC5F6F3238E45FD69B96BCCB0C6A5BB14B11F3C267B90DC987EFF3E1B7E45 \ No newline at end of file diff --git a/samples/client-apps-integration/ts/.modules/aspire.ts b/samples/client-apps-integration/ts/.modules/aspire.ts index f930fdcc..802979fb 100644 --- a/samples/client-apps-integration/ts/.modules/aspire.ts +++ b/samples/client-apps-integration/ts/.modules/aspire.ts @@ -8,6 +8,8 @@ import { AspireClient as AspireClientRpc, Handle, MarshalledHandle, + AppHostUsageError, + CancellationToken, CapabilityError, registerCallback, wrapIfHandle, @@ -26,9 +28,30 @@ import { // Handle Type Aliases (Internal - not exported to users) // ============================================================================ +/** Handle to JavaScriptAppResource */ +type JavaScriptAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource'>; + +/** Handle to NodeAppResource */ +type NodeAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource'>; + +/** Handle to ViteAppResource */ +type ViteAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource'>; + +/** Handle to AfterResourcesCreatedEvent */ +type AfterResourcesCreatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent'>; + +/** Handle to BeforeResourceStartedEvent */ +type BeforeResourceStartedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent'>; + +/** Handle to BeforeStartEvent */ +type BeforeStartEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent'>; + /** Handle to CommandLineArgsCallbackContext */ type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; +/** Handle to ConnectionStringAvailableEvent */ +type ConnectionStringAvailableEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent'>; + /** Handle to ContainerRegistryResource */ type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; @@ -38,6 +61,9 @@ type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Application /** Handle to CSharpAppResource */ type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; +/** Handle to DistributedApplicationModel */ +type DistributedApplicationModelHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel'>; + /** Handle to DotnetToolResource */ type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; @@ -56,9 +82,15 @@ type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicatio /** Handle to ExecuteCommandContext */ type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; +/** Handle to IComputeResource */ +type IComputeResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource'>; + /** Handle to IContainerFilesDestinationResource */ type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; +/** Handle to InitializeResourceEvent */ +type InitializeResourceEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent'>; + /** Handle to IResource */ type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; @@ -89,15 +121,27 @@ type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicati /** Handle to ReferenceExpressionBuilder */ type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; +/** Handle to ResourceEndpointsAllocatedEvent */ +type ResourceEndpointsAllocatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent'>; + /** Handle to ResourceLoggerService */ type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; /** Handle to ResourceNotificationService */ type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; +/** Handle to ResourceReadyEvent */ +type ResourceReadyEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent'>; + +/** Handle to ResourceStoppedEvent */ +type ResourceStoppedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent'>; + /** Handle to ResourceUrlsCallbackContext */ type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; +/** Handle to UpdateCommandStateContext */ +type UpdateCommandStateContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext'>; + /** Handle to ConnectionStringResource */ type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; @@ -122,18 +166,33 @@ type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hostin /** Handle to IResourceWithContainerFiles */ type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; -/** Handle to IResourceWithServiceDiscovery */ -type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; +/** Handle to IUserSecretsManager */ +type IUserSecretsManagerHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IUserSecretsManager'>; + +/** Handle to IReportingStep */ +type IReportingStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep'>; + +/** Handle to IReportingTask */ +type IReportingTaskHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask'>; /** Handle to PipelineConfigurationContext */ type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; +/** Handle to PipelineContext */ +type PipelineContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext'>; + /** Handle to PipelineStep */ type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; /** Handle to PipelineStepContext */ type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; +/** Handle to PipelineStepFactoryContext */ +type PipelineStepFactoryContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext'>; + +/** Handle to PipelineSummary */ +type PipelineSummaryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary'>; + /** Handle to ProjectResourceOptions */ type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; @@ -146,12 +205,18 @@ type ListanyHandle = Handle<'Aspire.Hosting/List'>; /** Handle to IConfiguration */ type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; +/** Handle to IConfigurationSection */ +type IConfigurationSectionHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfigurationSection'>; + /** Handle to IHostEnvironment */ type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; /** Handle to ILogger */ type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; +/** Handle to ILoggerFactory */ +type ILoggerFactoryHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory'>; + /** Handle to string[] */ type stringArrayHandle = Handle<'string[]'>; @@ -323,6 +388,10 @@ export interface AddConnectionStringOptions { environmentVariableName?: string; } +export interface AddContainerRegistryFromStringOptions { + repository?: string; +} + export interface AddContainerRegistryOptions { repository?: ParameterResource; } @@ -332,6 +401,10 @@ export interface AddDockerfileOptions { stage?: string; } +export interface AddJavaScriptAppOptions { + runScriptName?: string; +} + export interface AddParameterFromConfigurationOptions { secret?: boolean; } @@ -340,6 +413,15 @@ export interface AddParameterOptions { secret?: boolean; } +export interface AddParameterWithValueOptions { + publishValueAsDefault?: boolean; + secret?: boolean; +} + +export interface AddViteAppOptions { + runScriptName?: string; +} + export interface AppendFormattedOptions { format?: string; } @@ -348,22 +430,89 @@ export interface AppendValueProviderOptions { format?: string; } +export interface CompleteStepMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteStepOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskOptions { + completionMessage?: string; + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateMarkdownTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + export interface GetValueAsyncOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface PublishAsDockerFileOptions { + configure?: (obj: ContainerResource) => Promise; +} + +export interface PublishResourceUpdateOptions { + state?: string; + stateStyle?: string; } export interface RunOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface SaveStateJsonOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskMarkdownOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; } export interface WaitForCompletionOptions { exitCode?: number; } +export interface WaitForResourceStateOptions { + targetState?: string; +} + export interface WithBindMountOptions { isReadOnly?: boolean; } +export interface WithBrowserDebuggerOptions { + browser?: string; +} + +export interface WithBuildScriptOptions { + args?: string[]; +} + +export interface WithBunOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithCommandOptions { commandOptions?: CommandOptions; } @@ -447,6 +596,12 @@ export interface WithMcpServerOptions { endpointName?: string; } +export interface WithNpmOptions { + install?: boolean; + installCommand?: string; + installArgs?: string[]; +} + export interface WithPipelineStepFactoryOptions { dependsOn?: string[]; requiredBy?: string[]; @@ -454,15 +609,25 @@ export interface WithPipelineStepFactoryOptions { description?: string; } +export interface WithPnpmOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithReferenceOptions { connectionName?: string; optional?: boolean; + name?: string; } export interface WithRequiredCommandOptions { helpLink?: string; } +export interface WithRunScriptOptions { + args?: string[]; +} + export interface WithUrlExpressionOptions { displayText?: string; } @@ -476,6 +641,122 @@ export interface WithVolumeOptions { isReadOnly?: boolean; } +export interface WithYarnOptions { + install?: boolean; + installArgs?: string[]; +} + +// ============================================================================ +// AfterResourcesCreatedEvent +// ============================================================================ + +/** + * Type class for AfterResourcesCreatedEvent. + */ +export class AfterResourcesCreatedEvent { + constructor(private _handle: AfterResourcesCreatedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeResourceStartedEvent +// ============================================================================ + +/** + * Type class for BeforeResourceStartedEvent. + */ +export class BeforeResourceStartedEvent { + constructor(private _handle: BeforeResourceStartedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeStartEvent +// ============================================================================ + +/** + * Type class for BeforeStartEvent. + */ +export class BeforeStartEvent { + constructor(private _handle: BeforeStartEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + // ============================================================================ // CommandLineArgsCallbackContext // ============================================================================ @@ -505,11 +786,12 @@ export class CommandLineArgsCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, }; @@ -524,6 +806,65 @@ export class CommandLineArgsCallbackContext { }, }; + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ConnectionStringAvailableEvent +// ============================================================================ + +/** + * Type class for ConnectionStringAvailableEvent. + */ +export class ConnectionStringAvailableEvent { + constructor(private _handle: ConnectionStringAvailableEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + } // ============================================================================ @@ -541,9 +882,9 @@ export class DistributedApplication { /** Runs the distributed application */ /** @internal */ - async _runInternal(cancellationToken?: AbortSignal): Promise { + async _runInternal(cancellationToken?: AbortSignal | CancellationToken): Promise { const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); await this._client.invokeCapability( 'Aspire.Hosting/run', rpcArgs @@ -617,6 +958,17 @@ export class DistributedApplicationExecutionContext { }, }; + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the IsPublishMode property */ isPublishMode = { get: async (): Promise => { @@ -639,6 +991,70 @@ export class DistributedApplicationExecutionContext { } +// ============================================================================ +// DistributedApplicationModel +// ============================================================================ + +/** + * Type class for DistributedApplicationModel. + */ +export class DistributedApplicationModel { + constructor(private _handle: DistributedApplicationModelHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets resources from the distributed application model */ + async getResources(): Promise { + const rpcArgs: Record = { model: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResources', + rpcArgs + ); + } + + /** Finds a resource by name */ + /** @internal */ + async _findResourceByNameInternal(name: string): Promise { + const rpcArgs: Record = { model: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/findResourceByName', + rpcArgs + ); + return new Resource(result, this._client); + } + + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._findResourceByNameInternal(name)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationModel that enables fluent chaining. + */ +export class DistributedApplicationModelPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationModel) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets resources from the distributed application model */ + getResources(): Promise { + return this._promise.then(obj => obj.getResources()); + } + + /** Finds a resource by name */ + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.findResourceByName(name))); + } + +} + // ============================================================================ // EndpointReference // ============================================================================ @@ -652,6 +1068,17 @@ export class EndpointReference { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.resource', + { context: this._handle } + ); + return new ResourceWithEndpoints(handle, this._client); + }, + }; + /** Gets the EndpointName property */ endpointName = { get: async (): Promise => { @@ -782,7 +1209,7 @@ export class EndpointReference { async getValueAsync(options?: GetValueAsyncOptions): Promise { const cancellationToken = options?.cancellationToken; const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); return await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/getValueAsync', rpcArgs @@ -900,11 +1327,34 @@ export class EnvironmentCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; @@ -934,6 +1384,17 @@ export class ExecuteCommandContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the ResourceName property */ resourceName = { get: async (): Promise => { @@ -952,16 +1413,17 @@ export class ExecuteCommandContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, - set: async (value: AbortSignal): Promise => { + set: async (value: AbortSignal | CancellationToken): Promise => { await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', - { context: this._handle, value } + { context: this._handle, value: CancellationToken.fromValue(value) } ); } }; @@ -969,36 +1431,128 @@ export class ExecuteCommandContext { } // ============================================================================ -// PipelineConfigurationContext +// InitializeResourceEvent // ============================================================================ /** - * Type class for PipelineConfigurationContext. + * Type class for InitializeResourceEvent. */ -export class PipelineConfigurationContext { - constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} +export class InitializeResourceEvent { + constructor(private _handle: InitializeResourceEventHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the Steps property */ - steps = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.resource', { context: this._handle } ); + return new Resource(handle, this._client); }, - set: async (value: PipelineStep[]): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', - { context: this._handle, value } + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.eventing', + { context: this._handle } ); - } + return new DistributedApplicationEventing(handle, this._client); + }, }; - /** Gets pipeline steps with the specified tag */ - async getStepsByTag(tag: string): Promise { + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Notifications property */ + notifications = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.notifications', + { context: this._handle } + ); + return new ResourceNotificationService(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + { context: this._handle } + ); + }, + set: async (value: PipelineStep[]): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', + { context: this._handle, value } + ); + } + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + + /** Gets pipeline steps with the specified tag */ + async getStepsByTag(tag: string): Promise { const rpcArgs: Record = { context: this._handle, tag }; return await this._client.invokeCapability( 'Aspire.Hosting.Pipelines/getStepsByTag', @@ -1028,6 +1582,93 @@ export class PipelineConfigurationContextPromise implements PromiseLike => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + set: async (value: AbortSignal | CancellationToken): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.setCancellationToken', + { context: this._handle, value: CancellationToken.fromValue(value) } + ); + } + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + // ============================================================================ // PipelineStep // ============================================================================ @@ -1115,6 +1756,17 @@ export class PipelineStep { return this._tags; } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + /** Adds a dependency on another step by name */ /** @internal */ async _dependsOnInternal(stepName: string): Promise { @@ -1185,6 +1837,39 @@ export class PipelineStepContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the ReportingStep property */ + reportingStep = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.reportingStep', + { context: this._handle } + ); + return new ReportingStep(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + /** Gets the ExecutionContext property */ executionContext = { get: async (): Promise => { @@ -1196,16 +1881,157 @@ export class PipelineStepContext { }, }; + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineStepFactoryContext +// ============================================================================ + +/** + * Type class for PipelineStepFactoryContext. + */ +export class PipelineStepFactoryContext { + constructor(private _handle: PipelineStepFactoryContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); }, }; + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineSummary +// ============================================================================ + +/** + * Type class for PipelineSummary. + */ +export class PipelineSummary { + constructor(private _handle: PipelineSummaryHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Add method */ + /** @internal */ + async _addInternal(key: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, key, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineSummary.add', + rpcArgs + ); + return this; + } + + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addInternal(key, value)); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + /** @internal */ + async _addMarkdownInternal(key: string, markdownString: string): Promise { + const rpcArgs: Record = { summary: this._handle, key, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/addMarkdown', + rpcArgs + ); + return this; + } + + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addMarkdownInternal(key, markdownString)); + } + +} + +/** + * Thenable wrapper for PipelineSummary that enables fluent chaining. + */ +export class PipelineSummaryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineSummary) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Add method */ + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.add(key, value))); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.addMarkdown(key, markdownString))); + } + } // ============================================================================ @@ -1390,3794 +2216,3932 @@ export class ReferenceExpressionBuilderPromise implements PromiseLike; - get urls(): AspireList { - if (!this._urls) { - this._urls = new AspireList( - this._handle, - this._client, - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' - ); - } - return this._urls; - } - - /** Gets the CancellationToken property */ - cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.resource', { context: this._handle } ); + return new Resource(handle, this._client); }, }; - /** Gets the ExecutionContext property */ - executionContext = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.services', { context: this._handle } ); - return new DistributedApplicationExecutionContext(handle, this._client); + return new ServiceProvider(handle, this._client); }, }; } // ============================================================================ -// DistributedApplicationBuilder +// ResourceLoggerService // ============================================================================ /** - * Type class for DistributedApplicationBuilder. + * Type class for ResourceLoggerService. */ -export class DistributedApplicationBuilder { - constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} +export class ResourceLoggerService { + constructor(private _handle: ResourceLoggerServiceHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the AppHostDirectory property */ - appHostDirectory = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', - { context: this._handle } - ); - }, - }; + /** Completes the log stream for a resource */ + /** @internal */ + async _completeLogInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { loggerService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLog', + rpcArgs + ); + return this; + } - /** Gets the Eventing property */ - eventing = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', - { context: this._handle } - ); - return new DistributedApplicationEventing(handle, this._client); - }, - }; - - /** Gets the ExecutionContext property */ - executionContext = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', - { context: this._handle } - ); - return new DistributedApplicationExecutionContext(handle, this._client); - }, - }; + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogInternal(resource)); + } - /** Builds the distributed application */ + /** Completes the log stream by resource name */ /** @internal */ - async _buildInternal(): Promise { - const rpcArgs: Record = { context: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/build', + async _completeLogByNameInternal(resourceName: string): Promise { + const rpcArgs: Record = { loggerService: this._handle, resourceName }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLogByName', rpcArgs ); - return new DistributedApplication(result, this._client); + return this; } - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._buildInternal()); + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogByNameInternal(resourceName)); } - /** Adds a connection string with a builder callback */ - /** @internal */ - async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { - const connectionStringBuilderId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; - const obj = new ReferenceExpressionBuilder(objHandle, this._client); - await connectionStringBuilder(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionStringBuilder', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } +} - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); - } +/** + * Thenable wrapper for ResourceLoggerService that enables fluent chaining. + */ +export class ResourceLoggerServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** Adds a container registry resource */ - /** @internal */ - async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpoint }; - if (repository !== undefined) rpcArgs.repository = repository; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainerRegistry', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + then( + onfulfilled?: ((value: ResourceLoggerService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - const repository = options?.repository; - return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + /** Completes the log stream for a resource */ + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLog(resource))); } - /** Adds a container resource */ - /** @internal */ - async _addContainerInternal(name: string, image: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, image }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainer', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Completes the log stream by resource name */ + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLogByName(resourceName))); } - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._addContainerInternal(name, image)); - } +} - /** Adds a container resource built from a Dockerfile */ - /** @internal */ - async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDockerfile', - rpcArgs - ); - return new ContainerResource(result, this._client); - } +// ============================================================================ +// ResourceNotificationService +// ============================================================================ - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); - } +/** + * Type class for ResourceNotificationService. + */ +export class ResourceNotificationService { + constructor(private _handle: ResourceNotificationServiceHandle, private _client: AspireClientRpc) {} - /** Adds a .NET tool resource */ + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Waits for a resource to reach a specified state */ /** @internal */ - async _addDotnetToolInternal(name: string, packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDotnetTool', + async _waitForResourceStateInternal(resourceName: string, targetState?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + if (targetState !== undefined) rpcArgs.targetState = targetState; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceState', rpcArgs ); - return new DotnetToolResource(result, this._client); + return this; } - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + const targetState = options?.targetState; + return new ResourceNotificationServicePromise(this._waitForResourceStateInternal(resourceName, targetState)); } - /** Adds an executable resource */ - /** @internal */ - async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExecutable', + /** Waits for a resource to reach one of the specified states */ + async waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName, targetStates }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStates', rpcArgs ); - return new ExecutableResource(result, this._client); - } - - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); } - /** Adds an external service resource */ - /** @internal */ - async _addExternalServiceInternal(name: string, url: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, url }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExternalService', + /** Waits for a resource to become healthy */ + async waitForResourceHealthy(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceHealthy', rpcArgs ); - return new ExternalServiceResource(result, this._client); - } - - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); } - /** Adds a parameter resource */ + /** Waits for all dependencies of a resource to be ready */ /** @internal */ - async _addParameterInternal(name: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameter', + async _waitForDependenciesInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForDependencies', rpcArgs ); - return new ParameterResource(result, this._client); + return this; } - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterInternal(name, secret)); + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._waitForDependenciesInternal(resource)); } - /** Adds a parameter sourced from configuration */ - /** @internal */ - async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name, configurationKey }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameterFromConfiguration', + /** Tries to get the current state of a resource */ + async tryGetResourceState(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/tryGetResourceState', rpcArgs ); - return new ParameterResource(result, this._client); - } - - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); } - /** Adds a connection string resource */ + /** Publishes an update for a resource's state */ /** @internal */ - async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionString', + async _publishResourceUpdateInternal(resource: ResourceBuilderBase, state?: string, stateStyle?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + if (state !== undefined) rpcArgs.state = state; + if (stateStyle !== undefined) rpcArgs.stateStyle = stateStyle; + await this._client.invokeCapability( + 'Aspire.Hosting/publishResourceUpdate', rpcArgs ); - return new ResourceWithConnectionString(result, this._client); + return this; } - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - const environmentVariableName = options?.environmentVariableName; - return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + const state = options?.state; + const stateStyle = options?.stateStyle; + return new ResourceNotificationServicePromise(this._publishResourceUpdateInternal(resource, state, stateStyle)); } - /** Adds a .NET project resource */ - /** @internal */ - async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProject', - rpcArgs - ); - return new ProjectResource(result, this._client); - } +} - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); +/** + * Thenable wrapper for ResourceNotificationService that enables fluent chaining. + */ +export class ResourceNotificationServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceNotificationService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a project resource with configuration options */ - /** @internal */ - async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProjectWithOptions', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Waits for a resource to reach a specified state */ + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForResourceState(resourceName, options))); } - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + /** Waits for a resource to reach one of the specified states */ + waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + return this._promise.then(obj => obj.waitForResourceStates(resourceName, targetStates)); } - /** Adds a C# application resource */ - /** @internal */ - async _addCSharpAppInternal(name: string, path: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, path }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpApp', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Waits for a resource to become healthy */ + waitForResourceHealthy(resourceName: string): Promise { + return this._promise.then(obj => obj.waitForResourceHealthy(resourceName)); } - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + /** Waits for all dependencies of a resource to be ready */ + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForDependencies(resource))); } - /** Adds a C# application resource with configuration options */ - /** @internal */ - async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpAppWithOptions', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Tries to get the current state of a resource */ + tryGetResourceState(resourceName: string): Promise { + return this._promise.then(obj => obj.tryGetResourceState(resourceName)); } - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + /** Publishes an update for a resource's state */ + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.publishResourceUpdate(resource, options))); } } +// ============================================================================ +// ResourceReadyEvent +// ============================================================================ + /** - * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + * Type class for ResourceReadyEvent. */ -export class DistributedApplicationBuilderPromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } +export class ResourceReadyEvent { + constructor(private _handle: ResourceReadyEventHandle, private _client: AspireClientRpc) {} - /** Builds the distributed application */ - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Adds a connection string with a builder callback */ - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); - } - - /** Adds a container registry resource */ - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); - } - - /** Adds a container resource */ - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); - } - - /** Adds a container resource built from a Dockerfile */ - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); - } - - /** Adds a .NET tool resource */ - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); - } - - /** Adds an executable resource */ - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); - } - - /** Adds an external service resource */ - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); - } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; - /** Adds a parameter resource */ - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); - } + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; - /** Adds a parameter sourced from configuration */ - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); - } +} - /** Adds a connection string resource */ - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); - } +// ============================================================================ +// ResourceStoppedEvent +// ============================================================================ - /** Adds a .NET project resource */ - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); - } +/** + * Type class for ResourceStoppedEvent. + */ +export class ResourceStoppedEvent { + constructor(private _handle: ResourceStoppedEventHandle, private _client: AspireClientRpc) {} - /** Adds a project resource with configuration options */ - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Adds a C# application resource */ - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); - } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; - /** Adds a C# application resource with configuration options */ - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); - } + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; } // ============================================================================ -// DistributedApplicationEventing +// ResourceUrlsCallbackContext // ============================================================================ /** - * Type class for DistributedApplicationEventing. + * Type class for ResourceUrlsCallbackContext. */ -export class DistributedApplicationEventing { - constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Invokes the Unsubscribe method */ - /** @internal */ - async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { - const rpcArgs: Record = { context: this._handle, subscription }; - await this._client.invokeCapability( - 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', - rpcArgs - ); - return this; - } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; } + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + } +// ============================================================================ +// UpdateCommandStateContext +// ============================================================================ + /** - * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + * Type class for UpdateCommandStateContext. */ -export class DistributedApplicationEventingPromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class UpdateCommandStateContext { + constructor(private _handle: UpdateCommandStateContextHandle, private _client: AspireClientRpc) {} - then( - onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Invokes the Unsubscribe method */ - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); - } + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/UpdateCommandStateContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; } // ============================================================================ -// ConnectionStringResource +// Configuration // ============================================================================ -export class ConnectionStringResource extends ResourceBuilderBase { - constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { - super(handle, client); - } +/** + * Type class for Configuration. + */ +export class Configuration { + constructor(private _handle: IConfigurationHandle, private _client: AspireClientRpc) {} - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets a configuration value by key */ + async getConfigValue(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConfigValue', rpcArgs ); - return new ConnectionStringResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + /** Gets a connection string by name */ + async getConnectionString(name: string): Promise { + const rpcArgs: Record = { configuration: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionString', + rpcArgs + ); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + /** Gets a configuration section by key */ + async getSection(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getSection', rpcArgs ); - return new ConnectionStringResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Gets child configuration sections */ + async getChildren(): Promise { + const rpcArgs: Record = { configuration: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getChildren', + rpcArgs + ); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + /** Checks whether a configuration section exists */ + async exists(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/exists', rpcArgs ); - return new ConnectionStringResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { - const helpLink = options?.helpLink; - return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); +} + +/** + * Thenable wrapper for Configuration that enables fluent chaining. + */ +export class ConfigurationPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Configuration) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); + /** Gets a configuration value by key */ + getConfigValue(key: string): Promise { + return this._promise.then(obj => obj.getConfigValue(key)); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Gets a connection string by name */ + getConnectionString(name: string): Promise { + return this._promise.then(obj => obj.getConnectionString(name)); } - /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); + /** Gets a configuration section by key */ + getSection(key: string): Promise { + return this._promise.then(obj => obj.getSection(key)); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Gets child configuration sections */ + getChildren(): Promise { + return this._promise.then(obj => obj.getChildren()); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); + /** Checks whether a configuration section exists */ + exists(key: string): Promise { + return this._promise.then(obj => obj.exists(key)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); - } +} + +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Environment property */ + environment = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.environment', + { context: this._handle } + ); + return new HostEnvironment(handle, this._client); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the UserSecretsManager property */ + userSecretsManager = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.userSecretsManager', + { context: this._handle } + ); + return new UserSecretsManager(handle, this._client); + }, + }; + /** Builds the distributed application */ /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DistributedApplication(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); } + /** Adds a connection string with a reference expression */ /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; + async _addConnectionStringExpressionInternal(name: string, connectionStringExpression: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, connectionStringExpression }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + 'Aspire.Hosting/addConnectionStringExpression', rpcArgs ); return new ConnectionStringResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { - const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringExpressionInternal(name, connectionStringExpression)); } + /** Adds a connection string with a builder callback */ /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + 'Aspire.Hosting/addConnectionStringBuilder', rpcArgs ); return new ConnectionStringResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { - const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); } + /** Adds a container registry resource */ /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); } + /** Adds a container registry with string endpoint */ /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + async _addContainerRegistryFromStringInternal(name: string, endpoint: string, repository?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistryFromString', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryFromStringInternal(name, endpoint, repository)); } + /** Adds a container resource */ /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); } + /** Adds a container resource built from a Dockerfile */ /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); } + /** Adds a .NET tool resource */ /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); } + /** Adds an executable resource */ /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); } + /** Adds an external service resource */ /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); } + /** Adds an external service with a URI */ /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + async _addExternalServiceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceUri', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - const exitCode = options?.exitCode; - return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceUriInternal(name, uri)); } + /** Adds an external service with a parameter URL */ /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + async _addExternalServiceParameterInternal(name: string, urlParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, urlParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceParameter', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceParameterInternal(name, urlParameter)); } + /** Adds a parameter resource */ /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { - const commandOptions = options?.commandOptions; - return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); } + /** Adds a parameter with a default value */ /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + async _addParameterWithValueInternal(name: string, value: string, publishValueAsDefault?: boolean, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + if (publishValueAsDefault !== undefined) rpcArgs.publishValueAsDefault = publishValueAsDefault; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterWithValue', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + const publishValueAsDefault = options?.publishValueAsDefault; + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterWithValueInternal(name, value, publishValueAsDefault, secret)); } + /** Adds a parameter sourced from configuration */ /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); } + /** Adds a connection string resource */ /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ResourceWithConnectionString(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { - const iconVariant = options?.iconVariant; - return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); } + /** Adds a .NET project resource */ /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); } + /** Adds a project resource with configuration options */ /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); } + /** Adds a C# application resource */ /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); } + /** Adds a C# application resource with configuration options */ /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); } + /** Gets the application configuration */ /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + async _getConfigurationInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getConfiguration', + rpcArgs + ); + return new Configuration(result, this._client); + } + + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._getConfigurationInternal()); + } + + /** Subscribes to the BeforeStart event */ + async subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as BeforeStartEventHandle; + const arg = new BeforeStartEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeBeforeStart', rpcArgs ); - return new ConnectionStringResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Subscribes to the AfterResourcesCreated event */ + async subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as AfterResourcesCreatedEventHandle; + const arg = new AfterResourcesCreatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeAfterResourcesCreated', + rpcArgs + ); } + /** Adds a Node.js application resource */ /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + async _addNodeAppInternal(name: string, appDirectory: string, scriptPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory, scriptPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addNodeApp', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._addNodeAppInternal(name, appDirectory, scriptPath)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** Adds a JavaScript application resource */ + /** @internal */ + async _addJavaScriptAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addJavaScriptApp', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + const runScriptName = options?.runScriptName; + return new JavaScriptAppResourcePromise(this._addJavaScriptAppInternal(name, appDirectory, runScriptName)); + } + + /** Adds a Vite application resource */ + /** @internal */ + async _addViteAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addViteApp', rpcArgs ); + return new ViteAppResource(result, this._client); + } + + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + const runScriptName = options?.runScriptName; + return new ViteAppResourcePromise(this._addViteAppInternal(name, appDirectory, runScriptName)); } } /** - * Thenable wrapper for ConnectionStringResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. */ -export class ConnectionStringResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds a connection string with a reference expression */ + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringExpression(name, connectionStringExpression))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + /** Adds a container registry with string endpoint */ + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistryFromString(name, endpoint, options))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Adds an external service with a URI */ + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceUri(name, uri))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Adds an external service with a parameter URL */ + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceParameter(name, urlParameter))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Adds a parameter with a default value */ + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterWithValue(name, value, options))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Gets the application configuration */ + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._promise.then(obj => obj.getConfiguration())); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Subscribes to the BeforeStart event */ + subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeBeforeStart(callback)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Subscribes to the AfterResourcesCreated event */ + subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeAfterResourcesCreated(callback)); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds a Node.js application resource */ + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.addNodeApp(name, appDirectory, scriptPath))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Adds a JavaScript application resource */ + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.addJavaScriptApp(name, appDirectory, options))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds a Vite application resource */ + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.addViteApp(name, appDirectory, options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); +} + +// ============================================================================ +// DistributedApplicationEventing +// ============================================================================ + +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Unsubscribe method */ + /** @internal */ + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + rpcArgs + ); + return this; } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); } } // ============================================================================ -// ContainerRegistryResource +// HostEnvironment // ============================================================================ -export class ContainerRegistryResource extends ResourceBuilderBase { - constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { - super(handle, client); +/** + * Type class for HostEnvironment. + */ +export class HostEnvironment { + constructor(private _handle: IHostEnvironmentHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Checks if running in Development environment */ + async isDevelopment(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isDevelopment', + rpcArgs + ); } - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + /** Checks if running in Production environment */ + async isProduction(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isProduction', rpcArgs ); - return new ContainerRegistryResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + /** Checks if running in Staging environment */ + async isStaging(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isStaging', + rpcArgs + ); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + /** Checks if the environment matches the specified name */ + async isEnvironment(environmentName: string): Promise { + const rpcArgs: Record = { environment: this._handle, environmentName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isEnvironment', rpcArgs ); - return new ContainerRegistryResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); +} + +/** + * Thenable wrapper for HostEnvironment that enables fluent chaining. + */ +export class HostEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: HostEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Checks if running in Development environment */ + isDevelopment(): Promise { + return this._promise.then(obj => obj.isDevelopment()); + } + + /** Checks if running in Production environment */ + isProduction(): Promise { + return this._promise.then(obj => obj.isProduction()); + } + + /** Checks if running in Staging environment */ + isStaging(): Promise { + return this._promise.then(obj => obj.isStaging()); + } + + /** Checks if the environment matches the specified name */ + isEnvironment(environmentName: string): Promise { + return this._promise.then(obj => obj.isEnvironment(environmentName)); } +} + +// ============================================================================ +// Logger +// ============================================================================ + +/** + * Type class for Logger. + */ +export class Logger { + constructor(private _handle: ILoggerHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Logs an information message */ /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + async _logInformationInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logInformation', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { - const helpLink = options?.helpLink; - return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._logInformationInternal(message)); } + /** Logs a warning message */ /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + async _logWarningInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logWarning', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._logWarningInternal(message)); } + /** Logs an error message */ /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + async _logErrorInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logError', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + logError(message: string): LoggerPromise { + return new LoggerPromise(this._logErrorInternal(message)); } + /** Logs a debug message */ /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + async _logDebugInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logDebug', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { - const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._logDebugInternal(message)); } + /** Logs a message with specified level */ /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + async _logInternal(level: string, message: string): Promise { + const rpcArgs: Record = { logger: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/log', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { - const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._logInternal(level, message)); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } +} - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); - } +/** + * Thenable wrapper for Logger that enables fluent chaining. + */ +export class LoggerPromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + then( + onfulfilled?: ((value: Logger) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + /** Logs an information message */ + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logInformation(message))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Logs a warning message */ + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logWarning(message))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + /** Logs an error message */ + logError(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logError(message))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Logs a debug message */ + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logDebug(message))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + /** Logs a message with specified level */ + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.log(level, message))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } +} - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); - } +// ============================================================================ +// LoggerFactory +// ============================================================================ - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } +/** + * Type class for LoggerFactory. + */ +export class LoggerFactory { + constructor(private _handle: ILoggerFactoryHandle, private _client: AspireClientRpc) {} - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Creates a logger for a category */ /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + async _createLoggerInternal(categoryName: string): Promise { + const rpcArgs: Record = { loggerFactory: this._handle, categoryName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createLogger', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new Logger(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._createLoggerInternal(categoryName)); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); +} + +/** + * Thenable wrapper for LoggerFactory that enables fluent chaining. + */ +export class LoggerFactoryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: LoggerFactory) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Creates a logger for a category */ + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.createLogger(categoryName))); } +} + +// ============================================================================ +// ReportingStep +// ============================================================================ + +/** + * Type class for ReportingStep. + */ +export class ReportingStep { + constructor(private _handle: IReportingStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Creates a reporting task with plain-text status text */ /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + async _createTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createTask', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ReportingTask(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createTaskInternal(statusText, cancellationToken)); } + /** Creates a reporting task with Markdown-formatted status text */ /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + async _createMarkdownTaskInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createMarkdownTask', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ReportingTask(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createMarkdownTaskInternal(markdownString, cancellationToken)); } + /** Logs a plain-text message for the reporting step */ /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + async _logStepInternal(level: string, message: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStep', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepInternal(level, message)); } + /** Logs a Markdown-formatted message for the reporting step */ /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + async _logStepMarkdownInternal(level: string, markdownString: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStepMarkdown', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepMarkdownInternal(level, markdownString)); } + /** Completes the reporting step with plain-text completion text */ /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + async _completeStepInternal(completionText: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, completionText }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStep', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepInternal(completionText, completionState, cancellationToken)); } + /** Completes the reporting step with Markdown-formatted completion text */ /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + async _completeStepMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStepMarkdown', rpcArgs ); - return new ContainerRegistryResource(result, this._client); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + return this; } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepMarkdownInternal(markdownString, completionState, cancellationToken)); } } /** - * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); + * Thenable wrapper for ReportingStep that enables fluent chaining. */ -export class ContainerRegistryResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ReportingStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ReportingStep) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Creates a reporting task with plain-text status text */ + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createTask(statusText, options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Creates a reporting task with Markdown-formatted status text */ + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createMarkdownTask(markdownString, options))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Logs a plain-text message for the reporting step */ + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStep(level, message))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Logs a Markdown-formatted message for the reporting step */ + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStepMarkdown(level, markdownString))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Completes the reporting step with plain-text completion text */ + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStep(completionText, options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Completes the reporting step with Markdown-formatted completion text */ + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStepMarkdown(markdownString, options))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } +} - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } +// ============================================================================ +// ReportingTask +// ============================================================================ - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } +/** + * Type class for ReportingTask. + */ +export class ReportingTask { + constructor(private _handle: IReportingTaskHandle, private _client: AspireClientRpc) {} - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Updates the reporting task with plain-text status text */ + /** @internal */ + async _updateTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTask', + rpcArgs + ); + return this; } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskInternal(statusText, cancellationToken)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Updates the reporting task with Markdown-formatted status text */ + /** @internal */ + async _updateTaskMarkdownInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTaskMarkdown', + rpcArgs + ); + return this; } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskMarkdownInternal(markdownString, cancellationToken)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Completes the reporting task with plain-text completion text */ + /** @internal */ + async _completeTaskInternal(completionMessage?: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle }; + if (completionMessage !== undefined) rpcArgs.completionMessage = completionMessage; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTask', + rpcArgs + ); + return this; } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + const completionMessage = options?.completionMessage; + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskInternal(completionMessage, completionState, cancellationToken)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Completes the reporting task with Markdown-formatted completion text */ + /** @internal */ + async _completeTaskMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTaskMarkdown', + rpcArgs + ); + return this; } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskMarkdownInternal(markdownString, completionState, cancellationToken)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); +} + +/** + * Thenable wrapper for ReportingTask that enables fluent chaining. + */ +export class ReportingTaskPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReportingTask) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Updates the reporting task with plain-text status text */ + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTask(statusText, options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Updates the reporting task with Markdown-formatted status text */ + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTaskMarkdown(markdownString, options))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Completes the reporting task with plain-text completion text */ + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTask(options))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Completes the reporting task with Markdown-formatted completion text */ + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTaskMarkdown(markdownString, options))); } } // ============================================================================ -// ContainerResource +// ServiceProvider // ============================================================================ -export class ContainerResource extends ResourceBuilderBase { - constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { - super(handle, client); - } +/** + * Type class for ServiceProvider. + */ +export class ServiceProvider { + constructor(private _handle: IServiceProviderHandle, private _client: AspireClientRpc) {} + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the distributed application eventing service from the service provider */ /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + async _getEventingInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getEventing', rpcArgs ); - return new ContainerResource(result, this._client); + return new DistributedApplicationEventing(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._getEventingInternal()); } + /** Gets the logger factory from the service provider */ /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + async _getLoggerFactoryInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getLoggerFactory', rpcArgs ); - return new ContainerResource(result, this._client); + return new LoggerFactory(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._getLoggerFactoryInternal()); } + /** Gets the resource logger service from the service provider */ /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + async _getResourceLoggerServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceLoggerService', rpcArgs ); - return new ContainerResource(result, this._client); + return new ResourceLoggerService(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._getResourceLoggerServiceInternal()); } + /** Gets the distributed application model from the service provider */ /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + async _getDistributedApplicationModelInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getDistributedApplicationModel', rpcArgs ); - return new ContainerResource(result, this._client); + return new DistributedApplicationModel(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageTagInternal(tag)); + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._getDistributedApplicationModelInternal()); } + /** Gets the resource notification service from the service provider */ /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + async _getResourceNotificationServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceNotificationService', rpcArgs ); - return new ContainerResource(result, this._client); + return new ResourceNotificationService(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._getResourceNotificationServiceInternal()); } + /** Gets the user secrets manager from the service provider */ /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + async _getUserSecretsManagerInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getUserSecretsManager', rpcArgs ); - return new ContainerResource(result, this._client); + return new UserSecretsManager(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - const tag = options?.tag; - return new ContainerResourcePromise(this._withImageInternal(image, tag)); + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getUserSecretsManagerInternal()); } - /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', - rpcArgs - ); - return new ContainerResource(result, this._client); - } +} - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); - } +/** + * Thenable wrapper for ServiceProvider that enables fluent chaining. + */ +export class ServiceProviderPromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', - rpcArgs - ); - return new ContainerResource(result, this._client); + then( + onfulfilled?: ((value: ServiceProvider) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Gets the distributed application eventing service from the service provider */ + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.getEventing())); } - /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets the logger factory from the service provider */ + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._promise.then(obj => obj.getLoggerFactory())); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + /** Gets the resource logger service from the service provider */ + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.getResourceLoggerService())); } - /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets the distributed application model from the service provider */ + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._promise.then(obj => obj.getDistributedApplicationModel())); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Gets the resource notification service from the service provider */ + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.getResourceNotificationService())); } - /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets the user secrets manager from the service provider */ + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getUserSecretsManager())); } - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsContainerInternal()); - } +} - /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', +// ============================================================================ +// UserSecretsManager +// ============================================================================ + +/** + * Type class for UserSecretsManager. + */ +export class UserSecretsManager { + constructor(private _handle: IUserSecretsManagerHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the IsAvailable property */ + isAvailable = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.isAvailable', + { context: this._handle } + ); + }, + }; + + /** Gets the FilePath property */ + filePath = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.filePath', + { context: this._handle } + ); + }, + }; + + /** Attempts to set a user secret value */ + async trySetSecret(name: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, name, value }; + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.trySetSecret', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } + /** Saves state to user secrets from a JSON string */ /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', + async _saveStateJsonInternal(json: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, json }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/saveStateJson', rpcArgs ); - return new ContainerResource(result, this._client); + return this; } - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNameInternal(name)); + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + const cancellationToken = options?.cancellationToken; + return new UserSecretsManagerPromise(this._saveStateJsonInternal(json, cancellationToken)); } + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + async _getOrSetSecretInternal(resourceBuilder: ResourceBuilderBase, name: string, value: string): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, resourceBuilder, name, value }; + await this._client.invokeCapability( + 'Aspire.Hosting/getOrSetSecret', rpcArgs ); - return new ContainerResource(result, this._client); + return this; } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getOrSetSecretInternal(resourceBuilder, name, value)); } - /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', - rpcArgs - ); - return new ContainerResource(result, this._client); +} + +/** + * Thenable wrapper for UserSecretsManager that enables fluent chaining. + */ +export class UserSecretsManagerPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: UserSecretsManager) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + /** Attempts to set a user secret value */ + trySetSecret(name: string, value: string): Promise { + return this._promise.then(obj => obj.trySetSecret(name, value)); + } + + /** Saves state to user secrets from a JSON string */ + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.saveStateJson(json, options))); + } + + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getOrSetSecret(resourceBuilder, name, value))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterInternal()); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); } - /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - const helpLink = options?.helpLink; - return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsInternal(args)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); - } - - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onConnectionStringAvailableInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceReadyInternal(callback)); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new ContainerResource(result, this._client); +} + +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromManifestInternal()); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForInternal(dependency)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExplicitStartInternal()); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - const exitCode = options?.exitCode; - return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - const password = options?.password; - return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ContainerResource(result, this._client); - } +} - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ + +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromMcpInternal()); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); + return new ContainerRegistryResource(result, this._client); } -} - -/** - * Thenable wrapper for ContainerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ContainerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); } - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceReadyInternal(callback)); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); - } +} - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); - } +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); - } - - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); - } - - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); - } - - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); - } - - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } - - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } - - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); - } - - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); - } - - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); - } - - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } - - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); - } - - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); - } - - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); - } - - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); - } - - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } } // ============================================================================ -// CSharpAppResource +// ContainerResource // ============================================================================ -export class CSharpAppResource extends ResourceBuilderBase { - constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withReplicasInternal(replicas: number): Promise { - const rpcArgs: Record = { builder: this._handle, replicas }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReplicas', - rpcArgs - ); - return new CSharpAppResource(result, this._client); - } - - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); - } - - /** @internal */ - private async _disableForwardedHeadersInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/disableForwardedHeaders', + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - const helpLink = options?.helpLink; - return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsInternal(args)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -5187,15 +6151,15 @@ export class CSharpAppResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -5204,72 +6168,72 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -5282,293 +6246,278 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); - } - - /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', - rpcArgs - ); - return new CSharpAppResource(result, this._client); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { const exitCode = options?.exitCode; - return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -5576,130 +6525,130 @@ export class CSharpAppResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { const commandOptions = options?.commandOptions; - return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { const password = options?.password; - return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { const iconVariant = options?.iconVariant; - return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -5708,15 +6657,15 @@ export class CSharpAppResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -5724,56 +6673,56 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -5784,60 +6733,79 @@ export class CSharpAppResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); } /** Gets the resource name */ @@ -5849,161 +6817,316 @@ export class CSharpAppResource extends ResourceBuilderBase { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceReadyInternal(callback)); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } +} - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -6012,163 +7135,163 @@ export class CSharpAppResourcePromise implements PromiseLike } /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } /** Gets the resource name */ @@ -6176,538 +7299,397 @@ export class CSharpAppResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ -// DotnetToolResource +// CSharpAppResource // ============================================================================ -export class DotnetToolResource extends ResourceBuilderBase { - constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withToolPackageInternal(packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPackage', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withToolVersionInternal(version: string): Promise { - const rpcArgs: Record = { builder: this._handle, version }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolVersion', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withToolPrereleaseInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPrerelease', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withToolSourceInternal(source: string): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolSource', + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); } /** @internal */ - private async _withToolIgnoreExistingFeedsInternal(): Promise { + private async _disableForwardedHeadersInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreExistingFeeds', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); } /** @internal */ - private async _withToolIgnoreFailedSourcesInternal(): Promise { + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreFailedSources', + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + const configure = options?.configure; + return new CSharpAppResourcePromise(this._publishAsDockerFileInternal(configure)); } /** @internal */ - private async _publishAsDockerFileInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFile', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; - const obj = new ContainerResource(objHandle, this._client); - await configure(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFileWithConfigure', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withExecutableCommandInternal(command: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExecutableCommand', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { - const rpcArgs: Record = { builder: this._handle, workingDirectory }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withWorkingDirectory', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new DotnetToolResource(result, this._client); - } - - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); - } - - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - const helpLink = options?.helpLink; - return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } - - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); - } - - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); - } - - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); - } - - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); - } - - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); - } - - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -6717,15 +7699,15 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -6734,72 +7716,72 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -6812,278 +7794,293 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { const exitCode = options?.exitCode; - return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -7091,130 +8088,130 @@ export class DotnetToolResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { const commandOptions = options?.commandOptions; - return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { const password = options?.password; - return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { const iconVariant = options?.iconVariant; - return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -7223,15 +8220,15 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -7239,56 +8236,56 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -7299,60 +8296,60 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -7364,201 +8361,246 @@ export class DotnetToolResource extends ResourceBuilderBase { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceReadyInternal(callback)); } - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -7567,158 +8609,163 @@ export class DotnetToolResourcePromise implements PromiseLike obj.asHttp2Service())); + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -7726,383 +8773,500 @@ export class DotnetToolResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ -// ExecutableResource +// DotnetToolResource // ============================================================================ -export class ExecutableResource extends ResourceBuilderBase { - constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - const helpLink = options?.helpLink; - return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + const name = options?.name; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); - } - - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); - } - - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -8112,15 +9276,15 @@ export class ExecutableResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -8129,72 +9293,72 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -8207,278 +9371,278 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { const exitCode = options?.exitCode; - return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -8486,130 +9650,130 @@ export class ExecutableResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { const commandOptions = options?.commandOptions; - return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { const password = options?.password; - return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { const iconVariant = options?.iconVariant; - return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -8618,15 +9782,15 @@ export class ExecutableResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -8634,56 +9798,56 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -8694,60 +9858,60 @@ export class ExecutableResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -8759,151 +9923,281 @@ export class ExecutableResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** - * Thenable wrapper for ExecutableResource that enables fluent chaining. + * Thenable wrapper for DotnetToolResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ExecutableResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -8912,158 +10206,158 @@ export class ExecutableResourcePromise implements PromiseLike obj.asHttp2Service())); + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -9071,1081 +10365,7579 @@ export class ExecutableResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ -// ExternalServiceResource +// ExecutableResource // ============================================================================ -export class ExternalServiceResource extends ResourceBuilderBase { - constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceReadyInternal(callback)); + } + +} + +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceReadyInternal(callback)); + } + +} + +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// JavaScriptAppResource +// ============================================================================ + +export class JavaScriptAppResource extends ResourceBuilderBase { + constructor(handle: JavaScriptAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new JavaScriptAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + const helpLink = options?.helpLink; + return new JavaScriptAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new JavaScriptAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new JavaScriptAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new JavaScriptAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new JavaScriptAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + const displayText = options?.displayText; + return new JavaScriptAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + const displayText = options?.displayText; + return new JavaScriptAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + const exitCode = options?.exitCode; + return new JavaScriptAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + const commandOptions = options?.commandOptions; + return new JavaScriptAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + const password = options?.password; + return new JavaScriptAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + const iconVariant = options?.iconVariant; + return new JavaScriptAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new JavaScriptAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withYarnInternal(install, installArgs)); + } + + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withPnpmInternal(install, installArgs)); + } + + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withRunScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + const browser = options?.browser; + return new JavaScriptAppResourcePromise(this._withBrowserDebuggerInternal(browser)); + } + +} + +/** + * Thenable wrapper for JavaScriptAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class JavaScriptAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: JavaScriptAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + +} + +// ============================================================================ +// NodeAppResource +// ============================================================================ + +export class NodeAppResource extends ResourceBuilderBase { + constructor(handle: NodeAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new NodeAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + const helpLink = options?.helpLink; + return new NodeAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new NodeAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new NodeAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + const exitCode = options?.exitCode; + return new NodeAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + const commandOptions = options?.commandOptions; + return new NodeAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + const password = options?.password; + return new NodeAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + const iconVariant = options?.iconVariant; + return new NodeAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new NodeAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withYarnInternal(install, installArgs)); + } + + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withPnpmInternal(install, installArgs)); + } + + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withRunScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + const browser = options?.browser; + return new NodeAppResourcePromise(this._withBrowserDebuggerInternal(browser)); + } + +} + +/** + * Thenable wrapper for NodeAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class NodeAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: NodeAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceReadyInternal(callback)); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + const configure = options?.configure; + return new ProjectResourcePromise(this._publishAsDockerFileInternal(configure)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - const helpLink = options?.helpLink; - return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); - } - - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); - } - - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); - } - - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); - } - - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - const commandOptions = options?.commandOptions; - return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); - } - - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); - } - - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); - } - - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - const iconVariant = options?.iconVariant; - return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); - } - - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); + return new ProjectResource(result, this._client); } -} - -/** - * Thenable wrapper for ExternalServiceResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ExternalServiceResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); } -} + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } -// ============================================================================ -// ParameterResource -// ============================================================================ + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } -export class ParameterResource extends ResourceBuilderBase { - constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, description }; - if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDescription', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - const enableMarkdown = options?.enableMarkdown; - return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - const helpLink = options?.helpLink; - return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new ParameterResource(result, this._client); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromManifestInternal()); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._withExplicitStartInternal()); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - const commandOptions = options?.commandOptions; - return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceReadyInternal(callback)); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ParameterResource(result, this._client); +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - const iconVariant = options?.iconVariant; - return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromMcpInternal()); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } -} + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } -/** - * Thenable wrapper for ParameterResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ParameterResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } - then( - onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -10153,383 +17945,440 @@ export class ParameterResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ -// ProjectResource +// ViteAppResource // ============================================================================ -export class ProjectResource extends ResourceBuilderBase { - constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { +export class ViteAppResource extends ResourceBuilderBase { + constructor(handle: ViteAppResourceHandle, client: AspireClientRpc) { super(handle, client); } + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ViteAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _publishAsDockerFileInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterInternal()); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - const helpLink = options?.helpLink; - return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ViteAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { + const helpLink = options?.helpLink; + return new ViteAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ViteAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -10539,15 +18388,15 @@ export class ProjectResource extends ResourceBuilderBase if (isProxied !== undefined) rpcArgs.isProxied = isProxied; if (isExternal !== undefined) rpcArgs.isExternal = isExternal; if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -10556,72 +18405,72 @@ export class ProjectResource extends ResourceBuilderBase const isProxied = options?.isProxied; const isExternal = options?.isExternal; const protocol = options?.protocol; - return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + return new ViteAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -10634,293 +18483,308 @@ export class ProjectResource extends ResourceBuilderBase } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._clearContainerFilesSourcesInternal()); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { const exitCode = options?.exitCode; - return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ViteAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new ViteAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -10928,130 +18792,130 @@ export class ProjectResource extends ResourceBuilderBase }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { const commandOptions = options?.commandOptions; - return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ViteAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { const password = options?.password; - return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new ViteAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { const iconVariant = options?.iconVariant; - return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ViteAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -11060,15 +18924,15 @@ export class ProjectResource extends ResourceBuilderBase if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -11076,276 +18940,520 @@ export class ProjectResource extends ResourceBuilderBase const failureThreshold = options?.failureThreshold; const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new ViteAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ViteAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withViteConfigInternal(configPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, configPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withViteConfig', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withViteConfigInternal(configPath)); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withYarnInternal(install, installArgs)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withPnpmInternal(install, installArgs)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', rpcArgs ); + return new ViteAppResource(result, this._client); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + const browser = options?.browser; + return new ViteAppResourcePromise(this._withBrowserDebuggerInternal(browser)); } } /** - * Thenable wrapper for ProjectResource that enables fluent chaining. + * Thenable wrapper for ViteAppResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ProjectResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ViteAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ViteAppResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -11354,168 +19462,306 @@ export class ProjectResourcePromise implements PromiseLike { } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withViteConfig(configPath))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + +} + +// ============================================================================ +// ComputeResource +// ============================================================================ + +export class ComputeResource extends ResourceBuilderBase { + constructor(handle: IComputeResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); +} + +/** + * Thenable wrapper for ComputeResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ComputeResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ComputeResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } } @@ -11533,7 +19779,7 @@ export class ContainerFilesDestinationResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); return new ContainerFilesDestinationResource(result, this._client); @@ -11792,7 +20038,7 @@ export class Resource extends ResourceBuilderBase { private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new Resource(result, this._client); @@ -11807,7 +20053,7 @@ export class Resource extends ResourceBuilderBase { private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new Resource(result, this._client); @@ -11850,36 +20096,6 @@ export class Resource extends ResourceBuilderBase { return new ResourcePromise(this._excludeFromMcpInternal()); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -11957,6 +20173,86 @@ export class Resource extends ResourceBuilderBase { ); } + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -12054,16 +20350,6 @@ export class ResourcePromise implements PromiseLike { return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); @@ -12084,6 +20370,26 @@ export class ResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -12223,6 +20529,35 @@ export class ResourceWithConnectionString extends ResourceBuilderBase { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._onConnectionStringAvailableInternal(callback)); + } + } /** @@ -12250,6 +20585,16 @@ export class ResourceWithConnectionStringPromise implements PromiseLike obj.withConnectionPropertyValue(name, value))); } + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + } // ============================================================================ @@ -12538,6 +20883,26 @@ export class ResourceWithEndpoints extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + } /** @@ -12605,6 +20970,11 @@ export class ResourceWithEndpointsPromise implements PromiseLike obj.withHttpProbe(probeType, options))); } + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + } // ============================================================================ @@ -12647,41 +21017,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -12692,43 +21032,38 @@ export class ResourceWithEnvironment extends ResourceBuilderBase Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -12762,10 +21097,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -12777,37 +21113,8 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -12890,7 +21197,7 @@ export class ResourceWithEnvironment extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ResourceWithEnvironment(result, this._client); @@ -12944,31 +21251,21 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withOtlpExporterProtocol(protocol))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -12984,16 +21281,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -13031,34 +21318,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike { - constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { - super(handle, client); - } - -} - -/** - * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ResourceWithServiceDiscoveryPromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - -} - // ============================================================================ // ResourceWithWaitSupport // ============================================================================ @@ -13072,7 +21331,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -13102,7 +21361,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -13133,7 +21392,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -13252,7 +21511,7 @@ export async function createBuilder(options?: CreateBuilderOptions): Promise { const error = reason instanceof Error ? reason : new Error(String(reason)); - if (reason instanceof CapabilityError) { + if (reason instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else if (reason instanceof CapabilityError) { console.error(`\n❌ Capability Error: ${error.message}`); console.error(` Code: ${(reason as CapabilityError).code}`); if ((reason as CapabilityError).capability) { @@ -13283,8 +21544,12 @@ process.on('unhandledRejection', (reason: unknown) => { }); process.on('uncaughtException', (error: Error) => { - console.error(`\n❌ Uncaught Exception: ${error.message}`); - if (error.stack) { + if (error instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + } + if (!(error instanceof AppHostUsageError) && error.stack) { console.error(error.stack); } process.exit(1); @@ -13295,21 +21560,44 @@ process.on('uncaughtException', (error: Error) => { // ============================================================================ // Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent', (handle, client) => new AfterResourcesCreatedEvent(handle as AfterResourcesCreatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent', (handle, client) => new BeforeResourceStartedEvent(handle as BeforeResourceStartedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent', (handle, client) => new BeforeStartEvent(handle as BeforeStartEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent', (handle, client) => new ConnectionStringAvailableEvent(handle as ConnectionStringAvailableEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel', (handle, client) => new DistributedApplicationModel(handle as DistributedApplicationModelHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent', (handle, client) => new InitializeResourceEvent(handle as InitializeResourceEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext', (handle, client) => new PipelineContext(handle as PipelineContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext', (handle, client) => new PipelineStepFactoryContext(handle as PipelineStepFactoryContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary', (handle, client) => new PipelineSummary(handle as PipelineSummaryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent', (handle, client) => new ResourceEndpointsAllocatedEvent(handle as ResourceEndpointsAllocatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService', (handle, client) => new ResourceLoggerService(handle as ResourceLoggerServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService', (handle, client) => new ResourceNotificationService(handle as ResourceNotificationServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent', (handle, client) => new ResourceReadyEvent(handle as ResourceReadyEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent', (handle, client) => new ResourceStoppedEvent(handle as ResourceStoppedEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext', (handle, client) => new UpdateCommandStateContext(handle as UpdateCommandStateContextHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration', (handle, client) => new Configuration(handle as IConfigurationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment', (handle, client) => new HostEnvironment(handle as IHostEnvironmentHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger', (handle, client) => new Logger(handle as ILoggerHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory', (handle, client) => new LoggerFactory(handle as ILoggerFactoryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep', (handle, client) => new ReportingStep(handle as IReportingStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask', (handle, client) => new ReportingTask(handle as IReportingTaskHandle, client)); +registerHandleWrapper('System.ComponentModel/System.IServiceProvider', (handle, client) => new ServiceProvider(handle as IServiceProviderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IUserSecretsManager', (handle, client) => new UserSecretsManager(handle as IUserSecretsManagerHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); @@ -13317,8 +21605,12 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppR registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource', (handle, client) => new JavaScriptAppResource(handle as JavaScriptAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource', (handle, client) => new NodeAppResource(handle as NodeAppResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource', (handle, client) => new ViteAppResource(handle as ViteAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource', (handle, client) => new ComputeResource(handle as IComputeResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); @@ -13326,6 +21618,5 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceW registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); diff --git a/samples/client-apps-integration/ts/.modules/base.ts b/samples/client-apps-integration/ts/.modules/base.ts index 7778b0f1..b3d8b8be 100644 --- a/samples/client-apps-integration/ts/.modules/base.ts +++ b/samples/client-apps-integration/ts/.modules/base.ts @@ -1,8 +1,8 @@ -// aspire.ts - Core Aspire types: base classes, ReferenceExpression -import { Handle, AspireClient, MarshalledHandle } from './transport.js'; +// base.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle, CancellationToken, registerCancellation, registerHandleWrapper, unregisterCancellation } from './transport.js'; // Re-export transport types for convenience -export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export { Handle, AspireClient, CapabilityError, CancellationToken, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; @@ -43,22 +43,46 @@ export class ReferenceExpression { private readonly _format?: string; private readonly _valueProviders?: unknown[]; + // Conditional mode fields + private readonly _condition?: unknown; + private readonly _whenTrue?: ReferenceExpression; + private readonly _whenFalse?: ReferenceExpression; + private readonly _matchValue?: string; + // Handle mode fields (when wrapping a server-returned handle) private readonly _handle?: Handle; private readonly _client?: AspireClient; constructor(format: string, valueProviders: unknown[]); constructor(handle: Handle, client: AspireClient); - constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { - if (typeof handleOrFormat === 'string') { - this._format = handleOrFormat; - this._valueProviders = clientOrValueProviders as unknown[]; + constructor(condition: unknown, matchValue: string, whenTrue: ReferenceExpression, whenFalse: ReferenceExpression); + constructor( + handleOrFormatOrCondition: Handle | string | unknown, + clientOrValueProvidersOrMatchValue: AspireClient | unknown[] | string, + whenTrueOrWhenFalse?: ReferenceExpression, + whenFalse?: ReferenceExpression + ) { + if (typeof handleOrFormatOrCondition === 'string') { + this._format = handleOrFormatOrCondition; + this._valueProviders = clientOrValueProvidersOrMatchValue as unknown[]; + } else if (handleOrFormatOrCondition instanceof Handle) { + this._handle = handleOrFormatOrCondition; + this._client = clientOrValueProvidersOrMatchValue as AspireClient; } else { - this._handle = handleOrFormat; - this._client = clientOrValueProviders as AspireClient; + this._condition = handleOrFormatOrCondition; + this._matchValue = (clientOrValueProvidersOrMatchValue as string) ?? 'True'; + this._whenTrue = whenTrueOrWhenFalse; + this._whenFalse = whenFalse; } } + /** + * Gets whether this reference expression is conditional. + */ + get isConditional(): boolean { + return this._condition !== undefined; + } + /** * Creates a reference expression from a tagged template literal. * @@ -82,16 +106,46 @@ export class ReferenceExpression { return new ReferenceExpression(format, valueProviders); } + /** + * Creates a conditional reference expression from its constituent parts. + * + * @param condition - A value provider whose result is compared to matchValue + * @param whenTrue - The expression to use when the condition matches + * @param whenFalse - The expression to use when the condition does not match + * @param matchValue - The value to compare the condition against (defaults to "True") + * @returns A ReferenceExpression instance in conditional mode + */ + static createConditional( + condition: unknown, + matchValue: string, + whenTrue: ReferenceExpression, + whenFalse: ReferenceExpression + ): ReferenceExpression { + return new ReferenceExpression(condition, matchValue, whenTrue, whenFalse); + } + /** * Serializes the reference expression for JSON-RPC transport. - * In template-literal mode, uses the $expr format. + * In expression mode, uses the $expr format with format + valueProviders. + * In conditional mode, uses the $expr format with condition + whenTrue + whenFalse. * In handle mode, delegates to the handle's serialization. */ - toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } | { condition: unknown; whenTrue: unknown; whenFalse: unknown; matchValue: string } } | MarshalledHandle { if (this._handle) { return this._handle.toJSON(); } + if (this.isConditional) { + return { + $expr: { + condition: extractHandleForExpr(this._condition), + whenTrue: this._whenTrue!.toJSON(), + whenFalse: this._whenFalse!.toJSON(), + matchValue: this._matchValue! + } + }; + } + return { $expr: { format: this._format!, @@ -100,6 +154,30 @@ export class ReferenceExpression { }; } + /** + * Resolves the expression to its string value on the server. + * Only available on server-returned ReferenceExpression instances (handle mode). + * + * @param cancellationToken - Optional AbortSignal or CancellationToken for cancellation support + * @returns The resolved string value, or null if the expression resolves to null + */ + async getValue(cancellationToken?: AbortSignal | CancellationToken): Promise { + if (!this._handle || !this._client) { + throw new Error('getValue is only available on server-returned ReferenceExpression instances'); + } + const cancellationTokenId = registerCancellation(this._client, cancellationToken); + try { + const rpcArgs: Record = { context: this._handle }; + if (cancellationTokenId !== undefined) rpcArgs.cancellationToken = cancellationTokenId; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValue', + rpcArgs + ); + } finally { + unregisterCancellation(cancellationTokenId); + } + } + /** * String representation for debugging. */ @@ -107,10 +185,17 @@ export class ReferenceExpression { if (this._handle) { return `ReferenceExpression(handle)`; } + if (this.isConditional) { + return `ReferenceExpression(conditional)`; + } return `ReferenceExpression(${this._format})`; } } +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression', (handle, client) => + new ReferenceExpression(handle, client) +); + /** * Extracts a value for use in reference expressions. * Supports handles (objects) and string literals. @@ -136,15 +221,15 @@ function extractHandleForExpr(value: unknown): unknown { return value.toJSON(); } - // Objects with $handle property (already in handle format) - if (typeof value === 'object' && value !== null && '$handle' in value) { + // Objects with marshalled expression/handle payloads + if (typeof value === 'object' && value !== null && ('$handle' in value || '$expr' in value)) { return value; } - // Objects with toJSON that returns a handle + // Objects with toJSON that returns a marshalled expression or handle if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { const json = value.toJSON(); - if (json && typeof json === 'object' && '$handle' in json) { + if (json && typeof json === 'object' && ('$handle' in json || '$expr' in json)) { return json; } } @@ -307,11 +392,20 @@ export class AspireList { }) as T[]; } - toJSON(): MarshalledHandle { - if (this._resolvedHandle) { - return this._resolvedHandle.toJSON(); + async toTransportValue(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireList must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); } - return this._handleOrContext.toJSON(); + + return this._resolvedHandle.toJSON(); } } @@ -466,8 +560,19 @@ export class AspireDict { }) as Record; } - async toJSON(): Promise { + async toTransportValue(): Promise { const handle = await this._ensureHandle(); return handle.toJSON(); } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireDict must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); + } + + return this._resolvedHandle.toJSON(); + } } diff --git a/samples/client-apps-integration/ts/.modules/transport.ts b/samples/client-apps-integration/ts/.modules/transport.ts index 7bddd74b..6d29cf28 100644 --- a/samples/client-apps-integration/ts/.modules/transport.ts +++ b/samples/client-apps-integration/ts/.modules/transport.ts @@ -77,7 +77,8 @@ export function isAtsError(value: unknown): value is { $error: AtsError } { value !== null && typeof value === 'object' && '$error' in value && - typeof (value as { $error: unknown }).$error === 'object' + typeof (value as { $error: unknown }).$error === 'object' && + (value as { $error: unknown }).$error !== null ); } @@ -93,6 +94,47 @@ export function isMarshalledHandle(value: unknown): value is MarshalledHandle { ); } +function isAbortSignal(value: unknown): value is AbortSignal { + return ( + value !== null && + typeof value === 'object' && + 'aborted' in value && + 'addEventListener' in value && + 'removeEventListener' in value + ); +} + +function isPlainObject(value: unknown): value is Record { + if (value === null || typeof value !== 'object') { + return false; + } + + const prototype = Object.getPrototypeOf(value); + return prototype === Object.prototype || prototype === null; +} + +function hasTransportValue(value: unknown): value is { toTransportValue(): unknown | Promise } { + return ( + value !== null && + typeof value === 'object' && + 'toTransportValue' in value && + typeof (value as { toTransportValue?: unknown }).toTransportValue === 'function' + ); +} + +function createAbortError(message: string): Error { + const error = new Error(message); + error.name = 'AbortError'; + return error; +} + +function createCircularReferenceError(capabilityId: string, path: string): AppHostUsageError { + return new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' contains a circular reference. ` + + 'Circular references are not supported by the AppHost transport.' + ); +} + // ============================================================================ // Handle // ============================================================================ @@ -136,6 +178,92 @@ export class Handle { } } +// ============================================================================ +// CancellationToken +// ============================================================================ + +/** + * Represents a transport-safe cancellation token value for the generated SDK. + * + * Use a plain {@link AbortSignal} when you create cancellation in user code. + * Generated APIs accept either an {@link AbortSignal} or a {@link CancellationToken}. + * + * Values returned from generated callbacks and context/property getters are + * {@link CancellationToken} instances because they may reference remote + * cancellation token handles received from the AppHost. + * + * @example + * ```typescript + * const controller = new AbortController(); + * await connectionStringExpression.getValue(controller.signal); + * ``` + * + * @example + * ```typescript + * const cancellationToken = await context.cancellationToken.get(); + * const connectionStringExpression = await db.uriExpression.get(); + * const connectionString = await connectionStringExpression.getValue(cancellationToken); + * ``` + */ +export class CancellationToken { + private readonly _signal?: AbortSignal; + private readonly _remoteTokenId?: string; + + constructor(signal?: AbortSignal); + constructor(tokenId?: string); + constructor(value?: AbortSignal | string | null) { + if (typeof value === 'string') { + this._remoteTokenId = value; + } else if (isAbortSignal(value)) { + this._signal = value; + } + } + + /** + * Creates a cancellation token from a local {@link AbortSignal}. + */ + static from(signal?: AbortSignal): CancellationToken { + return new CancellationToken(signal); + } + + /** + * Creates a cancellation token from a transport value. + * Generated code uses this to materialize values that come from the AppHost. + */ + static fromValue(value: unknown): CancellationToken { + if (value instanceof CancellationToken) { + return value; + } + + if (typeof value === 'string') { + return new CancellationToken(value); + } + + if (isAbortSignal(value)) { + return new CancellationToken(value); + } + + return new CancellationToken(); + } + + /** + * Serializes the token for JSON-RPC transport. + */ + toJSON(): string | undefined { + return this._remoteTokenId; + } + + register(client?: AspireClient): string | undefined { + if (this._remoteTokenId !== undefined) { + return this._remoteTokenId; + } + + return client + ? registerCancellation(client, this._signal) + : registerCancellation(this._signal); + } +} + // ============================================================================ // Handle Wrapper Registry // ============================================================================ @@ -167,22 +295,35 @@ export function registerHandleWrapper(typeId: string, factory: HandleWrapperFact * @param client - Optional client for creating typed wrapper instances */ export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { - if (value && typeof value === 'object') { - if (isMarshalledHandle(value)) { - const handle = new Handle(value); - const typeId = value.$type; - - // Try to find a registered wrapper factory for this type - if (typeId && client) { - const factory = handleWrapperRegistry.get(typeId); - if (factory) { - return factory(handle, client); - } + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); } + } + + return handle; + } - return handle; + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + value[i] = wrapIfHandle(value[i], client); + } + + return value; + } + + if (isPlainObject(value)) { + for (const [key, nestedValue] of Object.entries(value)) { + value[key] = wrapIfHandle(nestedValue, client); } } + return value; } @@ -213,6 +354,76 @@ export class CapabilityError extends Error { } } +/** + * Error thrown when the AppHost script uses the generated SDK incorrectly. + */ +export class AppHostUsageError extends Error { + constructor(message: string) { + super(message); + this.name = 'AppHostUsageError'; + } +} + +function isPromiseLike(value: unknown): value is PromiseLike { + return ( + value !== null && + (typeof value === 'object' || typeof value === 'function') && + 'then' in value && + typeof (value as { then?: unknown }).then === 'function' + ); +} + +function validateCapabilityArgs( + capabilityId: string, + args?: Record +): void { + if (!args) { + return; + } + + const validateValue = (value: unknown, path: string, ancestors: Set): void => { + if (value === null || value === undefined) { + return; + } + + if (isPromiseLike(value)) { + throw new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' is a Promise-like value. ` + + `This usually means an async builder call was not awaited. ` + + `Did you forget 'await' on a call like builder.addPostgres(...) or resource.addDatabase(...)?` + ); + } + + if (typeof value !== 'object') { + return; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + ancestors.add(value); + try { + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + validateValue(value[i], `${path}[${i}]`, ancestors); + } + return; + } + + for (const [key, nestedValue] of Object.entries(value)) { + validateValue(nestedValue, `${path}.${key}`, ancestors); + } + } finally { + ancestors.delete(value); + } + }; + + for (const [key, value] of Object.entries(args)) { + validateValue(value, key, new Set()); + } +} + // ============================================================================ // Callback Registry // ============================================================================ @@ -324,21 +535,50 @@ export function getCallbackCount(): number { */ const cancellationRegistry = new Map void>(); let cancellationIdCounter = 0; +const connectedClients = new Set(); -/** - * A reference to the current AspireClient for sending cancel requests. - * Set by AspireClient.connect(). - */ -let currentClient: AspireClient | null = null; +function resolveCancellationClient(client?: AspireClient): AspireClient { + if (client) { + return client; + } + + if (connectedClients.size === 1) { + return connectedClients.values().next().value as AspireClient; + } + + if (connectedClients.size === 0) { + throw new Error( + 'registerCancellation(signal) requires a connected AspireClient. ' + + 'Pass the client explicitly or connect the client first.' + ); + } + + throw new Error( + 'registerCancellation(signal) is ambiguous when multiple AspireClient instances are connected. ' + + 'Pass the client explicitly.' + ); +} /** - * Register an AbortSignal for cancellation support. - * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * Registers cancellation support for a local signal or SDK cancellation token. + * Returns a cancellation ID that should be passed to methods accepting cancellation input. * * When the AbortSignal is aborted, sends a cancelToken request to the host. * - * @param signal - The AbortSignal to register (optional) - * @returns The cancellation ID, or undefined if no signal provided + * @param client - The AspireClient that should route the cancellation request + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + */ +export function registerCancellation(client: AspireClient, signalOrToken?: AbortSignal | CancellationToken): string | undefined; +/** + * Registers cancellation support using the single connected AspireClient. + * + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + * + * @example + * const controller = new AbortController(); + * await expression.getValue(controller.signal); * * @example * const controller = new AbortController(); @@ -346,14 +586,29 @@ let currentClient: AspireClient | null = null; * // Pass id to capability invocation * // Later: controller.abort() will cancel the operation */ -export function registerCancellation(signal?: AbortSignal): string | undefined { - if (!signal) { +export function registerCancellation(signalOrToken?: AbortSignal | CancellationToken): string | undefined; +export function registerCancellation( + clientOrSignalOrToken?: AspireClient | AbortSignal | CancellationToken, + maybeSignalOrToken?: AbortSignal | CancellationToken +): string | undefined { + const client = clientOrSignalOrToken instanceof AspireClient ? clientOrSignalOrToken : undefined; + const signalOrToken = client + ? maybeSignalOrToken + : clientOrSignalOrToken as AbortSignal | CancellationToken | undefined; + + if (!signalOrToken) { return undefined; } - // Already aborted? Don't register + if (signalOrToken instanceof CancellationToken) { + return signalOrToken.register(client); + } + + const signal = signalOrToken; + const cancellationClient = resolveCancellationClient(client); + if (signal.aborted) { - return undefined; + throw createAbortError('The operation was aborted before it was sent to the AppHost.'); } const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; @@ -361,8 +616,8 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { // Set up the abort listener const onAbort = () => { // Send cancel request to host - if (currentClient?.connected) { - currentClient.cancelToken(cancellationId).catch(() => { + if (cancellationClient.connected) { + cancellationClient.cancelToken(cancellationId).catch(() => { // Ignore errors - the operation may have already completed }); } @@ -381,6 +636,56 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { return cancellationId; } +async function marshalTransportValue( + value: unknown, + client: AspireClient, + cancellationIds: string[], + capabilityId: string, + path: string = 'args', + ancestors: Set = new Set() +): Promise { + if (value === null || value === undefined || typeof value !== 'object') { + return value; + } + + if (value instanceof CancellationToken) { + const cancellationId = value.register(client); + if (cancellationId !== undefined) { + cancellationIds.push(cancellationId); + } + + return cancellationId; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + const nextAncestors = new Set(ancestors); + nextAncestors.add(value); + + if (hasTransportValue(value)) { + return await marshalTransportValue(await value.toTransportValue(), client, cancellationIds, capabilityId, path, nextAncestors); + } + + if (Array.isArray(value)) { + return await Promise.all( + value.map((item, index) => marshalTransportValue(item, client, cancellationIds, capabilityId, `${path}[${index}]`, nextAncestors)) + ); + } + + if (isPlainObject(value)) { + const entries = await Promise.all( + Object.entries(value).map(async ([key, nestedValue]) => + [key, await marshalTransportValue(nestedValue, client, cancellationIds, capabilityId, `${path}.${key}`, nextAncestors)] as const) + ); + + return Object.fromEntries(entries); + } + + return value; +} + /** * Unregister a cancellation token by its ID. * Call this when the operation completes to clean up resources. @@ -411,6 +716,8 @@ export class AspireClient { private socket: net.Socket | null = null; private disconnectCallbacks: (() => void)[] = []; private _pendingCalls = 0; + private _connectPromise: Promise | null = null; + private _disconnectNotified = false; constructor(private socketPath: string) { } @@ -422,6 +729,12 @@ export class AspireClient { } private notifyDisconnect(): void { + if (this._disconnectNotified) { + return; + } + + this._disconnectNotified = true; + for (const callback of this.disconnectCallbacks) { try { callback(); @@ -432,30 +745,106 @@ export class AspireClient { } connect(timeoutMs: number = 5000): Promise { - return new Promise((resolve, reject) => { - const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + if (this.connected) { + return Promise.resolve(); + } + + if (this._connectPromise) { + return this._connectPromise; + } + + this._disconnectNotified = false; + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this._connectPromise = new Promise((resolve, reject) => { + const socket = net.createConnection(pipePath); + this.socket = socket; - // On Windows, use named pipes; on Unix, use Unix domain sockets - const isWindows = process.platform === 'win32'; - const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + let settled = false; - this.socket = net.createConnection(pipePath); + const cleanupPendingListeners = () => { + socket.removeListener('connect', onConnect); + socket.removeListener('error', onPendingError); + socket.removeListener('close', onPendingClose); + }; - this.socket.once('error', (error: Error) => { + const failConnect = (error: Error) => { + if (settled) { + return; + } + + settled = true; clearTimeout(timeout); + cleanupPendingListeners(); + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + if (!socket.destroyed) { + socket.destroy(); + } + reject(error); - }); + }; + + const onConnectedSocketError = (error: Error) => { + console.error('Socket error:', error); + }; + + const onConnectedSocketClose = () => { + socket.removeListener('error', onConnectedSocketError); + + if (this.socket && this.socket !== socket) { + return; + } + + const connection = this.connection; + this.connection = null; + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + this.notifyDisconnect(); + }; + + const onPendingError = (error: Error) => { + failConnect(error); + }; + + const onPendingClose = () => { + failConnect(new Error('Connection closed before JSON-RPC was established')); + }; + + const onConnect = async () => { + if (settled) { + return; + } - this.socket.once('connect', () => { clearTimeout(timeout); + cleanupPendingListeners(); + try { - const reader = new rpc.SocketMessageReader(this.socket!); - const writer = new rpc.SocketMessageWriter(this.socket!); + const reader = new rpc.SocketMessageReader(socket); + const writer = new rpc.SocketMessageWriter(socket); this.connection = rpc.createMessageConnection(reader, writer); this.connection.onClose(() => { this.connection = null; - this.notifyDisconnect(); }); this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); @@ -475,26 +864,39 @@ export class AspireClient { } }); + socket.on('error', onConnectedSocketError); + socket.on('close', onConnectedSocketClose); + + const authToken = process.env.ASPIRE_REMOTE_APPHOST_TOKEN; + if (!authToken) { + throw new Error('ASPIRE_REMOTE_APPHOST_TOKEN environment variable is not set.'); + } this.connection.listen(); + const authenticated = await this.connection.sendRequest('authenticate', authToken); + if (!authenticated) { + throw new Error('Failed to authenticate to the AppHost server.'); + } - // Set the current client for cancellation registry - currentClient = this; + connectedClients.add(this); + this._connectPromise = null; + settled = true; resolve(); - } catch (e) { - reject(e); + } catch (error) { + failConnect(error instanceof Error ? error : new Error(String(error))); } - }); + }; - this.socket.on('close', () => { - this.connection?.dispose(); - this.connection = null; - if (currentClient === this) { - currentClient = null; - } - this.notifyDisconnect(); - }); + const timeout = setTimeout(() => { + failConnect(new Error('Connection timeout')); + }, timeoutMs); + + socket.once('error', onPendingError); + socket.once('close', onPendingClose); + socket.once('connect', onConnect); }); + + return this._connectPromise; } ping(): Promise { @@ -533,39 +935,66 @@ export class AspireClient { throw new Error('Not connected to AppHost'); } - // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. - // We ref() during RPC calls so the process doesn't exit mid-call, and - // unref() when idle so the process can exit naturally after all work completes. - if (this._pendingCalls === 0) { - this.socket?.ref(); - } - this._pendingCalls++; + validateCapabilityArgs(capabilityId, args); + const cancellationIds: string[] = []; try { - const result = await this.connection.sendRequest( - 'invokeCapability', - capabilityId, - args ?? null - ); + const rpcArgs = await marshalTransportValue(args ?? null, this, cancellationIds, capabilityId); - // Check for structured error response - if (isAtsError(result)) { - throw new CapabilityError(result.$error); + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); } + this._pendingCalls++; - // Wrap handles automatically - return wrapIfHandle(result, this) as T; + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + rpcArgs + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } } finally { - this._pendingCalls--; - if (this._pendingCalls === 0) { - this.socket?.unref(); + for (const cancellationId of cancellationIds) { + unregisterCancellation(cancellationId); } } } disconnect(): void { - try { this.connection?.dispose(); } finally { this.connection = null; } - try { this.socket?.end(); } finally { this.socket = null; } + const connection = this.connection; + const socket = this.socket; + + this.connection = null; + this.socket = null; + this._connectPromise = null; + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + if (socket && !socket.destroyed) { + socket.end(); + socket.destroy(); + } } get connected(): boolean { diff --git a/samples/client-apps-integration/ts/apphost.ts b/samples/client-apps-integration/ts/apphost.ts index 4928644d..632030d7 100644 --- a/samples/client-apps-integration/ts/apphost.ts +++ b/samples/client-apps-integration/ts/apphost.ts @@ -16,7 +16,7 @@ if (os.platform() === "win32") { "../ClientAppsIntegration.WinForms/ClientAppsIntegration.WinForms.csproj", "ClientAppsIntegration.WinForms" ) - .withServiceReference(apiService) + .withReference(apiService) .waitFor(apiService) .withExplicitStart() .excludeFromManifest(); @@ -27,7 +27,7 @@ if (os.platform() === "win32") { "../ClientAppsIntegration.WPF/ClientAppsIntegration.WPF.csproj", "ClientAppsIntegration.WPF" ) - .withServiceReference(apiService) + .withReference(apiService) .waitFor(apiService) .withExplicitStart() .excludeFromManifest(); diff --git a/samples/client-apps-integration/ts/apphost.run.json b/samples/client-apps-integration/ts/aspire.config.json similarity index 67% rename from samples/client-apps-integration/ts/apphost.run.json rename to samples/client-apps-integration/ts/aspire.config.json index b857ff66..45971c74 100644 --- a/samples/client-apps-integration/ts/apphost.run.json +++ b/samples/client-apps-integration/ts/aspire.config.json @@ -1,4 +1,11 @@ { + "appHost": { + "path": "apphost.ts", + "language": "typescript/nodejs" + }, + "packages": { + "Aspire.Hosting.JavaScript": "13.2.0" + }, "profiles": { "https": { "applicationUrl": "https://localhost:27048;http://localhost:46197", @@ -8,4 +15,4 @@ } } } -} \ No newline at end of file +} diff --git a/samples/container-build/ts/.aspire/settings.json b/samples/container-build/ts/.aspire/settings.json deleted file mode 100644 index 3c03a3b9..00000000 --- a/samples/container-build/ts/.aspire/settings.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "appHostPath": "../apphost.ts", - "language": "typescript/nodejs", - "channel": "staging", - "sdkVersion": "13.2.0-preview.1.26159.1" -} \ No newline at end of file diff --git a/samples/container-build/ts/.modules/.codegen-hash b/samples/container-build/ts/.modules/.codegen-hash index 1369f62c..d112ad8d 100644 --- a/samples/container-build/ts/.modules/.codegen-hash +++ b/samples/container-build/ts/.modules/.codegen-hash @@ -1 +1 @@ -385A37965F5742D9B7F75074E7065C879412F46A58CE04016D535C18DA21950E \ No newline at end of file +54ABC5F6F3238E45FD69B96BCCB0C6A5BB14B11F3C267B90DC987EFF3E1B7E45 \ No newline at end of file diff --git a/samples/container-build/ts/.modules/aspire.ts b/samples/container-build/ts/.modules/aspire.ts index 73dc52d2..802979fb 100644 --- a/samples/container-build/ts/.modules/aspire.ts +++ b/samples/container-build/ts/.modules/aspire.ts @@ -8,6 +8,8 @@ import { AspireClient as AspireClientRpc, Handle, MarshalledHandle, + AppHostUsageError, + CancellationToken, CapabilityError, registerCallback, wrapIfHandle, @@ -26,9 +28,30 @@ import { // Handle Type Aliases (Internal - not exported to users) // ============================================================================ +/** Handle to JavaScriptAppResource */ +type JavaScriptAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource'>; + +/** Handle to NodeAppResource */ +type NodeAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource'>; + +/** Handle to ViteAppResource */ +type ViteAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource'>; + +/** Handle to AfterResourcesCreatedEvent */ +type AfterResourcesCreatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent'>; + +/** Handle to BeforeResourceStartedEvent */ +type BeforeResourceStartedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent'>; + +/** Handle to BeforeStartEvent */ +type BeforeStartEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent'>; + /** Handle to CommandLineArgsCallbackContext */ type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; +/** Handle to ConnectionStringAvailableEvent */ +type ConnectionStringAvailableEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent'>; + /** Handle to ContainerRegistryResource */ type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; @@ -38,6 +61,9 @@ type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Application /** Handle to CSharpAppResource */ type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; +/** Handle to DistributedApplicationModel */ +type DistributedApplicationModelHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel'>; + /** Handle to DotnetToolResource */ type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; @@ -56,9 +82,15 @@ type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicatio /** Handle to ExecuteCommandContext */ type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; +/** Handle to IComputeResource */ +type IComputeResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource'>; + /** Handle to IContainerFilesDestinationResource */ type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; +/** Handle to InitializeResourceEvent */ +type InitializeResourceEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent'>; + /** Handle to IResource */ type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; @@ -89,15 +121,27 @@ type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicati /** Handle to ReferenceExpressionBuilder */ type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; +/** Handle to ResourceEndpointsAllocatedEvent */ +type ResourceEndpointsAllocatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent'>; + /** Handle to ResourceLoggerService */ type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; /** Handle to ResourceNotificationService */ type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; +/** Handle to ResourceReadyEvent */ +type ResourceReadyEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent'>; + +/** Handle to ResourceStoppedEvent */ +type ResourceStoppedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent'>; + /** Handle to ResourceUrlsCallbackContext */ type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; +/** Handle to UpdateCommandStateContext */ +type UpdateCommandStateContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext'>; + /** Handle to ConnectionStringResource */ type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; @@ -122,18 +166,33 @@ type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hostin /** Handle to IResourceWithContainerFiles */ type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; -/** Handle to IResourceWithServiceDiscovery */ -type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; +/** Handle to IUserSecretsManager */ +type IUserSecretsManagerHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IUserSecretsManager'>; + +/** Handle to IReportingStep */ +type IReportingStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep'>; + +/** Handle to IReportingTask */ +type IReportingTaskHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask'>; /** Handle to PipelineConfigurationContext */ type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; +/** Handle to PipelineContext */ +type PipelineContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext'>; + /** Handle to PipelineStep */ type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; /** Handle to PipelineStepContext */ type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; +/** Handle to PipelineStepFactoryContext */ +type PipelineStepFactoryContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext'>; + +/** Handle to PipelineSummary */ +type PipelineSummaryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary'>; + /** Handle to ProjectResourceOptions */ type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; @@ -146,12 +205,18 @@ type ListanyHandle = Handle<'Aspire.Hosting/List'>; /** Handle to IConfiguration */ type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; +/** Handle to IConfigurationSection */ +type IConfigurationSectionHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfigurationSection'>; + /** Handle to IHostEnvironment */ type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; /** Handle to ILogger */ type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; +/** Handle to ILoggerFactory */ +type ILoggerFactoryHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory'>; + /** Handle to string[] */ type stringArrayHandle = Handle<'string[]'>; @@ -191,6 +256,7 @@ export enum EndpointProperty { Scheme = "Scheme", TargetPort = "TargetPort", HostAndPort = "HostAndPort", + TlsEnabled = "TlsEnabled", } /** Enum type for IconVariant */ @@ -322,6 +388,10 @@ export interface AddConnectionStringOptions { environmentVariableName?: string; } +export interface AddContainerRegistryFromStringOptions { + repository?: string; +} + export interface AddContainerRegistryOptions { repository?: ParameterResource; } @@ -331,6 +401,10 @@ export interface AddDockerfileOptions { stage?: string; } +export interface AddJavaScriptAppOptions { + runScriptName?: string; +} + export interface AddParameterFromConfigurationOptions { secret?: boolean; } @@ -339,6 +413,15 @@ export interface AddParameterOptions { secret?: boolean; } +export interface AddParameterWithValueOptions { + publishValueAsDefault?: boolean; + secret?: boolean; +} + +export interface AddViteAppOptions { + runScriptName?: string; +} + export interface AppendFormattedOptions { format?: string; } @@ -347,22 +430,89 @@ export interface AppendValueProviderOptions { format?: string; } +export interface CompleteStepMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteStepOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskOptions { + completionMessage?: string; + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateMarkdownTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + export interface GetValueAsyncOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface PublishAsDockerFileOptions { + configure?: (obj: ContainerResource) => Promise; +} + +export interface PublishResourceUpdateOptions { + state?: string; + stateStyle?: string; } export interface RunOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface SaveStateJsonOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskMarkdownOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; } export interface WaitForCompletionOptions { exitCode?: number; } +export interface WaitForResourceStateOptions { + targetState?: string; +} + export interface WithBindMountOptions { isReadOnly?: boolean; } +export interface WithBrowserDebuggerOptions { + browser?: string; +} + +export interface WithBuildScriptOptions { + args?: string[]; +} + +export interface WithBunOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithCommandOptions { commandOptions?: CommandOptions; } @@ -446,6 +596,12 @@ export interface WithMcpServerOptions { endpointName?: string; } +export interface WithNpmOptions { + install?: boolean; + installCommand?: string; + installArgs?: string[]; +} + export interface WithPipelineStepFactoryOptions { dependsOn?: string[]; requiredBy?: string[]; @@ -453,15 +609,25 @@ export interface WithPipelineStepFactoryOptions { description?: string; } +export interface WithPnpmOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithReferenceOptions { connectionName?: string; optional?: boolean; + name?: string; } export interface WithRequiredCommandOptions { helpLink?: string; } +export interface WithRunScriptOptions { + args?: string[]; +} + export interface WithUrlExpressionOptions { displayText?: string; } @@ -475,6 +641,122 @@ export interface WithVolumeOptions { isReadOnly?: boolean; } +export interface WithYarnOptions { + install?: boolean; + installArgs?: string[]; +} + +// ============================================================================ +// AfterResourcesCreatedEvent +// ============================================================================ + +/** + * Type class for AfterResourcesCreatedEvent. + */ +export class AfterResourcesCreatedEvent { + constructor(private _handle: AfterResourcesCreatedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeResourceStartedEvent +// ============================================================================ + +/** + * Type class for BeforeResourceStartedEvent. + */ +export class BeforeResourceStartedEvent { + constructor(private _handle: BeforeResourceStartedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeStartEvent +// ============================================================================ + +/** + * Type class for BeforeStartEvent. + */ +export class BeforeStartEvent { + constructor(private _handle: BeforeStartEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + // ============================================================================ // CommandLineArgsCallbackContext // ============================================================================ @@ -504,11 +786,12 @@ export class CommandLineArgsCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, }; @@ -523,6 +806,65 @@ export class CommandLineArgsCallbackContext { }, }; + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ConnectionStringAvailableEvent +// ============================================================================ + +/** + * Type class for ConnectionStringAvailableEvent. + */ +export class ConnectionStringAvailableEvent { + constructor(private _handle: ConnectionStringAvailableEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + } // ============================================================================ @@ -540,9 +882,9 @@ export class DistributedApplication { /** Runs the distributed application */ /** @internal */ - async _runInternal(cancellationToken?: AbortSignal): Promise { + async _runInternal(cancellationToken?: AbortSignal | CancellationToken): Promise { const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); await this._client.invokeCapability( 'Aspire.Hosting/run', rpcArgs @@ -616,6 +958,17 @@ export class DistributedApplicationExecutionContext { }, }; + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the IsPublishMode property */ isPublishMode = { get: async (): Promise => { @@ -638,6 +991,70 @@ export class DistributedApplicationExecutionContext { } +// ============================================================================ +// DistributedApplicationModel +// ============================================================================ + +/** + * Type class for DistributedApplicationModel. + */ +export class DistributedApplicationModel { + constructor(private _handle: DistributedApplicationModelHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets resources from the distributed application model */ + async getResources(): Promise { + const rpcArgs: Record = { model: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResources', + rpcArgs + ); + } + + /** Finds a resource by name */ + /** @internal */ + async _findResourceByNameInternal(name: string): Promise { + const rpcArgs: Record = { model: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/findResourceByName', + rpcArgs + ); + return new Resource(result, this._client); + } + + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._findResourceByNameInternal(name)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationModel that enables fluent chaining. + */ +export class DistributedApplicationModelPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationModel) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets resources from the distributed application model */ + getResources(): Promise { + return this._promise.then(obj => obj.getResources()); + } + + /** Finds a resource by name */ + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.findResourceByName(name))); + } + +} + // ============================================================================ // EndpointReference // ============================================================================ @@ -651,6 +1068,17 @@ export class EndpointReference { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.resource', + { context: this._handle } + ); + return new ResourceWithEndpoints(handle, this._client); + }, + }; + /** Gets the EndpointName property */ endpointName = { get: async (): Promise => { @@ -717,6 +1145,16 @@ export class EndpointReference { }, }; + /** Gets the TlsEnabled property */ + tlsEnabled = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.tlsEnabled', + { context: this._handle } + ); + }, + }; + /** Gets the Port property */ port = { get: async (): Promise => { @@ -771,13 +1209,22 @@ export class EndpointReference { async getValueAsync(options?: GetValueAsyncOptions): Promise { const cancellationToken = options?.cancellationToken; const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); return await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/getValueAsync', rpcArgs ); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + async getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + const rpcArgs: Record = { context: this._handle, enabledValue, disabledValue }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.getTlsValue', + rpcArgs + ); + } + } /** @@ -798,6 +1245,11 @@ export class EndpointReferencePromise implements PromiseLike return this._promise.then(obj => obj.getValueAsync(options)); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + return this._promise.then(obj => obj.getTlsValue(enabledValue, disabledValue)); + } + } // ============================================================================ @@ -875,11 +1327,34 @@ export class EnvironmentCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; @@ -909,6 +1384,17 @@ export class ExecuteCommandContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the ResourceName property */ resourceName = { get: async (): Promise => { @@ -927,16 +1413,17 @@ export class ExecuteCommandContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, - set: async (value: AbortSignal): Promise => { + set: async (value: AbortSignal | CancellationToken): Promise => { await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', - { context: this._handle, value } + { context: this._handle, value: CancellationToken.fromValue(value) } ); } }; @@ -944,34 +1431,126 @@ export class ExecuteCommandContext { } // ============================================================================ -// PipelineConfigurationContext +// InitializeResourceEvent // ============================================================================ /** - * Type class for PipelineConfigurationContext. + * Type class for InitializeResourceEvent. */ -export class PipelineConfigurationContext { - constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} +export class InitializeResourceEvent { + constructor(private _handle: InitializeResourceEventHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the Steps property */ - steps = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.resource', { context: this._handle } ); + return new Resource(handle, this._client); }, - set: async (value: PipelineStep[]): Promise => { - await this._client.invokeCapability( + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Notifications property */ + notifications = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.notifications', + { context: this._handle } + ); + return new ResourceNotificationService(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + { context: this._handle } + ); + }, + set: async (value: PipelineStep[]): Promise => { + await this._client.invokeCapability( 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', { context: this._handle, value } ); } }; + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + /** Gets pipeline steps with the specified tag */ async getStepsByTag(tag: string): Promise { const rpcArgs: Record = { context: this._handle, tag }; @@ -1003,6 +1582,93 @@ export class PipelineConfigurationContextPromise implements PromiseLike => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + set: async (value: AbortSignal | CancellationToken): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.setCancellationToken', + { context: this._handle, value: CancellationToken.fromValue(value) } + ); + } + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + // ============================================================================ // PipelineStep // ============================================================================ @@ -1090,6 +1756,17 @@ export class PipelineStep { return this._tags; } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + /** Adds a dependency on another step by name */ /** @internal */ async _dependsOnInternal(stepName: string): Promise { @@ -1160,6 +1837,39 @@ export class PipelineStepContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the ReportingStep property */ + reportingStep = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.reportingStep', + { context: this._handle } + ); + return new ReportingStep(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + /** Gets the ExecutionContext property */ executionContext = { get: async (): Promise => { @@ -1171,18 +1881,159 @@ export class PipelineStepContext { }, }; + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineStepFactoryContext +// ============================================================================ + +/** + * Type class for PipelineStepFactoryContext. + */ +export class PipelineStepFactoryContext { + constructor(private _handle: PipelineStepFactoryContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; } +// ============================================================================ +// PipelineSummary +// ============================================================================ + +/** + * Type class for PipelineSummary. + */ +export class PipelineSummary { + constructor(private _handle: PipelineSummaryHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Add method */ + /** @internal */ + async _addInternal(key: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, key, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineSummary.add', + rpcArgs + ); + return this; + } + + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addInternal(key, value)); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + /** @internal */ + async _addMarkdownInternal(key: string, markdownString: string): Promise { + const rpcArgs: Record = { summary: this._handle, key, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/addMarkdown', + rpcArgs + ); + return this; + } + + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addMarkdownInternal(key, markdownString)); + } + +} + +/** + * Thenable wrapper for PipelineSummary that enables fluent chaining. + */ +export class PipelineSummaryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineSummary) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Add method */ + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.add(key, value))); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.addMarkdown(key, markdownString))); + } + +} + // ============================================================================ // ProjectResourceOptions // ============================================================================ @@ -1365,3794 +2216,3932 @@ export class ReferenceExpressionBuilderPromise implements PromiseLike; - get urls(): AspireList { - if (!this._urls) { - this._urls = new AspireList( - this._handle, - this._client, - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' - ); - } - return this._urls; - } - - /** Gets the CancellationToken property */ - cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.resource', { context: this._handle } ); + return new Resource(handle, this._client); }, }; - /** Gets the ExecutionContext property */ - executionContext = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.services', { context: this._handle } ); - return new DistributedApplicationExecutionContext(handle, this._client); + return new ServiceProvider(handle, this._client); }, }; } // ============================================================================ -// DistributedApplicationBuilder +// ResourceLoggerService // ============================================================================ /** - * Type class for DistributedApplicationBuilder. + * Type class for ResourceLoggerService. */ -export class DistributedApplicationBuilder { - constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} +export class ResourceLoggerService { + constructor(private _handle: ResourceLoggerServiceHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the AppHostDirectory property */ - appHostDirectory = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', - { context: this._handle } - ); - }, - }; - - /** Gets the Eventing property */ - eventing = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', - { context: this._handle } - ); - return new DistributedApplicationEventing(handle, this._client); - }, - }; - - /** Gets the ExecutionContext property */ - executionContext = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', - { context: this._handle } - ); - return new DistributedApplicationExecutionContext(handle, this._client); - }, - }; - - /** Builds the distributed application */ - /** @internal */ - async _buildInternal(): Promise { - const rpcArgs: Record = { context: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/build', - rpcArgs - ); - return new DistributedApplication(result, this._client); - } - - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._buildInternal()); - } - - /** Adds a connection string with a builder callback */ - /** @internal */ - async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { - const connectionStringBuilderId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; - const obj = new ReferenceExpressionBuilder(objHandle, this._client); - await connectionStringBuilder(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionStringBuilder', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } - - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); - } - - /** Adds a container registry resource */ + /** Completes the log stream for a resource */ /** @internal */ - async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpoint }; - if (repository !== undefined) rpcArgs.repository = repository; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainerRegistry', + async _completeLogInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { loggerService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLog', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - const repository = options?.repository; - return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogInternal(resource)); } - /** Adds a container resource */ + /** Completes the log stream by resource name */ /** @internal */ - async _addContainerInternal(name: string, image: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, image }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainer', + async _completeLogByNameInternal(resourceName: string): Promise { + const rpcArgs: Record = { loggerService: this._handle, resourceName }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLogByName', rpcArgs ); - return new ContainerResource(result, this._client); - } - - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._addContainerInternal(name, image)); + return this; } - /** Adds a container resource built from a Dockerfile */ - /** @internal */ - async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDockerfile', - rpcArgs - ); - return new ContainerResource(result, this._client); + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogByNameInternal(resourceName)); } - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); - } +} - /** Adds a .NET tool resource */ - /** @internal */ - async _addDotnetToolInternal(name: string, packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDotnetTool', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } +/** + * Thenable wrapper for ResourceLoggerService that enables fluent chaining. + */ +export class ResourceLoggerServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + then( + onfulfilled?: ((value: ResourceLoggerService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds an executable resource */ - /** @internal */ - async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExecutable', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Completes the log stream for a resource */ + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLog(resource))); } - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + /** Completes the log stream by resource name */ + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLogByName(resourceName))); } - /** Adds an external service resource */ - /** @internal */ - async _addExternalServiceInternal(name: string, url: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, url }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExternalService', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } +} - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); - } +// ============================================================================ +// ResourceNotificationService +// ============================================================================ - /** Adds a parameter resource */ - /** @internal */ - async _addParameterInternal(name: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameter', - rpcArgs - ); - return new ParameterResource(result, this._client); - } +/** + * Type class for ResourceNotificationService. + */ +export class ResourceNotificationService { + constructor(private _handle: ResourceNotificationServiceHandle, private _client: AspireClientRpc) {} - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterInternal(name, secret)); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Adds a parameter sourced from configuration */ + /** Waits for a resource to reach a specified state */ /** @internal */ - async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name, configurationKey }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameterFromConfiguration', + async _waitForResourceStateInternal(resourceName: string, targetState?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + if (targetState !== undefined) rpcArgs.targetState = targetState; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceState', rpcArgs ); - return new ParameterResource(result, this._client); + return this; } - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + const targetState = options?.targetState; + return new ResourceNotificationServicePromise(this._waitForResourceStateInternal(resourceName, targetState)); } - /** Adds a connection string resource */ - /** @internal */ - async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionString', + /** Waits for a resource to reach one of the specified states */ + async waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName, targetStates }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStates', rpcArgs ); - return new ResourceWithConnectionString(result, this._client); - } - - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - const environmentVariableName = options?.environmentVariableName; - return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); } - /** Adds a .NET project resource */ - /** @internal */ - async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProject', + /** Waits for a resource to become healthy */ + async waitForResourceHealthy(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceHealthy', rpcArgs ); - return new ProjectResource(result, this._client); - } - - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); } - /** Adds a project resource with configuration options */ + /** Waits for all dependencies of a resource to be ready */ /** @internal */ - async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProjectWithOptions', + async _waitForDependenciesInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForDependencies', rpcArgs ); - return new ProjectResource(result, this._client); + return this; } - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._waitForDependenciesInternal(resource)); } - /** Adds a C# application resource */ - /** @internal */ - async _addCSharpAppInternal(name: string, path: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, path }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpApp', + /** Tries to get the current state of a resource */ + async tryGetResourceState(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/tryGetResourceState', rpcArgs ); - return new ProjectResource(result, this._client); - } - - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); } - /** Adds a C# application resource with configuration options */ + /** Publishes an update for a resource's state */ /** @internal */ - async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpAppWithOptions', + async _publishResourceUpdateInternal(resource: ResourceBuilderBase, state?: string, stateStyle?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + if (state !== undefined) rpcArgs.state = state; + if (stateStyle !== undefined) rpcArgs.stateStyle = stateStyle; + await this._client.invokeCapability( + 'Aspire.Hosting/publishResourceUpdate', rpcArgs ); - return new CSharpAppResource(result, this._client); + return this; } - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + const state = options?.state; + const stateStyle = options?.stateStyle; + return new ResourceNotificationServicePromise(this._publishResourceUpdateInternal(resource, state, stateStyle)); } } /** - * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + * Thenable wrapper for ResourceNotificationService that enables fluent chaining. */ -export class DistributedApplicationBuilderPromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ResourceNotificationServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ResourceNotificationService) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Builds the distributed application */ - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); + /** Waits for a resource to reach a specified state */ + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForResourceState(resourceName, options))); } - /** Adds a connection string with a builder callback */ - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + /** Waits for a resource to reach one of the specified states */ + waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + return this._promise.then(obj => obj.waitForResourceStates(resourceName, targetStates)); } - /** Adds a container registry resource */ - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + /** Waits for a resource to become healthy */ + waitForResourceHealthy(resourceName: string): Promise { + return this._promise.then(obj => obj.waitForResourceHealthy(resourceName)); } - /** Adds a container resource */ - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + /** Waits for all dependencies of a resource to be ready */ + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForDependencies(resource))); } - /** Adds a container resource built from a Dockerfile */ - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + /** Tries to get the current state of a resource */ + tryGetResourceState(resourceName: string): Promise { + return this._promise.then(obj => obj.tryGetResourceState(resourceName)); } - /** Adds a .NET tool resource */ - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + /** Publishes an update for a resource's state */ + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.publishResourceUpdate(resource, options))); } - /** Adds an executable resource */ - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); - } +} - /** Adds an external service resource */ - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); - } +// ============================================================================ +// ResourceReadyEvent +// ============================================================================ - /** Adds a parameter resource */ - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); - } +/** + * Type class for ResourceReadyEvent. + */ +export class ResourceReadyEvent { + constructor(private _handle: ResourceReadyEventHandle, private _client: AspireClientRpc) {} - /** Adds a parameter sourced from configuration */ - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Adds a connection string resource */ - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); - } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; - /** Adds a .NET project resource */ - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); - } + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; - /** Adds a project resource with configuration options */ - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); - } +} - /** Adds a C# application resource */ - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); - } +// ============================================================================ +// ResourceStoppedEvent +// ============================================================================ - /** Adds a C# application resource with configuration options */ - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); - } +/** + * Type class for ResourceStoppedEvent. + */ +export class ResourceStoppedEvent { + constructor(private _handle: ResourceStoppedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; } // ============================================================================ -// DistributedApplicationEventing +// ResourceUrlsCallbackContext // ============================================================================ /** - * Type class for DistributedApplicationEventing. + * Type class for ResourceUrlsCallbackContext. */ -export class DistributedApplicationEventing { - constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Invokes the Unsubscribe method */ - /** @internal */ - async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { - const rpcArgs: Record = { context: this._handle, subscription }; - await this._client.invokeCapability( - 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', - rpcArgs - ); - return this; - } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; } + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + } +// ============================================================================ +// UpdateCommandStateContext +// ============================================================================ + /** - * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + * Type class for UpdateCommandStateContext. */ -export class DistributedApplicationEventingPromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class UpdateCommandStateContext { + constructor(private _handle: UpdateCommandStateContextHandle, private _client: AspireClientRpc) {} - then( - onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Invokes the Unsubscribe method */ - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); - } + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/UpdateCommandStateContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; } // ============================================================================ -// ConnectionStringResource +// Configuration // ============================================================================ -export class ConnectionStringResource extends ResourceBuilderBase { - constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { - super(handle, client); - } +/** + * Type class for Configuration. + */ +export class Configuration { + constructor(private _handle: IConfigurationHandle, private _client: AspireClientRpc) {} - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets a configuration value by key */ + async getConfigValue(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConfigValue', rpcArgs ); - return new ConnectionStringResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + /** Gets a connection string by name */ + async getConnectionString(name: string): Promise { + const rpcArgs: Record = { configuration: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionString', + rpcArgs + ); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + /** Gets a configuration section by key */ + async getSection(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getSection', rpcArgs ); - return new ConnectionStringResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Gets child configuration sections */ + async getChildren(): Promise { + const rpcArgs: Record = { configuration: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getChildren', + rpcArgs + ); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + /** Checks whether a configuration section exists */ + async exists(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/exists', rpcArgs ); - return new ConnectionStringResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { - const helpLink = options?.helpLink; - return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } +} - /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); +/** + * Thenable wrapper for Configuration that enables fluent chaining. + */ +export class ConfigurationPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Configuration) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Gets a configuration value by key */ + getConfigValue(key: string): Promise { + return this._promise.then(obj => obj.getConfigValue(key)); } - /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); + /** Gets a connection string by name */ + getConnectionString(name: string): Promise { + return this._promise.then(obj => obj.getConnectionString(name)); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Gets a configuration section by key */ + getSection(key: string): Promise { + return this._promise.then(obj => obj.getSection(key)); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); + /** Gets child configuration sections */ + getChildren(): Promise { + return this._promise.then(obj => obj.getChildren()); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Checks whether a configuration section exists */ + exists(key: string): Promise { + return this._promise.then(obj => obj.exists(key)); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } +} - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); - } +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Environment property */ + environment = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.environment', + { context: this._handle } + ); + return new HostEnvironment(handle, this._client); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the UserSecretsManager property */ + userSecretsManager = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.userSecretsManager', + { context: this._handle } + ); + return new UserSecretsManager(handle, this._client); + }, + }; + /** Builds the distributed application */ /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DistributedApplication(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { - const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); } + /** Adds a connection string with a reference expression */ /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; + async _addConnectionStringExpressionInternal(name: string, connectionStringExpression: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, connectionStringExpression }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + 'Aspire.Hosting/addConnectionStringExpression', rpcArgs ); return new ConnectionStringResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { - const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringExpressionInternal(name, connectionStringExpression)); } + /** Adds a connection string with a builder callback */ /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + 'Aspire.Hosting/addConnectionStringBuilder', rpcArgs ); return new ConnectionStringResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); } + /** Adds a container registry resource */ /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); } + /** Adds a container registry with string endpoint */ /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + async _addContainerRegistryFromStringInternal(name: string, endpoint: string, repository?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistryFromString', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryFromStringInternal(name, endpoint, repository)); } + /** Adds a container resource */ /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); } + /** Adds a container resource built from a Dockerfile */ /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); } + /** Adds a .NET tool resource */ /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); } + /** Adds an executable resource */ /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); } + /** Adds an external service resource */ /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - const exitCode = options?.exitCode; - return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); } + /** Adds an external service with a URI */ /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + async _addExternalServiceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceUri', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceUriInternal(name, uri)); } + /** Adds an external service with a parameter URL */ /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + async _addExternalServiceParameterInternal(name: string, urlParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, urlParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceParameter', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { - const commandOptions = options?.commandOptions; - return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceParameterInternal(name, urlParameter)); } + /** Adds a parameter resource */ /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); } + /** Adds a parameter with a default value */ /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + async _addParameterWithValueInternal(name: string, value: string, publishValueAsDefault?: boolean, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + if (publishValueAsDefault !== undefined) rpcArgs.publishValueAsDefault = publishValueAsDefault; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterWithValue', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + const publishValueAsDefault = options?.publishValueAsDefault; + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterWithValueInternal(name, value, publishValueAsDefault, secret)); } + /** Adds a parameter sourced from configuration */ /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { - const iconVariant = options?.iconVariant; - return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); } + /** Adds a connection string resource */ /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ResourceWithConnectionString(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); } + /** Adds a .NET project resource */ /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); } + /** Adds a project resource with configuration options */ /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + } + + /** Adds a C# application resource */ + /** @internal */ + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); } + /** Adds a C# application resource with configuration options */ /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); } + /** Gets the application configuration */ /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + async _getConfigurationInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getConfiguration', + rpcArgs + ); + return new Configuration(result, this._client); + } + + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._getConfigurationInternal()); + } + + /** Subscribes to the BeforeStart event */ + async subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as BeforeStartEventHandle; + const arg = new BeforeStartEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeBeforeStart', rpcArgs ); - return new ConnectionStringResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Subscribes to the AfterResourcesCreated event */ + async subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as AfterResourcesCreatedEventHandle; + const arg = new AfterResourcesCreatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeAfterResourcesCreated', + rpcArgs + ); } + /** Adds a Node.js application resource */ /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + async _addNodeAppInternal(name: string, appDirectory: string, scriptPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory, scriptPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addNodeApp', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._addNodeAppInternal(name, appDirectory, scriptPath)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** Adds a JavaScript application resource */ + /** @internal */ + async _addJavaScriptAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addJavaScriptApp', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + const runScriptName = options?.runScriptName; + return new JavaScriptAppResourcePromise(this._addJavaScriptAppInternal(name, appDirectory, runScriptName)); + } + + /** Adds a Vite application resource */ + /** @internal */ + async _addViteAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addViteApp', rpcArgs ); + return new ViteAppResource(result, this._client); + } + + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + const runScriptName = options?.runScriptName; + return new ViteAppResourcePromise(this._addViteAppInternal(name, appDirectory, runScriptName)); } } /** - * Thenable wrapper for ConnectionStringResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. */ -export class ConnectionStringResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds a connection string with a reference expression */ + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringExpression(name, connectionStringExpression))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + /** Adds a container registry with string endpoint */ + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistryFromString(name, endpoint, options))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Adds an external service with a URI */ + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceUri(name, uri))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Adds an external service with a parameter URL */ + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceParameter(name, urlParameter))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Adds a parameter with a default value */ + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterWithValue(name, value, options))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Gets the application configuration */ + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._promise.then(obj => obj.getConfiguration())); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Subscribes to the BeforeStart event */ + subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeBeforeStart(callback)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Subscribes to the AfterResourcesCreated event */ + subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeAfterResourcesCreated(callback)); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds a Node.js application resource */ + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.addNodeApp(name, appDirectory, scriptPath))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Adds a JavaScript application resource */ + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.addJavaScriptApp(name, appDirectory, options))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds a Vite application resource */ + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.addViteApp(name, appDirectory, options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); +} + +// ============================================================================ +// DistributedApplicationEventing +// ============================================================================ + +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Unsubscribe method */ + /** @internal */ + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + rpcArgs + ); + return this; } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); } } // ============================================================================ -// ContainerRegistryResource +// HostEnvironment // ============================================================================ -export class ContainerRegistryResource extends ResourceBuilderBase { - constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { - super(handle, client); +/** + * Type class for HostEnvironment. + */ +export class HostEnvironment { + constructor(private _handle: IHostEnvironmentHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Checks if running in Development environment */ + async isDevelopment(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isDevelopment', + rpcArgs + ); } - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + /** Checks if running in Production environment */ + async isProduction(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isProduction', rpcArgs ); - return new ContainerRegistryResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + /** Checks if running in Staging environment */ + async isStaging(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isStaging', + rpcArgs + ); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + /** Checks if the environment matches the specified name */ + async isEnvironment(environmentName: string): Promise { + const rpcArgs: Record = { environment: this._handle, environmentName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isEnvironment', rpcArgs ); - return new ContainerRegistryResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); +} + +/** + * Thenable wrapper for HostEnvironment that enables fluent chaining. + */ +export class HostEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: HostEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Checks if running in Development environment */ + isDevelopment(): Promise { + return this._promise.then(obj => obj.isDevelopment()); } + /** Checks if running in Production environment */ + isProduction(): Promise { + return this._promise.then(obj => obj.isProduction()); + } + + /** Checks if running in Staging environment */ + isStaging(): Promise { + return this._promise.then(obj => obj.isStaging()); + } + + /** Checks if the environment matches the specified name */ + isEnvironment(environmentName: string): Promise { + return this._promise.then(obj => obj.isEnvironment(environmentName)); + } + +} + +// ============================================================================ +// Logger +// ============================================================================ + +/** + * Type class for Logger. + */ +export class Logger { + constructor(private _handle: ILoggerHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Logs an information message */ /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + async _logInformationInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logInformation', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { - const helpLink = options?.helpLink; - return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._logInformationInternal(message)); } + /** Logs a warning message */ /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + async _logWarningInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logWarning', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._logWarningInternal(message)); } + /** Logs an error message */ /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + async _logErrorInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logError', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + logError(message: string): LoggerPromise { + return new LoggerPromise(this._logErrorInternal(message)); } + /** Logs a debug message */ /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + async _logDebugInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logDebug', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { - const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._logDebugInternal(message)); } + /** Logs a message with specified level */ /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + async _logInternal(level: string, message: string): Promise { + const rpcArgs: Record = { logger: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/log', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { - const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._logInternal(level, message)); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } +} - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); - } +/** + * Thenable wrapper for Logger that enables fluent chaining. + */ +export class LoggerPromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + then( + onfulfilled?: ((value: Logger) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + /** Logs an information message */ + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logInformation(message))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Logs a warning message */ + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logWarning(message))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + /** Logs an error message */ + logError(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logError(message))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Logs a debug message */ + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logDebug(message))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + /** Logs a message with specified level */ + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.log(level, message))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } +} - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); - } +// ============================================================================ +// LoggerFactory +// ============================================================================ - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } +/** + * Type class for LoggerFactory. + */ +export class LoggerFactory { + constructor(private _handle: ILoggerFactoryHandle, private _client: AspireClientRpc) {} - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Creates a logger for a category */ /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + async _createLoggerInternal(categoryName: string): Promise { + const rpcArgs: Record = { loggerFactory: this._handle, categoryName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createLogger', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new Logger(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._createLoggerInternal(categoryName)); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); +} + +/** + * Thenable wrapper for LoggerFactory that enables fluent chaining. + */ +export class LoggerFactoryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: LoggerFactory) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Creates a logger for a category */ + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.createLogger(categoryName))); } +} + +// ============================================================================ +// ReportingStep +// ============================================================================ + +/** + * Type class for ReportingStep. + */ +export class ReportingStep { + constructor(private _handle: IReportingStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Creates a reporting task with plain-text status text */ /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + async _createTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createTask', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ReportingTask(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createTaskInternal(statusText, cancellationToken)); } + /** Creates a reporting task with Markdown-formatted status text */ /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + async _createMarkdownTaskInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createMarkdownTask', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ReportingTask(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createMarkdownTaskInternal(markdownString, cancellationToken)); } + /** Logs a plain-text message for the reporting step */ /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + async _logStepInternal(level: string, message: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStep', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepInternal(level, message)); } + /** Logs a Markdown-formatted message for the reporting step */ /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + async _logStepMarkdownInternal(level: string, markdownString: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStepMarkdown', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepMarkdownInternal(level, markdownString)); } + /** Completes the reporting step with plain-text completion text */ /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + async _completeStepInternal(completionText: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, completionText }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStep', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepInternal(completionText, completionState, cancellationToken)); } + /** Completes the reporting step with Markdown-formatted completion text */ /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + async _completeStepMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStepMarkdown', rpcArgs ); - return new ContainerRegistryResource(result, this._client); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + return this; } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepMarkdownInternal(markdownString, completionState, cancellationToken)); } } /** - * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); + * Thenable wrapper for ReportingStep that enables fluent chaining. */ -export class ContainerRegistryResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ReportingStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ReportingStep) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Creates a reporting task with plain-text status text */ + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createTask(statusText, options))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Creates a reporting task with Markdown-formatted status text */ + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createMarkdownTask(markdownString, options))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Logs a plain-text message for the reporting step */ + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStep(level, message))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Logs a Markdown-formatted message for the reporting step */ + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStepMarkdown(level, markdownString))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Completes the reporting step with plain-text completion text */ + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStep(completionText, options))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Completes the reporting step with Markdown-formatted completion text */ + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStepMarkdown(markdownString, options))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } +} - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } +// ============================================================================ +// ReportingTask +// ============================================================================ - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); +/** + * Type class for ReportingTask. + */ +export class ReportingTask { + constructor(private _handle: IReportingTaskHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Updates the reporting task with plain-text status text */ + /** @internal */ + async _updateTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTask', + rpcArgs + ); + return this; } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskInternal(statusText, cancellationToken)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Updates the reporting task with Markdown-formatted status text */ + /** @internal */ + async _updateTaskMarkdownInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTaskMarkdown', + rpcArgs + ); + return this; } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskMarkdownInternal(markdownString, cancellationToken)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Completes the reporting task with plain-text completion text */ + /** @internal */ + async _completeTaskInternal(completionMessage?: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle }; + if (completionMessage !== undefined) rpcArgs.completionMessage = completionMessage; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTask', + rpcArgs + ); + return this; } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + const completionMessage = options?.completionMessage; + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskInternal(completionMessage, completionState, cancellationToken)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Completes the reporting task with Markdown-formatted completion text */ + /** @internal */ + async _completeTaskMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTaskMarkdown', + rpcArgs + ); + return this; } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskMarkdownInternal(markdownString, completionState, cancellationToken)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); +} + +/** + * Thenable wrapper for ReportingTask that enables fluent chaining. + */ +export class ReportingTaskPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReportingTask) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Updates the reporting task with plain-text status text */ + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTask(statusText, options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Updates the reporting task with Markdown-formatted status text */ + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTaskMarkdown(markdownString, options))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Completes the reporting task with plain-text completion text */ + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTask(options))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Completes the reporting task with Markdown-formatted completion text */ + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTaskMarkdown(markdownString, options))); } } // ============================================================================ -// ContainerResource +// ServiceProvider // ============================================================================ -export class ContainerResource extends ResourceBuilderBase { - constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { - super(handle, client); - } +/** + * Type class for ServiceProvider. + */ +export class ServiceProvider { + constructor(private _handle: IServiceProviderHandle, private _client: AspireClientRpc) {} + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the distributed application eventing service from the service provider */ /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + async _getEventingInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getEventing', rpcArgs ); - return new ContainerResource(result, this._client); + return new DistributedApplicationEventing(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._getEventingInternal()); } + /** Gets the logger factory from the service provider */ /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + async _getLoggerFactoryInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getLoggerFactory', rpcArgs ); - return new ContainerResource(result, this._client); + return new LoggerFactory(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._getLoggerFactoryInternal()); } + /** Gets the resource logger service from the service provider */ /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + async _getResourceLoggerServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceLoggerService', rpcArgs ); - return new ContainerResource(result, this._client); + return new ResourceLoggerService(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._getResourceLoggerServiceInternal()); } + /** Gets the distributed application model from the service provider */ /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + async _getDistributedApplicationModelInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getDistributedApplicationModel', rpcArgs ); - return new ContainerResource(result, this._client); + return new DistributedApplicationModel(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageTagInternal(tag)); + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._getDistributedApplicationModelInternal()); } + /** Gets the resource notification service from the service provider */ /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + async _getResourceNotificationServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceNotificationService', rpcArgs ); - return new ContainerResource(result, this._client); + return new ResourceNotificationService(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._getResourceNotificationServiceInternal()); } + /** Gets the user secrets manager from the service provider */ /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + async _getUserSecretsManagerInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getUserSecretsManager', rpcArgs ); - return new ContainerResource(result, this._client); + return new UserSecretsManager(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - const tag = options?.tag; - return new ContainerResourcePromise(this._withImageInternal(image, tag)); + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getUserSecretsManagerInternal()); } - /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', - rpcArgs - ); - return new ContainerResource(result, this._client); - } +} - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); - } +/** + * Thenable wrapper for ServiceProvider that enables fluent chaining. + */ +export class ServiceProviderPromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', - rpcArgs - ); - return new ContainerResource(result, this._client); + then( + onfulfilled?: ((value: ServiceProvider) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Gets the distributed application eventing service from the service provider */ + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.getEventing())); } - /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets the logger factory from the service provider */ + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._promise.then(obj => obj.getLoggerFactory())); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + /** Gets the resource logger service from the service provider */ + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.getResourceLoggerService())); } - /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets the distributed application model from the service provider */ + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._promise.then(obj => obj.getDistributedApplicationModel())); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Gets the resource notification service from the service provider */ + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.getResourceNotificationService())); } - /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets the user secrets manager from the service provider */ + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getUserSecretsManager())); } - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsContainerInternal()); - } +} - /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', +// ============================================================================ +// UserSecretsManager +// ============================================================================ + +/** + * Type class for UserSecretsManager. + */ +export class UserSecretsManager { + constructor(private _handle: IUserSecretsManagerHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the IsAvailable property */ + isAvailable = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.isAvailable', + { context: this._handle } + ); + }, + }; + + /** Gets the FilePath property */ + filePath = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.filePath', + { context: this._handle } + ); + }, + }; + + /** Attempts to set a user secret value */ + async trySetSecret(name: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, name, value }; + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.trySetSecret', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } + /** Saves state to user secrets from a JSON string */ /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', + async _saveStateJsonInternal(json: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, json }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/saveStateJson', rpcArgs ); - return new ContainerResource(result, this._client); + return this; } - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNameInternal(name)); + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + const cancellationToken = options?.cancellationToken; + return new UserSecretsManagerPromise(this._saveStateJsonInternal(json, cancellationToken)); } + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + async _getOrSetSecretInternal(resourceBuilder: ResourceBuilderBase, name: string, value: string): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, resourceBuilder, name, value }; + await this._client.invokeCapability( + 'Aspire.Hosting/getOrSetSecret', rpcArgs ); - return new ContainerResource(result, this._client); + return this; } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getOrSetSecretInternal(resourceBuilder, name, value)); } - /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', - rpcArgs - ); - return new ContainerResource(result, this._client); +} + +/** + * Thenable wrapper for UserSecretsManager that enables fluent chaining. + */ +export class UserSecretsManagerPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: UserSecretsManager) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + /** Attempts to set a user secret value */ + trySetSecret(name: string, value: string): Promise { + return this._promise.then(obj => obj.trySetSecret(name, value)); + } + + /** Saves state to user secrets from a JSON string */ + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.saveStateJson(json, options))); + } + + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getOrSetSecret(resourceBuilder, name, value))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterInternal()); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); } - /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - const helpLink = options?.helpLink; - return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsInternal(args)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); - } - - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onConnectionStringAvailableInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceReadyInternal(callback)); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new ContainerResource(result, this._client); +} + +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromManifestInternal()); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForInternal(dependency)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExplicitStartInternal()); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - const exitCode = options?.exitCode; - return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - const password = options?.password; - return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ContainerResource(result, this._client); - } +} - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ + +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromMcpInternal()); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); + return new ContainerRegistryResource(result, this._client); } -} - -/** - * Thenable wrapper for ContainerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ContainerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); } - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceReadyInternal(callback)); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); - } +} - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); - } +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); - } - - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); - } - - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); - } - - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); - } - - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } - - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } - - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); - } - - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); - } - - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); - } - - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } - - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); - } - - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); - } - - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); - } - - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); - } - - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } } // ============================================================================ -// CSharpAppResource +// ContainerResource // ============================================================================ -export class CSharpAppResource extends ResourceBuilderBase { - constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withReplicasInternal(replicas: number): Promise { - const rpcArgs: Record = { builder: this._handle, replicas }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReplicas', - rpcArgs - ); - return new CSharpAppResource(result, this._client); - } - - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); - } - - /** @internal */ - private async _disableForwardedHeadersInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/disableForwardedHeaders', + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - const helpLink = options?.helpLink; - return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsInternal(args)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -5162,15 +6151,15 @@ export class CSharpAppResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -5179,72 +6168,72 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -5257,293 +6246,278 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); - } - - /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', - rpcArgs - ); - return new CSharpAppResource(result, this._client); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { const exitCode = options?.exitCode; - return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -5551,130 +6525,130 @@ export class CSharpAppResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { const commandOptions = options?.commandOptions; - return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { const password = options?.password; - return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { const iconVariant = options?.iconVariant; - return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -5683,15 +6657,15 @@ export class CSharpAppResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -5699,56 +6673,56 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -5759,60 +6733,79 @@ export class CSharpAppResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); } /** Gets the resource name */ @@ -5824,161 +6817,316 @@ export class CSharpAppResource extends ResourceBuilderBase { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceReadyInternal(callback)); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } +} - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -5987,163 +7135,163 @@ export class CSharpAppResourcePromise implements PromiseLike } /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } /** Gets the resource name */ @@ -6151,538 +7299,397 @@ export class CSharpAppResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ -// DotnetToolResource +// CSharpAppResource // ============================================================================ -export class DotnetToolResource extends ResourceBuilderBase { - constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withToolPackageInternal(packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPackage', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withToolVersionInternal(version: string): Promise { - const rpcArgs: Record = { builder: this._handle, version }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolVersion', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withToolPrereleaseInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPrerelease', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withToolSourceInternal(source: string): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolSource', + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); } /** @internal */ - private async _withToolIgnoreExistingFeedsInternal(): Promise { + private async _disableForwardedHeadersInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreExistingFeeds', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); } /** @internal */ - private async _withToolIgnoreFailedSourcesInternal(): Promise { + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreFailedSources', + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + const configure = options?.configure; + return new CSharpAppResourcePromise(this._publishAsDockerFileInternal(configure)); } /** @internal */ - private async _publishAsDockerFileInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFile', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; - const obj = new ContainerResource(objHandle, this._client); - await configure(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFileWithConfigure', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withExecutableCommandInternal(command: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExecutableCommand', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { - const rpcArgs: Record = { builder: this._handle, workingDirectory }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withWorkingDirectory', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new DotnetToolResource(result, this._client); - } - - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); - } - - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - const helpLink = options?.helpLink; - return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } - - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); - } - - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); - } - - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); - } - - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); - } - - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); - } - - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -6692,15 +7699,15 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -6709,72 +7716,72 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -6787,278 +7794,293 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { const exitCode = options?.exitCode; - return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -7066,130 +8088,130 @@ export class DotnetToolResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { const commandOptions = options?.commandOptions; - return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { const password = options?.password; - return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { const iconVariant = options?.iconVariant; - return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -7198,15 +8220,15 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -7214,56 +8236,56 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -7274,60 +8296,60 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -7339,201 +8361,246 @@ export class DotnetToolResource extends ResourceBuilderBase { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceReadyInternal(callback)); } - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -7542,158 +8609,163 @@ export class DotnetToolResourcePromise implements PromiseLike obj.asHttp2Service())); + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -7701,383 +8773,500 @@ export class DotnetToolResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ -// ExecutableResource +// DotnetToolResource // ============================================================================ -export class ExecutableResource extends ResourceBuilderBase { - constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - const helpLink = options?.helpLink; - return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + const name = options?.name; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); - } - - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); - } - - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -8087,15 +9276,15 @@ export class ExecutableResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -8104,72 +9293,72 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -8182,278 +9371,278 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { const exitCode = options?.exitCode; - return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -8461,130 +9650,130 @@ export class ExecutableResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { const commandOptions = options?.commandOptions; - return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { const password = options?.password; - return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { const iconVariant = options?.iconVariant; - return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -8593,15 +9782,15 @@ export class ExecutableResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -8609,56 +9798,56 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -8669,60 +9858,60 @@ export class ExecutableResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -8734,151 +9923,281 @@ export class ExecutableResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** - * Thenable wrapper for ExecutableResource that enables fluent chaining. + * Thenable wrapper for DotnetToolResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ExecutableResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -8887,158 +10206,158 @@ export class ExecutableResourcePromise implements PromiseLike obj.asHttp2Service())); + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -9046,1081 +10365,7579 @@ export class ExecutableResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ -// ExternalServiceResource +// ExecutableResource // ============================================================================ -export class ExternalServiceResource extends ResourceBuilderBase { - constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceReadyInternal(callback)); + } + +} + +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceReadyInternal(callback)); + } + +} + +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// JavaScriptAppResource +// ============================================================================ + +export class JavaScriptAppResource extends ResourceBuilderBase { + constructor(handle: JavaScriptAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new JavaScriptAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + const helpLink = options?.helpLink; + return new JavaScriptAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new JavaScriptAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new JavaScriptAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new JavaScriptAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new JavaScriptAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + const displayText = options?.displayText; + return new JavaScriptAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + const displayText = options?.displayText; + return new JavaScriptAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + const exitCode = options?.exitCode; + return new JavaScriptAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + const commandOptions = options?.commandOptions; + return new JavaScriptAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + const password = options?.password; + return new JavaScriptAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + const iconVariant = options?.iconVariant; + return new JavaScriptAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new JavaScriptAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withYarnInternal(install, installArgs)); + } + + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withPnpmInternal(install, installArgs)); + } + + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withRunScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + const browser = options?.browser; + return new JavaScriptAppResourcePromise(this._withBrowserDebuggerInternal(browser)); + } + +} + +/** + * Thenable wrapper for JavaScriptAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class JavaScriptAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: JavaScriptAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + +} + +// ============================================================================ +// NodeAppResource +// ============================================================================ + +export class NodeAppResource extends ResourceBuilderBase { + constructor(handle: NodeAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new NodeAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + const helpLink = options?.helpLink; + return new NodeAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new NodeAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new NodeAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + const exitCode = options?.exitCode; + return new NodeAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + const commandOptions = options?.commandOptions; + return new NodeAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + const password = options?.password; + return new NodeAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + const iconVariant = options?.iconVariant; + return new NodeAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new NodeAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withYarnInternal(install, installArgs)); + } + + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withPnpmInternal(install, installArgs)); + } + + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withRunScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + const browser = options?.browser; + return new NodeAppResourcePromise(this._withBrowserDebuggerInternal(browser)); + } + +} + +/** + * Thenable wrapper for NodeAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class NodeAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: NodeAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceReadyInternal(callback)); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + const configure = options?.configure; + return new ProjectResourcePromise(this._publishAsDockerFileInternal(configure)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - const helpLink = options?.helpLink; - return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); - } - - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); - } - - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); - } - - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); - } - - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - const commandOptions = options?.commandOptions; - return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); - } - - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); - } - - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); - } - - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - const iconVariant = options?.iconVariant; - return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); - } - - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); + return new ProjectResource(result, this._client); } -} - -/** - * Thenable wrapper for ExternalServiceResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ExternalServiceResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); } -} + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } -// ============================================================================ -// ParameterResource -// ============================================================================ + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } -export class ParameterResource extends ResourceBuilderBase { - constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, description }; - if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDescription', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - const enableMarkdown = options?.enableMarkdown; - return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - const helpLink = options?.helpLink; - return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new ParameterResource(result, this._client); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromManifestInternal()); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._withExplicitStartInternal()); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - const commandOptions = options?.commandOptions; - return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceReadyInternal(callback)); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ParameterResource(result, this._client); +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - const iconVariant = options?.iconVariant; - return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromMcpInternal()); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } -} + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } -/** - * Thenable wrapper for ParameterResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ParameterResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } - then( - onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -10128,383 +17945,440 @@ export class ParameterResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ -// ProjectResource +// ViteAppResource // ============================================================================ -export class ProjectResource extends ResourceBuilderBase { - constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { +export class ViteAppResource extends ResourceBuilderBase { + constructor(handle: ViteAppResourceHandle, client: AspireClientRpc) { super(handle, client); } + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ViteAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _publishAsDockerFileInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterInternal()); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - const helpLink = options?.helpLink; - return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ViteAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { + const helpLink = options?.helpLink; + return new ViteAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ViteAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -10514,15 +18388,15 @@ export class ProjectResource extends ResourceBuilderBase if (isProxied !== undefined) rpcArgs.isProxied = isProxied; if (isExternal !== undefined) rpcArgs.isExternal = isExternal; if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -10531,72 +18405,72 @@ export class ProjectResource extends ResourceBuilderBase const isProxied = options?.isProxied; const isExternal = options?.isExternal; const protocol = options?.protocol; - return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + return new ViteAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -10609,293 +18483,308 @@ export class ProjectResource extends ResourceBuilderBase } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._clearContainerFilesSourcesInternal()); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { const exitCode = options?.exitCode; - return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ViteAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new ViteAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -10903,130 +18792,130 @@ export class ProjectResource extends ResourceBuilderBase }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { const commandOptions = options?.commandOptions; - return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ViteAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { const password = options?.password; - return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new ViteAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { const iconVariant = options?.iconVariant; - return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ViteAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -11035,15 +18924,15 @@ export class ProjectResource extends ResourceBuilderBase if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -11051,276 +18940,520 @@ export class ProjectResource extends ResourceBuilderBase const failureThreshold = options?.failureThreshold; const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new ViteAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ViteAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withViteConfigInternal(configPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, configPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withViteConfig', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withViteConfigInternal(configPath)); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withYarnInternal(install, installArgs)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withPnpmInternal(install, installArgs)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', rpcArgs ); + return new ViteAppResource(result, this._client); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + const browser = options?.browser; + return new ViteAppResourcePromise(this._withBrowserDebuggerInternal(browser)); } } /** - * Thenable wrapper for ProjectResource that enables fluent chaining. + * Thenable wrapper for ViteAppResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ProjectResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ViteAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ViteAppResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -11329,168 +19462,306 @@ export class ProjectResourcePromise implements PromiseLike { } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withViteConfig(configPath))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + +} + +// ============================================================================ +// ComputeResource +// ============================================================================ + +export class ComputeResource extends ResourceBuilderBase { + constructor(handle: IComputeResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); +} + +/** + * Thenable wrapper for ComputeResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ComputeResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ComputeResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } } @@ -11508,7 +19779,7 @@ export class ContainerFilesDestinationResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); return new ContainerFilesDestinationResource(result, this._client); @@ -11767,7 +20038,7 @@ export class Resource extends ResourceBuilderBase { private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new Resource(result, this._client); @@ -11782,7 +20053,7 @@ export class Resource extends ResourceBuilderBase { private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new Resource(result, this._client); @@ -11825,36 +20096,6 @@ export class Resource extends ResourceBuilderBase { return new ResourcePromise(this._excludeFromMcpInternal()); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -11932,6 +20173,86 @@ export class Resource extends ResourceBuilderBase { ); } + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -12029,16 +20350,6 @@ export class ResourcePromise implements PromiseLike { return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); @@ -12059,6 +20370,26 @@ export class ResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -12198,6 +20529,35 @@ export class ResourceWithConnectionString extends ResourceBuilderBase { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._onConnectionStringAvailableInternal(callback)); + } + } /** @@ -12225,6 +20585,16 @@ export class ResourceWithConnectionStringPromise implements PromiseLike obj.withConnectionPropertyValue(name, value))); } + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + } // ============================================================================ @@ -12513,6 +20883,26 @@ export class ResourceWithEndpoints extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + } /** @@ -12580,6 +20970,11 @@ export class ResourceWithEndpointsPromise implements PromiseLike obj.withHttpProbe(probeType, options))); } + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + } // ============================================================================ @@ -12622,41 +21017,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -12667,43 +21032,38 @@ export class ResourceWithEnvironment extends ResourceBuilderBase Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -12737,10 +21097,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -12752,37 +21113,8 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -12865,7 +21197,7 @@ export class ResourceWithEnvironment extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ResourceWithEnvironment(result, this._client); @@ -12919,31 +21251,21 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withOtlpExporterProtocol(protocol))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -12959,16 +21281,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -13006,34 +21318,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike { - constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { - super(handle, client); - } - -} - -/** - * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ResourceWithServiceDiscoveryPromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - -} - // ============================================================================ // ResourceWithWaitSupport // ============================================================================ @@ -13047,7 +21331,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -13077,7 +21361,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -13108,7 +21392,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -13227,7 +21511,7 @@ export async function createBuilder(options?: CreateBuilderOptions): Promise { const error = reason instanceof Error ? reason : new Error(String(reason)); - if (reason instanceof CapabilityError) { + if (reason instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else if (reason instanceof CapabilityError) { console.error(`\n❌ Capability Error: ${error.message}`); console.error(` Code: ${(reason as CapabilityError).code}`); if ((reason as CapabilityError).capability) { @@ -13258,8 +21544,12 @@ process.on('unhandledRejection', (reason: unknown) => { }); process.on('uncaughtException', (error: Error) => { - console.error(`\n❌ Uncaught Exception: ${error.message}`); - if (error.stack) { + if (error instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + } + if (!(error instanceof AppHostUsageError) && error.stack) { console.error(error.stack); } process.exit(1); @@ -13270,21 +21560,44 @@ process.on('uncaughtException', (error: Error) => { // ============================================================================ // Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent', (handle, client) => new AfterResourcesCreatedEvent(handle as AfterResourcesCreatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent', (handle, client) => new BeforeResourceStartedEvent(handle as BeforeResourceStartedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent', (handle, client) => new BeforeStartEvent(handle as BeforeStartEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent', (handle, client) => new ConnectionStringAvailableEvent(handle as ConnectionStringAvailableEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel', (handle, client) => new DistributedApplicationModel(handle as DistributedApplicationModelHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent', (handle, client) => new InitializeResourceEvent(handle as InitializeResourceEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext', (handle, client) => new PipelineContext(handle as PipelineContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext', (handle, client) => new PipelineStepFactoryContext(handle as PipelineStepFactoryContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary', (handle, client) => new PipelineSummary(handle as PipelineSummaryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent', (handle, client) => new ResourceEndpointsAllocatedEvent(handle as ResourceEndpointsAllocatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService', (handle, client) => new ResourceLoggerService(handle as ResourceLoggerServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService', (handle, client) => new ResourceNotificationService(handle as ResourceNotificationServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent', (handle, client) => new ResourceReadyEvent(handle as ResourceReadyEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent', (handle, client) => new ResourceStoppedEvent(handle as ResourceStoppedEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext', (handle, client) => new UpdateCommandStateContext(handle as UpdateCommandStateContextHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration', (handle, client) => new Configuration(handle as IConfigurationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment', (handle, client) => new HostEnvironment(handle as IHostEnvironmentHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger', (handle, client) => new Logger(handle as ILoggerHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory', (handle, client) => new LoggerFactory(handle as ILoggerFactoryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep', (handle, client) => new ReportingStep(handle as IReportingStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask', (handle, client) => new ReportingTask(handle as IReportingTaskHandle, client)); +registerHandleWrapper('System.ComponentModel/System.IServiceProvider', (handle, client) => new ServiceProvider(handle as IServiceProviderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IUserSecretsManager', (handle, client) => new UserSecretsManager(handle as IUserSecretsManagerHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); @@ -13292,8 +21605,12 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppR registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource', (handle, client) => new JavaScriptAppResource(handle as JavaScriptAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource', (handle, client) => new NodeAppResource(handle as NodeAppResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource', (handle, client) => new ViteAppResource(handle as ViteAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource', (handle, client) => new ComputeResource(handle as IComputeResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); @@ -13301,6 +21618,5 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceW registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); diff --git a/samples/container-build/ts/.modules/base.ts b/samples/container-build/ts/.modules/base.ts index 7778b0f1..b3d8b8be 100644 --- a/samples/container-build/ts/.modules/base.ts +++ b/samples/container-build/ts/.modules/base.ts @@ -1,8 +1,8 @@ -// aspire.ts - Core Aspire types: base classes, ReferenceExpression -import { Handle, AspireClient, MarshalledHandle } from './transport.js'; +// base.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle, CancellationToken, registerCancellation, registerHandleWrapper, unregisterCancellation } from './transport.js'; // Re-export transport types for convenience -export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export { Handle, AspireClient, CapabilityError, CancellationToken, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; @@ -43,22 +43,46 @@ export class ReferenceExpression { private readonly _format?: string; private readonly _valueProviders?: unknown[]; + // Conditional mode fields + private readonly _condition?: unknown; + private readonly _whenTrue?: ReferenceExpression; + private readonly _whenFalse?: ReferenceExpression; + private readonly _matchValue?: string; + // Handle mode fields (when wrapping a server-returned handle) private readonly _handle?: Handle; private readonly _client?: AspireClient; constructor(format: string, valueProviders: unknown[]); constructor(handle: Handle, client: AspireClient); - constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { - if (typeof handleOrFormat === 'string') { - this._format = handleOrFormat; - this._valueProviders = clientOrValueProviders as unknown[]; + constructor(condition: unknown, matchValue: string, whenTrue: ReferenceExpression, whenFalse: ReferenceExpression); + constructor( + handleOrFormatOrCondition: Handle | string | unknown, + clientOrValueProvidersOrMatchValue: AspireClient | unknown[] | string, + whenTrueOrWhenFalse?: ReferenceExpression, + whenFalse?: ReferenceExpression + ) { + if (typeof handleOrFormatOrCondition === 'string') { + this._format = handleOrFormatOrCondition; + this._valueProviders = clientOrValueProvidersOrMatchValue as unknown[]; + } else if (handleOrFormatOrCondition instanceof Handle) { + this._handle = handleOrFormatOrCondition; + this._client = clientOrValueProvidersOrMatchValue as AspireClient; } else { - this._handle = handleOrFormat; - this._client = clientOrValueProviders as AspireClient; + this._condition = handleOrFormatOrCondition; + this._matchValue = (clientOrValueProvidersOrMatchValue as string) ?? 'True'; + this._whenTrue = whenTrueOrWhenFalse; + this._whenFalse = whenFalse; } } + /** + * Gets whether this reference expression is conditional. + */ + get isConditional(): boolean { + return this._condition !== undefined; + } + /** * Creates a reference expression from a tagged template literal. * @@ -82,16 +106,46 @@ export class ReferenceExpression { return new ReferenceExpression(format, valueProviders); } + /** + * Creates a conditional reference expression from its constituent parts. + * + * @param condition - A value provider whose result is compared to matchValue + * @param whenTrue - The expression to use when the condition matches + * @param whenFalse - The expression to use when the condition does not match + * @param matchValue - The value to compare the condition against (defaults to "True") + * @returns A ReferenceExpression instance in conditional mode + */ + static createConditional( + condition: unknown, + matchValue: string, + whenTrue: ReferenceExpression, + whenFalse: ReferenceExpression + ): ReferenceExpression { + return new ReferenceExpression(condition, matchValue, whenTrue, whenFalse); + } + /** * Serializes the reference expression for JSON-RPC transport. - * In template-literal mode, uses the $expr format. + * In expression mode, uses the $expr format with format + valueProviders. + * In conditional mode, uses the $expr format with condition + whenTrue + whenFalse. * In handle mode, delegates to the handle's serialization. */ - toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } | { condition: unknown; whenTrue: unknown; whenFalse: unknown; matchValue: string } } | MarshalledHandle { if (this._handle) { return this._handle.toJSON(); } + if (this.isConditional) { + return { + $expr: { + condition: extractHandleForExpr(this._condition), + whenTrue: this._whenTrue!.toJSON(), + whenFalse: this._whenFalse!.toJSON(), + matchValue: this._matchValue! + } + }; + } + return { $expr: { format: this._format!, @@ -100,6 +154,30 @@ export class ReferenceExpression { }; } + /** + * Resolves the expression to its string value on the server. + * Only available on server-returned ReferenceExpression instances (handle mode). + * + * @param cancellationToken - Optional AbortSignal or CancellationToken for cancellation support + * @returns The resolved string value, or null if the expression resolves to null + */ + async getValue(cancellationToken?: AbortSignal | CancellationToken): Promise { + if (!this._handle || !this._client) { + throw new Error('getValue is only available on server-returned ReferenceExpression instances'); + } + const cancellationTokenId = registerCancellation(this._client, cancellationToken); + try { + const rpcArgs: Record = { context: this._handle }; + if (cancellationTokenId !== undefined) rpcArgs.cancellationToken = cancellationTokenId; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValue', + rpcArgs + ); + } finally { + unregisterCancellation(cancellationTokenId); + } + } + /** * String representation for debugging. */ @@ -107,10 +185,17 @@ export class ReferenceExpression { if (this._handle) { return `ReferenceExpression(handle)`; } + if (this.isConditional) { + return `ReferenceExpression(conditional)`; + } return `ReferenceExpression(${this._format})`; } } +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression', (handle, client) => + new ReferenceExpression(handle, client) +); + /** * Extracts a value for use in reference expressions. * Supports handles (objects) and string literals. @@ -136,15 +221,15 @@ function extractHandleForExpr(value: unknown): unknown { return value.toJSON(); } - // Objects with $handle property (already in handle format) - if (typeof value === 'object' && value !== null && '$handle' in value) { + // Objects with marshalled expression/handle payloads + if (typeof value === 'object' && value !== null && ('$handle' in value || '$expr' in value)) { return value; } - // Objects with toJSON that returns a handle + // Objects with toJSON that returns a marshalled expression or handle if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { const json = value.toJSON(); - if (json && typeof json === 'object' && '$handle' in json) { + if (json && typeof json === 'object' && ('$handle' in json || '$expr' in json)) { return json; } } @@ -307,11 +392,20 @@ export class AspireList { }) as T[]; } - toJSON(): MarshalledHandle { - if (this._resolvedHandle) { - return this._resolvedHandle.toJSON(); + async toTransportValue(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireList must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); } - return this._handleOrContext.toJSON(); + + return this._resolvedHandle.toJSON(); } } @@ -466,8 +560,19 @@ export class AspireDict { }) as Record; } - async toJSON(): Promise { + async toTransportValue(): Promise { const handle = await this._ensureHandle(); return handle.toJSON(); } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireDict must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); + } + + return this._resolvedHandle.toJSON(); + } } diff --git a/samples/container-build/ts/.modules/transport.ts b/samples/container-build/ts/.modules/transport.ts index 7bddd74b..6d29cf28 100644 --- a/samples/container-build/ts/.modules/transport.ts +++ b/samples/container-build/ts/.modules/transport.ts @@ -77,7 +77,8 @@ export function isAtsError(value: unknown): value is { $error: AtsError } { value !== null && typeof value === 'object' && '$error' in value && - typeof (value as { $error: unknown }).$error === 'object' + typeof (value as { $error: unknown }).$error === 'object' && + (value as { $error: unknown }).$error !== null ); } @@ -93,6 +94,47 @@ export function isMarshalledHandle(value: unknown): value is MarshalledHandle { ); } +function isAbortSignal(value: unknown): value is AbortSignal { + return ( + value !== null && + typeof value === 'object' && + 'aborted' in value && + 'addEventListener' in value && + 'removeEventListener' in value + ); +} + +function isPlainObject(value: unknown): value is Record { + if (value === null || typeof value !== 'object') { + return false; + } + + const prototype = Object.getPrototypeOf(value); + return prototype === Object.prototype || prototype === null; +} + +function hasTransportValue(value: unknown): value is { toTransportValue(): unknown | Promise } { + return ( + value !== null && + typeof value === 'object' && + 'toTransportValue' in value && + typeof (value as { toTransportValue?: unknown }).toTransportValue === 'function' + ); +} + +function createAbortError(message: string): Error { + const error = new Error(message); + error.name = 'AbortError'; + return error; +} + +function createCircularReferenceError(capabilityId: string, path: string): AppHostUsageError { + return new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' contains a circular reference. ` + + 'Circular references are not supported by the AppHost transport.' + ); +} + // ============================================================================ // Handle // ============================================================================ @@ -136,6 +178,92 @@ export class Handle { } } +// ============================================================================ +// CancellationToken +// ============================================================================ + +/** + * Represents a transport-safe cancellation token value for the generated SDK. + * + * Use a plain {@link AbortSignal} when you create cancellation in user code. + * Generated APIs accept either an {@link AbortSignal} or a {@link CancellationToken}. + * + * Values returned from generated callbacks and context/property getters are + * {@link CancellationToken} instances because they may reference remote + * cancellation token handles received from the AppHost. + * + * @example + * ```typescript + * const controller = new AbortController(); + * await connectionStringExpression.getValue(controller.signal); + * ``` + * + * @example + * ```typescript + * const cancellationToken = await context.cancellationToken.get(); + * const connectionStringExpression = await db.uriExpression.get(); + * const connectionString = await connectionStringExpression.getValue(cancellationToken); + * ``` + */ +export class CancellationToken { + private readonly _signal?: AbortSignal; + private readonly _remoteTokenId?: string; + + constructor(signal?: AbortSignal); + constructor(tokenId?: string); + constructor(value?: AbortSignal | string | null) { + if (typeof value === 'string') { + this._remoteTokenId = value; + } else if (isAbortSignal(value)) { + this._signal = value; + } + } + + /** + * Creates a cancellation token from a local {@link AbortSignal}. + */ + static from(signal?: AbortSignal): CancellationToken { + return new CancellationToken(signal); + } + + /** + * Creates a cancellation token from a transport value. + * Generated code uses this to materialize values that come from the AppHost. + */ + static fromValue(value: unknown): CancellationToken { + if (value instanceof CancellationToken) { + return value; + } + + if (typeof value === 'string') { + return new CancellationToken(value); + } + + if (isAbortSignal(value)) { + return new CancellationToken(value); + } + + return new CancellationToken(); + } + + /** + * Serializes the token for JSON-RPC transport. + */ + toJSON(): string | undefined { + return this._remoteTokenId; + } + + register(client?: AspireClient): string | undefined { + if (this._remoteTokenId !== undefined) { + return this._remoteTokenId; + } + + return client + ? registerCancellation(client, this._signal) + : registerCancellation(this._signal); + } +} + // ============================================================================ // Handle Wrapper Registry // ============================================================================ @@ -167,22 +295,35 @@ export function registerHandleWrapper(typeId: string, factory: HandleWrapperFact * @param client - Optional client for creating typed wrapper instances */ export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { - if (value && typeof value === 'object') { - if (isMarshalledHandle(value)) { - const handle = new Handle(value); - const typeId = value.$type; - - // Try to find a registered wrapper factory for this type - if (typeId && client) { - const factory = handleWrapperRegistry.get(typeId); - if (factory) { - return factory(handle, client); - } + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); } + } + + return handle; + } - return handle; + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + value[i] = wrapIfHandle(value[i], client); + } + + return value; + } + + if (isPlainObject(value)) { + for (const [key, nestedValue] of Object.entries(value)) { + value[key] = wrapIfHandle(nestedValue, client); } } + return value; } @@ -213,6 +354,76 @@ export class CapabilityError extends Error { } } +/** + * Error thrown when the AppHost script uses the generated SDK incorrectly. + */ +export class AppHostUsageError extends Error { + constructor(message: string) { + super(message); + this.name = 'AppHostUsageError'; + } +} + +function isPromiseLike(value: unknown): value is PromiseLike { + return ( + value !== null && + (typeof value === 'object' || typeof value === 'function') && + 'then' in value && + typeof (value as { then?: unknown }).then === 'function' + ); +} + +function validateCapabilityArgs( + capabilityId: string, + args?: Record +): void { + if (!args) { + return; + } + + const validateValue = (value: unknown, path: string, ancestors: Set): void => { + if (value === null || value === undefined) { + return; + } + + if (isPromiseLike(value)) { + throw new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' is a Promise-like value. ` + + `This usually means an async builder call was not awaited. ` + + `Did you forget 'await' on a call like builder.addPostgres(...) or resource.addDatabase(...)?` + ); + } + + if (typeof value !== 'object') { + return; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + ancestors.add(value); + try { + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + validateValue(value[i], `${path}[${i}]`, ancestors); + } + return; + } + + for (const [key, nestedValue] of Object.entries(value)) { + validateValue(nestedValue, `${path}.${key}`, ancestors); + } + } finally { + ancestors.delete(value); + } + }; + + for (const [key, value] of Object.entries(args)) { + validateValue(value, key, new Set()); + } +} + // ============================================================================ // Callback Registry // ============================================================================ @@ -324,21 +535,50 @@ export function getCallbackCount(): number { */ const cancellationRegistry = new Map void>(); let cancellationIdCounter = 0; +const connectedClients = new Set(); -/** - * A reference to the current AspireClient for sending cancel requests. - * Set by AspireClient.connect(). - */ -let currentClient: AspireClient | null = null; +function resolveCancellationClient(client?: AspireClient): AspireClient { + if (client) { + return client; + } + + if (connectedClients.size === 1) { + return connectedClients.values().next().value as AspireClient; + } + + if (connectedClients.size === 0) { + throw new Error( + 'registerCancellation(signal) requires a connected AspireClient. ' + + 'Pass the client explicitly or connect the client first.' + ); + } + + throw new Error( + 'registerCancellation(signal) is ambiguous when multiple AspireClient instances are connected. ' + + 'Pass the client explicitly.' + ); +} /** - * Register an AbortSignal for cancellation support. - * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * Registers cancellation support for a local signal or SDK cancellation token. + * Returns a cancellation ID that should be passed to methods accepting cancellation input. * * When the AbortSignal is aborted, sends a cancelToken request to the host. * - * @param signal - The AbortSignal to register (optional) - * @returns The cancellation ID, or undefined if no signal provided + * @param client - The AspireClient that should route the cancellation request + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + */ +export function registerCancellation(client: AspireClient, signalOrToken?: AbortSignal | CancellationToken): string | undefined; +/** + * Registers cancellation support using the single connected AspireClient. + * + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + * + * @example + * const controller = new AbortController(); + * await expression.getValue(controller.signal); * * @example * const controller = new AbortController(); @@ -346,14 +586,29 @@ let currentClient: AspireClient | null = null; * // Pass id to capability invocation * // Later: controller.abort() will cancel the operation */ -export function registerCancellation(signal?: AbortSignal): string | undefined { - if (!signal) { +export function registerCancellation(signalOrToken?: AbortSignal | CancellationToken): string | undefined; +export function registerCancellation( + clientOrSignalOrToken?: AspireClient | AbortSignal | CancellationToken, + maybeSignalOrToken?: AbortSignal | CancellationToken +): string | undefined { + const client = clientOrSignalOrToken instanceof AspireClient ? clientOrSignalOrToken : undefined; + const signalOrToken = client + ? maybeSignalOrToken + : clientOrSignalOrToken as AbortSignal | CancellationToken | undefined; + + if (!signalOrToken) { return undefined; } - // Already aborted? Don't register + if (signalOrToken instanceof CancellationToken) { + return signalOrToken.register(client); + } + + const signal = signalOrToken; + const cancellationClient = resolveCancellationClient(client); + if (signal.aborted) { - return undefined; + throw createAbortError('The operation was aborted before it was sent to the AppHost.'); } const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; @@ -361,8 +616,8 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { // Set up the abort listener const onAbort = () => { // Send cancel request to host - if (currentClient?.connected) { - currentClient.cancelToken(cancellationId).catch(() => { + if (cancellationClient.connected) { + cancellationClient.cancelToken(cancellationId).catch(() => { // Ignore errors - the operation may have already completed }); } @@ -381,6 +636,56 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { return cancellationId; } +async function marshalTransportValue( + value: unknown, + client: AspireClient, + cancellationIds: string[], + capabilityId: string, + path: string = 'args', + ancestors: Set = new Set() +): Promise { + if (value === null || value === undefined || typeof value !== 'object') { + return value; + } + + if (value instanceof CancellationToken) { + const cancellationId = value.register(client); + if (cancellationId !== undefined) { + cancellationIds.push(cancellationId); + } + + return cancellationId; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + const nextAncestors = new Set(ancestors); + nextAncestors.add(value); + + if (hasTransportValue(value)) { + return await marshalTransportValue(await value.toTransportValue(), client, cancellationIds, capabilityId, path, nextAncestors); + } + + if (Array.isArray(value)) { + return await Promise.all( + value.map((item, index) => marshalTransportValue(item, client, cancellationIds, capabilityId, `${path}[${index}]`, nextAncestors)) + ); + } + + if (isPlainObject(value)) { + const entries = await Promise.all( + Object.entries(value).map(async ([key, nestedValue]) => + [key, await marshalTransportValue(nestedValue, client, cancellationIds, capabilityId, `${path}.${key}`, nextAncestors)] as const) + ); + + return Object.fromEntries(entries); + } + + return value; +} + /** * Unregister a cancellation token by its ID. * Call this when the operation completes to clean up resources. @@ -411,6 +716,8 @@ export class AspireClient { private socket: net.Socket | null = null; private disconnectCallbacks: (() => void)[] = []; private _pendingCalls = 0; + private _connectPromise: Promise | null = null; + private _disconnectNotified = false; constructor(private socketPath: string) { } @@ -422,6 +729,12 @@ export class AspireClient { } private notifyDisconnect(): void { + if (this._disconnectNotified) { + return; + } + + this._disconnectNotified = true; + for (const callback of this.disconnectCallbacks) { try { callback(); @@ -432,30 +745,106 @@ export class AspireClient { } connect(timeoutMs: number = 5000): Promise { - return new Promise((resolve, reject) => { - const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + if (this.connected) { + return Promise.resolve(); + } + + if (this._connectPromise) { + return this._connectPromise; + } + + this._disconnectNotified = false; + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this._connectPromise = new Promise((resolve, reject) => { + const socket = net.createConnection(pipePath); + this.socket = socket; - // On Windows, use named pipes; on Unix, use Unix domain sockets - const isWindows = process.platform === 'win32'; - const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + let settled = false; - this.socket = net.createConnection(pipePath); + const cleanupPendingListeners = () => { + socket.removeListener('connect', onConnect); + socket.removeListener('error', onPendingError); + socket.removeListener('close', onPendingClose); + }; - this.socket.once('error', (error: Error) => { + const failConnect = (error: Error) => { + if (settled) { + return; + } + + settled = true; clearTimeout(timeout); + cleanupPendingListeners(); + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + if (!socket.destroyed) { + socket.destroy(); + } + reject(error); - }); + }; + + const onConnectedSocketError = (error: Error) => { + console.error('Socket error:', error); + }; + + const onConnectedSocketClose = () => { + socket.removeListener('error', onConnectedSocketError); + + if (this.socket && this.socket !== socket) { + return; + } + + const connection = this.connection; + this.connection = null; + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + this.notifyDisconnect(); + }; + + const onPendingError = (error: Error) => { + failConnect(error); + }; + + const onPendingClose = () => { + failConnect(new Error('Connection closed before JSON-RPC was established')); + }; + + const onConnect = async () => { + if (settled) { + return; + } - this.socket.once('connect', () => { clearTimeout(timeout); + cleanupPendingListeners(); + try { - const reader = new rpc.SocketMessageReader(this.socket!); - const writer = new rpc.SocketMessageWriter(this.socket!); + const reader = new rpc.SocketMessageReader(socket); + const writer = new rpc.SocketMessageWriter(socket); this.connection = rpc.createMessageConnection(reader, writer); this.connection.onClose(() => { this.connection = null; - this.notifyDisconnect(); }); this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); @@ -475,26 +864,39 @@ export class AspireClient { } }); + socket.on('error', onConnectedSocketError); + socket.on('close', onConnectedSocketClose); + + const authToken = process.env.ASPIRE_REMOTE_APPHOST_TOKEN; + if (!authToken) { + throw new Error('ASPIRE_REMOTE_APPHOST_TOKEN environment variable is not set.'); + } this.connection.listen(); + const authenticated = await this.connection.sendRequest('authenticate', authToken); + if (!authenticated) { + throw new Error('Failed to authenticate to the AppHost server.'); + } - // Set the current client for cancellation registry - currentClient = this; + connectedClients.add(this); + this._connectPromise = null; + settled = true; resolve(); - } catch (e) { - reject(e); + } catch (error) { + failConnect(error instanceof Error ? error : new Error(String(error))); } - }); + }; - this.socket.on('close', () => { - this.connection?.dispose(); - this.connection = null; - if (currentClient === this) { - currentClient = null; - } - this.notifyDisconnect(); - }); + const timeout = setTimeout(() => { + failConnect(new Error('Connection timeout')); + }, timeoutMs); + + socket.once('error', onPendingError); + socket.once('close', onPendingClose); + socket.once('connect', onConnect); }); + + return this._connectPromise; } ping(): Promise { @@ -533,39 +935,66 @@ export class AspireClient { throw new Error('Not connected to AppHost'); } - // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. - // We ref() during RPC calls so the process doesn't exit mid-call, and - // unref() when idle so the process can exit naturally after all work completes. - if (this._pendingCalls === 0) { - this.socket?.ref(); - } - this._pendingCalls++; + validateCapabilityArgs(capabilityId, args); + const cancellationIds: string[] = []; try { - const result = await this.connection.sendRequest( - 'invokeCapability', - capabilityId, - args ?? null - ); + const rpcArgs = await marshalTransportValue(args ?? null, this, cancellationIds, capabilityId); - // Check for structured error response - if (isAtsError(result)) { - throw new CapabilityError(result.$error); + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); } + this._pendingCalls++; - // Wrap handles automatically - return wrapIfHandle(result, this) as T; + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + rpcArgs + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } } finally { - this._pendingCalls--; - if (this._pendingCalls === 0) { - this.socket?.unref(); + for (const cancellationId of cancellationIds) { + unregisterCancellation(cancellationId); } } } disconnect(): void { - try { this.connection?.dispose(); } finally { this.connection = null; } - try { this.socket?.end(); } finally { this.socket = null; } + const connection = this.connection; + const socket = this.socket; + + this.connection = null; + this.socket = null; + this._connectPromise = null; + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + if (socket && !socket.destroyed) { + socket.end(); + socket.destroy(); + } } get connected(): boolean { diff --git a/samples/container-build/ts/apphost.ts b/samples/container-build/ts/apphost.ts index 81341610..c2272952 100644 --- a/samples/container-build/ts/apphost.ts +++ b/samples/container-build/ts/apphost.ts @@ -8,7 +8,7 @@ const goVersion = await builder.addParameter("goversion", { secret: true }); const context = await builder.executionContext.get(); const isPublish = await context.isPublishMode.get(); -const ginapp = builder.executionContext.isPublishMode +const ginapp = isPublish ? builder.addDockerfile("ginapp", "../ginapp") .withBuildArg("GO_VERSION", goVersion) : builder.addDockerfile("ginapp", "../ginapp", { dockerfilePath: "Dockerfile.dev" }) diff --git a/samples/container-build/ts/apphost.run.json b/samples/container-build/ts/aspire.config.json similarity index 67% rename from samples/container-build/ts/apphost.run.json rename to samples/container-build/ts/aspire.config.json index f917e9c6..2b400d41 100644 --- a/samples/container-build/ts/apphost.run.json +++ b/samples/container-build/ts/aspire.config.json @@ -1,4 +1,11 @@ { + "appHost": { + "path": "apphost.ts", + "language": "typescript/nodejs" + }, + "packages": { + "Aspire.Hosting.JavaScript": "13.2.0" + }, "profiles": { "https": { "applicationUrl": "https://localhost:48638;http://localhost:10429", @@ -8,4 +15,4 @@ } } } -} \ No newline at end of file +} diff --git a/samples/custom-resources/ts/.aspire/settings.json b/samples/custom-resources/ts/.aspire/settings.json deleted file mode 100644 index 3c03a3b9..00000000 --- a/samples/custom-resources/ts/.aspire/settings.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "appHostPath": "../apphost.ts", - "language": "typescript/nodejs", - "channel": "staging", - "sdkVersion": "13.2.0-preview.1.26159.1" -} \ No newline at end of file diff --git a/samples/custom-resources/ts/.modules/.codegen-hash b/samples/custom-resources/ts/.modules/.codegen-hash index 1369f62c..d112ad8d 100644 --- a/samples/custom-resources/ts/.modules/.codegen-hash +++ b/samples/custom-resources/ts/.modules/.codegen-hash @@ -1 +1 @@ -385A37965F5742D9B7F75074E7065C879412F46A58CE04016D535C18DA21950E \ No newline at end of file +54ABC5F6F3238E45FD69B96BCCB0C6A5BB14B11F3C267B90DC987EFF3E1B7E45 \ No newline at end of file diff --git a/samples/custom-resources/ts/.modules/aspire.ts b/samples/custom-resources/ts/.modules/aspire.ts index 73dc52d2..802979fb 100644 --- a/samples/custom-resources/ts/.modules/aspire.ts +++ b/samples/custom-resources/ts/.modules/aspire.ts @@ -8,6 +8,8 @@ import { AspireClient as AspireClientRpc, Handle, MarshalledHandle, + AppHostUsageError, + CancellationToken, CapabilityError, registerCallback, wrapIfHandle, @@ -26,9 +28,30 @@ import { // Handle Type Aliases (Internal - not exported to users) // ============================================================================ +/** Handle to JavaScriptAppResource */ +type JavaScriptAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource'>; + +/** Handle to NodeAppResource */ +type NodeAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource'>; + +/** Handle to ViteAppResource */ +type ViteAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource'>; + +/** Handle to AfterResourcesCreatedEvent */ +type AfterResourcesCreatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent'>; + +/** Handle to BeforeResourceStartedEvent */ +type BeforeResourceStartedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent'>; + +/** Handle to BeforeStartEvent */ +type BeforeStartEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent'>; + /** Handle to CommandLineArgsCallbackContext */ type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; +/** Handle to ConnectionStringAvailableEvent */ +type ConnectionStringAvailableEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent'>; + /** Handle to ContainerRegistryResource */ type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; @@ -38,6 +61,9 @@ type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Application /** Handle to CSharpAppResource */ type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; +/** Handle to DistributedApplicationModel */ +type DistributedApplicationModelHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel'>; + /** Handle to DotnetToolResource */ type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; @@ -56,9 +82,15 @@ type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicatio /** Handle to ExecuteCommandContext */ type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; +/** Handle to IComputeResource */ +type IComputeResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource'>; + /** Handle to IContainerFilesDestinationResource */ type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; +/** Handle to InitializeResourceEvent */ +type InitializeResourceEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent'>; + /** Handle to IResource */ type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; @@ -89,15 +121,27 @@ type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicati /** Handle to ReferenceExpressionBuilder */ type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; +/** Handle to ResourceEndpointsAllocatedEvent */ +type ResourceEndpointsAllocatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent'>; + /** Handle to ResourceLoggerService */ type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; /** Handle to ResourceNotificationService */ type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; +/** Handle to ResourceReadyEvent */ +type ResourceReadyEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent'>; + +/** Handle to ResourceStoppedEvent */ +type ResourceStoppedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent'>; + /** Handle to ResourceUrlsCallbackContext */ type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; +/** Handle to UpdateCommandStateContext */ +type UpdateCommandStateContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext'>; + /** Handle to ConnectionStringResource */ type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; @@ -122,18 +166,33 @@ type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hostin /** Handle to IResourceWithContainerFiles */ type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; -/** Handle to IResourceWithServiceDiscovery */ -type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; +/** Handle to IUserSecretsManager */ +type IUserSecretsManagerHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IUserSecretsManager'>; + +/** Handle to IReportingStep */ +type IReportingStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep'>; + +/** Handle to IReportingTask */ +type IReportingTaskHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask'>; /** Handle to PipelineConfigurationContext */ type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; +/** Handle to PipelineContext */ +type PipelineContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext'>; + /** Handle to PipelineStep */ type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; /** Handle to PipelineStepContext */ type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; +/** Handle to PipelineStepFactoryContext */ +type PipelineStepFactoryContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext'>; + +/** Handle to PipelineSummary */ +type PipelineSummaryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary'>; + /** Handle to ProjectResourceOptions */ type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; @@ -146,12 +205,18 @@ type ListanyHandle = Handle<'Aspire.Hosting/List'>; /** Handle to IConfiguration */ type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; +/** Handle to IConfigurationSection */ +type IConfigurationSectionHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfigurationSection'>; + /** Handle to IHostEnvironment */ type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; /** Handle to ILogger */ type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; +/** Handle to ILoggerFactory */ +type ILoggerFactoryHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory'>; + /** Handle to string[] */ type stringArrayHandle = Handle<'string[]'>; @@ -191,6 +256,7 @@ export enum EndpointProperty { Scheme = "Scheme", TargetPort = "TargetPort", HostAndPort = "HostAndPort", + TlsEnabled = "TlsEnabled", } /** Enum type for IconVariant */ @@ -322,6 +388,10 @@ export interface AddConnectionStringOptions { environmentVariableName?: string; } +export interface AddContainerRegistryFromStringOptions { + repository?: string; +} + export interface AddContainerRegistryOptions { repository?: ParameterResource; } @@ -331,6 +401,10 @@ export interface AddDockerfileOptions { stage?: string; } +export interface AddJavaScriptAppOptions { + runScriptName?: string; +} + export interface AddParameterFromConfigurationOptions { secret?: boolean; } @@ -339,6 +413,15 @@ export interface AddParameterOptions { secret?: boolean; } +export interface AddParameterWithValueOptions { + publishValueAsDefault?: boolean; + secret?: boolean; +} + +export interface AddViteAppOptions { + runScriptName?: string; +} + export interface AppendFormattedOptions { format?: string; } @@ -347,22 +430,89 @@ export interface AppendValueProviderOptions { format?: string; } +export interface CompleteStepMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteStepOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskOptions { + completionMessage?: string; + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateMarkdownTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + export interface GetValueAsyncOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface PublishAsDockerFileOptions { + configure?: (obj: ContainerResource) => Promise; +} + +export interface PublishResourceUpdateOptions { + state?: string; + stateStyle?: string; } export interface RunOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface SaveStateJsonOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskMarkdownOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; } export interface WaitForCompletionOptions { exitCode?: number; } +export interface WaitForResourceStateOptions { + targetState?: string; +} + export interface WithBindMountOptions { isReadOnly?: boolean; } +export interface WithBrowserDebuggerOptions { + browser?: string; +} + +export interface WithBuildScriptOptions { + args?: string[]; +} + +export interface WithBunOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithCommandOptions { commandOptions?: CommandOptions; } @@ -446,6 +596,12 @@ export interface WithMcpServerOptions { endpointName?: string; } +export interface WithNpmOptions { + install?: boolean; + installCommand?: string; + installArgs?: string[]; +} + export interface WithPipelineStepFactoryOptions { dependsOn?: string[]; requiredBy?: string[]; @@ -453,15 +609,25 @@ export interface WithPipelineStepFactoryOptions { description?: string; } +export interface WithPnpmOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithReferenceOptions { connectionName?: string; optional?: boolean; + name?: string; } export interface WithRequiredCommandOptions { helpLink?: string; } +export interface WithRunScriptOptions { + args?: string[]; +} + export interface WithUrlExpressionOptions { displayText?: string; } @@ -475,6 +641,122 @@ export interface WithVolumeOptions { isReadOnly?: boolean; } +export interface WithYarnOptions { + install?: boolean; + installArgs?: string[]; +} + +// ============================================================================ +// AfterResourcesCreatedEvent +// ============================================================================ + +/** + * Type class for AfterResourcesCreatedEvent. + */ +export class AfterResourcesCreatedEvent { + constructor(private _handle: AfterResourcesCreatedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeResourceStartedEvent +// ============================================================================ + +/** + * Type class for BeforeResourceStartedEvent. + */ +export class BeforeResourceStartedEvent { + constructor(private _handle: BeforeResourceStartedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeStartEvent +// ============================================================================ + +/** + * Type class for BeforeStartEvent. + */ +export class BeforeStartEvent { + constructor(private _handle: BeforeStartEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + // ============================================================================ // CommandLineArgsCallbackContext // ============================================================================ @@ -504,11 +786,12 @@ export class CommandLineArgsCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, }; @@ -523,6 +806,65 @@ export class CommandLineArgsCallbackContext { }, }; + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ConnectionStringAvailableEvent +// ============================================================================ + +/** + * Type class for ConnectionStringAvailableEvent. + */ +export class ConnectionStringAvailableEvent { + constructor(private _handle: ConnectionStringAvailableEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + } // ============================================================================ @@ -540,9 +882,9 @@ export class DistributedApplication { /** Runs the distributed application */ /** @internal */ - async _runInternal(cancellationToken?: AbortSignal): Promise { + async _runInternal(cancellationToken?: AbortSignal | CancellationToken): Promise { const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); await this._client.invokeCapability( 'Aspire.Hosting/run', rpcArgs @@ -616,6 +958,17 @@ export class DistributedApplicationExecutionContext { }, }; + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the IsPublishMode property */ isPublishMode = { get: async (): Promise => { @@ -638,6 +991,70 @@ export class DistributedApplicationExecutionContext { } +// ============================================================================ +// DistributedApplicationModel +// ============================================================================ + +/** + * Type class for DistributedApplicationModel. + */ +export class DistributedApplicationModel { + constructor(private _handle: DistributedApplicationModelHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets resources from the distributed application model */ + async getResources(): Promise { + const rpcArgs: Record = { model: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResources', + rpcArgs + ); + } + + /** Finds a resource by name */ + /** @internal */ + async _findResourceByNameInternal(name: string): Promise { + const rpcArgs: Record = { model: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/findResourceByName', + rpcArgs + ); + return new Resource(result, this._client); + } + + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._findResourceByNameInternal(name)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationModel that enables fluent chaining. + */ +export class DistributedApplicationModelPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationModel) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets resources from the distributed application model */ + getResources(): Promise { + return this._promise.then(obj => obj.getResources()); + } + + /** Finds a resource by name */ + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.findResourceByName(name))); + } + +} + // ============================================================================ // EndpointReference // ============================================================================ @@ -651,6 +1068,17 @@ export class EndpointReference { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.resource', + { context: this._handle } + ); + return new ResourceWithEndpoints(handle, this._client); + }, + }; + /** Gets the EndpointName property */ endpointName = { get: async (): Promise => { @@ -717,6 +1145,16 @@ export class EndpointReference { }, }; + /** Gets the TlsEnabled property */ + tlsEnabled = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.tlsEnabled', + { context: this._handle } + ); + }, + }; + /** Gets the Port property */ port = { get: async (): Promise => { @@ -771,13 +1209,22 @@ export class EndpointReference { async getValueAsync(options?: GetValueAsyncOptions): Promise { const cancellationToken = options?.cancellationToken; const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); return await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/getValueAsync', rpcArgs ); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + async getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + const rpcArgs: Record = { context: this._handle, enabledValue, disabledValue }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.getTlsValue', + rpcArgs + ); + } + } /** @@ -798,6 +1245,11 @@ export class EndpointReferencePromise implements PromiseLike return this._promise.then(obj => obj.getValueAsync(options)); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + return this._promise.then(obj => obj.getTlsValue(enabledValue, disabledValue)); + } + } // ============================================================================ @@ -875,11 +1327,34 @@ export class EnvironmentCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; @@ -909,6 +1384,17 @@ export class ExecuteCommandContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the ResourceName property */ resourceName = { get: async (): Promise => { @@ -927,16 +1413,17 @@ export class ExecuteCommandContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, - set: async (value: AbortSignal): Promise => { + set: async (value: AbortSignal | CancellationToken): Promise => { await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', - { context: this._handle, value } + { context: this._handle, value: CancellationToken.fromValue(value) } ); } }; @@ -944,34 +1431,126 @@ export class ExecuteCommandContext { } // ============================================================================ -// PipelineConfigurationContext +// InitializeResourceEvent // ============================================================================ /** - * Type class for PipelineConfigurationContext. + * Type class for InitializeResourceEvent. */ -export class PipelineConfigurationContext { - constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} +export class InitializeResourceEvent { + constructor(private _handle: InitializeResourceEventHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the Steps property */ - steps = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.resource', { context: this._handle } ); + return new Resource(handle, this._client); }, - set: async (value: PipelineStep[]): Promise => { - await this._client.invokeCapability( + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Notifications property */ + notifications = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.notifications', + { context: this._handle } + ); + return new ResourceNotificationService(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + { context: this._handle } + ); + }, + set: async (value: PipelineStep[]): Promise => { + await this._client.invokeCapability( 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', { context: this._handle, value } ); } }; + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + /** Gets pipeline steps with the specified tag */ async getStepsByTag(tag: string): Promise { const rpcArgs: Record = { context: this._handle, tag }; @@ -1003,6 +1582,93 @@ export class PipelineConfigurationContextPromise implements PromiseLike => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + set: async (value: AbortSignal | CancellationToken): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.setCancellationToken', + { context: this._handle, value: CancellationToken.fromValue(value) } + ); + } + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + // ============================================================================ // PipelineStep // ============================================================================ @@ -1090,6 +1756,17 @@ export class PipelineStep { return this._tags; } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + /** Adds a dependency on another step by name */ /** @internal */ async _dependsOnInternal(stepName: string): Promise { @@ -1160,6 +1837,39 @@ export class PipelineStepContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the ReportingStep property */ + reportingStep = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.reportingStep', + { context: this._handle } + ); + return new ReportingStep(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + /** Gets the ExecutionContext property */ executionContext = { get: async (): Promise => { @@ -1171,18 +1881,159 @@ export class PipelineStepContext { }, }; + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineStepFactoryContext +// ============================================================================ + +/** + * Type class for PipelineStepFactoryContext. + */ +export class PipelineStepFactoryContext { + constructor(private _handle: PipelineStepFactoryContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; } +// ============================================================================ +// PipelineSummary +// ============================================================================ + +/** + * Type class for PipelineSummary. + */ +export class PipelineSummary { + constructor(private _handle: PipelineSummaryHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Add method */ + /** @internal */ + async _addInternal(key: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, key, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineSummary.add', + rpcArgs + ); + return this; + } + + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addInternal(key, value)); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + /** @internal */ + async _addMarkdownInternal(key: string, markdownString: string): Promise { + const rpcArgs: Record = { summary: this._handle, key, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/addMarkdown', + rpcArgs + ); + return this; + } + + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addMarkdownInternal(key, markdownString)); + } + +} + +/** + * Thenable wrapper for PipelineSummary that enables fluent chaining. + */ +export class PipelineSummaryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineSummary) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Add method */ + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.add(key, value))); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.addMarkdown(key, markdownString))); + } + +} + // ============================================================================ // ProjectResourceOptions // ============================================================================ @@ -1365,3794 +2216,3932 @@ export class ReferenceExpressionBuilderPromise implements PromiseLike; - get urls(): AspireList { - if (!this._urls) { - this._urls = new AspireList( - this._handle, - this._client, - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' - ); - } - return this._urls; - } - - /** Gets the CancellationToken property */ - cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.resource', { context: this._handle } ); + return new Resource(handle, this._client); }, }; - /** Gets the ExecutionContext property */ - executionContext = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.services', { context: this._handle } ); - return new DistributedApplicationExecutionContext(handle, this._client); + return new ServiceProvider(handle, this._client); }, }; } // ============================================================================ -// DistributedApplicationBuilder +// ResourceLoggerService // ============================================================================ /** - * Type class for DistributedApplicationBuilder. + * Type class for ResourceLoggerService. */ -export class DistributedApplicationBuilder { - constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} +export class ResourceLoggerService { + constructor(private _handle: ResourceLoggerServiceHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the AppHostDirectory property */ - appHostDirectory = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', - { context: this._handle } - ); - }, - }; - - /** Gets the Eventing property */ - eventing = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', - { context: this._handle } - ); - return new DistributedApplicationEventing(handle, this._client); - }, - }; - - /** Gets the ExecutionContext property */ - executionContext = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', - { context: this._handle } - ); - return new DistributedApplicationExecutionContext(handle, this._client); - }, - }; - - /** Builds the distributed application */ - /** @internal */ - async _buildInternal(): Promise { - const rpcArgs: Record = { context: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/build', - rpcArgs - ); - return new DistributedApplication(result, this._client); - } - - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._buildInternal()); - } - - /** Adds a connection string with a builder callback */ - /** @internal */ - async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { - const connectionStringBuilderId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; - const obj = new ReferenceExpressionBuilder(objHandle, this._client); - await connectionStringBuilder(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionStringBuilder', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } - - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); - } - - /** Adds a container registry resource */ + /** Completes the log stream for a resource */ /** @internal */ - async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpoint }; - if (repository !== undefined) rpcArgs.repository = repository; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainerRegistry', + async _completeLogInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { loggerService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLog', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - const repository = options?.repository; - return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogInternal(resource)); } - /** Adds a container resource */ + /** Completes the log stream by resource name */ /** @internal */ - async _addContainerInternal(name: string, image: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, image }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainer', + async _completeLogByNameInternal(resourceName: string): Promise { + const rpcArgs: Record = { loggerService: this._handle, resourceName }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLogByName', rpcArgs ); - return new ContainerResource(result, this._client); - } - - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._addContainerInternal(name, image)); + return this; } - /** Adds a container resource built from a Dockerfile */ - /** @internal */ - async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDockerfile', - rpcArgs - ); - return new ContainerResource(result, this._client); + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogByNameInternal(resourceName)); } - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); - } +} - /** Adds a .NET tool resource */ - /** @internal */ - async _addDotnetToolInternal(name: string, packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDotnetTool', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } +/** + * Thenable wrapper for ResourceLoggerService that enables fluent chaining. + */ +export class ResourceLoggerServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + then( + onfulfilled?: ((value: ResourceLoggerService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds an executable resource */ - /** @internal */ - async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExecutable', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Completes the log stream for a resource */ + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLog(resource))); } - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + /** Completes the log stream by resource name */ + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLogByName(resourceName))); } - /** Adds an external service resource */ - /** @internal */ - async _addExternalServiceInternal(name: string, url: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, url }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExternalService', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } +} - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); - } +// ============================================================================ +// ResourceNotificationService +// ============================================================================ - /** Adds a parameter resource */ - /** @internal */ - async _addParameterInternal(name: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameter', - rpcArgs - ); - return new ParameterResource(result, this._client); - } +/** + * Type class for ResourceNotificationService. + */ +export class ResourceNotificationService { + constructor(private _handle: ResourceNotificationServiceHandle, private _client: AspireClientRpc) {} - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterInternal(name, secret)); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Adds a parameter sourced from configuration */ + /** Waits for a resource to reach a specified state */ /** @internal */ - async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name, configurationKey }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameterFromConfiguration', + async _waitForResourceStateInternal(resourceName: string, targetState?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + if (targetState !== undefined) rpcArgs.targetState = targetState; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceState', rpcArgs ); - return new ParameterResource(result, this._client); + return this; } - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + const targetState = options?.targetState; + return new ResourceNotificationServicePromise(this._waitForResourceStateInternal(resourceName, targetState)); } - /** Adds a connection string resource */ - /** @internal */ - async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionString', + /** Waits for a resource to reach one of the specified states */ + async waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName, targetStates }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStates', rpcArgs ); - return new ResourceWithConnectionString(result, this._client); - } - - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - const environmentVariableName = options?.environmentVariableName; - return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); } - /** Adds a .NET project resource */ - /** @internal */ - async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProject', + /** Waits for a resource to become healthy */ + async waitForResourceHealthy(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceHealthy', rpcArgs ); - return new ProjectResource(result, this._client); - } - - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); } - /** Adds a project resource with configuration options */ + /** Waits for all dependencies of a resource to be ready */ /** @internal */ - async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProjectWithOptions', + async _waitForDependenciesInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForDependencies', rpcArgs ); - return new ProjectResource(result, this._client); + return this; } - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._waitForDependenciesInternal(resource)); } - /** Adds a C# application resource */ - /** @internal */ - async _addCSharpAppInternal(name: string, path: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, path }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpApp', + /** Tries to get the current state of a resource */ + async tryGetResourceState(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/tryGetResourceState', rpcArgs ); - return new ProjectResource(result, this._client); - } - - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); } - /** Adds a C# application resource with configuration options */ + /** Publishes an update for a resource's state */ /** @internal */ - async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpAppWithOptions', + async _publishResourceUpdateInternal(resource: ResourceBuilderBase, state?: string, stateStyle?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + if (state !== undefined) rpcArgs.state = state; + if (stateStyle !== undefined) rpcArgs.stateStyle = stateStyle; + await this._client.invokeCapability( + 'Aspire.Hosting/publishResourceUpdate', rpcArgs ); - return new CSharpAppResource(result, this._client); + return this; } - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + const state = options?.state; + const stateStyle = options?.stateStyle; + return new ResourceNotificationServicePromise(this._publishResourceUpdateInternal(resource, state, stateStyle)); } } /** - * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + * Thenable wrapper for ResourceNotificationService that enables fluent chaining. */ -export class DistributedApplicationBuilderPromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ResourceNotificationServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ResourceNotificationService) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Builds the distributed application */ - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); + /** Waits for a resource to reach a specified state */ + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForResourceState(resourceName, options))); } - /** Adds a connection string with a builder callback */ - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + /** Waits for a resource to reach one of the specified states */ + waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + return this._promise.then(obj => obj.waitForResourceStates(resourceName, targetStates)); } - /** Adds a container registry resource */ - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + /** Waits for a resource to become healthy */ + waitForResourceHealthy(resourceName: string): Promise { + return this._promise.then(obj => obj.waitForResourceHealthy(resourceName)); } - /** Adds a container resource */ - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + /** Waits for all dependencies of a resource to be ready */ + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForDependencies(resource))); } - /** Adds a container resource built from a Dockerfile */ - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + /** Tries to get the current state of a resource */ + tryGetResourceState(resourceName: string): Promise { + return this._promise.then(obj => obj.tryGetResourceState(resourceName)); } - /** Adds a .NET tool resource */ - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + /** Publishes an update for a resource's state */ + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.publishResourceUpdate(resource, options))); } - /** Adds an executable resource */ - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); - } +} - /** Adds an external service resource */ - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); - } +// ============================================================================ +// ResourceReadyEvent +// ============================================================================ - /** Adds a parameter resource */ - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); - } +/** + * Type class for ResourceReadyEvent. + */ +export class ResourceReadyEvent { + constructor(private _handle: ResourceReadyEventHandle, private _client: AspireClientRpc) {} - /** Adds a parameter sourced from configuration */ - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Adds a connection string resource */ - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); - } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; - /** Adds a .NET project resource */ - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); - } + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; - /** Adds a project resource with configuration options */ - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); - } +} - /** Adds a C# application resource */ - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); - } +// ============================================================================ +// ResourceStoppedEvent +// ============================================================================ - /** Adds a C# application resource with configuration options */ - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); - } +/** + * Type class for ResourceStoppedEvent. + */ +export class ResourceStoppedEvent { + constructor(private _handle: ResourceStoppedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; } // ============================================================================ -// DistributedApplicationEventing +// ResourceUrlsCallbackContext // ============================================================================ /** - * Type class for DistributedApplicationEventing. + * Type class for ResourceUrlsCallbackContext. */ -export class DistributedApplicationEventing { - constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Invokes the Unsubscribe method */ - /** @internal */ - async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { - const rpcArgs: Record = { context: this._handle, subscription }; - await this._client.invokeCapability( - 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', - rpcArgs - ); - return this; - } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; } + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + } +// ============================================================================ +// UpdateCommandStateContext +// ============================================================================ + /** - * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + * Type class for UpdateCommandStateContext. */ -export class DistributedApplicationEventingPromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class UpdateCommandStateContext { + constructor(private _handle: UpdateCommandStateContextHandle, private _client: AspireClientRpc) {} - then( - onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Invokes the Unsubscribe method */ - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); - } + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/UpdateCommandStateContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; } // ============================================================================ -// ConnectionStringResource +// Configuration // ============================================================================ -export class ConnectionStringResource extends ResourceBuilderBase { - constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { - super(handle, client); - } +/** + * Type class for Configuration. + */ +export class Configuration { + constructor(private _handle: IConfigurationHandle, private _client: AspireClientRpc) {} - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets a configuration value by key */ + async getConfigValue(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConfigValue', rpcArgs ); - return new ConnectionStringResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + /** Gets a connection string by name */ + async getConnectionString(name: string): Promise { + const rpcArgs: Record = { configuration: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionString', + rpcArgs + ); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + /** Gets a configuration section by key */ + async getSection(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getSection', rpcArgs ); - return new ConnectionStringResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Gets child configuration sections */ + async getChildren(): Promise { + const rpcArgs: Record = { configuration: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getChildren', + rpcArgs + ); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + /** Checks whether a configuration section exists */ + async exists(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/exists', rpcArgs ); - return new ConnectionStringResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { - const helpLink = options?.helpLink; - return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } +} - /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); +/** + * Thenable wrapper for Configuration that enables fluent chaining. + */ +export class ConfigurationPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Configuration) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Gets a configuration value by key */ + getConfigValue(key: string): Promise { + return this._promise.then(obj => obj.getConfigValue(key)); } - /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); + /** Gets a connection string by name */ + getConnectionString(name: string): Promise { + return this._promise.then(obj => obj.getConnectionString(name)); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Gets a configuration section by key */ + getSection(key: string): Promise { + return this._promise.then(obj => obj.getSection(key)); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); + /** Gets child configuration sections */ + getChildren(): Promise { + return this._promise.then(obj => obj.getChildren()); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Checks whether a configuration section exists */ + exists(key: string): Promise { + return this._promise.then(obj => obj.exists(key)); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } +} - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); - } +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Environment property */ + environment = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.environment', + { context: this._handle } + ); + return new HostEnvironment(handle, this._client); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the UserSecretsManager property */ + userSecretsManager = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.userSecretsManager', + { context: this._handle } + ); + return new UserSecretsManager(handle, this._client); + }, + }; + /** Builds the distributed application */ /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DistributedApplication(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { - const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); } + /** Adds a connection string with a reference expression */ /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; + async _addConnectionStringExpressionInternal(name: string, connectionStringExpression: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, connectionStringExpression }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + 'Aspire.Hosting/addConnectionStringExpression', rpcArgs ); return new ConnectionStringResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { - const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringExpressionInternal(name, connectionStringExpression)); } + /** Adds a connection string with a builder callback */ /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + 'Aspire.Hosting/addConnectionStringBuilder', rpcArgs ); return new ConnectionStringResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); } + /** Adds a container registry resource */ /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); } + /** Adds a container registry with string endpoint */ /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + async _addContainerRegistryFromStringInternal(name: string, endpoint: string, repository?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistryFromString', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryFromStringInternal(name, endpoint, repository)); } + /** Adds a container resource */ /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); } + /** Adds a container resource built from a Dockerfile */ /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); } + /** Adds a .NET tool resource */ /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); } + /** Adds an executable resource */ /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); } + /** Adds an external service resource */ /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - const exitCode = options?.exitCode; - return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); } + /** Adds an external service with a URI */ /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + async _addExternalServiceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceUri', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceUriInternal(name, uri)); } + /** Adds an external service with a parameter URL */ /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + async _addExternalServiceParameterInternal(name: string, urlParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, urlParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceParameter', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { - const commandOptions = options?.commandOptions; - return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceParameterInternal(name, urlParameter)); } + /** Adds a parameter resource */ /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); } + /** Adds a parameter with a default value */ /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + async _addParameterWithValueInternal(name: string, value: string, publishValueAsDefault?: boolean, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + if (publishValueAsDefault !== undefined) rpcArgs.publishValueAsDefault = publishValueAsDefault; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterWithValue', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + const publishValueAsDefault = options?.publishValueAsDefault; + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterWithValueInternal(name, value, publishValueAsDefault, secret)); } + /** Adds a parameter sourced from configuration */ /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { - const iconVariant = options?.iconVariant; - return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); } + /** Adds a connection string resource */ /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ResourceWithConnectionString(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); } + /** Adds a .NET project resource */ /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); } + /** Adds a project resource with configuration options */ /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + } + + /** Adds a C# application resource */ + /** @internal */ + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); } + /** Adds a C# application resource with configuration options */ /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); } + /** Gets the application configuration */ /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + async _getConfigurationInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getConfiguration', + rpcArgs + ); + return new Configuration(result, this._client); + } + + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._getConfigurationInternal()); + } + + /** Subscribes to the BeforeStart event */ + async subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as BeforeStartEventHandle; + const arg = new BeforeStartEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeBeforeStart', rpcArgs ); - return new ConnectionStringResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Subscribes to the AfterResourcesCreated event */ + async subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as AfterResourcesCreatedEventHandle; + const arg = new AfterResourcesCreatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeAfterResourcesCreated', + rpcArgs + ); } + /** Adds a Node.js application resource */ /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + async _addNodeAppInternal(name: string, appDirectory: string, scriptPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory, scriptPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addNodeApp', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._addNodeAppInternal(name, appDirectory, scriptPath)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** Adds a JavaScript application resource */ + /** @internal */ + async _addJavaScriptAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addJavaScriptApp', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + const runScriptName = options?.runScriptName; + return new JavaScriptAppResourcePromise(this._addJavaScriptAppInternal(name, appDirectory, runScriptName)); + } + + /** Adds a Vite application resource */ + /** @internal */ + async _addViteAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addViteApp', rpcArgs ); + return new ViteAppResource(result, this._client); + } + + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + const runScriptName = options?.runScriptName; + return new ViteAppResourcePromise(this._addViteAppInternal(name, appDirectory, runScriptName)); } } /** - * Thenable wrapper for ConnectionStringResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. */ -export class ConnectionStringResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds a connection string with a reference expression */ + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringExpression(name, connectionStringExpression))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + /** Adds a container registry with string endpoint */ + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistryFromString(name, endpoint, options))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Adds an external service with a URI */ + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceUri(name, uri))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Adds an external service with a parameter URL */ + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceParameter(name, urlParameter))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Adds a parameter with a default value */ + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterWithValue(name, value, options))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Gets the application configuration */ + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._promise.then(obj => obj.getConfiguration())); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Subscribes to the BeforeStart event */ + subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeBeforeStart(callback)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Subscribes to the AfterResourcesCreated event */ + subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeAfterResourcesCreated(callback)); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds a Node.js application resource */ + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.addNodeApp(name, appDirectory, scriptPath))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Adds a JavaScript application resource */ + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.addJavaScriptApp(name, appDirectory, options))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds a Vite application resource */ + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.addViteApp(name, appDirectory, options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); +} + +// ============================================================================ +// DistributedApplicationEventing +// ============================================================================ + +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Unsubscribe method */ + /** @internal */ + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + rpcArgs + ); + return this; } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); } } // ============================================================================ -// ContainerRegistryResource +// HostEnvironment // ============================================================================ -export class ContainerRegistryResource extends ResourceBuilderBase { - constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { - super(handle, client); +/** + * Type class for HostEnvironment. + */ +export class HostEnvironment { + constructor(private _handle: IHostEnvironmentHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Checks if running in Development environment */ + async isDevelopment(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isDevelopment', + rpcArgs + ); } - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + /** Checks if running in Production environment */ + async isProduction(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isProduction', rpcArgs ); - return new ContainerRegistryResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + /** Checks if running in Staging environment */ + async isStaging(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isStaging', + rpcArgs + ); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + /** Checks if the environment matches the specified name */ + async isEnvironment(environmentName: string): Promise { + const rpcArgs: Record = { environment: this._handle, environmentName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isEnvironment', rpcArgs ); - return new ContainerRegistryResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); +} + +/** + * Thenable wrapper for HostEnvironment that enables fluent chaining. + */ +export class HostEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: HostEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Checks if running in Development environment */ + isDevelopment(): Promise { + return this._promise.then(obj => obj.isDevelopment()); } + /** Checks if running in Production environment */ + isProduction(): Promise { + return this._promise.then(obj => obj.isProduction()); + } + + /** Checks if running in Staging environment */ + isStaging(): Promise { + return this._promise.then(obj => obj.isStaging()); + } + + /** Checks if the environment matches the specified name */ + isEnvironment(environmentName: string): Promise { + return this._promise.then(obj => obj.isEnvironment(environmentName)); + } + +} + +// ============================================================================ +// Logger +// ============================================================================ + +/** + * Type class for Logger. + */ +export class Logger { + constructor(private _handle: ILoggerHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Logs an information message */ /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + async _logInformationInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logInformation', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { - const helpLink = options?.helpLink; - return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._logInformationInternal(message)); } + /** Logs a warning message */ /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + async _logWarningInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logWarning', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._logWarningInternal(message)); } + /** Logs an error message */ /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + async _logErrorInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logError', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + logError(message: string): LoggerPromise { + return new LoggerPromise(this._logErrorInternal(message)); } + /** Logs a debug message */ /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + async _logDebugInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logDebug', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { - const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._logDebugInternal(message)); } + /** Logs a message with specified level */ /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + async _logInternal(level: string, message: string): Promise { + const rpcArgs: Record = { logger: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/log', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { - const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._logInternal(level, message)); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } +} - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); - } +/** + * Thenable wrapper for Logger that enables fluent chaining. + */ +export class LoggerPromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + then( + onfulfilled?: ((value: Logger) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + /** Logs an information message */ + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logInformation(message))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Logs a warning message */ + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logWarning(message))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + /** Logs an error message */ + logError(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logError(message))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Logs a debug message */ + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logDebug(message))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + /** Logs a message with specified level */ + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.log(level, message))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } +} - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); - } +// ============================================================================ +// LoggerFactory +// ============================================================================ - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } +/** + * Type class for LoggerFactory. + */ +export class LoggerFactory { + constructor(private _handle: ILoggerFactoryHandle, private _client: AspireClientRpc) {} - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Creates a logger for a category */ /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + async _createLoggerInternal(categoryName: string): Promise { + const rpcArgs: Record = { loggerFactory: this._handle, categoryName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createLogger', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new Logger(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._createLoggerInternal(categoryName)); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); +} + +/** + * Thenable wrapper for LoggerFactory that enables fluent chaining. + */ +export class LoggerFactoryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: LoggerFactory) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Creates a logger for a category */ + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.createLogger(categoryName))); } +} + +// ============================================================================ +// ReportingStep +// ============================================================================ + +/** + * Type class for ReportingStep. + */ +export class ReportingStep { + constructor(private _handle: IReportingStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Creates a reporting task with plain-text status text */ /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + async _createTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createTask', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ReportingTask(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createTaskInternal(statusText, cancellationToken)); } + /** Creates a reporting task with Markdown-formatted status text */ /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + async _createMarkdownTaskInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createMarkdownTask', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ReportingTask(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createMarkdownTaskInternal(markdownString, cancellationToken)); } + /** Logs a plain-text message for the reporting step */ /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + async _logStepInternal(level: string, message: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStep', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepInternal(level, message)); } + /** Logs a Markdown-formatted message for the reporting step */ /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + async _logStepMarkdownInternal(level: string, markdownString: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStepMarkdown', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepMarkdownInternal(level, markdownString)); } + /** Completes the reporting step with plain-text completion text */ /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + async _completeStepInternal(completionText: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, completionText }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStep', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepInternal(completionText, completionState, cancellationToken)); } + /** Completes the reporting step with Markdown-formatted completion text */ /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + async _completeStepMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStepMarkdown', rpcArgs ); - return new ContainerRegistryResource(result, this._client); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + return this; } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepMarkdownInternal(markdownString, completionState, cancellationToken)); } } /** - * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); + * Thenable wrapper for ReportingStep that enables fluent chaining. */ -export class ContainerRegistryResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ReportingStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ReportingStep) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Creates a reporting task with plain-text status text */ + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createTask(statusText, options))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Creates a reporting task with Markdown-formatted status text */ + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createMarkdownTask(markdownString, options))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Logs a plain-text message for the reporting step */ + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStep(level, message))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Logs a Markdown-formatted message for the reporting step */ + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStepMarkdown(level, markdownString))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Completes the reporting step with plain-text completion text */ + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStep(completionText, options))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Completes the reporting step with Markdown-formatted completion text */ + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStepMarkdown(markdownString, options))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } +} - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } +// ============================================================================ +// ReportingTask +// ============================================================================ - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); +/** + * Type class for ReportingTask. + */ +export class ReportingTask { + constructor(private _handle: IReportingTaskHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Updates the reporting task with plain-text status text */ + /** @internal */ + async _updateTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTask', + rpcArgs + ); + return this; } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskInternal(statusText, cancellationToken)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Updates the reporting task with Markdown-formatted status text */ + /** @internal */ + async _updateTaskMarkdownInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTaskMarkdown', + rpcArgs + ); + return this; } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskMarkdownInternal(markdownString, cancellationToken)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Completes the reporting task with plain-text completion text */ + /** @internal */ + async _completeTaskInternal(completionMessage?: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle }; + if (completionMessage !== undefined) rpcArgs.completionMessage = completionMessage; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTask', + rpcArgs + ); + return this; } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + const completionMessage = options?.completionMessage; + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskInternal(completionMessage, completionState, cancellationToken)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Completes the reporting task with Markdown-formatted completion text */ + /** @internal */ + async _completeTaskMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTaskMarkdown', + rpcArgs + ); + return this; } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskMarkdownInternal(markdownString, completionState, cancellationToken)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); +} + +/** + * Thenable wrapper for ReportingTask that enables fluent chaining. + */ +export class ReportingTaskPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReportingTask) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Updates the reporting task with plain-text status text */ + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTask(statusText, options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Updates the reporting task with Markdown-formatted status text */ + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTaskMarkdown(markdownString, options))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Completes the reporting task with plain-text completion text */ + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTask(options))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Completes the reporting task with Markdown-formatted completion text */ + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTaskMarkdown(markdownString, options))); } } // ============================================================================ -// ContainerResource +// ServiceProvider // ============================================================================ -export class ContainerResource extends ResourceBuilderBase { - constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { - super(handle, client); - } +/** + * Type class for ServiceProvider. + */ +export class ServiceProvider { + constructor(private _handle: IServiceProviderHandle, private _client: AspireClientRpc) {} + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the distributed application eventing service from the service provider */ /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + async _getEventingInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getEventing', rpcArgs ); - return new ContainerResource(result, this._client); + return new DistributedApplicationEventing(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._getEventingInternal()); } + /** Gets the logger factory from the service provider */ /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + async _getLoggerFactoryInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getLoggerFactory', rpcArgs ); - return new ContainerResource(result, this._client); + return new LoggerFactory(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._getLoggerFactoryInternal()); } + /** Gets the resource logger service from the service provider */ /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + async _getResourceLoggerServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceLoggerService', rpcArgs ); - return new ContainerResource(result, this._client); + return new ResourceLoggerService(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._getResourceLoggerServiceInternal()); } + /** Gets the distributed application model from the service provider */ /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + async _getDistributedApplicationModelInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getDistributedApplicationModel', rpcArgs ); - return new ContainerResource(result, this._client); + return new DistributedApplicationModel(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageTagInternal(tag)); + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._getDistributedApplicationModelInternal()); } + /** Gets the resource notification service from the service provider */ /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + async _getResourceNotificationServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceNotificationService', rpcArgs ); - return new ContainerResource(result, this._client); + return new ResourceNotificationService(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._getResourceNotificationServiceInternal()); } + /** Gets the user secrets manager from the service provider */ /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + async _getUserSecretsManagerInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getUserSecretsManager', rpcArgs ); - return new ContainerResource(result, this._client); + return new UserSecretsManager(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - const tag = options?.tag; - return new ContainerResourcePromise(this._withImageInternal(image, tag)); + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getUserSecretsManagerInternal()); } - /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', - rpcArgs - ); - return new ContainerResource(result, this._client); - } +} - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); - } +/** + * Thenable wrapper for ServiceProvider that enables fluent chaining. + */ +export class ServiceProviderPromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', - rpcArgs - ); - return new ContainerResource(result, this._client); + then( + onfulfilled?: ((value: ServiceProvider) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Gets the distributed application eventing service from the service provider */ + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.getEventing())); } - /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets the logger factory from the service provider */ + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._promise.then(obj => obj.getLoggerFactory())); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); + /** Gets the resource logger service from the service provider */ + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.getResourceLoggerService())); } - /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets the distributed application model from the service provider */ + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._promise.then(obj => obj.getDistributedApplicationModel())); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Gets the resource notification service from the service provider */ + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.getResourceNotificationService())); } - /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets the user secrets manager from the service provider */ + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getUserSecretsManager())); } - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsContainerInternal()); - } +} - /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', +// ============================================================================ +// UserSecretsManager +// ============================================================================ + +/** + * Type class for UserSecretsManager. + */ +export class UserSecretsManager { + constructor(private _handle: IUserSecretsManagerHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the IsAvailable property */ + isAvailable = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.isAvailable', + { context: this._handle } + ); + }, + }; + + /** Gets the FilePath property */ + filePath = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.filePath', + { context: this._handle } + ); + }, + }; + + /** Attempts to set a user secret value */ + async trySetSecret(name: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, name, value }; + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.trySetSecret', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } + /** Saves state to user secrets from a JSON string */ /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', + async _saveStateJsonInternal(json: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, json }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/saveStateJson', rpcArgs ); - return new ContainerResource(result, this._client); + return this; } - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNameInternal(name)); + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + const cancellationToken = options?.cancellationToken; + return new UserSecretsManagerPromise(this._saveStateJsonInternal(json, cancellationToken)); } + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + async _getOrSetSecretInternal(resourceBuilder: ResourceBuilderBase, name: string, value: string): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, resourceBuilder, name, value }; + await this._client.invokeCapability( + 'Aspire.Hosting/getOrSetSecret', rpcArgs ); - return new ContainerResource(result, this._client); + return this; } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getOrSetSecretInternal(resourceBuilder, name, value)); } - /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', - rpcArgs - ); - return new ContainerResource(result, this._client); +} + +/** + * Thenable wrapper for UserSecretsManager that enables fluent chaining. + */ +export class UserSecretsManagerPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: UserSecretsManager) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + /** Attempts to set a user secret value */ + trySetSecret(name: string, value: string): Promise { + return this._promise.then(obj => obj.trySetSecret(name, value)); + } + + /** Saves state to user secrets from a JSON string */ + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.saveStateJson(json, options))); + } + + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getOrSetSecret(resourceBuilder, name, value))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterInternal()); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); } - /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - const helpLink = options?.helpLink; - return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsInternal(args)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); - } - - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onConnectionStringAvailableInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceReadyInternal(callback)); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new ContainerResource(result, this._client); +} + +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromManifestInternal()); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForInternal(dependency)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExplicitStartInternal()); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - const exitCode = options?.exitCode; - return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - const password = options?.password; - return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ContainerResource(result, this._client); - } +} - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ + +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromMcpInternal()); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); + return new ContainerRegistryResource(result, this._client); } -} - -/** - * Thenable wrapper for ContainerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ContainerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Sets the container image registry */ - withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Configures the resource to be published as a container */ - publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); } - /** Sets the container name */ - withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceReadyInternal(callback)); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); - } +} - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); - } +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); - } - - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); - } - - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); - } - - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); - } - - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } - - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } - - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); - } - - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); - } - - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); - } - - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } - - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); - } - - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); - } - - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); - } - - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); - } - - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } } // ============================================================================ -// CSharpAppResource +// ContainerResource // ============================================================================ -export class CSharpAppResource extends ResourceBuilderBase { - constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withReplicasInternal(replicas: number): Promise { - const rpcArgs: Record = { builder: this._handle, replicas }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReplicas', - rpcArgs - ); - return new CSharpAppResource(result, this._client); - } - - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); - } - - /** @internal */ - private async _disableForwardedHeadersInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/disableForwardedHeaders', + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - const helpLink = options?.helpLink; - return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsInternal(args)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -5162,15 +6151,15 @@ export class CSharpAppResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -5179,72 +6168,72 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -5257,293 +6246,278 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); - } - - /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', - rpcArgs - ); - return new CSharpAppResource(result, this._client); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { const exitCode = options?.exitCode; - return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -5551,130 +6525,130 @@ export class CSharpAppResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { const commandOptions = options?.commandOptions; - return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { const password = options?.password; - return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { const iconVariant = options?.iconVariant; - return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -5683,15 +6657,15 @@ export class CSharpAppResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -5699,56 +6673,56 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -5759,60 +6733,79 @@ export class CSharpAppResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); } /** Gets the resource name */ @@ -5824,161 +6817,316 @@ export class CSharpAppResource extends ResourceBuilderBase { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceReadyInternal(callback)); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } +} - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -5987,163 +7135,163 @@ export class CSharpAppResourcePromise implements PromiseLike } /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } /** Gets the resource name */ @@ -6151,538 +7299,397 @@ export class CSharpAppResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ -// DotnetToolResource +// CSharpAppResource // ============================================================================ -export class DotnetToolResource extends ResourceBuilderBase { - constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withToolPackageInternal(packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPackage', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withToolVersionInternal(version: string): Promise { - const rpcArgs: Record = { builder: this._handle, version }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolVersion', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withToolPrereleaseInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPrerelease', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withToolSourceInternal(source: string): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolSource', + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); } /** @internal */ - private async _withToolIgnoreExistingFeedsInternal(): Promise { + private async _disableForwardedHeadersInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreExistingFeeds', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); } /** @internal */ - private async _withToolIgnoreFailedSourcesInternal(): Promise { + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreFailedSources', + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + const configure = options?.configure; + return new CSharpAppResourcePromise(this._publishAsDockerFileInternal(configure)); } /** @internal */ - private async _publishAsDockerFileInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFile', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; - const obj = new ContainerResource(objHandle, this._client); - await configure(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFileWithConfigure', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withExecutableCommandInternal(command: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExecutableCommand', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { - const rpcArgs: Record = { builder: this._handle, workingDirectory }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withWorkingDirectory', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new DotnetToolResource(result, this._client); - } - - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); - } - - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - const helpLink = options?.helpLink; - return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } - - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); - } - - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); - } - - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); - } - - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); - } - - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); - } - - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -6692,15 +7699,15 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -6709,72 +7716,72 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -6787,278 +7794,293 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { const exitCode = options?.exitCode; - return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -7066,130 +8088,130 @@ export class DotnetToolResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { const commandOptions = options?.commandOptions; - return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { const password = options?.password; - return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { const iconVariant = options?.iconVariant; - return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -7198,15 +8220,15 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -7214,56 +8236,56 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -7274,60 +8296,60 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -7339,201 +8361,246 @@ export class DotnetToolResource extends ResourceBuilderBase { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceReadyInternal(callback)); } - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -7542,158 +8609,163 @@ export class DotnetToolResourcePromise implements PromiseLike obj.asHttp2Service())); + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -7701,383 +8773,500 @@ export class DotnetToolResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ -// ExecutableResource +// DotnetToolResource // ============================================================================ -export class ExecutableResource extends ResourceBuilderBase { - constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - const helpLink = options?.helpLink; - return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + const name = options?.name; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); - } - - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); - } - - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -8087,15 +9276,15 @@ export class ExecutableResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -8104,72 +9293,72 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -8182,278 +9371,278 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { const exitCode = options?.exitCode; - return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -8461,130 +9650,130 @@ export class ExecutableResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { const commandOptions = options?.commandOptions; - return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { const password = options?.password; - return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { const iconVariant = options?.iconVariant; - return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -8593,15 +9782,15 @@ export class ExecutableResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -8609,56 +9798,56 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -8669,60 +9858,60 @@ export class ExecutableResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -8734,151 +9923,281 @@ export class ExecutableResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** - * Thenable wrapper for ExecutableResource that enables fluent chaining. + * Thenable wrapper for DotnetToolResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ExecutableResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -8887,158 +10206,158 @@ export class ExecutableResourcePromise implements PromiseLike obj.asHttp2Service())); + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -9046,1081 +10365,7579 @@ export class ExecutableResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ -// ExternalServiceResource +// ExecutableResource // ============================================================================ -export class ExternalServiceResource extends ResourceBuilderBase { - constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceReadyInternal(callback)); + } + +} + +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceReadyInternal(callback)); + } + +} + +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// JavaScriptAppResource +// ============================================================================ + +export class JavaScriptAppResource extends ResourceBuilderBase { + constructor(handle: JavaScriptAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new JavaScriptAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + const helpLink = options?.helpLink; + return new JavaScriptAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new JavaScriptAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new JavaScriptAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new JavaScriptAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new JavaScriptAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + const displayText = options?.displayText; + return new JavaScriptAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + const displayText = options?.displayText; + return new JavaScriptAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + const exitCode = options?.exitCode; + return new JavaScriptAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + const commandOptions = options?.commandOptions; + return new JavaScriptAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + const password = options?.password; + return new JavaScriptAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + const iconVariant = options?.iconVariant; + return new JavaScriptAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new JavaScriptAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withYarnInternal(install, installArgs)); + } + + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withPnpmInternal(install, installArgs)); + } + + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withRunScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + const browser = options?.browser; + return new JavaScriptAppResourcePromise(this._withBrowserDebuggerInternal(browser)); + } + +} + +/** + * Thenable wrapper for JavaScriptAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class JavaScriptAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: JavaScriptAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + +} + +// ============================================================================ +// NodeAppResource +// ============================================================================ + +export class NodeAppResource extends ResourceBuilderBase { + constructor(handle: NodeAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new NodeAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + const helpLink = options?.helpLink; + return new NodeAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new NodeAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new NodeAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + const exitCode = options?.exitCode; + return new NodeAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + const commandOptions = options?.commandOptions; + return new NodeAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + const password = options?.password; + return new NodeAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + const iconVariant = options?.iconVariant; + return new NodeAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new NodeAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withYarnInternal(install, installArgs)); + } + + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withPnpmInternal(install, installArgs)); + } + + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withRunScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + const browser = options?.browser; + return new NodeAppResourcePromise(this._withBrowserDebuggerInternal(browser)); + } + +} + +/** + * Thenable wrapper for NodeAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class NodeAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: NodeAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceReadyInternal(callback)); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + const configure = options?.configure; + return new ProjectResourcePromise(this._publishAsDockerFileInternal(configure)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - const helpLink = options?.helpLink; - return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); - } - - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); - } - - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); - } - - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); - } - - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - const commandOptions = options?.commandOptions; - return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); - } - - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); - } - - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); - } - - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - const iconVariant = options?.iconVariant; - return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); - } - - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); + return new ProjectResource(result, this._client); } -} - -/** - * Thenable wrapper for ExternalServiceResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ExternalServiceResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); } -} + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } -// ============================================================================ -// ParameterResource -// ============================================================================ + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } -export class ParameterResource extends ResourceBuilderBase { - constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, description }; - if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDescription', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - const enableMarkdown = options?.enableMarkdown; - return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - const helpLink = options?.helpLink; - return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new ParameterResource(result, this._client); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromManifestInternal()); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._withExplicitStartInternal()); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new ParameterResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - const commandOptions = options?.commandOptions; - return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceReadyInternal(callback)); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ParameterResource(result, this._client); +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - const iconVariant = options?.iconVariant; - return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromMcpInternal()); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } -} + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } -/** - * Thenable wrapper for ParameterResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ParameterResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } - then( - onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -10128,383 +17945,440 @@ export class ParameterResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ -// ProjectResource +// ViteAppResource // ============================================================================ -export class ProjectResource extends ResourceBuilderBase { - constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { +export class ViteAppResource extends ResourceBuilderBase { + constructor(handle: ViteAppResourceHandle, client: AspireClientRpc) { super(handle, client); } + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ViteAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _publishAsDockerFileInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterInternal()); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - const helpLink = options?.helpLink; - return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ViteAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { + const helpLink = options?.helpLink; + return new ViteAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ViteAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -10514,15 +18388,15 @@ export class ProjectResource extends ResourceBuilderBase if (isProxied !== undefined) rpcArgs.isProxied = isProxied; if (isExternal !== undefined) rpcArgs.isExternal = isExternal; if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -10531,72 +18405,72 @@ export class ProjectResource extends ResourceBuilderBase const isProxied = options?.isProxied; const isExternal = options?.isExternal; const protocol = options?.protocol; - return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + return new ViteAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -10609,293 +18483,308 @@ export class ProjectResource extends ResourceBuilderBase } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._clearContainerFilesSourcesInternal()); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { const exitCode = options?.exitCode; - return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ViteAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new ViteAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -10903,130 +18792,130 @@ export class ProjectResource extends ResourceBuilderBase }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { const commandOptions = options?.commandOptions; - return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ViteAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { const password = options?.password; - return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new ViteAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { const iconVariant = options?.iconVariant; - return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ViteAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -11035,15 +18924,15 @@ export class ProjectResource extends ResourceBuilderBase if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -11051,276 +18940,520 @@ export class ProjectResource extends ResourceBuilderBase const failureThreshold = options?.failureThreshold; const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new ViteAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ViteAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withViteConfigInternal(configPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, configPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withViteConfig', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withViteConfigInternal(configPath)); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withYarnInternal(install, installArgs)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withPnpmInternal(install, installArgs)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', rpcArgs ); - return new ProjectResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', rpcArgs ); + return new ViteAppResource(result, this._client); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + const browser = options?.browser; + return new ViteAppResourcePromise(this._withBrowserDebuggerInternal(browser)); } } /** - * Thenable wrapper for ProjectResource that enables fluent chaining. + * Thenable wrapper for ViteAppResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ProjectResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ViteAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ViteAppResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -11329,168 +19462,306 @@ export class ProjectResourcePromise implements PromiseLike { } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withViteConfig(configPath))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + +} + +// ============================================================================ +// ComputeResource +// ============================================================================ + +export class ComputeResource extends ResourceBuilderBase { + constructor(handle: IComputeResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); +} + +/** + * Thenable wrapper for ComputeResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ComputeResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ComputeResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } } @@ -11508,7 +19779,7 @@ export class ContainerFilesDestinationResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); return new ContainerFilesDestinationResource(result, this._client); @@ -11767,7 +20038,7 @@ export class Resource extends ResourceBuilderBase { private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new Resource(result, this._client); @@ -11782,7 +20053,7 @@ export class Resource extends ResourceBuilderBase { private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new Resource(result, this._client); @@ -11825,36 +20096,6 @@ export class Resource extends ResourceBuilderBase { return new ResourcePromise(this._excludeFromMcpInternal()); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -11932,6 +20173,86 @@ export class Resource extends ResourceBuilderBase { ); } + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -12029,16 +20350,6 @@ export class ResourcePromise implements PromiseLike { return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); @@ -12059,6 +20370,26 @@ export class ResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -12198,6 +20529,35 @@ export class ResourceWithConnectionString extends ResourceBuilderBase { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._onConnectionStringAvailableInternal(callback)); + } + } /** @@ -12225,6 +20585,16 @@ export class ResourceWithConnectionStringPromise implements PromiseLike obj.withConnectionPropertyValue(name, value))); } + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + } // ============================================================================ @@ -12513,6 +20883,26 @@ export class ResourceWithEndpoints extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + } /** @@ -12580,6 +20970,11 @@ export class ResourceWithEndpointsPromise implements PromiseLike obj.withHttpProbe(probeType, options))); } + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + } // ============================================================================ @@ -12622,41 +21017,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -12667,43 +21032,38 @@ export class ResourceWithEnvironment extends ResourceBuilderBase Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -12737,10 +21097,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -12752,37 +21113,8 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -12865,7 +21197,7 @@ export class ResourceWithEnvironment extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ResourceWithEnvironment(result, this._client); @@ -12919,31 +21251,21 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withOtlpExporterProtocol(protocol))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -12959,16 +21281,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -13006,34 +21318,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike { - constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { - super(handle, client); - } - -} - -/** - * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ResourceWithServiceDiscoveryPromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - -} - // ============================================================================ // ResourceWithWaitSupport // ============================================================================ @@ -13047,7 +21331,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -13077,7 +21361,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -13108,7 +21392,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -13227,7 +21511,7 @@ export async function createBuilder(options?: CreateBuilderOptions): Promise { const error = reason instanceof Error ? reason : new Error(String(reason)); - if (reason instanceof CapabilityError) { + if (reason instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else if (reason instanceof CapabilityError) { console.error(`\n❌ Capability Error: ${error.message}`); console.error(` Code: ${(reason as CapabilityError).code}`); if ((reason as CapabilityError).capability) { @@ -13258,8 +21544,12 @@ process.on('unhandledRejection', (reason: unknown) => { }); process.on('uncaughtException', (error: Error) => { - console.error(`\n❌ Uncaught Exception: ${error.message}`); - if (error.stack) { + if (error instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + } + if (!(error instanceof AppHostUsageError) && error.stack) { console.error(error.stack); } process.exit(1); @@ -13270,21 +21560,44 @@ process.on('uncaughtException', (error: Error) => { // ============================================================================ // Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent', (handle, client) => new AfterResourcesCreatedEvent(handle as AfterResourcesCreatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent', (handle, client) => new BeforeResourceStartedEvent(handle as BeforeResourceStartedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent', (handle, client) => new BeforeStartEvent(handle as BeforeStartEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent', (handle, client) => new ConnectionStringAvailableEvent(handle as ConnectionStringAvailableEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel', (handle, client) => new DistributedApplicationModel(handle as DistributedApplicationModelHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent', (handle, client) => new InitializeResourceEvent(handle as InitializeResourceEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext', (handle, client) => new PipelineContext(handle as PipelineContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext', (handle, client) => new PipelineStepFactoryContext(handle as PipelineStepFactoryContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary', (handle, client) => new PipelineSummary(handle as PipelineSummaryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent', (handle, client) => new ResourceEndpointsAllocatedEvent(handle as ResourceEndpointsAllocatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService', (handle, client) => new ResourceLoggerService(handle as ResourceLoggerServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService', (handle, client) => new ResourceNotificationService(handle as ResourceNotificationServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent', (handle, client) => new ResourceReadyEvent(handle as ResourceReadyEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent', (handle, client) => new ResourceStoppedEvent(handle as ResourceStoppedEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext', (handle, client) => new UpdateCommandStateContext(handle as UpdateCommandStateContextHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration', (handle, client) => new Configuration(handle as IConfigurationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment', (handle, client) => new HostEnvironment(handle as IHostEnvironmentHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger', (handle, client) => new Logger(handle as ILoggerHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory', (handle, client) => new LoggerFactory(handle as ILoggerFactoryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep', (handle, client) => new ReportingStep(handle as IReportingStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask', (handle, client) => new ReportingTask(handle as IReportingTaskHandle, client)); +registerHandleWrapper('System.ComponentModel/System.IServiceProvider', (handle, client) => new ServiceProvider(handle as IServiceProviderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IUserSecretsManager', (handle, client) => new UserSecretsManager(handle as IUserSecretsManagerHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); @@ -13292,8 +21605,12 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppR registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource', (handle, client) => new JavaScriptAppResource(handle as JavaScriptAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource', (handle, client) => new NodeAppResource(handle as NodeAppResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource', (handle, client) => new ViteAppResource(handle as ViteAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource', (handle, client) => new ComputeResource(handle as IComputeResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); @@ -13301,6 +21618,5 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceW registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); diff --git a/samples/custom-resources/ts/.modules/base.ts b/samples/custom-resources/ts/.modules/base.ts index 7778b0f1..b3d8b8be 100644 --- a/samples/custom-resources/ts/.modules/base.ts +++ b/samples/custom-resources/ts/.modules/base.ts @@ -1,8 +1,8 @@ -// aspire.ts - Core Aspire types: base classes, ReferenceExpression -import { Handle, AspireClient, MarshalledHandle } from './transport.js'; +// base.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle, CancellationToken, registerCancellation, registerHandleWrapper, unregisterCancellation } from './transport.js'; // Re-export transport types for convenience -export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export { Handle, AspireClient, CapabilityError, CancellationToken, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; @@ -43,22 +43,46 @@ export class ReferenceExpression { private readonly _format?: string; private readonly _valueProviders?: unknown[]; + // Conditional mode fields + private readonly _condition?: unknown; + private readonly _whenTrue?: ReferenceExpression; + private readonly _whenFalse?: ReferenceExpression; + private readonly _matchValue?: string; + // Handle mode fields (when wrapping a server-returned handle) private readonly _handle?: Handle; private readonly _client?: AspireClient; constructor(format: string, valueProviders: unknown[]); constructor(handle: Handle, client: AspireClient); - constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { - if (typeof handleOrFormat === 'string') { - this._format = handleOrFormat; - this._valueProviders = clientOrValueProviders as unknown[]; + constructor(condition: unknown, matchValue: string, whenTrue: ReferenceExpression, whenFalse: ReferenceExpression); + constructor( + handleOrFormatOrCondition: Handle | string | unknown, + clientOrValueProvidersOrMatchValue: AspireClient | unknown[] | string, + whenTrueOrWhenFalse?: ReferenceExpression, + whenFalse?: ReferenceExpression + ) { + if (typeof handleOrFormatOrCondition === 'string') { + this._format = handleOrFormatOrCondition; + this._valueProviders = clientOrValueProvidersOrMatchValue as unknown[]; + } else if (handleOrFormatOrCondition instanceof Handle) { + this._handle = handleOrFormatOrCondition; + this._client = clientOrValueProvidersOrMatchValue as AspireClient; } else { - this._handle = handleOrFormat; - this._client = clientOrValueProviders as AspireClient; + this._condition = handleOrFormatOrCondition; + this._matchValue = (clientOrValueProvidersOrMatchValue as string) ?? 'True'; + this._whenTrue = whenTrueOrWhenFalse; + this._whenFalse = whenFalse; } } + /** + * Gets whether this reference expression is conditional. + */ + get isConditional(): boolean { + return this._condition !== undefined; + } + /** * Creates a reference expression from a tagged template literal. * @@ -82,16 +106,46 @@ export class ReferenceExpression { return new ReferenceExpression(format, valueProviders); } + /** + * Creates a conditional reference expression from its constituent parts. + * + * @param condition - A value provider whose result is compared to matchValue + * @param whenTrue - The expression to use when the condition matches + * @param whenFalse - The expression to use when the condition does not match + * @param matchValue - The value to compare the condition against (defaults to "True") + * @returns A ReferenceExpression instance in conditional mode + */ + static createConditional( + condition: unknown, + matchValue: string, + whenTrue: ReferenceExpression, + whenFalse: ReferenceExpression + ): ReferenceExpression { + return new ReferenceExpression(condition, matchValue, whenTrue, whenFalse); + } + /** * Serializes the reference expression for JSON-RPC transport. - * In template-literal mode, uses the $expr format. + * In expression mode, uses the $expr format with format + valueProviders. + * In conditional mode, uses the $expr format with condition + whenTrue + whenFalse. * In handle mode, delegates to the handle's serialization. */ - toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } | { condition: unknown; whenTrue: unknown; whenFalse: unknown; matchValue: string } } | MarshalledHandle { if (this._handle) { return this._handle.toJSON(); } + if (this.isConditional) { + return { + $expr: { + condition: extractHandleForExpr(this._condition), + whenTrue: this._whenTrue!.toJSON(), + whenFalse: this._whenFalse!.toJSON(), + matchValue: this._matchValue! + } + }; + } + return { $expr: { format: this._format!, @@ -100,6 +154,30 @@ export class ReferenceExpression { }; } + /** + * Resolves the expression to its string value on the server. + * Only available on server-returned ReferenceExpression instances (handle mode). + * + * @param cancellationToken - Optional AbortSignal or CancellationToken for cancellation support + * @returns The resolved string value, or null if the expression resolves to null + */ + async getValue(cancellationToken?: AbortSignal | CancellationToken): Promise { + if (!this._handle || !this._client) { + throw new Error('getValue is only available on server-returned ReferenceExpression instances'); + } + const cancellationTokenId = registerCancellation(this._client, cancellationToken); + try { + const rpcArgs: Record = { context: this._handle }; + if (cancellationTokenId !== undefined) rpcArgs.cancellationToken = cancellationTokenId; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValue', + rpcArgs + ); + } finally { + unregisterCancellation(cancellationTokenId); + } + } + /** * String representation for debugging. */ @@ -107,10 +185,17 @@ export class ReferenceExpression { if (this._handle) { return `ReferenceExpression(handle)`; } + if (this.isConditional) { + return `ReferenceExpression(conditional)`; + } return `ReferenceExpression(${this._format})`; } } +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression', (handle, client) => + new ReferenceExpression(handle, client) +); + /** * Extracts a value for use in reference expressions. * Supports handles (objects) and string literals. @@ -136,15 +221,15 @@ function extractHandleForExpr(value: unknown): unknown { return value.toJSON(); } - // Objects with $handle property (already in handle format) - if (typeof value === 'object' && value !== null && '$handle' in value) { + // Objects with marshalled expression/handle payloads + if (typeof value === 'object' && value !== null && ('$handle' in value || '$expr' in value)) { return value; } - // Objects with toJSON that returns a handle + // Objects with toJSON that returns a marshalled expression or handle if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { const json = value.toJSON(); - if (json && typeof json === 'object' && '$handle' in json) { + if (json && typeof json === 'object' && ('$handle' in json || '$expr' in json)) { return json; } } @@ -307,11 +392,20 @@ export class AspireList { }) as T[]; } - toJSON(): MarshalledHandle { - if (this._resolvedHandle) { - return this._resolvedHandle.toJSON(); + async toTransportValue(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireList must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); } - return this._handleOrContext.toJSON(); + + return this._resolvedHandle.toJSON(); } } @@ -466,8 +560,19 @@ export class AspireDict { }) as Record; } - async toJSON(): Promise { + async toTransportValue(): Promise { const handle = await this._ensureHandle(); return handle.toJSON(); } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireDict must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); + } + + return this._resolvedHandle.toJSON(); + } } diff --git a/samples/custom-resources/ts/.modules/transport.ts b/samples/custom-resources/ts/.modules/transport.ts index 7bddd74b..6d29cf28 100644 --- a/samples/custom-resources/ts/.modules/transport.ts +++ b/samples/custom-resources/ts/.modules/transport.ts @@ -77,7 +77,8 @@ export function isAtsError(value: unknown): value is { $error: AtsError } { value !== null && typeof value === 'object' && '$error' in value && - typeof (value as { $error: unknown }).$error === 'object' + typeof (value as { $error: unknown }).$error === 'object' && + (value as { $error: unknown }).$error !== null ); } @@ -93,6 +94,47 @@ export function isMarshalledHandle(value: unknown): value is MarshalledHandle { ); } +function isAbortSignal(value: unknown): value is AbortSignal { + return ( + value !== null && + typeof value === 'object' && + 'aborted' in value && + 'addEventListener' in value && + 'removeEventListener' in value + ); +} + +function isPlainObject(value: unknown): value is Record { + if (value === null || typeof value !== 'object') { + return false; + } + + const prototype = Object.getPrototypeOf(value); + return prototype === Object.prototype || prototype === null; +} + +function hasTransportValue(value: unknown): value is { toTransportValue(): unknown | Promise } { + return ( + value !== null && + typeof value === 'object' && + 'toTransportValue' in value && + typeof (value as { toTransportValue?: unknown }).toTransportValue === 'function' + ); +} + +function createAbortError(message: string): Error { + const error = new Error(message); + error.name = 'AbortError'; + return error; +} + +function createCircularReferenceError(capabilityId: string, path: string): AppHostUsageError { + return new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' contains a circular reference. ` + + 'Circular references are not supported by the AppHost transport.' + ); +} + // ============================================================================ // Handle // ============================================================================ @@ -136,6 +178,92 @@ export class Handle { } } +// ============================================================================ +// CancellationToken +// ============================================================================ + +/** + * Represents a transport-safe cancellation token value for the generated SDK. + * + * Use a plain {@link AbortSignal} when you create cancellation in user code. + * Generated APIs accept either an {@link AbortSignal} or a {@link CancellationToken}. + * + * Values returned from generated callbacks and context/property getters are + * {@link CancellationToken} instances because they may reference remote + * cancellation token handles received from the AppHost. + * + * @example + * ```typescript + * const controller = new AbortController(); + * await connectionStringExpression.getValue(controller.signal); + * ``` + * + * @example + * ```typescript + * const cancellationToken = await context.cancellationToken.get(); + * const connectionStringExpression = await db.uriExpression.get(); + * const connectionString = await connectionStringExpression.getValue(cancellationToken); + * ``` + */ +export class CancellationToken { + private readonly _signal?: AbortSignal; + private readonly _remoteTokenId?: string; + + constructor(signal?: AbortSignal); + constructor(tokenId?: string); + constructor(value?: AbortSignal | string | null) { + if (typeof value === 'string') { + this._remoteTokenId = value; + } else if (isAbortSignal(value)) { + this._signal = value; + } + } + + /** + * Creates a cancellation token from a local {@link AbortSignal}. + */ + static from(signal?: AbortSignal): CancellationToken { + return new CancellationToken(signal); + } + + /** + * Creates a cancellation token from a transport value. + * Generated code uses this to materialize values that come from the AppHost. + */ + static fromValue(value: unknown): CancellationToken { + if (value instanceof CancellationToken) { + return value; + } + + if (typeof value === 'string') { + return new CancellationToken(value); + } + + if (isAbortSignal(value)) { + return new CancellationToken(value); + } + + return new CancellationToken(); + } + + /** + * Serializes the token for JSON-RPC transport. + */ + toJSON(): string | undefined { + return this._remoteTokenId; + } + + register(client?: AspireClient): string | undefined { + if (this._remoteTokenId !== undefined) { + return this._remoteTokenId; + } + + return client + ? registerCancellation(client, this._signal) + : registerCancellation(this._signal); + } +} + // ============================================================================ // Handle Wrapper Registry // ============================================================================ @@ -167,22 +295,35 @@ export function registerHandleWrapper(typeId: string, factory: HandleWrapperFact * @param client - Optional client for creating typed wrapper instances */ export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { - if (value && typeof value === 'object') { - if (isMarshalledHandle(value)) { - const handle = new Handle(value); - const typeId = value.$type; - - // Try to find a registered wrapper factory for this type - if (typeId && client) { - const factory = handleWrapperRegistry.get(typeId); - if (factory) { - return factory(handle, client); - } + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); } + } + + return handle; + } - return handle; + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + value[i] = wrapIfHandle(value[i], client); + } + + return value; + } + + if (isPlainObject(value)) { + for (const [key, nestedValue] of Object.entries(value)) { + value[key] = wrapIfHandle(nestedValue, client); } } + return value; } @@ -213,6 +354,76 @@ export class CapabilityError extends Error { } } +/** + * Error thrown when the AppHost script uses the generated SDK incorrectly. + */ +export class AppHostUsageError extends Error { + constructor(message: string) { + super(message); + this.name = 'AppHostUsageError'; + } +} + +function isPromiseLike(value: unknown): value is PromiseLike { + return ( + value !== null && + (typeof value === 'object' || typeof value === 'function') && + 'then' in value && + typeof (value as { then?: unknown }).then === 'function' + ); +} + +function validateCapabilityArgs( + capabilityId: string, + args?: Record +): void { + if (!args) { + return; + } + + const validateValue = (value: unknown, path: string, ancestors: Set): void => { + if (value === null || value === undefined) { + return; + } + + if (isPromiseLike(value)) { + throw new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' is a Promise-like value. ` + + `This usually means an async builder call was not awaited. ` + + `Did you forget 'await' on a call like builder.addPostgres(...) or resource.addDatabase(...)?` + ); + } + + if (typeof value !== 'object') { + return; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + ancestors.add(value); + try { + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + validateValue(value[i], `${path}[${i}]`, ancestors); + } + return; + } + + for (const [key, nestedValue] of Object.entries(value)) { + validateValue(nestedValue, `${path}.${key}`, ancestors); + } + } finally { + ancestors.delete(value); + } + }; + + for (const [key, value] of Object.entries(args)) { + validateValue(value, key, new Set()); + } +} + // ============================================================================ // Callback Registry // ============================================================================ @@ -324,21 +535,50 @@ export function getCallbackCount(): number { */ const cancellationRegistry = new Map void>(); let cancellationIdCounter = 0; +const connectedClients = new Set(); -/** - * A reference to the current AspireClient for sending cancel requests. - * Set by AspireClient.connect(). - */ -let currentClient: AspireClient | null = null; +function resolveCancellationClient(client?: AspireClient): AspireClient { + if (client) { + return client; + } + + if (connectedClients.size === 1) { + return connectedClients.values().next().value as AspireClient; + } + + if (connectedClients.size === 0) { + throw new Error( + 'registerCancellation(signal) requires a connected AspireClient. ' + + 'Pass the client explicitly or connect the client first.' + ); + } + + throw new Error( + 'registerCancellation(signal) is ambiguous when multiple AspireClient instances are connected. ' + + 'Pass the client explicitly.' + ); +} /** - * Register an AbortSignal for cancellation support. - * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * Registers cancellation support for a local signal or SDK cancellation token. + * Returns a cancellation ID that should be passed to methods accepting cancellation input. * * When the AbortSignal is aborted, sends a cancelToken request to the host. * - * @param signal - The AbortSignal to register (optional) - * @returns The cancellation ID, or undefined if no signal provided + * @param client - The AspireClient that should route the cancellation request + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + */ +export function registerCancellation(client: AspireClient, signalOrToken?: AbortSignal | CancellationToken): string | undefined; +/** + * Registers cancellation support using the single connected AspireClient. + * + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + * + * @example + * const controller = new AbortController(); + * await expression.getValue(controller.signal); * * @example * const controller = new AbortController(); @@ -346,14 +586,29 @@ let currentClient: AspireClient | null = null; * // Pass id to capability invocation * // Later: controller.abort() will cancel the operation */ -export function registerCancellation(signal?: AbortSignal): string | undefined { - if (!signal) { +export function registerCancellation(signalOrToken?: AbortSignal | CancellationToken): string | undefined; +export function registerCancellation( + clientOrSignalOrToken?: AspireClient | AbortSignal | CancellationToken, + maybeSignalOrToken?: AbortSignal | CancellationToken +): string | undefined { + const client = clientOrSignalOrToken instanceof AspireClient ? clientOrSignalOrToken : undefined; + const signalOrToken = client + ? maybeSignalOrToken + : clientOrSignalOrToken as AbortSignal | CancellationToken | undefined; + + if (!signalOrToken) { return undefined; } - // Already aborted? Don't register + if (signalOrToken instanceof CancellationToken) { + return signalOrToken.register(client); + } + + const signal = signalOrToken; + const cancellationClient = resolveCancellationClient(client); + if (signal.aborted) { - return undefined; + throw createAbortError('The operation was aborted before it was sent to the AppHost.'); } const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; @@ -361,8 +616,8 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { // Set up the abort listener const onAbort = () => { // Send cancel request to host - if (currentClient?.connected) { - currentClient.cancelToken(cancellationId).catch(() => { + if (cancellationClient.connected) { + cancellationClient.cancelToken(cancellationId).catch(() => { // Ignore errors - the operation may have already completed }); } @@ -381,6 +636,56 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { return cancellationId; } +async function marshalTransportValue( + value: unknown, + client: AspireClient, + cancellationIds: string[], + capabilityId: string, + path: string = 'args', + ancestors: Set = new Set() +): Promise { + if (value === null || value === undefined || typeof value !== 'object') { + return value; + } + + if (value instanceof CancellationToken) { + const cancellationId = value.register(client); + if (cancellationId !== undefined) { + cancellationIds.push(cancellationId); + } + + return cancellationId; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + const nextAncestors = new Set(ancestors); + nextAncestors.add(value); + + if (hasTransportValue(value)) { + return await marshalTransportValue(await value.toTransportValue(), client, cancellationIds, capabilityId, path, nextAncestors); + } + + if (Array.isArray(value)) { + return await Promise.all( + value.map((item, index) => marshalTransportValue(item, client, cancellationIds, capabilityId, `${path}[${index}]`, nextAncestors)) + ); + } + + if (isPlainObject(value)) { + const entries = await Promise.all( + Object.entries(value).map(async ([key, nestedValue]) => + [key, await marshalTransportValue(nestedValue, client, cancellationIds, capabilityId, `${path}.${key}`, nextAncestors)] as const) + ); + + return Object.fromEntries(entries); + } + + return value; +} + /** * Unregister a cancellation token by its ID. * Call this when the operation completes to clean up resources. @@ -411,6 +716,8 @@ export class AspireClient { private socket: net.Socket | null = null; private disconnectCallbacks: (() => void)[] = []; private _pendingCalls = 0; + private _connectPromise: Promise | null = null; + private _disconnectNotified = false; constructor(private socketPath: string) { } @@ -422,6 +729,12 @@ export class AspireClient { } private notifyDisconnect(): void { + if (this._disconnectNotified) { + return; + } + + this._disconnectNotified = true; + for (const callback of this.disconnectCallbacks) { try { callback(); @@ -432,30 +745,106 @@ export class AspireClient { } connect(timeoutMs: number = 5000): Promise { - return new Promise((resolve, reject) => { - const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + if (this.connected) { + return Promise.resolve(); + } + + if (this._connectPromise) { + return this._connectPromise; + } + + this._disconnectNotified = false; + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this._connectPromise = new Promise((resolve, reject) => { + const socket = net.createConnection(pipePath); + this.socket = socket; - // On Windows, use named pipes; on Unix, use Unix domain sockets - const isWindows = process.platform === 'win32'; - const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + let settled = false; - this.socket = net.createConnection(pipePath); + const cleanupPendingListeners = () => { + socket.removeListener('connect', onConnect); + socket.removeListener('error', onPendingError); + socket.removeListener('close', onPendingClose); + }; - this.socket.once('error', (error: Error) => { + const failConnect = (error: Error) => { + if (settled) { + return; + } + + settled = true; clearTimeout(timeout); + cleanupPendingListeners(); + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + if (!socket.destroyed) { + socket.destroy(); + } + reject(error); - }); + }; + + const onConnectedSocketError = (error: Error) => { + console.error('Socket error:', error); + }; + + const onConnectedSocketClose = () => { + socket.removeListener('error', onConnectedSocketError); + + if (this.socket && this.socket !== socket) { + return; + } + + const connection = this.connection; + this.connection = null; + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + this.notifyDisconnect(); + }; + + const onPendingError = (error: Error) => { + failConnect(error); + }; + + const onPendingClose = () => { + failConnect(new Error('Connection closed before JSON-RPC was established')); + }; + + const onConnect = async () => { + if (settled) { + return; + } - this.socket.once('connect', () => { clearTimeout(timeout); + cleanupPendingListeners(); + try { - const reader = new rpc.SocketMessageReader(this.socket!); - const writer = new rpc.SocketMessageWriter(this.socket!); + const reader = new rpc.SocketMessageReader(socket); + const writer = new rpc.SocketMessageWriter(socket); this.connection = rpc.createMessageConnection(reader, writer); this.connection.onClose(() => { this.connection = null; - this.notifyDisconnect(); }); this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); @@ -475,26 +864,39 @@ export class AspireClient { } }); + socket.on('error', onConnectedSocketError); + socket.on('close', onConnectedSocketClose); + + const authToken = process.env.ASPIRE_REMOTE_APPHOST_TOKEN; + if (!authToken) { + throw new Error('ASPIRE_REMOTE_APPHOST_TOKEN environment variable is not set.'); + } this.connection.listen(); + const authenticated = await this.connection.sendRequest('authenticate', authToken); + if (!authenticated) { + throw new Error('Failed to authenticate to the AppHost server.'); + } - // Set the current client for cancellation registry - currentClient = this; + connectedClients.add(this); + this._connectPromise = null; + settled = true; resolve(); - } catch (e) { - reject(e); + } catch (error) { + failConnect(error instanceof Error ? error : new Error(String(error))); } - }); + }; - this.socket.on('close', () => { - this.connection?.dispose(); - this.connection = null; - if (currentClient === this) { - currentClient = null; - } - this.notifyDisconnect(); - }); + const timeout = setTimeout(() => { + failConnect(new Error('Connection timeout')); + }, timeoutMs); + + socket.once('error', onPendingError); + socket.once('close', onPendingClose); + socket.once('connect', onConnect); }); + + return this._connectPromise; } ping(): Promise { @@ -533,39 +935,66 @@ export class AspireClient { throw new Error('Not connected to AppHost'); } - // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. - // We ref() during RPC calls so the process doesn't exit mid-call, and - // unref() when idle so the process can exit naturally after all work completes. - if (this._pendingCalls === 0) { - this.socket?.ref(); - } - this._pendingCalls++; + validateCapabilityArgs(capabilityId, args); + const cancellationIds: string[] = []; try { - const result = await this.connection.sendRequest( - 'invokeCapability', - capabilityId, - args ?? null - ); + const rpcArgs = await marshalTransportValue(args ?? null, this, cancellationIds, capabilityId); - // Check for structured error response - if (isAtsError(result)) { - throw new CapabilityError(result.$error); + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); } + this._pendingCalls++; - // Wrap handles automatically - return wrapIfHandle(result, this) as T; + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + rpcArgs + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } } finally { - this._pendingCalls--; - if (this._pendingCalls === 0) { - this.socket?.unref(); + for (const cancellationId of cancellationIds) { + unregisterCancellation(cancellationId); } } } disconnect(): void { - try { this.connection?.dispose(); } finally { this.connection = null; } - try { this.socket?.end(); } finally { this.socket = null; } + const connection = this.connection; + const socket = this.socket; + + this.connection = null; + this.socket = null; + this._connectPromise = null; + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + if (socket && !socket.destroyed) { + socket.end(); + socket.destroy(); + } } get connected(): boolean { diff --git a/samples/custom-resources/ts/apphost.run.json b/samples/custom-resources/ts/aspire.config.json similarity index 67% rename from samples/custom-resources/ts/apphost.run.json rename to samples/custom-resources/ts/aspire.config.json index 6bc233ec..c69986ad 100644 --- a/samples/custom-resources/ts/apphost.run.json +++ b/samples/custom-resources/ts/aspire.config.json @@ -1,4 +1,11 @@ { + "appHost": { + "path": "apphost.ts", + "language": "typescript/nodejs" + }, + "packages": { + "Aspire.Hosting.JavaScript": "13.2.0" + }, "profiles": { "https": { "applicationUrl": "https://localhost:14749;http://localhost:19147", @@ -8,4 +15,4 @@ } } } -} \ No newline at end of file +} diff --git a/samples/database-containers/ts/.aspire/settings.json b/samples/database-containers/ts/.aspire/settings.json deleted file mode 100644 index 847e6309..00000000 --- a/samples/database-containers/ts/.aspire/settings.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "appHostPath": "../apphost.ts", - "language": "typescript/nodejs", - "channel": "staging", - "sdkVersion": "13.2.0-preview.1.26159.1", - "packages": { - "Aspire.Hosting.MySql": "13.2.0-preview.1.26159.1", - "Aspire.Hosting.SqlServer": "13.2.0-preview.1.26159.1", - "Aspire.Hosting.PostgreSQL": "13.2.0-preview.1.26159.1" - } -} \ No newline at end of file diff --git a/samples/database-containers/ts/.modules/.codegen-hash b/samples/database-containers/ts/.modules/.codegen-hash index 2d458169..251ffead 100644 --- a/samples/database-containers/ts/.modules/.codegen-hash +++ b/samples/database-containers/ts/.modules/.codegen-hash @@ -1 +1 @@ -FAB8AD59B56D9F8877DFAFD7060D80050FD8C598324727D81CD00E2A094EF5FD \ No newline at end of file +2412A9A9784EEE5F3243400CBE90CDDBC097AC1E126E85F761675CB8572FC775 \ No newline at end of file diff --git a/samples/database-containers/ts/.modules/aspire.ts b/samples/database-containers/ts/.modules/aspire.ts index 5b8421d8..d4be9f22 100644 --- a/samples/database-containers/ts/.modules/aspire.ts +++ b/samples/database-containers/ts/.modules/aspire.ts @@ -8,6 +8,8 @@ import { AspireClient as AspireClientRpc, Handle, MarshalledHandle, + AppHostUsageError, + CancellationToken, CapabilityError, registerCallback, wrapIfHandle, @@ -26,6 +28,15 @@ import { // Handle Type Aliases (Internal - not exported to users) // ============================================================================ +/** Handle to JavaScriptAppResource */ +type JavaScriptAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource'>; + +/** Handle to NodeAppResource */ +type NodeAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource'>; + +/** Handle to ViteAppResource */ +type ViteAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource'>; + /** Handle to MySqlDatabaseResource */ type MySqlDatabaseResourceHandle = Handle<'Aspire.Hosting.MySql/Aspire.Hosting.ApplicationModel.MySqlDatabaseResource'>; @@ -56,9 +67,21 @@ type SqlServerDatabaseResourceHandle = Handle<'Aspire.Hosting.SqlServer/Aspire.H /** Handle to SqlServerServerResource */ type SqlServerServerResourceHandle = Handle<'Aspire.Hosting.SqlServer/Aspire.Hosting.ApplicationModel.SqlServerServerResource'>; +/** Handle to AfterResourcesCreatedEvent */ +type AfterResourcesCreatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent'>; + +/** Handle to BeforeResourceStartedEvent */ +type BeforeResourceStartedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent'>; + +/** Handle to BeforeStartEvent */ +type BeforeStartEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent'>; + /** Handle to CommandLineArgsCallbackContext */ type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; +/** Handle to ConnectionStringAvailableEvent */ +type ConnectionStringAvailableEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent'>; + /** Handle to ContainerRegistryResource */ type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; @@ -68,6 +91,9 @@ type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Application /** Handle to CSharpAppResource */ type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; +/** Handle to DistributedApplicationModel */ +type DistributedApplicationModelHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel'>; + /** Handle to DotnetToolResource */ type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; @@ -86,9 +112,15 @@ type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicatio /** Handle to ExecuteCommandContext */ type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; +/** Handle to IComputeResource */ +type IComputeResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource'>; + /** Handle to IContainerFilesDestinationResource */ type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; +/** Handle to InitializeResourceEvent */ +type InitializeResourceEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent'>; + /** Handle to IResource */ type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; @@ -119,15 +151,27 @@ type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicati /** Handle to ReferenceExpressionBuilder */ type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; +/** Handle to ResourceEndpointsAllocatedEvent */ +type ResourceEndpointsAllocatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent'>; + /** Handle to ResourceLoggerService */ type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; /** Handle to ResourceNotificationService */ type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; +/** Handle to ResourceReadyEvent */ +type ResourceReadyEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent'>; + +/** Handle to ResourceStoppedEvent */ +type ResourceStoppedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent'>; + /** Handle to ResourceUrlsCallbackContext */ type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; +/** Handle to UpdateCommandStateContext */ +type UpdateCommandStateContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext'>; + /** Handle to ConnectionStringResource */ type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; @@ -152,18 +196,33 @@ type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hostin /** Handle to IResourceWithContainerFiles */ type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; -/** Handle to IResourceWithServiceDiscovery */ -type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; +/** Handle to IUserSecretsManager */ +type IUserSecretsManagerHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IUserSecretsManager'>; + +/** Handle to IReportingStep */ +type IReportingStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep'>; + +/** Handle to IReportingTask */ +type IReportingTaskHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask'>; /** Handle to PipelineConfigurationContext */ type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; +/** Handle to PipelineContext */ +type PipelineContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext'>; + /** Handle to PipelineStep */ type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; /** Handle to PipelineStepContext */ type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; +/** Handle to PipelineStepFactoryContext */ +type PipelineStepFactoryContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext'>; + +/** Handle to PipelineSummary */ +type PipelineSummaryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary'>; + /** Handle to ProjectResourceOptions */ type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; @@ -176,12 +235,18 @@ type ListanyHandle = Handle<'Aspire.Hosting/List'>; /** Handle to IConfiguration */ type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; +/** Handle to IConfigurationSection */ +type IConfigurationSectionHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfigurationSection'>; + /** Handle to IHostEnvironment */ type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; /** Handle to ILogger */ type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; +/** Handle to ILoggerFactory */ +type ILoggerFactoryHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory'>; + /** Handle to string[] */ type stringArrayHandle = Handle<'string[]'>; @@ -221,6 +286,7 @@ export enum EndpointProperty { Scheme = "Scheme", TargetPort = "TargetPort", HostAndPort = "HostAndPort", + TlsEnabled = "TlsEnabled", } /** Enum type for IconVariant */ @@ -352,6 +418,10 @@ export interface AddConnectionStringOptions { environmentVariableName?: string; } +export interface AddContainerRegistryFromStringOptions { + repository?: string; +} + export interface AddContainerRegistryOptions { repository?: ParameterResource; } @@ -365,6 +435,10 @@ export interface AddDockerfileOptions { stage?: string; } +export interface AddJavaScriptAppOptions { + runScriptName?: string; +} + export interface AddMySqlOptions { password?: ParameterResource; port?: number; @@ -378,6 +452,11 @@ export interface AddParameterOptions { secret?: boolean; } +export interface AddParameterWithValueOptions { + publishValueAsDefault?: boolean; + secret?: boolean; +} + export interface AddPostgresOptions { userName?: ParameterResource; password?: ParameterResource; @@ -389,6 +468,10 @@ export interface AddSqlServerOptions { port?: number; } +export interface AddViteAppOptions { + runScriptName?: string; +} + export interface AppendFormattedOptions { format?: string; } @@ -397,22 +480,89 @@ export interface AppendValueProviderOptions { format?: string; } +export interface CompleteStepMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteStepOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskOptions { + completionMessage?: string; + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateMarkdownTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + export interface GetValueAsyncOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface PublishAsDockerFileOptions { + configure?: (obj: ContainerResource) => Promise; +} + +export interface PublishResourceUpdateOptions { + state?: string; + stateStyle?: string; } export interface RunOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface SaveStateJsonOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskMarkdownOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; } export interface WaitForCompletionOptions { exitCode?: number; } +export interface WaitForResourceStateOptions { + targetState?: string; +} + export interface WithBindMountOptions { isReadOnly?: boolean; } +export interface WithBrowserDebuggerOptions { + browser?: string; +} + +export interface WithBuildScriptOptions { + args?: string[]; +} + +export interface WithBunOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithCommandOptions { commandOptions?: CommandOptions; } @@ -509,6 +659,12 @@ export interface WithMcpServerOptions { endpointName?: string; } +export interface WithNpmOptions { + install?: boolean; + installCommand?: string; + installArgs?: string[]; +} + export interface WithPgAdminOptions { configureContainer?: (obj: PgAdminContainerResource) => Promise; containerName?: string; @@ -531,6 +687,11 @@ export interface WithPipelineStepFactoryOptions { description?: string; } +export interface WithPnpmOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithPostgresMcpOptions { configureContainer?: (obj: PostgresMcpContainerResource) => Promise; containerName?: string; @@ -539,12 +700,17 @@ export interface WithPostgresMcpOptions { export interface WithReferenceOptions { connectionName?: string; optional?: boolean; + name?: string; } export interface WithRequiredCommandOptions { helpLink?: string; } +export interface WithRunScriptOptions { + args?: string[]; +} + export interface WithUrlExpressionOptions { displayText?: string; } @@ -558,6 +724,122 @@ export interface WithVolumeOptions { isReadOnly?: boolean; } +export interface WithYarnOptions { + install?: boolean; + installArgs?: string[]; +} + +// ============================================================================ +// AfterResourcesCreatedEvent +// ============================================================================ + +/** + * Type class for AfterResourcesCreatedEvent. + */ +export class AfterResourcesCreatedEvent { + constructor(private _handle: AfterResourcesCreatedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeResourceStartedEvent +// ============================================================================ + +/** + * Type class for BeforeResourceStartedEvent. + */ +export class BeforeResourceStartedEvent { + constructor(private _handle: BeforeResourceStartedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeStartEvent +// ============================================================================ + +/** + * Type class for BeforeStartEvent. + */ +export class BeforeStartEvent { + constructor(private _handle: BeforeStartEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + // ============================================================================ // CommandLineArgsCallbackContext // ============================================================================ @@ -587,11 +869,12 @@ export class CommandLineArgsCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, }; @@ -606,6 +889,65 @@ export class CommandLineArgsCallbackContext { }, }; + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ConnectionStringAvailableEvent +// ============================================================================ + +/** + * Type class for ConnectionStringAvailableEvent. + */ +export class ConnectionStringAvailableEvent { + constructor(private _handle: ConnectionStringAvailableEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + } // ============================================================================ @@ -623,9 +965,9 @@ export class DistributedApplication { /** Runs the distributed application */ /** @internal */ - async _runInternal(cancellationToken?: AbortSignal): Promise { + async _runInternal(cancellationToken?: AbortSignal | CancellationToken): Promise { const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); await this._client.invokeCapability( 'Aspire.Hosting/run', rpcArgs @@ -699,6 +1041,17 @@ export class DistributedApplicationExecutionContext { }, }; + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the IsPublishMode property */ isPublishMode = { get: async (): Promise => { @@ -721,6 +1074,70 @@ export class DistributedApplicationExecutionContext { } +// ============================================================================ +// DistributedApplicationModel +// ============================================================================ + +/** + * Type class for DistributedApplicationModel. + */ +export class DistributedApplicationModel { + constructor(private _handle: DistributedApplicationModelHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets resources from the distributed application model */ + async getResources(): Promise { + const rpcArgs: Record = { model: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResources', + rpcArgs + ); + } + + /** Finds a resource by name */ + /** @internal */ + async _findResourceByNameInternal(name: string): Promise { + const rpcArgs: Record = { model: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/findResourceByName', + rpcArgs + ); + return new Resource(result, this._client); + } + + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._findResourceByNameInternal(name)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationModel that enables fluent chaining. + */ +export class DistributedApplicationModelPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationModel) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets resources from the distributed application model */ + getResources(): Promise { + return this._promise.then(obj => obj.getResources()); + } + + /** Finds a resource by name */ + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.findResourceByName(name))); + } + +} + // ============================================================================ // EndpointReference // ============================================================================ @@ -734,6 +1151,17 @@ export class EndpointReference { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.resource', + { context: this._handle } + ); + return new ResourceWithEndpoints(handle, this._client); + }, + }; + /** Gets the EndpointName property */ endpointName = { get: async (): Promise => { @@ -800,6 +1228,16 @@ export class EndpointReference { }, }; + /** Gets the TlsEnabled property */ + tlsEnabled = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.tlsEnabled', + { context: this._handle } + ); + }, + }; + /** Gets the Port property */ port = { get: async (): Promise => { @@ -854,13 +1292,22 @@ export class EndpointReference { async getValueAsync(options?: GetValueAsyncOptions): Promise { const cancellationToken = options?.cancellationToken; const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); return await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/getValueAsync', rpcArgs ); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + async getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + const rpcArgs: Record = { context: this._handle, enabledValue, disabledValue }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.getTlsValue', + rpcArgs + ); + } + } /** @@ -881,6 +1328,11 @@ export class EndpointReferencePromise implements PromiseLike return this._promise.then(obj => obj.getValueAsync(options)); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + return this._promise.then(obj => obj.getTlsValue(enabledValue, disabledValue)); + } + } // ============================================================================ @@ -958,11 +1410,34 @@ export class EnvironmentCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; @@ -992,6 +1467,17 @@ export class ExecuteCommandContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the ResourceName property */ resourceName = { get: async (): Promise => { @@ -1010,16 +1496,17 @@ export class ExecuteCommandContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, - set: async (value: AbortSignal): Promise => { + set: async (value: AbortSignal | CancellationToken): Promise => { await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', - { context: this._handle, value } + { context: this._handle, value: CancellationToken.fromValue(value) } ); } }; @@ -1027,34 +1514,126 @@ export class ExecuteCommandContext { } // ============================================================================ -// PipelineConfigurationContext +// InitializeResourceEvent // ============================================================================ /** - * Type class for PipelineConfigurationContext. + * Type class for InitializeResourceEvent. */ -export class PipelineConfigurationContext { - constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} +export class InitializeResourceEvent { + constructor(private _handle: InitializeResourceEventHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the Steps property */ - steps = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.resource', { context: this._handle } ); + return new Resource(handle, this._client); }, - set: async (value: PipelineStep[]): Promise => { - await this._client.invokeCapability( + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Notifications property */ + notifications = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.notifications', + { context: this._handle } + ); + return new ResourceNotificationService(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + { context: this._handle } + ); + }, + set: async (value: PipelineStep[]): Promise => { + await this._client.invokeCapability( 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', { context: this._handle, value } ); } }; + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + /** Gets pipeline steps with the specified tag */ async getStepsByTag(tag: string): Promise { const rpcArgs: Record = { context: this._handle, tag }; @@ -1086,6 +1665,93 @@ export class PipelineConfigurationContextPromise implements PromiseLike => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + set: async (value: AbortSignal | CancellationToken): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.setCancellationToken', + { context: this._handle, value: CancellationToken.fromValue(value) } + ); + } + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + // ============================================================================ // PipelineStep // ============================================================================ @@ -1173,6 +1839,17 @@ export class PipelineStep { return this._tags; } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + /** Adds a dependency on another step by name */ /** @internal */ async _dependsOnInternal(stepName: string): Promise { @@ -1243,6 +1920,39 @@ export class PipelineStepContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the ReportingStep property */ + reportingStep = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.reportingStep', + { context: this._handle } + ); + return new ReportingStep(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + /** Gets the ExecutionContext property */ executionContext = { get: async (): Promise => { @@ -1254,18 +1964,159 @@ export class PipelineStepContext { }, }; + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineStepFactoryContext +// ============================================================================ + +/** + * Type class for PipelineStepFactoryContext. + */ +export class PipelineStepFactoryContext { + constructor(private _handle: PipelineStepFactoryContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; } +// ============================================================================ +// PipelineSummary +// ============================================================================ + +/** + * Type class for PipelineSummary. + */ +export class PipelineSummary { + constructor(private _handle: PipelineSummaryHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Add method */ + /** @internal */ + async _addInternal(key: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, key, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineSummary.add', + rpcArgs + ); + return this; + } + + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addInternal(key, value)); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + /** @internal */ + async _addMarkdownInternal(key: string, markdownString: string): Promise { + const rpcArgs: Record = { summary: this._handle, key, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/addMarkdown', + rpcArgs + ); + return this; + } + + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addMarkdownInternal(key, markdownString)); + } + +} + +/** + * Thenable wrapper for PipelineSummary that enables fluent chaining. + */ +export class PipelineSummaryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineSummary) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Add method */ + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.add(key, value))); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.addMarkdown(key, markdownString))); + } + +} + // ============================================================================ // ProjectResourceOptions // ============================================================================ @@ -1448,3082 +2299,3402 @@ export class ReferenceExpressionBuilderPromise implements PromiseLike; - get urls(): AspireList { - if (!this._urls) { - this._urls = new AspireList( - this._handle, - this._client, - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' - ); - } - return this._urls; - } - - /** Gets the CancellationToken property */ - cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.resource', { context: this._handle } ); + return new Resource(handle, this._client); }, }; - /** Gets the ExecutionContext property */ - executionContext = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.services', { context: this._handle } ); - return new DistributedApplicationExecutionContext(handle, this._client); + return new ServiceProvider(handle, this._client); }, }; } // ============================================================================ -// DistributedApplicationBuilder +// ResourceLoggerService // ============================================================================ /** - * Type class for DistributedApplicationBuilder. + * Type class for ResourceLoggerService. */ -export class DistributedApplicationBuilder { - constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} +export class ResourceLoggerService { + constructor(private _handle: ResourceLoggerServiceHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the AppHostDirectory property */ - appHostDirectory = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', - { context: this._handle } - ); - }, - }; - - /** Gets the Eventing property */ - eventing = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', - { context: this._handle } - ); - return new DistributedApplicationEventing(handle, this._client); - }, - }; - - /** Gets the ExecutionContext property */ - executionContext = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', - { context: this._handle } - ); - return new DistributedApplicationExecutionContext(handle, this._client); - }, - }; - - /** Builds the distributed application */ + /** Completes the log stream for a resource */ /** @internal */ - async _buildInternal(): Promise { - const rpcArgs: Record = { context: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/build', + async _completeLogInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { loggerService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLog', rpcArgs ); - return new DistributedApplication(result, this._client); + return this; } - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._buildInternal()); + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogInternal(resource)); } - /** Adds a connection string with a builder callback */ + /** Completes the log stream by resource name */ /** @internal */ - async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { - const connectionStringBuilderId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; - const obj = new ReferenceExpressionBuilder(objHandle, this._client); - await connectionStringBuilder(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionStringBuilder', + async _completeLogByNameInternal(resourceName: string): Promise { + const rpcArgs: Record = { loggerService: this._handle, resourceName }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLogByName', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return this; } - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogByNameInternal(resourceName)); } - /** Adds a container registry resource */ - /** @internal */ - async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpoint }; - if (repository !== undefined) rpcArgs.repository = repository; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainerRegistry', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } +} - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - const repository = options?.repository; - return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); - } +/** + * Thenable wrapper for ResourceLoggerService that enables fluent chaining. + */ +export class ResourceLoggerServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** Adds a container resource */ - /** @internal */ - async _addContainerInternal(name: string, image: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, image }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainer', - rpcArgs - ); - return new ContainerResource(result, this._client); + then( + onfulfilled?: ((value: ResourceLoggerService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._addContainerInternal(name, image)); + /** Completes the log stream for a resource */ + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLog(resource))); } - /** Adds a container resource built from a Dockerfile */ - /** @internal */ - async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDockerfile', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Completes the log stream by resource name */ + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLogByName(resourceName))); } - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); - } +} - /** Adds a .NET tool resource */ - /** @internal */ - async _addDotnetToolInternal(name: string, packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDotnetTool', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } +// ============================================================================ +// ResourceNotificationService +// ============================================================================ - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); - } +/** + * Type class for ResourceNotificationService. + */ +export class ResourceNotificationService { + constructor(private _handle: ResourceNotificationServiceHandle, private _client: AspireClientRpc) {} - /** Adds an executable resource */ + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Waits for a resource to reach a specified state */ /** @internal */ - async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExecutable', + async _waitForResourceStateInternal(resourceName: string, targetState?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + if (targetState !== undefined) rpcArgs.targetState = targetState; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceState', rpcArgs ); - return new ExecutableResource(result, this._client); + return this; } - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + const targetState = options?.targetState; + return new ResourceNotificationServicePromise(this._waitForResourceStateInternal(resourceName, targetState)); } - /** Adds an external service resource */ - /** @internal */ - async _addExternalServiceInternal(name: string, url: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, url }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExternalService', + /** Waits for a resource to reach one of the specified states */ + async waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName, targetStates }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStates', rpcArgs ); - return new ExternalServiceResource(result, this._client); - } - - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); } - /** Adds a parameter resource */ - /** @internal */ - async _addParameterInternal(name: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameter', + /** Waits for a resource to become healthy */ + async waitForResourceHealthy(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceHealthy', rpcArgs ); - return new ParameterResource(result, this._client); - } - - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterInternal(name, secret)); } - /** Adds a parameter sourced from configuration */ + /** Waits for all dependencies of a resource to be ready */ /** @internal */ - async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name, configurationKey }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameterFromConfiguration', + async _waitForDependenciesInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForDependencies', rpcArgs ); - return new ParameterResource(result, this._client); + return this; } - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._waitForDependenciesInternal(resource)); } - /** Adds a connection string resource */ - /** @internal */ - async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionString', + /** Tries to get the current state of a resource */ + async tryGetResourceState(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/tryGetResourceState', rpcArgs ); - return new ResourceWithConnectionString(result, this._client); } - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - const environmentVariableName = options?.environmentVariableName; - return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); - } - - /** Adds a .NET project resource */ + /** Publishes an update for a resource's state */ /** @internal */ - async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProject', + async _publishResourceUpdateInternal(resource: ResourceBuilderBase, state?: string, stateStyle?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + if (state !== undefined) rpcArgs.state = state; + if (stateStyle !== undefined) rpcArgs.stateStyle = stateStyle; + await this._client.invokeCapability( + 'Aspire.Hosting/publishResourceUpdate', rpcArgs ); - return new ProjectResource(result, this._client); + return this; } - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + const state = options?.state; + const stateStyle = options?.stateStyle; + return new ResourceNotificationServicePromise(this._publishResourceUpdateInternal(resource, state, stateStyle)); } - /** Adds a project resource with configuration options */ - /** @internal */ - async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProjectWithOptions', - rpcArgs - ); - return new ProjectResource(result, this._client); - } +} - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); +/** + * Thenable wrapper for ResourceNotificationService that enables fluent chaining. + */ +export class ResourceNotificationServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceNotificationService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a C# application resource */ - /** @internal */ - async _addCSharpAppInternal(name: string, path: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, path }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpApp', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Waits for a resource to reach a specified state */ + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForResourceState(resourceName, options))); } - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + /** Waits for a resource to reach one of the specified states */ + waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + return this._promise.then(obj => obj.waitForResourceStates(resourceName, targetStates)); } - /** Adds a C# application resource with configuration options */ - /** @internal */ - async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpAppWithOptions', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Waits for a resource to become healthy */ + waitForResourceHealthy(resourceName: string): Promise { + return this._promise.then(obj => obj.waitForResourceHealthy(resourceName)); } - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + /** Waits for all dependencies of a resource to be ready */ + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForDependencies(resource))); } - /** Adds a MySQL server resource */ - /** @internal */ - async _addMySqlInternal(name: string, password?: ParameterResource, port?: number): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (password !== undefined) rpcArgs.password = password; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.MySql/addMySql', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Tries to get the current state of a resource */ + tryGetResourceState(resourceName: string): Promise { + return this._promise.then(obj => obj.tryGetResourceState(resourceName)); } - addMySql(name: string, options?: AddMySqlOptions): MySqlServerResourcePromise { - const password = options?.password; - const port = options?.port; - return new MySqlServerResourcePromise(this._addMySqlInternal(name, password, port)); + /** Publishes an update for a resource's state */ + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.publishResourceUpdate(resource, options))); } - /** Adds a SQL Server container resource */ - /** @internal */ - async _addSqlServerInternal(name: string, password?: ParameterResource, port?: number): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (password !== undefined) rpcArgs.password = password; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.SqlServer/addSqlServer', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); - } +} - addSqlServer(name: string, options?: AddSqlServerOptions): SqlServerServerResourcePromise { - const password = options?.password; - const port = options?.port; - return new SqlServerServerResourcePromise(this._addSqlServerInternal(name, password, port)); - } +// ============================================================================ +// ResourceReadyEvent +// ============================================================================ - /** Adds a PostgreSQL server resource */ - /** @internal */ - async _addPostgresInternal(name: string, userName?: ParameterResource, password?: ParameterResource, port?: number): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (userName !== undefined) rpcArgs.userName = userName; - if (password !== undefined) rpcArgs.password = password; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/addPostgres', - rpcArgs - ); - return new PostgresServerResource(result, this._client); - } +/** + * Type class for ResourceReadyEvent. + */ +export class ResourceReadyEvent { + constructor(private _handle: ResourceReadyEventHandle, private _client: AspireClientRpc) {} - addPostgres(name: string, options?: AddPostgresOptions): PostgresServerResourcePromise { - const userName = options?.userName; - const password = options?.password; - const port = options?.port; - return new PostgresServerResourcePromise(this._addPostgresInternal(name, userName, password, port)); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; } +// ============================================================================ +// ResourceStoppedEvent +// ============================================================================ + /** - * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + * Type class for ResourceStoppedEvent. */ -export class DistributedApplicationBuilderPromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - - /** Builds the distributed application */ - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); - } +export class ResourceStoppedEvent { + constructor(private _handle: ResourceStoppedEventHandle, private _client: AspireClientRpc) {} - /** Adds a connection string with a builder callback */ - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Adds a container registry resource */ - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); - } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; - /** Adds a container resource */ - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); - } + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; - /** Adds a container resource built from a Dockerfile */ - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); - } +} - /** Adds a .NET tool resource */ - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); - } +// ============================================================================ +// ResourceUrlsCallbackContext +// ============================================================================ - /** Adds an executable resource */ - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); - } +/** + * Type class for ResourceUrlsCallbackContext. + */ +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} - /** Adds an external service resource */ - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Adds a parameter resource */ - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); - } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; - /** Adds a parameter sourced from configuration */ - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; } - /** Adds a connection string resource */ - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); - } + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + }; - /** Adds a .NET project resource */ - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); - } + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; - /** Adds a project resource with configuration options */ - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); - } + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; - /** Adds a C# application resource */ - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); - } +} - /** Adds a C# application resource with configuration options */ - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); - } +// ============================================================================ +// UpdateCommandStateContext +// ============================================================================ - /** Adds a MySQL server resource */ - addMySql(name: string, options?: AddMySqlOptions): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.addMySql(name, options))); - } +/** + * Type class for UpdateCommandStateContext. + */ +export class UpdateCommandStateContext { + constructor(private _handle: UpdateCommandStateContextHandle, private _client: AspireClientRpc) {} - /** Adds a SQL Server container resource */ - addSqlServer(name: string, options?: AddSqlServerOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.addSqlServer(name, options))); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Adds a PostgreSQL server resource */ - addPostgres(name: string, options?: AddPostgresOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.addPostgres(name, options))); - } + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/UpdateCommandStateContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; } // ============================================================================ -// DistributedApplicationEventing +// Configuration // ============================================================================ /** - * Type class for DistributedApplicationEventing. + * Type class for Configuration. */ -export class DistributedApplicationEventing { - constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} +export class Configuration { + constructor(private _handle: IConfigurationHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Invokes the Unsubscribe method */ - /** @internal */ - async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { - const rpcArgs: Record = { context: this._handle, subscription }; - await this._client.invokeCapability( - 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + /** Gets a configuration value by key */ + async getConfigValue(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConfigValue', rpcArgs ); - return this; } - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + /** Gets a connection string by name */ + async getConnectionString(name: string): Promise { + const rpcArgs: Record = { configuration: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionString', + rpcArgs + ); + } + + /** Gets a configuration section by key */ + async getSection(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getSection', + rpcArgs + ); + } + + /** Gets child configuration sections */ + async getChildren(): Promise { + const rpcArgs: Record = { configuration: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getChildren', + rpcArgs + ); + } + + /** Checks whether a configuration section exists */ + async exists(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/exists', + rpcArgs + ); } } /** - * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + * Thenable wrapper for Configuration that enables fluent chaining. */ -export class DistributedApplicationEventingPromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ConfigurationPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: Configuration) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Invokes the Unsubscribe method */ - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + /** Gets a configuration value by key */ + getConfigValue(key: string): Promise { + return this._promise.then(obj => obj.getConfigValue(key)); } -} + /** Gets a connection string by name */ + getConnectionString(name: string): Promise { + return this._promise.then(obj => obj.getConnectionString(name)); + } -// ============================================================================ -// ConnectionStringResource -// ============================================================================ + /** Gets a configuration section by key */ + getSection(key: string): Promise { + return this._promise.then(obj => obj.getSection(key)); + } -export class ConnectionStringResource extends ResourceBuilderBase { - constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Gets child configuration sections */ + getChildren(): Promise { + return this._promise.then(obj => obj.getChildren()); } - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); + /** Checks whether a configuration section exists */ + exists(key: string): Promise { + return this._promise.then(obj => obj.exists(key)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); - } +} + +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Environment property */ + environment = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.environment', + { context: this._handle } + ); + return new HostEnvironment(handle, this._client); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the UserSecretsManager property */ + userSecretsManager = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.userSecretsManager', + { context: this._handle } + ); + return new UserSecretsManager(handle, this._client); + }, + }; + /** Builds the distributed application */ /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DistributedApplication(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); } + /** Adds a connection string with a reference expression */ /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + async _addConnectionStringExpressionInternal(name: string, connectionStringExpression: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, connectionStringExpression }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + 'Aspire.Hosting/addConnectionStringExpression', rpcArgs ); return new ConnectionStringResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { - const helpLink = options?.helpLink; - return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringExpressionInternal(name, connectionStringExpression)); } + /** Adds a connection string with a builder callback */ /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', + 'Aspire.Hosting/addConnectionStringBuilder', rpcArgs ); return new ConnectionStringResource(result, this._client); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); } + /** Adds a container registry resource */ /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); } + /** Adds a container registry with string endpoint */ /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + async _addContainerRegistryFromStringInternal(name: string, endpoint: string, repository?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistryFromString', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryFromStringInternal(name, endpoint, repository)); } + /** Adds a container resource */ /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); } + /** Adds a container resource built from a Dockerfile */ /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { - const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); } + /** Adds a .NET tool resource */ /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { - const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); } + /** Adds an executable resource */ /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); } + /** Adds an external service resource */ /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); } + /** Adds an external service with a URI */ /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + async _addExternalServiceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceUri', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceUriInternal(name, uri)); } + /** Adds an external service with a parameter URL */ /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + async _addExternalServiceParameterInternal(name: string, urlParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, urlParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceParameter', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceParameterInternal(name, urlParameter)); } + /** Adds a parameter resource */ /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); } + /** Adds a parameter with a default value */ /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + async _addParameterWithValueInternal(name: string, value: string, publishValueAsDefault?: boolean, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + if (publishValueAsDefault !== undefined) rpcArgs.publishValueAsDefault = publishValueAsDefault; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterWithValue', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + const publishValueAsDefault = options?.publishValueAsDefault; + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterWithValueInternal(name, value, publishValueAsDefault, secret)); } + /** Adds a parameter sourced from configuration */ /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); } + /** Adds a connection string resource */ /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ResourceWithConnectionString(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - const exitCode = options?.exitCode; - return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); } + /** Adds a .NET project resource */ /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); } + /** Adds a project resource with configuration options */ /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { - const commandOptions = options?.commandOptions; - return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); } + /** Adds a C# application resource */ /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); } + /** Adds a C# application resource with configuration options */ /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); } + /** Gets the application configuration */ /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + async _getConfigurationInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getConfiguration', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new Configuration(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { - const iconVariant = options?.iconVariant; - return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._getConfigurationInternal()); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + /** Subscribes to the BeforeStart event */ + async subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeStartEventHandle; + const arg = new BeforeStartEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeBeforeStart', rpcArgs ); - return new ConnectionStringResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + /** Subscribes to the AfterResourcesCreated event */ + async subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as AfterResourcesCreatedEventHandle; + const arg = new AfterResourcesCreatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeAfterResourcesCreated', + rpcArgs + ); } + /** Adds a Node.js application resource */ /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + async _addNodeAppInternal(name: string, appDirectory: string, scriptPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory, scriptPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addNodeApp', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._addNodeAppInternal(name, appDirectory, scriptPath)); } + /** Adds a JavaScript application resource */ /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + async _addJavaScriptAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addJavaScriptApp', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + const runScriptName = options?.runScriptName; + return new JavaScriptAppResourcePromise(this._addJavaScriptAppInternal(name, appDirectory, runScriptName)); } + /** Adds a Vite application resource */ /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + async _addViteAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addViteApp', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + const runScriptName = options?.runScriptName; + return new ViteAppResourcePromise(this._addViteAppInternal(name, appDirectory, runScriptName)); } + /** Adds a MySQL server resource */ /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + async _addMySqlInternal(name: string, password?: ParameterResource, port?: number): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (password !== undefined) rpcArgs.password = password; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.MySql/addMySql', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + addMySql(name: string, options?: AddMySqlOptions): MySqlServerResourcePromise { + const password = options?.password; + const port = options?.port; + return new MySqlServerResourcePromise(this._addMySqlInternal(name, password, port)); } + /** Adds a SQL Server container resource */ /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + async _addSqlServerInternal(name: string, password?: ParameterResource, port?: number): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (password !== undefined) rpcArgs.password = password; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/addSqlServer', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new SqlServerServerResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + addSqlServer(name: string, options?: AddSqlServerOptions): SqlServerServerResourcePromise { + const password = options?.password; + const port = options?.port; + return new SqlServerServerResourcePromise(this._addSqlServerInternal(name, password, port)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** Adds a PostgreSQL server resource */ + /** @internal */ + async _addPostgresInternal(name: string, userName?: ParameterResource, password?: ParameterResource, port?: number): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (userName !== undefined) rpcArgs.userName = userName; + if (password !== undefined) rpcArgs.password = password; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/addPostgres', rpcArgs ); + return new PostgresServerResource(result, this._client); + } + + addPostgres(name: string, options?: AddPostgresOptions): PostgresServerResourcePromise { + const userName = options?.userName; + const password = options?.password; + const port = options?.port; + return new PostgresServerResourcePromise(this._addPostgresInternal(name, userName, password, port)); } } /** - * Thenable wrapper for ConnectionStringResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. */ -export class ConnectionStringResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds a connection string with a reference expression */ + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringExpression(name, connectionStringExpression))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + /** Adds a container registry with string endpoint */ + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistryFromString(name, endpoint, options))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Adds an external service with a URI */ + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceUri(name, uri))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Adds an external service with a parameter URL */ + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceParameter(name, urlParameter))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Adds a parameter with a default value */ + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterWithValue(name, value, options))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Gets the application configuration */ + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._promise.then(obj => obj.getConfiguration())); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Subscribes to the BeforeStart event */ + subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeBeforeStart(callback)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Subscribes to the AfterResourcesCreated event */ + subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeAfterResourcesCreated(callback)); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds a Node.js application resource */ + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.addNodeApp(name, appDirectory, scriptPath))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Adds a JavaScript application resource */ + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.addJavaScriptApp(name, appDirectory, options))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds a Vite application resource */ + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.addViteApp(name, appDirectory, options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Adds a MySQL server resource */ + addMySql(name: string, options?: AddMySqlOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.addMySql(name, options))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Adds a SQL Server container resource */ + addSqlServer(name: string, options?: AddSqlServerOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.addSqlServer(name, options))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Adds a PostgreSQL server resource */ + addPostgres(name: string, options?: AddPostgresOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.addPostgres(name, options))); } } // ============================================================================ -// ContainerRegistryResource +// DistributedApplicationEventing // ============================================================================ -export class ContainerRegistryResource extends ResourceBuilderBase { - constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { - super(handle, client); - } +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Invokes the Unsubscribe method */ /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', +} + +// ============================================================================ +// HostEnvironment +// ============================================================================ + +/** + * Type class for HostEnvironment. + */ +export class HostEnvironment { + constructor(private _handle: IHostEnvironmentHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Checks if running in Development environment */ + async isDevelopment(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isDevelopment', rpcArgs ); - return new ContainerRegistryResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { - const helpLink = options?.helpLink; - return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Checks if running in Production environment */ + async isProduction(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isProduction', + rpcArgs + ); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + /** Checks if running in Staging environment */ + async isStaging(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isStaging', rpcArgs ); - return new ContainerRegistryResource(result, this._client); - } - - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + /** Checks if the environment matches the specified name */ + async isEnvironment(environmentName: string): Promise { + const rpcArgs: Record = { environment: this._handle, environmentName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isEnvironment', rpcArgs ); - return new ContainerRegistryResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); +} + +/** + * Thenable wrapper for HostEnvironment that enables fluent chaining. + */ +export class HostEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: HostEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Checks if running in Development environment */ + isDevelopment(): Promise { + return this._promise.then(obj => obj.isDevelopment()); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { - const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + /** Checks if running in Production environment */ + isProduction(): Promise { + return this._promise.then(obj => obj.isProduction()); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Checks if running in Staging environment */ + isStaging(): Promise { + return this._promise.then(obj => obj.isStaging()); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { - const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Checks if the environment matches the specified name */ + isEnvironment(environmentName: string): Promise { + return this._promise.then(obj => obj.isEnvironment(environmentName)); } +} + +// ============================================================================ +// Logger +// ============================================================================ + +/** + * Type class for Logger. + */ +export class Logger { + constructor(private _handle: ILoggerHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Logs an information message */ /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + async _logInformationInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logInformation', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._logInformationInternal(message)); } + /** Logs a warning message */ /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + async _logWarningInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logWarning', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._logWarningInternal(message)); } + /** Logs an error message */ /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + async _logErrorInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logError', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + logError(message: string): LoggerPromise { + return new LoggerPromise(this._logErrorInternal(message)); } + /** Logs a debug message */ /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + async _logDebugInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logDebug', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._logDebugInternal(message)); } + /** Logs a message with specified level */ /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + async _logInternal(level: string, message: string): Promise { + const rpcArgs: Record = { logger: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/log', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._logInternal(level, message)); + } + +} + +/** + * Thenable wrapper for Logger that enables fluent chaining. + */ +export class LoggerPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Logger) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Logs an information message */ + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logInformation(message))); + } + + /** Logs a warning message */ + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logWarning(message))); + } + + /** Logs an error message */ + logError(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logError(message))); + } + + /** Logs a debug message */ + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logDebug(message))); + } + + /** Logs a message with specified level */ + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.log(level, message))); } +} + +// ============================================================================ +// LoggerFactory +// ============================================================================ + +/** + * Type class for LoggerFactory. + */ +export class LoggerFactory { + constructor(private _handle: ILoggerFactoryHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Creates a logger for a category */ /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + async _createLoggerInternal(categoryName: string): Promise { + const rpcArgs: Record = { loggerFactory: this._handle, categoryName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createLogger', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new Logger(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._createLoggerInternal(categoryName)); + } + +} + +/** + * Thenable wrapper for LoggerFactory that enables fluent chaining. + */ +export class LoggerFactoryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: LoggerFactory) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Creates a logger for a category */ + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.createLogger(categoryName))); } +} + +// ============================================================================ +// ReportingStep +// ============================================================================ + +/** + * Type class for ReportingStep. + */ +export class ReportingStep { + constructor(private _handle: IReportingStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Creates a reporting task with plain-text status text */ /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + async _createTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createTask', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ReportingTask(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createTaskInternal(statusText, cancellationToken)); } + /** Creates a reporting task with Markdown-formatted status text */ /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + async _createMarkdownTaskInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createMarkdownTask', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ReportingTask(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createMarkdownTaskInternal(markdownString, cancellationToken)); } + /** Logs a plain-text message for the reporting step */ /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + async _logStepInternal(level: string, message: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStep', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepInternal(level, message)); } + /** Logs a Markdown-formatted message for the reporting step */ /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + async _logStepMarkdownInternal(level: string, markdownString: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStepMarkdown', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepMarkdownInternal(level, markdownString)); } + /** Completes the reporting step with plain-text completion text */ /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + async _completeStepInternal(completionText: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, completionText }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStep', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepInternal(completionText, completionState, cancellationToken)); } + /** Completes the reporting step with Markdown-formatted completion text */ /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + async _completeStepMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStepMarkdown', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); - } - - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); - } - - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); - } - - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepMarkdownInternal(markdownString, completionState, cancellationToken)); } } /** - * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); + * Thenable wrapper for ReportingStep that enables fluent chaining. */ -export class ContainerRegistryResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ReportingStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ReportingStep) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Creates a reporting task with plain-text status text */ + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createTask(statusText, options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Creates a reporting task with Markdown-formatted status text */ + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createMarkdownTask(markdownString, options))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Logs a plain-text message for the reporting step */ + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStep(level, message))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Logs a Markdown-formatted message for the reporting step */ + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStepMarkdown(level, markdownString))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Completes the reporting step with plain-text completion text */ + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStep(completionText, options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Completes the reporting step with Markdown-formatted completion text */ + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStepMarkdown(markdownString, options))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } +} - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } +// ============================================================================ +// ReportingTask +// ============================================================================ - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } +/** + * Type class for ReportingTask. + */ +export class ReportingTask { + constructor(private _handle: IReportingTaskHandle, private _client: AspireClientRpc) {} - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Updates the reporting task with plain-text status text */ + /** @internal */ + async _updateTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTask', + rpcArgs + ); + return this; } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskInternal(statusText, cancellationToken)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Updates the reporting task with Markdown-formatted status text */ + /** @internal */ + async _updateTaskMarkdownInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTaskMarkdown', + rpcArgs + ); + return this; } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskMarkdownInternal(markdownString, cancellationToken)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Completes the reporting task with plain-text completion text */ + /** @internal */ + async _completeTaskInternal(completionMessage?: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle }; + if (completionMessage !== undefined) rpcArgs.completionMessage = completionMessage; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTask', + rpcArgs + ); + return this; } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + const completionMessage = options?.completionMessage; + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskInternal(completionMessage, completionState, cancellationToken)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Completes the reporting task with Markdown-formatted completion text */ + /** @internal */ + async _completeTaskMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTaskMarkdown', + rpcArgs + ); + return this; } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskMarkdownInternal(markdownString, completionState, cancellationToken)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); +} + +/** + * Thenable wrapper for ReportingTask that enables fluent chaining. + */ +export class ReportingTaskPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReportingTask) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Updates the reporting task with plain-text status text */ + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTask(statusText, options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Updates the reporting task with Markdown-formatted status text */ + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTaskMarkdown(markdownString, options))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Completes the reporting task with plain-text completion text */ + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTask(options))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Completes the reporting task with Markdown-formatted completion text */ + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTaskMarkdown(markdownString, options))); } } // ============================================================================ -// ContainerResource +// ServiceProvider // ============================================================================ -export class ContainerResource extends ResourceBuilderBase { - constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { - super(handle, client); - } +/** + * Type class for ServiceProvider. + */ +export class ServiceProvider { + constructor(private _handle: IServiceProviderHandle, private _client: AspireClientRpc) {} + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the distributed application eventing service from the service provider */ /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + async _getEventingInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getEventing', rpcArgs ); - return new ContainerResource(result, this._client); + return new DistributedApplicationEventing(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._getEventingInternal()); } + /** Gets the logger factory from the service provider */ /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + async _getLoggerFactoryInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getLoggerFactory', rpcArgs ); - return new ContainerResource(result, this._client); + return new LoggerFactory(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._getLoggerFactoryInternal()); } + /** Gets the resource logger service from the service provider */ /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + async _getResourceLoggerServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceLoggerService', rpcArgs ); - return new ContainerResource(result, this._client); + return new ResourceLoggerService(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._getResourceLoggerServiceInternal()); } + /** Gets the distributed application model from the service provider */ /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + async _getDistributedApplicationModelInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getDistributedApplicationModel', rpcArgs ); - return new ContainerResource(result, this._client); + return new DistributedApplicationModel(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterInternal()); + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._getDistributedApplicationModelInternal()); } + /** Gets the resource notification service from the service provider */ /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + async _getResourceNotificationServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceNotificationService', rpcArgs ); - return new ContainerResource(result, this._client); + return new ResourceNotificationService(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._getResourceNotificationServiceInternal()); } + /** Gets the user secrets manager from the service provider */ /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + async _getUserSecretsManagerInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getUserSecretsManager', rpcArgs ); - return new ContainerResource(result, this._client); + return new UserSecretsManager(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - const helpLink = options?.helpLink; - return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getUserSecretsManagerInternal()); } - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ContainerResource(result, this._client); +} + +/** + * Thenable wrapper for ServiceProvider that enables fluent chaining. + */ +export class ServiceProviderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ServiceProvider) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + /** Gets the distributed application eventing service from the service provider */ + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.getEventing())); } - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + /** Gets the logger factory from the service provider */ + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._promise.then(obj => obj.getLoggerFactory())); + } + + /** Gets the resource logger service from the service provider */ + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.getResourceLoggerService())); + } + + /** Gets the distributed application model from the service provider */ + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._promise.then(obj => obj.getDistributedApplicationModel())); + } + + /** Gets the resource notification service from the service provider */ + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.getResourceNotificationService())); + } + + /** Gets the user secrets manager from the service provider */ + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getUserSecretsManager())); + } + +} + +// ============================================================================ +// UserSecretsManager +// ============================================================================ + +/** + * Type class for UserSecretsManager. + */ +export class UserSecretsManager { + constructor(private _handle: IUserSecretsManagerHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the IsAvailable property */ + isAvailable = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.isAvailable', + { context: this._handle } + ); + }, + }; + + /** Gets the FilePath property */ + filePath = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.filePath', + { context: this._handle } + ); + }, + }; + + /** Attempts to set a user secret value */ + async trySetSecret(name: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, name, value }; + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.trySetSecret', rpcArgs ); - return new ContainerResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Saves state to user secrets from a JSON string */ + /** @internal */ + async _saveStateJsonInternal(json: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, json }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/saveStateJson', + rpcArgs + ); + return this; + } + + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + const cancellationToken = options?.cancellationToken; + return new UserSecretsManagerPromise(this._saveStateJsonInternal(json, cancellationToken)); } + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + async _getOrSetSecretInternal(resourceBuilder: ResourceBuilderBase, name: string, value: string): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, resourceBuilder, name, value }; + await this._client.invokeCapability( + 'Aspire.Hosting/getOrSetSecret', rpcArgs ); - return new ContainerResource(result, this._client); + return this; } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getOrSetSecretInternal(resourceBuilder, name, value)); + } + +} + +/** + * Thenable wrapper for UserSecretsManager that enables fluent chaining. + */ +export class UserSecretsManagerPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: UserSecretsManager) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Attempts to set a user secret value */ + trySetSecret(name: string, value: string): Promise { + return this._promise.then(obj => obj.trySetSecret(name, value)); + } + + /** Saves state to user secrets from a JSON string */ + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.saveStateJson(json, options))); + } + + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getOrSetSecret(resourceBuilder, name, value))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsInternal(args)); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + return new ConnectionStringResource(result, this._client); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromManifestInternal()); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForInternal(dependency)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExplicitStartInternal()); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onConnectionStringAvailableInternal(callback)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - const exitCode = options?.exitCode; - return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceReadyInternal(callback)); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new ContainerResource(result, this._client); - } +} - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); - } +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ContainerResource(result, this._client); + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - const password = options?.password; - return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromMcpInternal()); + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } -} + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } -/** - * Thenable wrapper for ContainerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ContainerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } - then( - onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } +} - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ + +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceReadyInternal(callback)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); - } +} - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); - } +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -4531,952 +5702,1127 @@ export class ContainerResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ -// CSharpAppResource +// ContainerResource // ============================================================================ -export class CSharpAppResource extends ResourceBuilderBase { - constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withReplicasInternal(replicas: number): Promise { - const rpcArgs: Record = { builder: this._handle, replicas }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReplicas', + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _disableForwardedHeadersInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/disableForwardedHeaders', + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - const helpLink = options?.helpLink; - return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsInternal(args)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new CSharpAppResource(result, this._client); - } - - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + return new ContainerResource(result, this._client); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); - } - - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - const exitCode = options?.exitCode; - return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - const commandOptions = options?.commandOptions; - return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - const password = options?.password; - return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - const iconVariant = options?.iconVariant; - return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + const exitCode = options?.exitCode; + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + const password = options?.password; + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -5484,56 +6830,56 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -5544,226 +6890,400 @@ export class CSharpAppResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceReadyInternal(callback)); } } /** - * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * Thenable wrapper for ContainerResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class CSharpAppResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -5772,163 +7292,163 @@ export class CSharpAppResourcePromise implements PromiseLike } /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); - } + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } /** Gets the resource name */ @@ -5936,538 +7456,397 @@ export class CSharpAppResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ -// DotnetToolResource +// CSharpAppResource // ============================================================================ -export class DotnetToolResource extends ResourceBuilderBase { - constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withToolPackageInternal(packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPackage', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withToolVersionInternal(version: string): Promise { - const rpcArgs: Record = { builder: this._handle, version }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolVersion', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withToolPrereleaseInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPrerelease', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withToolSourceInternal(source: string): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolSource', + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); } /** @internal */ - private async _withToolIgnoreExistingFeedsInternal(): Promise { + private async _disableForwardedHeadersInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreExistingFeeds', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); } /** @internal */ - private async _withToolIgnoreFailedSourcesInternal(): Promise { + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreFailedSources', + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + const configure = options?.configure; + return new CSharpAppResourcePromise(this._publishAsDockerFileInternal(configure)); } /** @internal */ - private async _publishAsDockerFileInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFile', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); - } - - /** @internal */ - private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; - const obj = new ContainerResource(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFileWithConfigure', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); - } - - /** @internal */ - private async _withExecutableCommandInternal(command: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExecutableCommand', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); - } - - /** @internal */ - private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { - const rpcArgs: Record = { builder: this._handle, workingDirectory }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withWorkingDirectory', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); - } - - /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); - } - - /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); - } - - /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); - } - - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { const helpLink = options?.helpLink; - return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } - - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + const name = options?.name; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); - } - - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); - } - - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -6477,15 +7856,15 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -6494,72 +7873,72 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -6572,278 +7951,293 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { const exitCode = options?.exitCode; - return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -6851,130 +8245,130 @@ export class DotnetToolResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { const commandOptions = options?.commandOptions; - return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { const password = options?.password; - return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { const iconVariant = options?.iconVariant; - return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -6983,15 +8377,15 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -6999,56 +8393,56 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -7059,60 +8453,60 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -7124,201 +8518,246 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** - * Thenable wrapper for DotnetToolResource that enables fluent chaining. + * Thenable wrapper for CSharpAppResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class DotnetToolResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); - } - - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); - } - - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); - } - - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); - } - - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); - } - - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); - } - - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); - } - - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -7327,158 +8766,163 @@ export class DotnetToolResourcePromise implements PromiseLike obj.asHttp2Service())); + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -7486,383 +8930,500 @@ export class DotnetToolResourcePromise implements PromiseLike obj.getResourceName()); } -} + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } -// ============================================================================ -// ExecutableResource -// ============================================================================ + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } -export class ExecutableResource extends ResourceBuilderBase { - constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// DotnetToolResource +// ============================================================================ + +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - const helpLink = options?.helpLink; - return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsInternal(args)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -7872,15 +9433,15 @@ export class ExecutableResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -7889,72 +9450,72 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -7967,278 +9528,278 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); - } + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { const exitCode = options?.exitCode; - return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -8246,130 +9807,130 @@ export class ExecutableResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { const commandOptions = options?.commandOptions; - return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { const password = options?.password; - return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { const iconVariant = options?.iconVariant; - return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -8378,15 +9939,15 @@ export class ExecutableResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -8394,56 +9955,56 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -8454,60 +10015,60 @@ export class ExecutableResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -8519,151 +10080,281 @@ export class ExecutableResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** - * Thenable wrapper for ExecutableResource that enables fluent chaining. + * Thenable wrapper for DotnetToolResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ExecutableResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -8672,158 +10363,158 @@ export class ExecutableResourcePromise implements PromiseLike obj.asHttp2Service())); + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -8831,955 +10522,991 @@ export class ExecutableResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ -// ExternalServiceResource +// ExecutableResource // ============================================================================ -export class ExternalServiceResource extends ResourceBuilderBase { - constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + private async _publishAsDockerFileInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - const helpLink = options?.helpLink; - return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - const commandOptions = options?.commandOptions; - return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - const iconVariant = options?.iconVariant; - return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', rpcArgs ); + return new ExecutableResource(result, this._client); } -} - -/** - * Thenable wrapper for ExternalServiceResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ExternalServiceResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); - } - -} - -// ============================================================================ -// MySqlDatabaseResource -// ============================================================================ - -export class MySqlDatabaseResource extends ResourceBuilderBase { - constructor(handle: MySqlDatabaseResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Gets the Parent property */ - parent = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/MySqlDatabaseResource.parent', - { context: this._handle } - ); - return new MySqlServerResource(handle, this._client); - }, - }; - - /** Gets the ConnectionStringExpression property */ - connectionStringExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/MySqlDatabaseResource.connectionStringExpression', - { context: this._handle } - ); - }, - }; - - /** Gets the UriExpression property */ - uriExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/MySqlDatabaseResource.uriExpression', - { context: this._handle } - ); - }, - }; - - /** Gets the JdbcConnectionString property */ - jdbcConnectionString = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/MySqlDatabaseResource.jdbcConnectionString', - { context: this._handle } - ); - }, - }; - - /** Gets the DatabaseName property */ - databaseName = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/MySqlDatabaseResource.databaseName', - { context: this._handle } - ); - }, - }; - - /** Gets the Name property */ - name = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/MySqlDatabaseResource.name', - { context: this._handle } - ); - }, - }; - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new MySqlDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new MySqlDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): MySqlDatabaseResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new MySqlDatabaseResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new MySqlDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): MySqlDatabaseResourcePromise { - const helpLink = options?.helpLink; - return new MySqlDatabaseResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new MySqlDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new MySqlDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new MySqlDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new MySqlDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new MySqlDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): MySqlDatabaseResourcePromise { - const displayText = options?.displayText; - return new MySqlDatabaseResourcePromise(this._withUrlInternal(url, displayText)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new MySqlDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): MySqlDatabaseResourcePromise { - const displayText = options?.displayText; - return new MySqlDatabaseResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new MySqlDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new MySqlDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._excludeFromManifestInternal()); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new MySqlDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._withExplicitStartInternal()); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new MySqlDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._withHealthCheckInternal(key)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new MySqlDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): MySqlDatabaseResourcePromise { - const commandOptions = options?.commandOptions; - return new MySqlDatabaseResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new MySqlDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new MySqlDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new MySqlDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): MySqlDatabaseResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { const iconVariant = options?.iconVariant; - return new MySqlDatabaseResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new MySqlDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new MySqlDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new MySqlDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -9790,60 +11517,60 @@ export class MySqlDatabaseResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new MySqlDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): MySqlDatabaseResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new MySqlDatabaseResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new MySqlDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new MySqlDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -9856,7414 +11583,7622 @@ export class MySqlDatabaseResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, script }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.MySql/withCreationScript', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new MySqlDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Defines the SQL script for database creation */ - withCreationScript(script: string): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._withCreationScriptInternal(script)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onBeforeResourceStartedInternal(callback)); } -} - -/** - * Thenable wrapper for MySqlDatabaseResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceReadyInternal(callback)); + } + +} + +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); */ -export class MySqlDatabaseResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: MySqlDatabaseResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Adds a health check by key */ - withHealthCheck(key: string): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Defines the SQL script for database creation */ - withCreationScript(script: string): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withCreationScript(script))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } -} - -// ============================================================================ -// MySqlServerResource -// ============================================================================ + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } -export class MySqlServerResource extends ResourceBuilderBase { - constructor(handle: MySqlServerResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Gets the PrimaryEndpoint property */ - primaryEndpoint = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/MySqlServerResource.primaryEndpoint', - { context: this._handle } - ); - return new EndpointReference(handle, this._client); - }, - }; + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } - /** Gets the Host property */ - host = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/MySqlServerResource.host', - { context: this._handle } - ); - return new EndpointReferenceExpression(handle, this._client); - }, - }; + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } - /** Gets the Port property */ - port = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/MySqlServerResource.port', - { context: this._handle } - ); - return new EndpointReferenceExpression(handle, this._client); - }, - }; + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } - /** Gets the ConnectionStringExpression property */ - connectionStringExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/MySqlServerResource.connectionStringExpression', - { context: this._handle } - ); - }, - }; - - /** Gets the UriExpression property */ - uriExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/MySqlServerResource.uriExpression', - { context: this._handle } - ); - }, - }; - - /** Gets the JdbcConnectionString property */ - jdbcConnectionString = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/MySqlServerResource.jdbcConnectionString', - { context: this._handle } - ); - }, - }; + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } - /** Gets the Databases property */ - private _databases?: AspireDict; - get databases(): AspireDict { - if (!this._databases) { - this._databases = new AspireDict( - this._handle, - this._client, - 'Aspire.Hosting.ApplicationModel/MySqlServerResource.databases', - 'Aspire.Hosting.ApplicationModel/MySqlServerResource.databases' - ); - } - return this._databases; + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Gets the Entrypoint property */ - entrypoint = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/MySqlServerResource.entrypoint', - { context: this._handle } - ); - }, - set: async (value: string): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/MySqlServerResource.setEntrypoint', - { context: this._handle, value } - ); - } - }; + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } - /** Gets the ShellExecution property */ - shellExecution = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/MySqlServerResource.shellExecution', - { context: this._handle } - ); - }, - set: async (value: boolean): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/MySqlServerResource.setShellExecution', - { context: this._handle, value } - ); - } - }; + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } - /** Gets the Name property */ - name = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/MySqlServerResource.name', - { context: this._handle } - ); - }, - }; + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withContainerRegistryInternal(registry)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): MySqlServerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new MySqlServerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Sets the container image tag */ - withImageTag(tag: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withImageTagInternal(tag)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Sets the container image registry */ - withImageRegistry(registry: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withImageRegistryInternal(registry)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): MySqlServerResourcePromise { - const tag = options?.tag; - return new MySqlServerResourcePromise(this._withImageInternal(image, tag)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withImageSHA256Internal(sha256)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withLifetimeInternal(lifetime)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Configures the resource to be published as a container */ - publishAsContainer(): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._publishAsContainerInternal()); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): MySqlServerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new MySqlServerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Sets the container name */ - withContainerName(name: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withContainerNameInternal(name)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withBuildArgInternal(name, value)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withBuildSecretInternal(name, value)); +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): MySqlServerResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new MySqlServerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): MySqlServerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new MySqlServerResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withOtlpExporterInternal()); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._publishAsConnectionStringInternal()); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): MySqlServerResourcePromise { - const helpLink = options?.helpLink; - return new MySqlServerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withEnvironmentInternal(name, value)); - } + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withArgsInternal(args)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): MySqlServerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new MySqlServerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withServiceReferenceInternal(source)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceReadyInternal(callback)); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new MySqlServerResource(result, this._client); +} + +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): MySqlServerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new MySqlServerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): MySqlServerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new MySqlServerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): MySqlServerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new MySqlServerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._asHttp2ServiceInternal()); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): MySqlServerResourcePromise { - const displayText = options?.displayText; - return new MySqlServerResourcePromise(this._withUrlInternal(url, displayText)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): MySqlServerResourcePromise { - const displayText = options?.displayText; - return new MySqlServerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new MySqlServerResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); +} + +// ============================================================================ +// JavaScriptAppResource +// ============================================================================ + +export class JavaScriptAppResource extends ResourceBuilderBase { + constructor(handle: JavaScriptAppResourceHandle, client: AspireClientRpc) { + super(handle, client); } + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._excludeFromManifestInternal()); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new JavaScriptAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._waitForInternal(dependency)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._waitForStartInternal(dependency)); + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withExplicitStartInternal()); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): MySqlServerResourcePromise { - const exitCode = options?.exitCode; - return new MySqlServerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withHealthCheckInternal(key)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): MySqlServerResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new MySqlServerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + const helpLink = options?.helpLink; + return new JavaScriptAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): MySqlServerResourcePromise { - const commandOptions = options?.commandOptions; - return new MySqlServerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): MySqlServerResourcePromise { - const password = options?.password; - return new MySqlServerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withParentRelationshipInternal(parent)); + /** Adds arguments */ + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): MySqlServerResourcePromise { - const iconVariant = options?.iconVariant; - return new MySqlServerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): MySqlServerResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new MySqlServerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new JavaScriptAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._excludeFromMcpInternal()); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): MySqlServerResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new MySqlServerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new JavaScriptAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new JavaScriptAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new JavaScriptAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): MySqlServerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new MySqlServerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', rpcArgs ); } /** @internal */ - private async _addDatabaseInternal(name: string, databaseName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (databaseName !== undefined) rpcArgs.databaseName = databaseName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.MySql/addDatabase', + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new MySqlDatabaseResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a MySQL database */ - addDatabase(name: string, options?: AddDatabaseOptions): MySqlDatabaseResourcePromise { - const databaseName = options?.databaseName; - return new MySqlDatabaseResourcePromise(this._addDatabaseInternal(name, databaseName)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withPasswordInternal(password: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, password }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.MySql/withPassword', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures the MySQL password */ - withPassword(password: ParameterResource): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withPasswordInternal(password)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withPhpMyAdminInternal(configureContainer?: (obj: PhpMyAdminContainerResource) => Promise, containerName?: string): Promise { - const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PhpMyAdminContainerResourceHandle; - const obj = new PhpMyAdminContainerResource(objHandle, this._client); - await configureContainer(obj); - }) : undefined; - const rpcArgs: Record = { builder: this._handle }; - if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; - if (containerName !== undefined) rpcArgs.containerName = containerName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.MySql/withPhpMyAdmin', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds phpMyAdmin management UI */ - withPhpMyAdmin(options?: WithPhpMyAdminOptions): MySqlServerResourcePromise { - const configureContainer = options?.configureContainer; - const containerName = options?.containerName; - return new MySqlServerResourcePromise(this._withPhpMyAdminInternal(configureContainer, containerName)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.MySql/withDataVolume', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a data volume for MySQL */ - withDataVolume(options?: WithDataVolumeOptions): MySqlServerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new MySqlServerResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + const displayText = options?.displayText; + return new JavaScriptAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.MySql/withDataBindMount', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a data bind mount for MySQL */ - withDataBindMount(source: string, options?: WithDataBindMountOptions): MySqlServerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new MySqlServerResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + const displayText = options?.displayText; + return new JavaScriptAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withInitFilesInternal(source: string): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.MySql/withInitFiles', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new MySqlServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Copies init files to MySQL */ - withInitFiles(source: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._withInitFilesInternal(source)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } -} + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } -/** - * Thenable wrapper for MySqlServerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class MySqlServerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } - then( - onfulfilled?: ((value: MySqlServerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._clearContainerFilesSourcesInternal()); } - /** Sets the container image tag */ - withImageTag(tag: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromManifestInternal()); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForInternal(dependency)); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartInternal(dependency)); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** Prevents resource from starting automatically */ + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExplicitStartInternal()); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + const exitCode = options?.exitCode; + return new JavaScriptAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Adds a health check by key */ + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withHealthCheckInternal(key)); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + const commandOptions = options?.commandOptions; + return new JavaScriptAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); - } - - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + const password = options?.password; + return new JavaScriptAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Adds arguments */ - withArgs(args: string[]): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withChildRelationshipInternal(child)); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + const iconVariant = options?.iconVariant; + return new JavaScriptAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromMcpInternal()); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new JavaScriptAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceReadyInternal(callback)); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withBunInternal(install, installArgs)); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withYarnInternal(install, installArgs)); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withPnpmInternal(install, installArgs)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + const browser = options?.browser; + return new JavaScriptAppResourcePromise(this._withBrowserDebuggerInternal(browser)); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); - } +} - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); - } +/** + * Thenable wrapper for JavaScriptAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class JavaScriptAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** Adds a MySQL database */ - addDatabase(name: string, options?: AddDatabaseOptions): MySqlDatabaseResourcePromise { - return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.addDatabase(name, options))); + then( + onfulfilled?: ((value: JavaScriptAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Configures the MySQL password */ - withPassword(password: ParameterResource): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withPassword(password))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Adds phpMyAdmin management UI */ - withPhpMyAdmin(options?: WithPhpMyAdminOptions): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withPhpMyAdmin(options))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a data volume for MySQL */ - withDataVolume(options?: WithDataVolumeOptions): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Adds a data bind mount for MySQL */ - withDataBindMount(source: string, options?: WithDataBindMountOptions): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Copies init files to MySQL */ - withInitFiles(source: string): MySqlServerResourcePromise { - return new MySqlServerResourcePromise(this._promise.then(obj => obj.withInitFiles(source))); + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } -} + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } -// ============================================================================ -// ParameterResource -// ============================================================================ + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } -export class ParameterResource extends ResourceBuilderBase { - constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** @internal */ - private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, description }; - if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDescription', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - const enableMarkdown = options?.enableMarkdown; - return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - const helpLink = options?.helpLink; - return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds arguments */ + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromManifestInternal()); + /** Configures resource for HTTP/2 */ + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._withExplicitStartInternal()); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - const commandOptions = options?.commandOptions; - return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - const iconVariant = options?.iconVariant; - return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromMcpInternal()); + /** Prevents resource from starting automatically */ + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a health check by key */ + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } -} + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } -/** - * Thenable wrapper for ParameterResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ParameterResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } - then( - onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBun(options))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } +} - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } +// ============================================================================ +// MySqlDatabaseResource +// ============================================================================ - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); +export class MySqlDatabaseResource extends ResourceBuilderBase { + constructor(handle: MySqlDatabaseResourceHandle, client: AspireClientRpc) { + super(handle, client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); - } + /** Gets the Parent property */ + parent = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlDatabaseResource.parent', + { context: this._handle } + ); + return new MySqlServerResource(handle, this._client); + }, + }; - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlDatabaseResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); - } + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlDatabaseResource.uriExpression', + { context: this._handle } + ); + }, + }; -} + /** Gets the JdbcConnectionString property */ + jdbcConnectionString = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlDatabaseResource.jdbcConnectionString', + { context: this._handle } + ); + }, + }; -// ============================================================================ -// PgAdminContainerResource -// ============================================================================ + /** Gets the DatabaseName property */ + databaseName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlDatabaseResource.databaseName', + { context: this._handle } + ); + }, + }; -export class PgAdminContainerResource extends ResourceBuilderBase { - constructor(handle: PgAdminContainerResourceHandle, client: AspireClientRpc) { - super(handle, client); - } + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlDatabaseResource.name', + { context: this._handle } + ); + }, + }; /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): PgAdminContainerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new PgAdminContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): MySqlDatabaseResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new MySqlDatabaseResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): MySqlDatabaseResourcePromise { + const helpLink = options?.helpLink; + return new MySqlDatabaseResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withImageTagInternal(tag)); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withConnectionPropertyInternal(name, value)); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withImageRegistryInternal(registry)); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withConnectionPropertyValueInternal(name, value)); } - /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', rpcArgs ); - return new PgAdminContainerResource(result, this._client); - } - - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): PgAdminContainerResourcePromise { - const tag = options?.tag; - return new PgAdminContainerResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withImageSHA256Internal(sha256)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withLifetimeInternal(lifetime)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): MySqlDatabaseResourcePromise { + const displayText = options?.displayText; + return new MySqlDatabaseResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): MySqlDatabaseResourcePromise { + const displayText = options?.displayText; + return new MySqlDatabaseResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._publishAsContainerInternal()); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): PgAdminContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new PgAdminContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withContainerNameInternal(name)); + /** Prevents resource from starting automatically */ + withExplicitStart(): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withBuildArgInternal(name, value)); + /** Adds a health check by key */ + withHealthCheck(key: string): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withBuildSecretInternal(name, value)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): MySqlDatabaseResourcePromise { + const commandOptions = options?.commandOptions; + return new MySqlDatabaseResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PgAdminContainerResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new PgAdminContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): MySqlDatabaseResourcePromise { + const iconVariant = options?.iconVariant; + return new MySqlDatabaseResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): PgAdminContainerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new PgAdminContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withOtlpExporterInternal()); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): MySqlDatabaseResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new MySqlDatabaseResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); - } - - /** Publishes the resource as a connection string */ - publishAsConnectionString(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._publishAsConnectionStringInternal()); - } - - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PgAdminContainerResourcePromise { - const helpLink = options?.helpLink; - return new PgAdminContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new PgAdminContainerResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._onConnectionStringAvailableInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withCreationScriptInternal(script: string): Promise { + const rpcArgs: Record = { builder: this._handle, script }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.MySql/withCreationScript', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Defines the SQL script for database creation */ + withCreationScript(script: string): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._withCreationScriptInternal(script)); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); - } +} - /** Adds arguments */ - withArgs(args: string[]): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withArgsInternal(args)); +/** + * Thenable wrapper for MySqlDatabaseResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class MySqlDatabaseResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: MySqlDatabaseResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PgAdminContainerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new PgAdminContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withServiceReferenceInternal(source)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Adds a health check by key */ + withHealthCheck(key: string): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): PgAdminContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new PgAdminContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): PgAdminContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new PgAdminContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): PgAdminContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new PgAdminContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._asHttp2ServiceInternal()); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Defines the SQL script for database creation */ + withCreationScript(script: string): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.withCreationScript(script))); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); - } +} - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); - } +// ============================================================================ +// MySqlServerResource +// ============================================================================ - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); +export class MySqlServerResource extends ResourceBuilderBase { + constructor(handle: MySqlServerResourceHandle, client: AspireClientRpc) { + super(handle, client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): PgAdminContainerResourcePromise { - const displayText = options?.displayText; - return new PgAdminContainerResourcePromise(this._withUrlInternal(url, displayText)); - } + /** Gets the PrimaryEndpoint property */ + primaryEndpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.primaryEndpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); - } + /** Gets the Host property */ + host = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.host', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PgAdminContainerResourcePromise { - const displayText = options?.displayText; - return new PgAdminContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); - } + /** Gets the Port property */ + port = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.port', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new PgAdminContainerResource(result, this._client); - } + /** Gets the PasswordParameter property */ + passwordParameter = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.passwordParameter', + { context: this._handle } + ); + return new ParameterResource(handle, this._client); + }, + }; - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the JdbcConnectionString property */ + jdbcConnectionString = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.jdbcConnectionString', + { context: this._handle } + ); + }, + }; + + /** Gets the Databases property */ + private _databases?: AspireDict; + get databases(): AspireDict { + if (!this._databases) { + this._databases = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.databases', + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.databases' + ); + } + return this._databases; } + /** Gets the Entrypoint property */ + entrypoint = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.entrypoint', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.setEntrypoint', + { context: this._handle, value } + ); + } + }; + + /** Gets the ShellExecution property */ + shellExecution = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.shellExecution', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.setShellExecution', + { context: this._handle, value } + ); + } + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/MySqlServerResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._excludeFromManifestInternal()); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): MySqlServerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new MySqlServerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._waitForInternal(dependency)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Sets the container image tag */ + withImageTag(tag: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._waitForStartInternal(dependency)); + /** Sets the container image registry */ + withImageRegistry(registry: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): MySqlServerResourcePromise { + const tag = options?.tag; + return new MySqlServerResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withExplicitStartInternal()); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PgAdminContainerResourcePromise { - const exitCode = options?.exitCode; - return new PgAdminContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withHealthCheckInternal(key)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withLifetimeInternal(lifetime)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PgAdminContainerResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new PgAdminContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PgAdminContainerResourcePromise { - const commandOptions = options?.commandOptions; - return new PgAdminContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Configures the resource to be published as a container */ + publishAsContainer(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): MySqlServerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new MySqlServerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Sets the container name */ + withContainerName(name: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withContainerNameInternal(name)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PgAdminContainerResourcePromise { - const password = options?.password; - return new PgAdminContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withBuildArgInternal(name, value)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withParentRelationshipInternal(parent)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): MySqlServerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new MySqlServerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): PgAdminContainerResourcePromise { - const iconVariant = options?.iconVariant; - return new PgAdminContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withContainerNetworkAliasInternal(alias)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PgAdminContainerResourcePromise { + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): MySqlServerResourcePromise { const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new PgAdminContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new MySqlServerResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _withOtlpExporterInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._excludeFromMcpInternal()); + /** Configures OTLP telemetry export */ + withOtlpExporter(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._publishAsConnectionStringInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PgAdminContainerResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new PgAdminContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): MySqlServerResourcePromise { + const helpLink = options?.helpLink; + return new MySqlServerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new PgAdminContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): PgAdminContainerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new PgAdminContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withEnvironmentInternal(name, value)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); + return new MySqlServerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withHostPortInternal(port?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/withPgAdminHostPort', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new PgAdminContainerResource(result, this._client); - } - - /** Sets the host port for pgAdmin */ - withHostPort(options?: WithHostPortOptions): PgAdminContainerResourcePromise { - const port = options?.port; - return new PgAdminContainerResourcePromise(this._withHostPortInternal(port)); + return new MySqlServerResource(result, this._client); } -} - -/** - * Thenable wrapper for PgAdminContainerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class PgAdminContainerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: PgAdminContainerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withConnectionPropertyInternal(name, value)); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withConnectionPropertyValueInternal(name, value)); } - /** Sets the container image registry */ - withImageRegistry(registry: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** Adds arguments */ + withArgs(args: string[]): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withArgsInternal(args)); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withArgsCallbackInternal(callback)); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } - /** Configures the resource to be published as a container */ - publishAsContainer(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): MySqlServerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new MySqlServerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } - /** Sets the container name */ - withContainerName(name: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withReferenceUriInternal(name, uri)); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): MySqlServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new MySqlServerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): MySqlServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new MySqlServerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): MySqlServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new MySqlServerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._asHttp2ServiceInternal()); } - /** Adds arguments */ - withArgs(args: string[]): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): MySqlServerResourcePromise { + const displayText = options?.displayText; + return new MySqlServerResourcePromise(this._withUrlInternal(url, displayText)); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): MySqlServerResourcePromise { + const displayText = options?.displayText; + return new MySqlServerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._excludeFromManifestInternal()); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._waitForInternal(dependency)); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._waitForStartInternal(dependency)); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Prevents resource from starting automatically */ + withExplicitStart(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withExplicitStartInternal()); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): MySqlServerResourcePromise { + const exitCode = options?.exitCode; + return new MySqlServerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Prevents resource from starting automatically */ - withExplicitStart(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Adds a health check by key */ + withHealthCheck(key: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withHealthCheckInternal(key)); } - /** Adds a health check by key */ - withHealthCheck(key: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): MySqlServerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new MySqlServerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): MySqlServerResourcePromise { + const commandOptions = options?.commandOptions; + return new MySqlServerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): MySqlServerResourcePromise { + const password = options?.password; + return new MySqlServerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withChildRelationshipInternal(child)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): MySqlServerResourcePromise { + const iconVariant = options?.iconVariant; + return new MySqlServerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): MySqlServerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new MySqlServerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } - /** Sets the host port for pgAdmin */ - withHostPort(options?: WithHostPortOptions): PgAdminContainerResourcePromise { - return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new MySqlServerResource(result, this._client); } -} - -// ============================================================================ -// PgWebContainerResource -// ============================================================================ - -export class PgWebContainerResource extends ResourceBuilderBase { - constructor(handle: PgWebContainerResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withContainerRegistryInternal(registry)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): PgWebContainerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new PgWebContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): MySqlServerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new MySqlServerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withImageTagInternal(tag)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withImageRegistryInternal(registry)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): PgWebContainerResourcePromise { - const tag = options?.tag; - return new PgWebContainerResourcePromise(this._withImageInternal(image, tag)); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): MySqlServerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new MySqlServerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); } - /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new PgWebContainerResource(result, this._client); - } - - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withLifetimeInternal(lifetime)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._onConnectionStringAvailableInternal(callback)); } /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._publishAsContainerInternal()); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): PgWebContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new PgWebContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withContainerNameInternal(name)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + private async _addDatabaseInternal(name: string, databaseName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (databaseName !== undefined) rpcArgs.databaseName = databaseName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.MySql/addDatabase', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new MySqlDatabaseResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withBuildArgInternal(name, value)); + /** Adds a MySQL database */ + addDatabase(name: string, options?: AddDatabaseOptions): MySqlDatabaseResourcePromise { + const databaseName = options?.databaseName; + return new MySqlDatabaseResourcePromise(this._addDatabaseInternal(name, databaseName)); } /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + private async _withPasswordInternal(password: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, password }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.MySql/withPassword', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withBuildSecretInternal(name, value)); + /** Configures the MySQL password */ + withPassword(password: ParameterResource): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withPasswordInternal(password)); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + private async _withPhpMyAdminInternal(configureContainer?: (obj: PhpMyAdminContainerResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PhpMyAdminContainerResourceHandle; + const obj = new PhpMyAdminContainerResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.MySql/withPhpMyAdmin', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Adds phpMyAdmin management UI */ + withPhpMyAdmin(options?: WithPhpMyAdminOptions): MySqlServerResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new MySqlServerResourcePromise(this._withPhpMyAdminInternal(configureContainer, containerName)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.MySql/withDataVolume', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PgWebContainerResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new PgWebContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds a data volume for MySQL */ + withDataVolume(options?: WithDataVolumeOptions): MySqlServerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new MySqlServerResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); } /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', + private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.MySql/withDataBindMount', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Adds a data bind mount for MySQL */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): MySqlServerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new MySqlServerResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withInitFilesInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.MySql/withInitFiles', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new MySqlServerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): PgWebContainerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new PgWebContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Copies init files to MySQL */ + withInitFiles(source: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._withInitFilesInternal(source)); } - /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); - } +} - /** Configures OTLP telemetry export */ - withOtlpExporter(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withOtlpExporterInternal()); - } +/** + * Thenable wrapper for MySqlServerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class MySqlServerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + then( + onfulfilled?: ((value: MySqlServerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._publishAsConnectionStringInternal()); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Sets the container image tag */ + withImageTag(tag: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PgWebContainerResourcePromise { - const helpLink = options?.helpLink; - return new PgWebContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the container image registry */ + withImageRegistry(registry: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withEnvironmentInternal(name, value)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); } - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Configures the resource to be published as a container */ + publishAsContainer(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); } - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets the container name */ + withContainerName(name: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); } - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); } - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Configures OTLP telemetry export */ + withOtlpExporter(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Adds arguments */ - withArgs(args: string[]): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withArgsInternal(args)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PgWebContainerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new PgWebContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Adds arguments */ + withArgs(args: string[]): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): PgWebContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new PgWebContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); - } - - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + withEndpoint(options?: WithEndpointOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): PgWebContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new PgWebContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); - } - - /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + withHttpEndpoint(options?: WithHttpEndpointOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): PgWebContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new PgWebContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); - } - - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Configures resource for HTTP/2 */ + asHttp2Service(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._asHttp2ServiceInternal()); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): PgWebContainerResourcePromise { - const displayText = options?.displayText; - return new PgWebContainerResourcePromise(this._withUrlInternal(url, displayText)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PgWebContainerResourcePromise { - const displayText = options?.displayText; - return new PgWebContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._excludeFromManifestInternal()); + /** Adds a health check by key */ + withHealthCheck(key: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._waitForInternal(dependency)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._waitForStartInternal(dependency)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withExplicitStartInternal()); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PgWebContainerResourcePromise { - const exitCode = options?.exitCode; - return new PgWebContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** Adds a health check by key */ - withHealthCheck(key: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withHealthCheckInternal(key)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PgWebContainerResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new PgWebContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PgWebContainerResourcePromise { - const commandOptions = options?.commandOptions; - return new PgWebContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PgWebContainerResourcePromise { - const password = options?.password; - return new PgWebContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Adds a MySQL database */ + addDatabase(name: string, options?: AddDatabaseOptions): MySqlDatabaseResourcePromise { + return new MySqlDatabaseResourcePromise(this._promise.then(obj => obj.addDatabase(name, options))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Configures the MySQL password */ + withPassword(password: ParameterResource): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withPassword(password))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Adds phpMyAdmin management UI */ + withPhpMyAdmin(options?: WithPhpMyAdminOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withPhpMyAdmin(options))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withParentRelationshipInternal(parent)); + /** Adds a data volume for MySQL */ + withDataVolume(options?: WithDataVolumeOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new PgWebContainerResource(result, this._client); + /** Adds a data bind mount for MySQL */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withChildRelationshipInternal(child)); + /** Copies init files to MySQL */ + withInitFiles(source: string): MySqlServerResourcePromise { + return new MySqlServerResourcePromise(this._promise.then(obj => obj.withInitFiles(source))); + } + +} + +// ============================================================================ +// NodeAppResource +// ============================================================================ + +export class NodeAppResource extends ResourceBuilderBase { + constructor(handle: NodeAppResourceHandle, client: AspireClientRpc) { + super(handle, client); } + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): PgWebContainerResourcePromise { - const iconVariant = options?.iconVariant; - return new PgWebContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PgWebContainerResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new PgWebContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new NodeAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _publishAsDockerFileInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._excludeFromMcpInternal()); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PgWebContainerResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new PgWebContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): PgWebContainerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new PgWebContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); + return new NodeAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + const helpLink = options?.helpLink; + return new NodeAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withHostPortInternal(port?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/withPgWebHostPort', + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new PgWebContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the host port for pgweb */ - withHostPort(options?: WithHostPortOptions): PgWebContainerResourcePromise { - const port = options?.port; - return new PgWebContainerResourcePromise(this._withHostPortInternal(port)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } -} - -/** - * Thenable wrapper for PgWebContainerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class PgWebContainerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: PgWebContainerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentInternal(name, value)); } - /** Sets the container image tag */ - withImageTag(tag: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); - } - - /** Sets the container image registry */ - withImageRegistry(registry: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** Adds arguments */ + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsInternal(args)); } - /** Configures the resource to be published as a container */ - publishAsContainer(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackInternal(callback)); } - /** Sets the container name */ - withContainerName(name: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new NodeAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceUriInternal(name, uri)); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new NodeAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** Adds arguments */ - withArgs(args: string[]): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._asHttp2ServiceInternal()); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlInternal(url, displayText)); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new NodeAppResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new NodeAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new NodeAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new NodeAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new NodeAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new NodeAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + const exitCode = options?.exitCode; + return new NodeAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new NodeAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new NodeAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + const commandOptions = options?.commandOptions; + return new NodeAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + const password = options?.password; + return new NodeAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withChildRelationshipInternal(child)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + const iconVariant = options?.iconVariant; + return new NodeAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } - /** Sets the host port for pgweb */ - withHostPort(options?: WithHostPortOptions): PgWebContainerResourcePromise { - return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new NodeAppResource(result, this._client); } -} - -// ============================================================================ -// PhpMyAdminContainerResource -// ============================================================================ - -export class PhpMyAdminContainerResource extends ResourceBuilderBase { - constructor(handle: PhpMyAdminContainerResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withContainerRegistryInternal(registry)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): PhpMyAdminContainerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new PhpMyAdminContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new NodeAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withImageTagInternal(tag)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withImageRegistryInternal(registry)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): PhpMyAdminContainerResourcePromise { - const tag = options?.tag; - return new PhpMyAdminContainerResourcePromise(this._withImageInternal(image, tag)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withImageSHA256Internal(sha256)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withLifetimeInternal(lifetime)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._publishAsContainerInternal()); + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); } /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): PhpMyAdminContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new PhpMyAdminContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withBunInternal(install, installArgs)); } /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withContainerNameInternal(name)); + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withYarnInternal(install, installArgs)); } /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withBuildArgInternal(name, value)); + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withPnpmInternal(install, installArgs)); } /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withBuildSecretInternal(name, value)); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withBrowserDebuggerInternal(browser?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PhpMyAdminContainerResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new PhpMyAdminContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + const browser = options?.browser; + return new NodeAppResourcePromise(this._withBrowserDebuggerInternal(browser)); } - /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); - } +} - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); +/** + * Thenable wrapper for NodeAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class NodeAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: NodeAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): PhpMyAdminContainerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new PhpMyAdminContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withOtlpExporterInternal()); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._publishAsConnectionStringInternal()); + /** Configures OTLP telemetry export */ + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PhpMyAdminContainerResourcePromise { - const helpLink = options?.helpLink; - return new PhpMyAdminContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withEnvironmentInternal(name, value)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Adds arguments */ + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Adds arguments */ - withArgs(args: string[]): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withArgsInternal(args)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PhpMyAdminContainerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new PhpMyAdminContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): PhpMyAdminContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new PhpMyAdminContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): PhpMyAdminContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new PhpMyAdminContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): PhpMyAdminContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new PhpMyAdminContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._asHttp2ServiceInternal()); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): PhpMyAdminContainerResourcePromise { - const displayText = options?.displayText; - return new PhpMyAdminContainerResourcePromise(this._withUrlInternal(url, displayText)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PhpMyAdminContainerResourcePromise { - const displayText = options?.displayText; - return new PhpMyAdminContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._excludeFromManifestInternal()); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._waitForInternal(dependency)); + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBun(options))); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new PhpMyAdminContainerResource(result, this._client); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._waitForStartInternal(dependency)); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withExplicitStartInternal()); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PhpMyAdminContainerResourcePromise { - const exitCode = options?.exitCode; - return new PhpMyAdminContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withHealthCheckInternal(key)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PhpMyAdminContainerResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new PhpMyAdminContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PhpMyAdminContainerResourcePromise { - const commandOptions = options?.commandOptions; - return new PhpMyAdminContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PhpMyAdminContainerResourcePromise { - const password = options?.password; - return new PhpMyAdminContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withParentRelationshipInternal(parent)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withChildRelationshipInternal(child)); + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): PhpMyAdminContainerResourcePromise { - const iconVariant = options?.iconVariant; - return new PhpMyAdminContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PhpMyAdminContainerResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new PhpMyAdminContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._excludeFromMcpInternal()); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -17274,6351 +19209,6361 @@ export class PhpMyAdminContainerResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new ParameterResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PhpMyAdminContainerResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new PhpMyAdminContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new ParameterResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new ParameterResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): PhpMyAdminContainerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new PhpMyAdminContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withHostPortInternal(port?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.MySql/withHostPort', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new PhpMyAdminContainerResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the host port for phpMyAdmin */ - withHostPort(options?: WithHostPortOptions): PhpMyAdminContainerResourcePromise { - const port = options?.port; - return new PhpMyAdminContainerResourcePromise(this._withHostPortInternal(port)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceReadyInternal(callback)); } } /** - * Thenable wrapper for PhpMyAdminContainerResource that enables fluent chaining. + * Thenable wrapper for ParameterResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class PhpMyAdminContainerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: PhpMyAdminContainerResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); } - /** Sets the container image tag */ - withImageTag(tag: string): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets the container image registry */ - withImageRegistry(registry: string): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Configures the resource to be published as a container */ - publishAsContainer(): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Sets the container name */ - withContainerName(name: string): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); - } +} - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } +// ============================================================================ +// PgAdminContainerResource +// ============================================================================ - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); +export class PgAdminContainerResource extends ResourceBuilderBase { + constructor(handle: PgAdminContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withContainerRegistryInternal(registry)); } - /** Adds arguments */ - withArgs(args: string[]): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PgAdminContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new PgAdminContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEntrypointInternal(entrypoint)); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Sets the container image tag */ + withImageTag(tag: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withImageTagInternal(tag)); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** Sets the container image registry */ + withImageRegistry(registry: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withImageRegistryInternal(registry)); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PgAdminContainerResourcePromise { + const tag = options?.tag; + return new PgAdminContainerResourcePromise(this._withImageInternal(image, tag)); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withImageSHA256Internal(sha256)); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withLifetimeInternal(lifetime)); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Configures the resource to be published as a container */ + publishAsContainer(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._publishAsContainerInternal()); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PgAdminContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new PgAdminContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Sets the container name */ + withContainerName(name: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withContainerNameInternal(name)); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withBuildArgInternal(name, value)); } - /** Prevents resource from starting automatically */ - withExplicitStart(): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withBuildSecretInternal(name, value)); } - /** Adds a health check by key */ - withHealthCheck(key: string): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PgAdminContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new PgAdminContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PgAdminContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new PgAdminContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withOtlpExporterInternal()); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._publishAsConnectionStringInternal()); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PgAdminContainerResourcePromise { + const helpLink = options?.helpLink; + return new PgAdminContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** Sets the host port for phpMyAdmin */ - withHostPort(options?: WithHostPortOptions): PhpMyAdminContainerResourcePromise { - return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } -} - -// ============================================================================ -// PostgresDatabaseResource -// ============================================================================ - -export class PostgresDatabaseResource extends ResourceBuilderBase { - constructor(handle: PostgresDatabaseResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); } - /** Gets the Parent property */ - parent = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.parent', - { context: this._handle } - ); - return new PostgresServerResource(handle, this._client); - }, - }; - - /** Gets the ConnectionStringExpression property */ - connectionStringExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.connectionStringExpression', - { context: this._handle } - ); - }, - }; - - /** Gets the DatabaseName property */ - databaseName = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.databaseName', - { context: this._handle } - ); - }, - }; - - /** Gets the UriExpression property */ - uriExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.uriExpression', - { context: this._handle } - ); - }, - }; - - /** Gets the JdbcConnectionString property */ - jdbcConnectionString = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.jdbcConnectionString', - { context: this._handle } - ); - }, - }; - - /** Gets the Name property */ - name = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.name', - { context: this._handle } - ); - }, - }; - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withContainerRegistryInternal(registry)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresDatabaseResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new PostgresDatabaseResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresDatabaseResourcePromise { - const helpLink = options?.helpLink; - return new PostgresDatabaseResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Adds arguments */ + withArgs(args: string[]): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): PostgresDatabaseResourcePromise { - const displayText = options?.displayText; - return new PostgresDatabaseResourcePromise(this._withUrlInternal(url, displayText)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PgAdminContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new PgAdminContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresDatabaseResourcePromise { - const displayText = options?.displayText; - return new PostgresDatabaseResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._excludeFromManifestInternal()); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withExplicitStartInternal()); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PgAdminContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new PgAdminContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withHealthCheckInternal(key)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PgAdminContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PgAdminContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresDatabaseResourcePromise { - const commandOptions = options?.commandOptions; - return new PostgresDatabaseResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PgAdminContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PgAdminContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withParentRelationshipInternal(parent)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): PostgresDatabaseResourcePromise { - const iconVariant = options?.iconVariant; - return new PostgresDatabaseResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._excludeFromMcpInternal()); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new PostgresDatabaseResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresDatabaseResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new PostgresDatabaseResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PgAdminContainerResourcePromise { + const displayText = options?.displayText; + return new PgAdminContainerResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PgAdminContainerResourcePromise { + const displayText = options?.displayText; + return new PgAdminContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); + return new PgAdminContainerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withPostgresMcpInternal(configureContainer?: (obj: PostgresMcpContainerResource) => Promise, containerName?: string): Promise { - const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PostgresMcpContainerResourceHandle; - const obj = new PostgresMcpContainerResource(objHandle, this._client); - await configureContainer(obj); - }) : undefined; + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; - if (containerName !== undefined) rpcArgs.containerName = containerName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/withPostgresMcp', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds Postgres MCP server */ - withPostgresMcp(options?: WithPostgresMcpOptions): PostgresDatabaseResourcePromise { - const configureContainer = options?.configureContainer; - const containerName = options?.containerName; - return new PostgresDatabaseResourcePromise(this._withPostgresMcpInternal(configureContainer, containerName)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withCreationScriptInternal(script: string): Promise { - const rpcArgs: Record = { builder: this._handle, script }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/withCreationScript', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Defines the SQL script for database creation */ - withCreationScript(script: string): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._withCreationScriptInternal(script)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._waitForInternal(dependency)); } -} - -/** - * Thenable wrapper for PostgresDatabaseResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class PostgresDatabaseResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: PostgresDatabaseResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._waitForStartInternal(dependency)); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Prevents resource from starting automatically */ + withExplicitStart(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withExplicitStartInternal()); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PgAdminContainerResourcePromise { + const exitCode = options?.exitCode; + return new PgAdminContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Adds a health check by key */ + withHealthCheck(key: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withHealthCheckInternal(key)); } - /** Prevents resource from starting automatically */ - withExplicitStart(): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PgAdminContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new PgAdminContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PgAdminContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new PgAdminContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PgAdminContainerResourcePromise { + const password = options?.password; + return new PgAdminContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } - /** Adds Postgres MCP server */ - withPostgresMcp(options?: WithPostgresMcpOptions): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withPostgresMcp(options))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Defines the SQL script for database creation */ - withCreationScript(script: string): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withCreationScript(script))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new PgAdminContainerResource(result, this._client); } -} - -// ============================================================================ -// PostgresMcpContainerResource -// ============================================================================ - -export class PostgresMcpContainerResource extends ResourceBuilderBase { - constructor(handle: PostgresMcpContainerResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withContainerRegistryInternal(registry)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): PostgresMcpContainerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new PostgresMcpContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PgAdminContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new PgAdminContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PgAdminContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new PgAdminContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withImageTagInternal(tag)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withImageRegistryInternal(registry)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): PostgresMcpContainerResourcePromise { - const tag = options?.tag; - return new PostgresMcpContainerResourcePromise(this._withImageInternal(image, tag)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withImageSHA256Internal(sha256)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PgAdminContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new PgAdminContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withLifetimeInternal(lifetime)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PgAdminContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new PgAdminContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); } - /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); - } - - /** Configures the resource to be published as a container */ - publishAsContainer(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): PostgresMcpContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new PostgresMcpContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withContainerNameInternal(name)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withBuildArgInternal(name, value)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withBuildSecretInternal(name, value)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withHostPortInternal(port?: number): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPgAdminHostPort', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgAdminContainerResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresMcpContainerResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new PostgresMcpContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Sets the host port for pgAdmin */ + withHostPort(options?: WithHostPortOptions): PgAdminContainerResourcePromise { + const port = options?.port; + return new PgAdminContainerResourcePromise(this._withHostPortInternal(port)); } - /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); - } +} - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); - } +/** + * Thenable wrapper for PgAdminContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class PgAdminContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + then( + onfulfilled?: ((value: PgAdminContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): PostgresMcpContainerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new PostgresMcpContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withOtlpExporterInternal()); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } - /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Sets the container image tag */ + withImageTag(tag: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the container image registry */ + withImageRegistry(registry: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._publishAsConnectionStringInternal()); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresMcpContainerResourcePromise { - const helpLink = options?.helpLink; - return new PostgresMcpContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withEnvironmentInternal(name, value)); + /** Configures the resource to be published as a container */ + publishAsContainer(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); } - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Sets the container name */ + withContainerName(name: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); } - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); } - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Configures OTLP telemetry export */ + withOtlpExporter(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Adds arguments */ - withArgs(args: string[]): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withArgsInternal(args)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Adds arguments */ + withArgs(args: string[]): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PostgresMcpContainerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new PostgresMcpContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withServiceReferenceInternal(source)); - } + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): PostgresMcpContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new PostgresMcpContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): PostgresMcpContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new PostgresMcpContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): PostgresMcpContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new PostgresMcpContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._asHttp2ServiceInternal()); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): PostgresMcpContainerResourcePromise { - const displayText = options?.displayText; - return new PostgresMcpContainerResourcePromise(this._withUrlInternal(url, displayText)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresMcpContainerResourcePromise { - const displayText = options?.displayText; - return new PostgresMcpContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._excludeFromManifestInternal()); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._waitForInternal(dependency)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._waitForStartInternal(dependency)); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withExplicitStartInternal()); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PostgresMcpContainerResourcePromise { - const exitCode = options?.exitCode; - return new PostgresMcpContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + /** Sets the host port for pgAdmin */ + withHostPort(options?: WithHostPortOptions): PgAdminContainerResourcePromise { + return new PgAdminContainerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); } - /** Adds a health check by key */ - withHealthCheck(key: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withHealthCheckInternal(key)); +} + +// ============================================================================ +// PgWebContainerResource +// ============================================================================ + +export class PgWebContainerResource extends ResourceBuilderBase { + constructor(handle: PgWebContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PostgresMcpContainerResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new PostgresMcpContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresMcpContainerResourcePromise { - const commandOptions = options?.commandOptions; - return new PostgresMcpContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PgWebContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new PgWebContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Sets the container image tag */ + withImageTag(tag: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PostgresMcpContainerResourcePromise { - const password = options?.password; - return new PostgresMcpContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Sets the container image registry */ + withImageRegistry(registry: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PgWebContainerResourcePromise { + const tag = options?.tag; + return new PgWebContainerResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withParentRelationshipInternal(parent)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withChildRelationshipInternal(child)); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): PostgresMcpContainerResourcePromise { - const iconVariant = options?.iconVariant; - return new PostgresMcpContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withLifetimeInternal(lifetime)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PostgresMcpContainerResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new PostgresMcpContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _publishAsContainerInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._excludeFromMcpInternal()); + /** Configures the resource to be published as a container */ + publishAsContainer(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PgWebContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new PgWebContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Sets the container name */ + withContainerName(name: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withContainerNameInternal(name)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresMcpContainerResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new PostgresMcpContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withBuildArgInternal(name, value)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); - return new PostgresMcpContainerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', - rpcArgs - ); - return new PostgresMcpContainerResource(result, this._client); + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): PostgresMcpContainerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new PostgresMcpContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PgWebContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new PgWebContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', rpcArgs ); + return new PgWebContainerResource(result, this._client); } -} - -/** - * Thenable wrapper for PostgresMcpContainerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class PostgresMcpContainerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } - then( - onfulfilled?: ((value: PostgresMcpContainerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PgWebContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new PgWebContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withOtlpExporterInternal()); } - /** Sets the container image tag */ - withImageTag(tag: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._publishAsConnectionStringInternal()); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PgWebContainerResourcePromise { + const helpLink = options?.helpLink; + return new PgWebContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEnvironmentInternal(name, value)); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Adds arguments */ + withArgs(args: string[]): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withArgsInternal(args)); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withArgsCallbackInternal(callback)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PgWebContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new PgWebContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withReferenceUriInternal(name, uri)); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PgWebContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new PgWebContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PgWebContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PgWebContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PgWebContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PgWebContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._asHttp2ServiceInternal()); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PgWebContainerResourcePromise { + const displayText = options?.displayText; + return new PgWebContainerResourcePromise(this._withUrlInternal(url, displayText)); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PgWebContainerResourcePromise { + const displayText = options?.displayText; + return new PgWebContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } - /** Prevents resource from starting automatically */ - withExplicitStart(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._excludeFromManifestInternal()); } - /** Adds a health check by key */ - withHealthCheck(key: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._waitForInternal(dependency)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._waitForStartInternal(dependency)); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Prevents resource from starting automatically */ + withExplicitStart(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withExplicitStartInternal()); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PgWebContainerResourcePromise { + const exitCode = options?.exitCode; + return new PgWebContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Adds a health check by key */ + withHealthCheck(key: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withHealthCheckInternal(key)); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PgWebContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new PgWebContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): PostgresMcpContainerResourcePromise { - return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); - } - - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PgWebContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new PgWebContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } -} - -// ============================================================================ -// PostgresServerResource -// ============================================================================ - -export class PostgresServerResource extends ResourceBuilderBase { - constructor(handle: PostgresServerResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new PgWebContainerResource(result, this._client); } - /** Gets the PrimaryEndpoint property */ - primaryEndpoint = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.primaryEndpoint', - { context: this._handle } - ); - return new EndpointReference(handle, this._client); - }, - }; - - /** Gets the UserNameReference property */ - userNameReference = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.userNameReference', - { context: this._handle } - ); - }, - }; - - /** Gets the ConnectionStringExpression property */ - connectionStringExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.connectionStringExpression', - { context: this._handle } - ); - }, - }; - - /** Gets the Databases property */ - private _databases?: AspireDict; - get databases(): AspireDict { - if (!this._databases) { - this._databases = new AspireDict( - this._handle, - this._client, - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.databases', - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.databases' - ); - } - return this._databases; + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Gets the Host property */ - host = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.host', - { context: this._handle } - ); - return new EndpointReferenceExpression(handle, this._client); - }, - }; - - /** Gets the Port property */ - port = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.port', - { context: this._handle } - ); - return new EndpointReferenceExpression(handle, this._client); - }, - }; - - /** Gets the UriExpression property */ - uriExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.uriExpression', - { context: this._handle } - ); - }, - }; - - /** Gets the JdbcConnectionString property */ - jdbcConnectionString = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.jdbcConnectionString', - { context: this._handle } - ); - }, - }; - - /** Gets the Entrypoint property */ - entrypoint = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.entrypoint', - { context: this._handle } - ); - }, - set: async (value: string): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.setEntrypoint', - { context: this._handle, value } - ); - } - }; - - /** Gets the ShellExecution property */ - shellExecution = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.shellExecution', - { context: this._handle } - ); - }, - set: async (value: boolean): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.setShellExecution', - { context: this._handle, value } - ); - } - }; - - /** Gets the Name property */ - name = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/PostgresServerResource.name', - { context: this._handle } - ); - }, - }; - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withContainerRegistryInternal(registry)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): PostgresServerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new PostgresServerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PgWebContainerResourcePromise { + const password = options?.password; + return new PgWebContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withImageTagInternal(tag)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withImageRegistryInternal(registry)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): PostgresServerResourcePromise { - const tag = options?.tag; - return new PostgresServerResourcePromise(this._withImageInternal(image, tag)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PgWebContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new PgWebContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withImageSHA256Internal(sha256)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PgWebContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new PgWebContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withLifetimeInternal(lifetime)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._publishAsContainerInternal()); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PgWebContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new PgWebContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): PostgresServerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new PostgresServerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withContainerNameInternal(name)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withBuildArgInternal(name, value)); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PgWebContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new PgWebContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); } - /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new PostgresServerResource(result, this._client); - } - - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresServerResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new PostgresServerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): PostgresServerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new PostgresServerResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withOtlpExporterInternal()); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPgWebHostPort', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PgWebContainerResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the host port for pgweb */ + withHostPort(options?: WithHostPortOptions): PgWebContainerResourcePromise { + const port = options?.port; + return new PgWebContainerResourcePromise(this._withHostPortInternal(port)); } - /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', - rpcArgs - ); - return new PostgresServerResource(result, this._client); - } +} - /** Publishes the resource as a connection string */ - publishAsConnectionString(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._publishAsConnectionStringInternal()); +/** + * Thenable wrapper for PgWebContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class PgWebContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PgWebContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresServerResourcePromise { - const helpLink = options?.helpLink; - return new PostgresServerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withEnvironmentInternal(name, value)); + /** Sets the container image tag */ + withImageTag(tag: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Sets the container image registry */ + withImageRegistry(registry: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Configures the resource to be published as a container */ + publishAsContainer(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); } - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Sets the container name */ + withContainerName(name: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); } - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } - /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } - /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Adds arguments */ - withArgs(args: string[]): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withArgsInternal(args)); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PostgresServerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new PostgresServerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Adds arguments */ + withArgs(args: string[]): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withServiceReferenceInternal(source)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): PostgresServerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new PostgresServerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Configures resource for HTTP/2 */ + asHttp2Service(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): PostgresServerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new PostgresServerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): PostgresServerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new PostgresServerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._asHttp2ServiceInternal()); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Prevents resource from starting automatically */ + withExplicitStart(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): PostgresServerResourcePromise { - const displayText = options?.displayText; - return new PostgresServerResourcePromise(this._withUrlInternal(url, displayText)); + /** Adds a health check by key */ + withHealthCheck(key: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresServerResourcePromise { - const displayText = options?.displayText; - return new PostgresServerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._excludeFromManifestInternal()); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._waitForInternal(dependency)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._waitForStartInternal(dependency)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withExplicitStartInternal()); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PostgresServerResourcePromise { - const exitCode = options?.exitCode; - return new PostgresServerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Adds a health check by key */ - withHealthCheck(key: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withHealthCheckInternal(key)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new PostgresServerResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PostgresServerResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new PostgresServerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Sets the host port for pgweb */ + withHostPort(options?: WithHostPortOptions): PgWebContainerResourcePromise { + return new PgWebContainerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + +} + +// ============================================================================ +// PhpMyAdminContainerResource +// ============================================================================ + +export class PhpMyAdminContainerResource extends ResourceBuilderBase { + constructor(handle: PhpMyAdminContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresServerResourcePromise { - const commandOptions = options?.commandOptions; - return new PostgresServerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PhpMyAdminContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new PhpMyAdminContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PostgresServerResourcePromise { - const password = options?.password; - return new PostgresServerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Sets the container image tag */ + withImageTag(tag: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Sets the container image registry */ + withImageRegistry(registry: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withParentRelationshipInternal(parent)); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PhpMyAdminContainerResourcePromise { + const tag = options?.tag; + return new PhpMyAdminContainerResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): PostgresServerResourcePromise { - const iconVariant = options?.iconVariant; - return new PostgresServerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PostgresServerResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new PostgresServerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withLifetimeInternal(lifetime)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._excludeFromMcpInternal()); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Configures the resource to be published as a container */ + publishAsContainer(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PhpMyAdminContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new PhpMyAdminContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresServerResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new PostgresServerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Sets the container name */ + withContainerName(name: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withContainerNameInternal(name)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withBuildArgInternal(name, value)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); - return new PostgresServerResource(result, this._client); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): PostgresServerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new PostgresServerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + return new PhpMyAdminContainerResource(result, this._client); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _addDatabaseInternal(name: string, databaseName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (databaseName !== undefined) rpcArgs.databaseName = databaseName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/addDatabase', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new PostgresDatabaseResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds a PostgreSQL database */ - addDatabase(name: string, options?: AddDatabaseOptions): PostgresDatabaseResourcePromise { - const databaseName = options?.databaseName; - return new PostgresDatabaseResourcePromise(this._addDatabaseInternal(name, databaseName)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PhpMyAdminContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new PhpMyAdminContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withPgAdminInternal(configureContainer?: (obj: PgAdminContainerResource) => Promise, containerName?: string): Promise { - const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PgAdminContainerResourceHandle; - const obj = new PgAdminContainerResource(objHandle, this._client); - await configureContainer(obj); - }) : undefined; - const rpcArgs: Record = { builder: this._handle }; - if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; - if (containerName !== undefined) rpcArgs.containerName = containerName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/withPgAdmin', + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds pgAdmin 4 management UI */ - withPgAdmin(options?: WithPgAdminOptions): PostgresServerResourcePromise { - const configureContainer = options?.configureContainer; - const containerName = options?.containerName; - return new PostgresServerResourcePromise(this._withPgAdminInternal(configureContainer, containerName)); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); } /** @internal */ - private async _withPgWebInternal(configureContainer?: (obj: PgWebContainerResource) => Promise, containerName?: string): Promise { - const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PgWebContainerResourceHandle; - const obj = new PgWebContainerResource(objHandle, this._client); - await configureContainer(obj); - }) : undefined; + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; - if (containerName !== undefined) rpcArgs.containerName = containerName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/withPgWeb', + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds pgweb management UI */ - withPgWeb(options?: WithPgWebOptions): PostgresServerResourcePromise { - const configureContainer = options?.configureContainer; - const containerName = options?.containerName; - return new PostgresServerResourcePromise(this._withPgWebInternal(configureContainer, containerName)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PhpMyAdminContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new PhpMyAdminContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { + private async _withOtlpExporterInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/withDataVolume', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds a data volume for PostgreSQL */ - withDataVolume(options?: WithDataVolumeOptions): PostgresServerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new PostgresServerResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/withDataBindMount', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds a data bind mount for PostgreSQL */ - withDataBindMount(source: string, options?: WithDataBindMountOptions): PostgresServerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new PostgresServerResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withInitFilesInternal(source: string): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/withInitFiles', + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Copies init files to PostgreSQL */ - withInitFiles(source: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withInitFilesInternal(source)); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._publishAsConnectionStringInternal()); } /** @internal */ - private async _withPasswordInternal(password: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, password }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/withPassword', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Configures the PostgreSQL password */ - withPassword(password: ParameterResource): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withPasswordInternal(password)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PhpMyAdminContainerResourcePromise { + const helpLink = options?.helpLink; + return new PhpMyAdminContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withUserNameInternal(userName: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, userName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/withUserName', + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Configures the PostgreSQL user name */ - withUserName(userName: ParameterResource): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._withUserNameInternal(userName)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withHostPortInternal(port?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.PostgreSQL/withPostgresHostPort', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new PostgresServerResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Sets the host port for PostgreSQL */ - withHostPort(options?: WithHostPortOptions): PostgresServerResourcePromise { - const port = options?.port; - return new PostgresServerResourcePromise(this._withHostPortInternal(port)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } -} - -/** - * Thenable wrapper for PostgresServerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class PostgresServerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); + } - then( - onfulfilled?: ((value: PostgresServerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withEnvironmentInternal(name, value)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } - /** Sets the container image registry */ - withImageRegistry(registry: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** Adds arguments */ + withArgs(args: string[]): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withArgsInternal(args)); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withArgsCallbackInternal(callback)); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } - /** Configures the resource to be published as a container */ - publishAsContainer(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PhpMyAdminContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new PhpMyAdminContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } - /** Sets the container name */ - withContainerName(name: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withReferenceUriInternal(name, uri)); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PhpMyAdminContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new PhpMyAdminContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PhpMyAdminContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PhpMyAdminContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PhpMyAdminContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PhpMyAdminContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._asHttp2ServiceInternal()); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PhpMyAdminContainerResourcePromise { + const displayText = options?.displayText; + return new PhpMyAdminContainerResourcePromise(this._withUrlInternal(url, displayText)); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PhpMyAdminContainerResourcePromise { + const displayText = options?.displayText; + return new PhpMyAdminContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._excludeFromManifestInternal()); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._waitForInternal(dependency)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._waitForStartInternal(dependency)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Prevents resource from starting automatically */ + withExplicitStart(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withExplicitStartInternal()); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PhpMyAdminContainerResourcePromise { + const exitCode = options?.exitCode; + return new PhpMyAdminContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Adds a health check by key */ + withHealthCheck(key: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withHealthCheckInternal(key)); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PhpMyAdminContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new PhpMyAdminContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PhpMyAdminContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new PhpMyAdminContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PhpMyAdminContainerResourcePromise { + const password = options?.password; + return new PhpMyAdminContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withChildRelationshipInternal(child)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PhpMyAdminContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new PhpMyAdminContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PhpMyAdminContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new PhpMyAdminContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); - } - - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); - } - - /** Adds a PostgreSQL database */ - addDatabase(name: string, options?: AddDatabaseOptions): PostgresDatabaseResourcePromise { - return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.addDatabase(name, options))); - } - - /** Adds pgAdmin 4 management UI */ - withPgAdmin(options?: WithPgAdminOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPgAdmin(options))); - } - - /** Adds pgweb management UI */ - withPgWeb(options?: WithPgWebOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPgWeb(options))); - } - - /** Adds a data volume for PostgreSQL */ - withDataVolume(options?: WithDataVolumeOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); - } - - /** Adds a data bind mount for PostgreSQL */ - withDataBindMount(source: string, options?: WithDataBindMountOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Copies init files to PostgreSQL */ - withInitFiles(source: string): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withInitFiles(source))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._excludeFromMcpInternal()); } - /** Configures the PostgreSQL password */ - withPassword(password: ParameterResource): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPassword(password))); + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } - /** Configures the PostgreSQL user name */ - withUserName(userName: ParameterResource): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUserName(userName))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } - /** Sets the host port for PostgreSQL */ - withHostPort(options?: WithHostPortOptions): PostgresServerResourcePromise { - return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new PhpMyAdminContainerResource(result, this._client); } -} - -// ============================================================================ -// ProjectResource -// ============================================================================ - -export class ProjectResource extends ResourceBuilderBase { - constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PhpMyAdminContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new PhpMyAdminContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ProjectResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', rpcArgs ); - return new ProjectResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterInternal()); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PhpMyAdminContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new PhpMyAdminContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); } - /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new ProjectResource(result, this._client); - } - - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ProjectResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - const helpLink = options?.helpLink; - return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new ProjectResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new ProjectResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new ProjectResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new ProjectResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.MySql/withHostPort', rpcArgs ); - return new ProjectResource(result, this._client); + return new PhpMyAdminContainerResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets the host port for phpMyAdmin */ + withHostPort(options?: WithHostPortOptions): PhpMyAdminContainerResourcePromise { + const port = options?.port; + return new PhpMyAdminContainerResourcePromise(this._withHostPortInternal(port)); } - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new ProjectResource(result, this._client); +} + +/** + * Thenable wrapper for PhpMyAdminContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class PhpMyAdminContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PhpMyAdminContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets the container image tag */ + withImageTag(tag: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsInternal(args)); + /** Sets the container image registry */ + withImageRegistry(registry: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); } - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Configures the resource to be published as a container */ + publishAsContainer(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + /** Sets the container name */ + withContainerName(name: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Configures OTLP telemetry export */ + withOtlpExporter(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Adds arguments */ + withArgs(args: string[]): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { - const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { - const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Configures resource for HTTP/2 */ + asHttp2Service(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromManifestInternal()); - } - - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new ProjectResource(result, this._client); + excludeFromManifest(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + /** Prevents resource from starting automatically */ + withExplicitStart(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Adds a health check by key */ + withHealthCheck(key: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExplicitStartInternal()); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { - const exitCode = options?.exitCode; - return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { - const commandOptions = options?.commandOptions; - return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { - const password = options?.password; - return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { - const iconVariant = options?.iconVariant; - return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Sets the host port for phpMyAdmin */ + withHostPort(options?: WithHostPortOptions): PhpMyAdminContainerResourcePromise { + return new PhpMyAdminContainerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); } - /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', +} + +// ============================================================================ +// PostgresDatabaseResource +// ============================================================================ + +export class PostgresDatabaseResource extends ResourceBuilderBase { + constructor(handle: PostgresDatabaseResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Parent property */ + parent = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.parent', + { context: this._handle } + ); + return new PostgresServerResource(handle, this._client); + }, + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the DatabaseName property */ + databaseName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.databaseName', + { context: this._handle } + ); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the JdbcConnectionString property */ + jdbcConnectionString = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.jdbcConnectionString', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresDatabaseResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromMcpInternal()); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresDatabaseResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new PostgresDatabaseResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresDatabaseResourcePromise { + const helpLink = options?.helpLink; + return new PostgresDatabaseResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withConnectionPropertyInternal(name, value)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new PostgresDatabaseResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); + return new PostgresDatabaseResource(result, this._client); } -} + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PostgresDatabaseResourcePromise { + const displayText = options?.displayText; + return new PostgresDatabaseResourcePromise(this._withUrlInternal(url, displayText)); + } -/** - * Thenable wrapper for ProjectResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ProjectResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresDatabaseResourcePromise { + const displayText = options?.displayText; + return new PostgresDatabaseResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._excludeFromManifestInternal()); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Prevents resource from starting automatically */ + withExplicitStart(): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withExplicitStartInternal()); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Adds a health check by key */ + withHealthCheck(key: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withHealthCheckInternal(key)); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresDatabaseResourcePromise { + const commandOptions = options?.commandOptions; + return new PostgresDatabaseResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withChildRelationshipInternal(child)); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PostgresDatabaseResourcePromise { + const iconVariant = options?.iconVariant; + return new PostgresDatabaseResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._excludeFromMcpInternal()); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresDatabaseResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new PostgresDatabaseResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._onConnectionStringAvailableInternal(callback)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._onResourceReadyInternal(callback)); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** @internal */ + private async _withPostgresMcpInternal(configureContainer?: (obj: PostgresMcpContainerResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PostgresMcpContainerResourceHandle; + const obj = new PostgresMcpContainerResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPostgresMcp', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Adds Postgres MCP server */ + withPostgresMcp(options?: WithPostgresMcpOptions): PostgresDatabaseResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new PostgresDatabaseResourcePromise(this._withPostgresMcpInternal(configureContainer, containerName)); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** @internal */ + private async _withCreationScriptInternal(script: string): Promise { + const rpcArgs: Record = { builder: this._handle, script }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withCreationScript', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Defines the SQL script for database creation */ + withCreationScript(script: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._withCreationScriptInternal(script)); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); +} + +/** + * Thenable wrapper for PostgresDatabaseResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class PostgresDatabaseResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PostgresDatabaseResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Prevents resource from starting automatically */ + withExplicitStart(): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds a health check by key */ + withHealthCheck(key: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -23626,1444 +25571,8706 @@ export class ProjectResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } -} + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } -// ============================================================================ -// SqlServerDatabaseResource -// ============================================================================ + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } -export class SqlServerDatabaseResource extends ResourceBuilderBase { - constructor(handle: SqlServerDatabaseResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } - /** Gets the Parent property */ - parent = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.parent', - { context: this._handle } - ); - return new SqlServerServerResource(handle, this._client); - }, - }; + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } - /** Gets the ConnectionStringExpression property */ - connectionStringExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.connectionStringExpression', - { context: this._handle } - ); - }, - }; + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } - /** Gets the UriExpression property */ - uriExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.uriExpression', - { context: this._handle } - ); - }, - }; + /** Adds Postgres MCP server */ + withPostgresMcp(options?: WithPostgresMcpOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withPostgresMcp(options))); + } - /** Gets the JdbcConnectionString property */ - jdbcConnectionString = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.jdbcConnectionString', - { context: this._handle } - ); - }, - }; + /** Defines the SQL script for database creation */ + withCreationScript(script: string): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.withCreationScript(script))); + } - /** Gets the DatabaseName property */ - databaseName = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.databaseName', - { context: this._handle } - ); - }, - }; +} - /** Gets the Name property */ - name = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.name', - { context: this._handle } - ); - }, - }; +// ============================================================================ +// PostgresMcpContainerResource +// ============================================================================ + +export class PostgresMcpContainerResource extends ResourceBuilderBase { + constructor(handle: PostgresMcpContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerDatabaseResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new SqlServerDatabaseResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PostgresMcpContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new PostgresMcpContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerDatabaseResourcePromise { - const helpLink = options?.helpLink; - return new SqlServerDatabaseResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Sets the container image tag */ + withImageTag(tag: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Sets the container image registry */ + withImageRegistry(registry: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PostgresMcpContainerResourcePromise { + const tag = options?.tag; + return new PostgresMcpContainerResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): SqlServerDatabaseResourcePromise { - const displayText = options?.displayText; - return new SqlServerDatabaseResourcePromise(this._withUrlInternal(url, displayText)); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerDatabaseResourcePromise { - const displayText = options?.displayText; - return new SqlServerDatabaseResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withLifetimeInternal(lifetime)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _publishAsContainerInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._excludeFromManifestInternal()); + /** Configures the resource to be published as a container */ + publishAsContainer(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withExplicitStartInternal()); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PostgresMcpContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new PostgresMcpContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withHealthCheckInternal(key)); + /** Sets the container name */ + withContainerName(name: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withContainerNameInternal(name)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerDatabaseResourcePromise { - const commandOptions = options?.commandOptions; - return new SqlServerDatabaseResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withBuildArgInternal(name, value)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withParentRelationshipInternal(parent)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withChildRelationshipInternal(child)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): SqlServerDatabaseResourcePromise { - const iconVariant = options?.iconVariant; - return new SqlServerDatabaseResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresMcpContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new PostgresMcpContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._excludeFromMcpInternal()); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PostgresMcpContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new PostgresMcpContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerDatabaseResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new SqlServerDatabaseResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._publishAsConnectionStringInternal()); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresMcpContainerResourcePromise { + const helpLink = options?.helpLink; + return new PostgresMcpContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withCreationScriptInternal(script: string): Promise { - const rpcArgs: Record = { builder: this._handle, script }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.SqlServer/withCreationScript', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new PostgresMcpContainerResource(result, this._client); } - /** Defines the SQL script used to create the database */ - withCreationScript(script: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withCreationScriptInternal(script)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } -} - -/** - * Thenable wrapper for SqlServerDatabaseResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class SqlServerDatabaseResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: SqlServerDatabaseResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEnvironmentInternal(name, value)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Adds arguments */ + withArgs(args: string[]): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withArgsInternal(args)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withArgsCallbackInternal(callback)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } - /** Prevents resource from starting automatically */ - withExplicitStart(): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PostgresMcpContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new PostgresMcpContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withReferenceUriInternal(name, uri)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PostgresMcpContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new PostgresMcpContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PostgresMcpContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PostgresMcpContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PostgresMcpContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PostgresMcpContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PostgresMcpContainerResourcePromise { + const displayText = options?.displayText; + return new PostgresMcpContainerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresMcpContainerResourcePromise { + const displayText = options?.displayText; + return new PostgresMcpContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PostgresMcpContainerResourcePromise { + const exitCode = options?.exitCode; + return new PostgresMcpContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PostgresMcpContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new PostgresMcpContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresMcpContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new PostgresMcpContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PostgresMcpContainerResourcePromise { + const password = options?.password; + return new PostgresMcpContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PostgresMcpContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new PostgresMcpContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PostgresMcpContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new PostgresMcpContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresMcpContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new PostgresMcpContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PostgresMcpContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new PostgresMcpContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new PostgresMcpContainerResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._onResourceReadyInternal(callback)); + } + +} + +/** + * Thenable wrapper for PostgresMcpContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class PostgresMcpContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PostgresMcpContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): PostgresMcpContainerResourcePromise { + return new PostgresMcpContainerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// PostgresServerResource +// ============================================================================ + +export class PostgresServerResource extends ResourceBuilderBase { + constructor(handle: PostgresServerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the PrimaryEndpoint property */ + primaryEndpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.primaryEndpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the UserNameParameter property */ + userNameParameter = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.userNameParameter', + { context: this._handle } + ); + return new ParameterResource(handle, this._client); + }, + }; + + /** Gets the UserNameReference property */ + userNameReference = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.userNameReference', + { context: this._handle } + ); + }, + }; + + /** Gets the PasswordParameter property */ + passwordParameter = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.passwordParameter', + { context: this._handle } + ); + return new ParameterResource(handle, this._client); + }, + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the Databases property */ + private _databases?: AspireDict; + get databases(): AspireDict { + if (!this._databases) { + this._databases = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.databases', + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.databases' + ); + } + return this._databases; + } + + /** Gets the Host property */ + host = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.host', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.port', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the JdbcConnectionString property */ + jdbcConnectionString = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.jdbcConnectionString', + { context: this._handle } + ); + }, + }; + + /** Gets the Entrypoint property */ + entrypoint = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.entrypoint', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.setEntrypoint', + { context: this._handle, value } + ); + } + }; + + /** Gets the ShellExecution property */ + shellExecution = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.shellExecution', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.setShellExecution', + { context: this._handle, value } + ); + } + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/PostgresServerResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PostgresServerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new PostgresServerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PostgresServerResourcePromise { + const tag = options?.tag; + return new PostgresServerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PostgresServerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new PostgresServerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresServerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new PostgresServerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PostgresServerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new PostgresServerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresServerResourcePromise { + const helpLink = options?.helpLink; + return new PostgresServerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PostgresServerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new PostgresServerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PostgresServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new PostgresServerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PostgresServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PostgresServerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PostgresServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new PostgresServerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PostgresServerResourcePromise { + const displayText = options?.displayText; + return new PostgresServerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresServerResourcePromise { + const displayText = options?.displayText; + return new PostgresServerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PostgresServerResourcePromise { + const exitCode = options?.exitCode; + return new PostgresServerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PostgresServerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new PostgresServerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresServerResourcePromise { + const commandOptions = options?.commandOptions; + return new PostgresServerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PostgresServerResourcePromise { + const password = options?.password; + return new PostgresServerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PostgresServerResourcePromise { + const iconVariant = options?.iconVariant; + return new PostgresServerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PostgresServerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new PostgresServerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresServerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new PostgresServerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PostgresServerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new PostgresServerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._onConnectionStringAvailableInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _addDatabaseInternal(name: string, databaseName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (databaseName !== undefined) rpcArgs.databaseName = databaseName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/addDatabase', + rpcArgs + ); + return new PostgresDatabaseResource(result, this._client); + } + + /** Adds a PostgreSQL database */ + addDatabase(name: string, options?: AddDatabaseOptions): PostgresDatabaseResourcePromise { + const databaseName = options?.databaseName; + return new PostgresDatabaseResourcePromise(this._addDatabaseInternal(name, databaseName)); + } + + /** @internal */ + private async _withPgAdminInternal(configureContainer?: (obj: PgAdminContainerResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PgAdminContainerResourceHandle; + const obj = new PgAdminContainerResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPgAdmin', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds pgAdmin 4 management UI */ + withPgAdmin(options?: WithPgAdminOptions): PostgresServerResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new PostgresServerResourcePromise(this._withPgAdminInternal(configureContainer, containerName)); + } + + /** @internal */ + private async _withPgWebInternal(configureContainer?: (obj: PgWebContainerResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PgWebContainerResourceHandle; + const obj = new PgWebContainerResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPgWeb', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds pgweb management UI */ + withPgWeb(options?: WithPgWebOptions): PostgresServerResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new PostgresServerResourcePromise(this._withPgWebInternal(configureContainer, containerName)); + } + + /** @internal */ + private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withDataVolume', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a data volume for PostgreSQL */ + withDataVolume(options?: WithDataVolumeOptions): PostgresServerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new PostgresServerResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + } + + /** @internal */ + private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withDataBindMount', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Adds a data bind mount for PostgreSQL */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): PostgresServerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new PostgresServerResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); + } + + /** @internal */ + private async _withInitFilesInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withInitFiles', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Copies init files to PostgreSQL */ + withInitFiles(source: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withInitFilesInternal(source)); + } + + /** @internal */ + private async _withPasswordInternal(password: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, password }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPassword', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures the PostgreSQL password */ + withPassword(password: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withPasswordInternal(password)); + } + + /** @internal */ + private async _withUserNameInternal(userName: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, userName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withUserName', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Configures the PostgreSQL user name */ + withUserName(userName: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._withUserNameInternal(userName)); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.PostgreSQL/withPostgresHostPort', + rpcArgs + ); + return new PostgresServerResource(result, this._client); + } + + /** Sets the host port for PostgreSQL */ + withHostPort(options?: WithHostPortOptions): PostgresServerResourcePromise { + const port = options?.port; + return new PostgresServerResourcePromise(this._withHostPortInternal(port)); + } + +} + +/** + * Thenable wrapper for PostgresServerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class PostgresServerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PostgresServerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Adds arguments */ + withArgs(args: string[]): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Adds a PostgreSQL database */ + addDatabase(name: string, options?: AddDatabaseOptions): PostgresDatabaseResourcePromise { + return new PostgresDatabaseResourcePromise(this._promise.then(obj => obj.addDatabase(name, options))); + } + + /** Adds pgAdmin 4 management UI */ + withPgAdmin(options?: WithPgAdminOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPgAdmin(options))); + } + + /** Adds pgweb management UI */ + withPgWeb(options?: WithPgWebOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPgWeb(options))); + } + + /** Adds a data volume for PostgreSQL */ + withDataVolume(options?: WithDataVolumeOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + } + + /** Adds a data bind mount for PostgreSQL */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); + } + + /** Copies init files to PostgreSQL */ + withInitFiles(source: string): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withInitFiles(source))); + } + + /** Configures the PostgreSQL password */ + withPassword(password: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withPassword(password))); + } + + /** Configures the PostgreSQL user name */ + withUserName(userName: ParameterResource): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withUserName(userName))); + } + + /** Sets the host port for PostgreSQL */ + withHostPort(options?: WithHostPortOptions): PostgresServerResourcePromise { + return new PostgresServerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + const configure = options?.configure; + return new ProjectResourcePromise(this._publishAsDockerFileInternal(configure)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceReadyInternal(callback)); + } + +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// SqlServerDatabaseResource +// ============================================================================ + +export class SqlServerDatabaseResource extends ResourceBuilderBase { + constructor(handle: SqlServerDatabaseResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Parent property */ + parent = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.parent', + { context: this._handle } + ); + return new SqlServerServerResource(handle, this._client); + }, + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the JdbcConnectionString property */ + jdbcConnectionString = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.jdbcConnectionString', + { context: this._handle } + ); + }, + }; + + /** Gets the DatabaseName property */ + databaseName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.databaseName', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerDatabaseResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new SqlServerDatabaseResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerDatabaseResourcePromise { + const helpLink = options?.helpLink; + return new SqlServerDatabaseResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): SqlServerDatabaseResourcePromise { + const displayText = options?.displayText; + return new SqlServerDatabaseResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerDatabaseResourcePromise { + const displayText = options?.displayText; + return new SqlServerDatabaseResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerDatabaseResourcePromise { + const commandOptions = options?.commandOptions; + return new SqlServerDatabaseResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): SqlServerDatabaseResourcePromise { + const iconVariant = options?.iconVariant; + return new SqlServerDatabaseResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerDatabaseResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new SqlServerDatabaseResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._onConnectionStringAvailableInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withCreationScriptInternal(script: string): Promise { + const rpcArgs: Record = { builder: this._handle, script }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withCreationScript', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Defines the SQL script used to create the database */ + withCreationScript(script: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withCreationScriptInternal(script)); + } + +} + +/** + * Thenable wrapper for SqlServerDatabaseResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class SqlServerDatabaseResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: SqlServerDatabaseResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Defines the SQL script used to create the database */ + withCreationScript(script: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withCreationScript(script))); + } + +} + +// ============================================================================ +// SqlServerServerResource +// ============================================================================ + +export class SqlServerServerResource extends ResourceBuilderBase { + constructor(handle: SqlServerServerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the PrimaryEndpoint property */ + primaryEndpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.primaryEndpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.host', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.port', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the PasswordParameter property */ + passwordParameter = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.passwordParameter', + { context: this._handle } + ); + return new ParameterResource(handle, this._client); + }, + }; + + /** Gets the UserNameReference property */ + userNameReference = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.userNameReference', + { context: this._handle } + ); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the JdbcConnectionString property */ + jdbcConnectionString = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.jdbcConnectionString', + { context: this._handle } + ); + }, + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the Databases property */ + private _databases?: AspireDict; + get databases(): AspireDict { + if (!this._databases) { + this._databases = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.databases', + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.databases' + ); + } + return this._databases; + } + + /** Gets the Entrypoint property */ + entrypoint = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.entrypoint', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.setEntrypoint', + { context: this._handle, value } + ); + } + }; + + /** Gets the ShellExecution property */ + shellExecution = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.shellExecution', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.setShellExecution', + { context: this._handle, value } + ); + } + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): SqlServerServerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new SqlServerServerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): SqlServerServerResourcePromise { + const tag = options?.tag; + return new SqlServerServerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): SqlServerServerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new SqlServerServerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerServerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new SqlServerServerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): SqlServerServerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new SqlServerServerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerServerResourcePromise { + const helpLink = options?.helpLink; + return new SqlServerServerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): SqlServerServerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new SqlServerServerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): SqlServerServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new SqlServerServerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): SqlServerServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new SqlServerServerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): SqlServerServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new SqlServerServerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): SqlServerServerResourcePromise { + const displayText = options?.displayText; + return new SqlServerServerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerServerResourcePromise { + const displayText = options?.displayText; + return new SqlServerServerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): SqlServerServerResourcePromise { + const exitCode = options?.exitCode; + return new SqlServerServerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): SqlServerServerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new SqlServerServerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerServerResourcePromise { + const commandOptions = options?.commandOptions; + return new SqlServerServerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): SqlServerServerResourcePromise { + const password = options?.password; + return new SqlServerServerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): SqlServerServerResourcePromise { + const iconVariant = options?.iconVariant; + return new SqlServerServerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): SqlServerServerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new SqlServerServerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerServerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new SqlServerServerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): SqlServerServerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new SqlServerServerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._onConnectionStringAvailableInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _addDatabaseInternal(name: string, databaseName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (databaseName !== undefined) rpcArgs.databaseName = databaseName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/addDatabase', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a SQL Server database resource */ + addDatabase(name: string, options?: AddDatabaseOptions): SqlServerDatabaseResourcePromise { + const databaseName = options?.databaseName; + return new SqlServerDatabaseResourcePromise(this._addDatabaseInternal(name, databaseName)); + } + + /** @internal */ + private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withDataVolume', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a named volume for the SQL Server data folder */ + withDataVolume(options?: WithDataVolumeOptions): SqlServerServerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new SqlServerServerResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + } + + /** @internal */ + private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withDataBindMount', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a bind mount for the SQL Server data folder */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): SqlServerServerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new SqlServerServerResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); + } + + /** @internal */ + private async _withPasswordInternal(password: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, password }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withPassword', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures the password for the SQL Server resource */ + withPassword(password: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withPasswordInternal(password)); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withHostPort', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the host port for the SQL Server resource */ + withHostPort(options?: WithHostPortOptions): SqlServerServerResourcePromise { + const port = options?.port; + return new SqlServerServerResourcePromise(this._withHostPortInternal(port)); + } + +} + +/** + * Thenable wrapper for SqlServerServerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class SqlServerServerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: SqlServerServerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Adds arguments */ + withArgs(args: string[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Defines the SQL script used to create the database */ - withCreationScript(script: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withCreationScript(script))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } -} + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } -// ============================================================================ -// SqlServerServerResource -// ============================================================================ + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } -export class SqlServerServerResource extends ResourceBuilderBase { - constructor(handle: SqlServerServerResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Gets the PrimaryEndpoint property */ - primaryEndpoint = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.primaryEndpoint', - { context: this._handle } - ); - return new EndpointReference(handle, this._client); - }, - }; + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } - /** Gets the Host property */ - host = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.host', - { context: this._handle } - ); - return new EndpointReferenceExpression(handle, this._client); - }, - }; + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } - /** Gets the Port property */ - port = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.port', - { context: this._handle } - ); - return new EndpointReferenceExpression(handle, this._client); - }, - }; + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } - /** Gets the UserNameReference property */ - userNameReference = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.userNameReference', - { context: this._handle } - ); - }, - }; + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } - /** Gets the UriExpression property */ - uriExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.uriExpression', - { context: this._handle } - ); - }, - }; + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } - /** Gets the JdbcConnectionString property */ - jdbcConnectionString = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.jdbcConnectionString', - { context: this._handle } - ); - }, - }; + /** Prevents resource from starting automatically */ + withExplicitStart(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } - /** Gets the ConnectionStringExpression property */ - connectionStringExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.connectionStringExpression', - { context: this._handle } - ); - }, - }; + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } - /** Gets the Databases property */ - private _databases?: AspireDict; - get databases(): AspireDict { - if (!this._databases) { - this._databases = new AspireDict( - this._handle, - this._client, - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.databases', - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.databases' - ); - } - return this._databases; + /** Adds a health check by key */ + withHealthCheck(key: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Gets the Entrypoint property */ - entrypoint = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.entrypoint', - { context: this._handle } - ); - }, - set: async (value: string): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.setEntrypoint', - { context: this._handle, value } - ); - } - }; + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } - /** Gets the ShellExecution property */ - shellExecution = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.shellExecution', - { context: this._handle } - ); - }, - set: async (value: boolean): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.setShellExecution', - { context: this._handle, value } - ); - } - }; + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } - /** Gets the Name property */ - name = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.name', - { context: this._handle } - ); - }, - }; + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withContainerRegistryInternal(registry)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): SqlServerServerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new SqlServerServerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Sets the container image tag */ - withImageTag(tag: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withImageTagInternal(tag)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Sets the container image registry */ - withImageRegistry(registry: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withImageRegistryInternal(registry)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): SqlServerServerResourcePromise { - const tag = options?.tag; - return new SqlServerServerResourcePromise(this._withImageInternal(image, tag)); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } - /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withImageSHA256Internal(sha256)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } - /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withLifetimeInternal(lifetime)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Adds a SQL Server database resource */ + addDatabase(name: string, options?: AddDatabaseOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.addDatabase(name, options))); } - /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Adds a named volume for the SQL Server data folder */ + withDataVolume(options?: WithDataVolumeOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); } - /** Configures the resource to be published as a container */ - publishAsContainer(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._publishAsContainerInternal()); + /** Adds a bind mount for the SQL Server data folder */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); } - /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Configures the password for the SQL Server resource */ + withPassword(password: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPassword(password))); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): SqlServerServerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new SqlServerServerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Sets the host port for the SQL Server resource */ + withHostPort(options?: WithHostPortOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + +} + +// ============================================================================ +// ViteAppResource +// ============================================================================ + +export class ViteAppResource extends ResourceBuilderBase { + constructor(handle: ViteAppResourceHandle, client: AspireClientRpc) { + super(handle, client); } + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withContainerNameInternal(name)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withBuildArgInternal(name, value)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ViteAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withBuildSecretInternal(name, value)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerServerResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new SqlServerServerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): SqlServerServerResourcePromise { + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { const path = options?.path; const endpointName = options?.endpointName; - return new SqlServerServerResourcePromise(this._withMcpServerInternal(path, endpointName)); + return new ViteAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { + private async _withOtlpExporterInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures OTLP telemetry export */ - withOtlpExporter(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withOtlpExporterInternal()); + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); - } - - /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); - } - - /** Publishes the resource as a connection string */ - publishAsConnectionString(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._publishAsConnectionStringInternal()); + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerServerResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { const helpLink = options?.helpLink; - return new SqlServerServerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } - - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + return new ViteAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); - } - - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withConnectionPropertyInternal(name, value)); - } - - /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); - } - - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withConnectionPropertyValueInternal(name, value)); - } - - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): SqlServerServerResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new SqlServerServerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ViteAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -25073,15 +34280,15 @@ export class SqlServerServerResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): SqlServerServerResourcePromise { + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -25090,72 +34297,72 @@ export class SqlServerServerResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): SqlServerServerResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new SqlServerServerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): SqlServerServerResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new SqlServerServerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -25168,278 +34375,308 @@ export class SqlServerServerResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): SqlServerServerResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new SqlServerServerResourcePromise(this._withUrlInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerServerResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new SqlServerServerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): SqlServerServerResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { const exitCode = options?.exitCode; - return new SqlServerServerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ViteAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): SqlServerServerResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new SqlServerServerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new ViteAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -25447,130 +34684,130 @@ export class SqlServerServerResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerServerResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { const commandOptions = options?.commandOptions; - return new SqlServerServerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ViteAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): SqlServerServerResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { const password = options?.password; - return new SqlServerServerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new ViteAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): SqlServerServerResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { const iconVariant = options?.iconVariant; - return new SqlServerServerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ViteAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -25579,15 +34816,15 @@ export class SqlServerServerResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): SqlServerServerResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -25595,56 +34832,56 @@ export class SqlServerServerResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -25655,79 +34892,60 @@ export class SqlServerServerResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerServerResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new SqlServerServerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ViteAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withPipelineConfigurationInternal(callback)); - } - - /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): SqlServerServerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new SqlServerServerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -25740,330 +34958,394 @@ export class SqlServerServerResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name }; - if (databaseName !== undefined) rpcArgs.databaseName = databaseName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.SqlServer/addDatabase', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a SQL Server database resource */ - addDatabase(name: string, options?: AddDatabaseOptions): SqlServerDatabaseResourcePromise { - const databaseName = options?.databaseName; - return new SqlServerDatabaseResourcePromise(this._addDatabaseInternal(name, databaseName)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.SqlServer/withDataVolume', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a named volume for the SQL Server data folder */ - withDataVolume(options?: WithDataVolumeOptions): SqlServerServerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new SqlServerServerResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.SqlServer/withDataBindMount', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a bind mount for the SQL Server data folder */ - withDataBindMount(source: string, options?: WithDataBindMountOptions): SqlServerServerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new SqlServerServerResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withPasswordInternal(password: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, password }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.SqlServer/withPassword', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures the password for the SQL Server resource */ - withPassword(password: ParameterResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withPasswordInternal(password)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withHostPortInternal(port?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.SqlServer/withHostPort', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets the host port for the SQL Server resource */ - withHostPort(options?: WithHostPortOptions): SqlServerServerResourcePromise { - const port = options?.port; - return new SqlServerServerResourcePromise(this._withHostPortInternal(port)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceReadyInternal(callback)); } -} - -/** - * Thenable wrapper for SqlServerServerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class SqlServerServerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** @internal */ + private async _withViteConfigInternal(configPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, configPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withViteConfig', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } - then( - onfulfilled?: ((value: SqlServerServerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withViteConfigInternal(configPath)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withBunInternal(install, installArgs)); } - /** Sets the container image registry */ - withImageRegistry(registry: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withYarnInternal(install, installArgs)); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withPnpmInternal(install, installArgs)); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); } - /** Configures the resource to be published as a container */ - publishAsContainer(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } - /** Sets the container name */ - withContainerName(name: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + const browser = options?.browser; + return new ViteAppResourcePromise(this._withBrowserDebuggerInternal(browser)); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); +} + +/** + * Thenable wrapper for ViteAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ViteAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ViteAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); - } - - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); - } - - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -26072,163 +35354,168 @@ export class SqlServerServerResourcePromise implements PromiseLike obj.asHttp2Service())); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -26236,29 +35523,137 @@ export class SqlServerServerResourcePromise implements PromiseLike obj.getResourceName()); } - /** Adds a SQL Server database resource */ - addDatabase(name: string, options?: AddDatabaseOptions): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.addDatabase(name, options))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Adds a named volume for the SQL Server data folder */ - withDataVolume(options?: WithDataVolumeOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withViteConfig(configPath))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + +} + +// ============================================================================ +// ComputeResource +// ============================================================================ + +export class ComputeResource extends ResourceBuilderBase { + constructor(handle: IComputeResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Adds a bind mount for the SQL Server data folder */ - withDataBindMount(source: string, options?: WithDataBindMountOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); +} + +/** + * Thenable wrapper for ComputeResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ComputeResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ComputeResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Configures the password for the SQL Server resource */ - withPassword(password: ParameterResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPassword(password))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Sets the host port for the SQL Server resource */ - withHostPort(options?: WithHostPortOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } } @@ -26276,7 +35671,7 @@ export class ContainerFilesDestinationResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); return new ContainerFilesDestinationResource(result, this._client); @@ -26535,7 +35930,7 @@ export class Resource extends ResourceBuilderBase { private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new Resource(result, this._client); @@ -26550,7 +35945,7 @@ export class Resource extends ResourceBuilderBase { private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new Resource(result, this._client); @@ -26593,36 +35988,6 @@ export class Resource extends ResourceBuilderBase { return new ResourcePromise(this._excludeFromMcpInternal()); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -26700,6 +36065,86 @@ export class Resource extends ResourceBuilderBase { ); } + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -26797,16 +36242,6 @@ export class ResourcePromise implements PromiseLike { return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); @@ -26827,6 +36262,26 @@ export class ResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -26966,6 +36421,35 @@ export class ResourceWithConnectionString extends ResourceBuilderBase { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._onConnectionStringAvailableInternal(callback)); + } + } /** @@ -26993,6 +36477,16 @@ export class ResourceWithConnectionStringPromise implements PromiseLike obj.withConnectionPropertyValue(name, value))); } + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + } // ============================================================================ @@ -27281,6 +36775,26 @@ export class ResourceWithEndpoints extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + } /** @@ -27348,6 +36862,11 @@ export class ResourceWithEndpointsPromise implements PromiseLike obj.withHttpProbe(probeType, options))); } + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + } // ============================================================================ @@ -27390,41 +36909,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -27435,43 +36924,38 @@ export class ResourceWithEnvironment extends ResourceBuilderBase Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -27505,10 +36989,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -27520,37 +37005,8 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -27633,7 +37089,7 @@ export class ResourceWithEnvironment extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ResourceWithEnvironment(result, this._client); @@ -27687,31 +37143,21 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withOtlpExporterProtocol(protocol))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -27727,16 +37173,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -27774,34 +37210,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike { - constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { - super(handle, client); - } - -} - -/** - * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ResourceWithServiceDiscoveryPromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - -} - // ============================================================================ // ResourceWithWaitSupport // ============================================================================ @@ -27815,7 +37223,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -27845,7 +37253,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -27876,7 +37284,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -27995,7 +37403,7 @@ export async function createBuilder(options?: CreateBuilderOptions): Promise { const error = reason instanceof Error ? reason : new Error(String(reason)); - if (reason instanceof CapabilityError) { + if (reason instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else if (reason instanceof CapabilityError) { console.error(`\n❌ Capability Error: ${error.message}`); console.error(` Code: ${(reason as CapabilityError).code}`); if ((reason as CapabilityError).capability) { @@ -28026,8 +37436,12 @@ process.on('unhandledRejection', (reason: unknown) => { }); process.on('uncaughtException', (error: Error) => { - console.error(`\n❌ Uncaught Exception: ${error.message}`); - if (error.stack) { + if (error instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + } + if (!(error instanceof AppHostUsageError) && error.stack) { console.error(error.stack); } process.exit(1); @@ -28038,21 +37452,44 @@ process.on('uncaughtException', (error: Error) => { // ============================================================================ // Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent', (handle, client) => new AfterResourcesCreatedEvent(handle as AfterResourcesCreatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent', (handle, client) => new BeforeResourceStartedEvent(handle as BeforeResourceStartedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent', (handle, client) => new BeforeStartEvent(handle as BeforeStartEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent', (handle, client) => new ConnectionStringAvailableEvent(handle as ConnectionStringAvailableEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel', (handle, client) => new DistributedApplicationModel(handle as DistributedApplicationModelHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent', (handle, client) => new InitializeResourceEvent(handle as InitializeResourceEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext', (handle, client) => new PipelineContext(handle as PipelineContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext', (handle, client) => new PipelineStepFactoryContext(handle as PipelineStepFactoryContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary', (handle, client) => new PipelineSummary(handle as PipelineSummaryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent', (handle, client) => new ResourceEndpointsAllocatedEvent(handle as ResourceEndpointsAllocatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService', (handle, client) => new ResourceLoggerService(handle as ResourceLoggerServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService', (handle, client) => new ResourceNotificationService(handle as ResourceNotificationServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent', (handle, client) => new ResourceReadyEvent(handle as ResourceReadyEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent', (handle, client) => new ResourceStoppedEvent(handle as ResourceStoppedEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext', (handle, client) => new UpdateCommandStateContext(handle as UpdateCommandStateContextHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration', (handle, client) => new Configuration(handle as IConfigurationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment', (handle, client) => new HostEnvironment(handle as IHostEnvironmentHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger', (handle, client) => new Logger(handle as ILoggerHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory', (handle, client) => new LoggerFactory(handle as ILoggerFactoryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep', (handle, client) => new ReportingStep(handle as IReportingStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask', (handle, client) => new ReportingTask(handle as IReportingTaskHandle, client)); +registerHandleWrapper('System.ComponentModel/System.IServiceProvider', (handle, client) => new ServiceProvider(handle as IServiceProviderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IUserSecretsManager', (handle, client) => new UserSecretsManager(handle as IUserSecretsManagerHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); @@ -28060,8 +37497,10 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppR registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource', (handle, client) => new JavaScriptAppResource(handle as JavaScriptAppResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.MySql/Aspire.Hosting.ApplicationModel.MySqlDatabaseResource', (handle, client) => new MySqlDatabaseResource(handle as MySqlDatabaseResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.MySql/Aspire.Hosting.ApplicationModel.MySqlServerResource', (handle, client) => new MySqlServerResource(handle as MySqlServerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource', (handle, client) => new NodeAppResource(handle as NodeAppResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.PostgreSQL/Aspire.Hosting.Postgres.PgAdminContainerResource', (handle, client) => new PgAdminContainerResource(handle as PgAdminContainerResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.PostgreSQL/Aspire.Hosting.Postgres.PgWebContainerResource', (handle, client) => new PgWebContainerResource(handle as PgWebContainerResourceHandle, client)); @@ -28072,6 +37511,8 @@ registerHandleWrapper('Aspire.Hosting.PostgreSQL/Aspire.Hosting.ApplicationModel registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.SqlServer/Aspire.Hosting.ApplicationModel.SqlServerDatabaseResource', (handle, client) => new SqlServerDatabaseResource(handle as SqlServerDatabaseResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.SqlServer/Aspire.Hosting.ApplicationModel.SqlServerServerResource', (handle, client) => new SqlServerServerResource(handle as SqlServerServerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource', (handle, client) => new ViteAppResource(handle as ViteAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource', (handle, client) => new ComputeResource(handle as IComputeResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); @@ -28079,6 +37520,5 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceW registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); diff --git a/samples/database-containers/ts/.modules/base.ts b/samples/database-containers/ts/.modules/base.ts index 7778b0f1..b3d8b8be 100644 --- a/samples/database-containers/ts/.modules/base.ts +++ b/samples/database-containers/ts/.modules/base.ts @@ -1,8 +1,8 @@ -// aspire.ts - Core Aspire types: base classes, ReferenceExpression -import { Handle, AspireClient, MarshalledHandle } from './transport.js'; +// base.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle, CancellationToken, registerCancellation, registerHandleWrapper, unregisterCancellation } from './transport.js'; // Re-export transport types for convenience -export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export { Handle, AspireClient, CapabilityError, CancellationToken, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; @@ -43,22 +43,46 @@ export class ReferenceExpression { private readonly _format?: string; private readonly _valueProviders?: unknown[]; + // Conditional mode fields + private readonly _condition?: unknown; + private readonly _whenTrue?: ReferenceExpression; + private readonly _whenFalse?: ReferenceExpression; + private readonly _matchValue?: string; + // Handle mode fields (when wrapping a server-returned handle) private readonly _handle?: Handle; private readonly _client?: AspireClient; constructor(format: string, valueProviders: unknown[]); constructor(handle: Handle, client: AspireClient); - constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { - if (typeof handleOrFormat === 'string') { - this._format = handleOrFormat; - this._valueProviders = clientOrValueProviders as unknown[]; + constructor(condition: unknown, matchValue: string, whenTrue: ReferenceExpression, whenFalse: ReferenceExpression); + constructor( + handleOrFormatOrCondition: Handle | string | unknown, + clientOrValueProvidersOrMatchValue: AspireClient | unknown[] | string, + whenTrueOrWhenFalse?: ReferenceExpression, + whenFalse?: ReferenceExpression + ) { + if (typeof handleOrFormatOrCondition === 'string') { + this._format = handleOrFormatOrCondition; + this._valueProviders = clientOrValueProvidersOrMatchValue as unknown[]; + } else if (handleOrFormatOrCondition instanceof Handle) { + this._handle = handleOrFormatOrCondition; + this._client = clientOrValueProvidersOrMatchValue as AspireClient; } else { - this._handle = handleOrFormat; - this._client = clientOrValueProviders as AspireClient; + this._condition = handleOrFormatOrCondition; + this._matchValue = (clientOrValueProvidersOrMatchValue as string) ?? 'True'; + this._whenTrue = whenTrueOrWhenFalse; + this._whenFalse = whenFalse; } } + /** + * Gets whether this reference expression is conditional. + */ + get isConditional(): boolean { + return this._condition !== undefined; + } + /** * Creates a reference expression from a tagged template literal. * @@ -82,16 +106,46 @@ export class ReferenceExpression { return new ReferenceExpression(format, valueProviders); } + /** + * Creates a conditional reference expression from its constituent parts. + * + * @param condition - A value provider whose result is compared to matchValue + * @param whenTrue - The expression to use when the condition matches + * @param whenFalse - The expression to use when the condition does not match + * @param matchValue - The value to compare the condition against (defaults to "True") + * @returns A ReferenceExpression instance in conditional mode + */ + static createConditional( + condition: unknown, + matchValue: string, + whenTrue: ReferenceExpression, + whenFalse: ReferenceExpression + ): ReferenceExpression { + return new ReferenceExpression(condition, matchValue, whenTrue, whenFalse); + } + /** * Serializes the reference expression for JSON-RPC transport. - * In template-literal mode, uses the $expr format. + * In expression mode, uses the $expr format with format + valueProviders. + * In conditional mode, uses the $expr format with condition + whenTrue + whenFalse. * In handle mode, delegates to the handle's serialization. */ - toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } | { condition: unknown; whenTrue: unknown; whenFalse: unknown; matchValue: string } } | MarshalledHandle { if (this._handle) { return this._handle.toJSON(); } + if (this.isConditional) { + return { + $expr: { + condition: extractHandleForExpr(this._condition), + whenTrue: this._whenTrue!.toJSON(), + whenFalse: this._whenFalse!.toJSON(), + matchValue: this._matchValue! + } + }; + } + return { $expr: { format: this._format!, @@ -100,6 +154,30 @@ export class ReferenceExpression { }; } + /** + * Resolves the expression to its string value on the server. + * Only available on server-returned ReferenceExpression instances (handle mode). + * + * @param cancellationToken - Optional AbortSignal or CancellationToken for cancellation support + * @returns The resolved string value, or null if the expression resolves to null + */ + async getValue(cancellationToken?: AbortSignal | CancellationToken): Promise { + if (!this._handle || !this._client) { + throw new Error('getValue is only available on server-returned ReferenceExpression instances'); + } + const cancellationTokenId = registerCancellation(this._client, cancellationToken); + try { + const rpcArgs: Record = { context: this._handle }; + if (cancellationTokenId !== undefined) rpcArgs.cancellationToken = cancellationTokenId; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValue', + rpcArgs + ); + } finally { + unregisterCancellation(cancellationTokenId); + } + } + /** * String representation for debugging. */ @@ -107,10 +185,17 @@ export class ReferenceExpression { if (this._handle) { return `ReferenceExpression(handle)`; } + if (this.isConditional) { + return `ReferenceExpression(conditional)`; + } return `ReferenceExpression(${this._format})`; } } +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression', (handle, client) => + new ReferenceExpression(handle, client) +); + /** * Extracts a value for use in reference expressions. * Supports handles (objects) and string literals. @@ -136,15 +221,15 @@ function extractHandleForExpr(value: unknown): unknown { return value.toJSON(); } - // Objects with $handle property (already in handle format) - if (typeof value === 'object' && value !== null && '$handle' in value) { + // Objects with marshalled expression/handle payloads + if (typeof value === 'object' && value !== null && ('$handle' in value || '$expr' in value)) { return value; } - // Objects with toJSON that returns a handle + // Objects with toJSON that returns a marshalled expression or handle if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { const json = value.toJSON(); - if (json && typeof json === 'object' && '$handle' in json) { + if (json && typeof json === 'object' && ('$handle' in json || '$expr' in json)) { return json; } } @@ -307,11 +392,20 @@ export class AspireList { }) as T[]; } - toJSON(): MarshalledHandle { - if (this._resolvedHandle) { - return this._resolvedHandle.toJSON(); + async toTransportValue(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireList must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); } - return this._handleOrContext.toJSON(); + + return this._resolvedHandle.toJSON(); } } @@ -466,8 +560,19 @@ export class AspireDict { }) as Record; } - async toJSON(): Promise { + async toTransportValue(): Promise { const handle = await this._ensureHandle(); return handle.toJSON(); } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireDict must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); + } + + return this._resolvedHandle.toJSON(); + } } diff --git a/samples/database-containers/ts/.modules/transport.ts b/samples/database-containers/ts/.modules/transport.ts index 7bddd74b..6d29cf28 100644 --- a/samples/database-containers/ts/.modules/transport.ts +++ b/samples/database-containers/ts/.modules/transport.ts @@ -77,7 +77,8 @@ export function isAtsError(value: unknown): value is { $error: AtsError } { value !== null && typeof value === 'object' && '$error' in value && - typeof (value as { $error: unknown }).$error === 'object' + typeof (value as { $error: unknown }).$error === 'object' && + (value as { $error: unknown }).$error !== null ); } @@ -93,6 +94,47 @@ export function isMarshalledHandle(value: unknown): value is MarshalledHandle { ); } +function isAbortSignal(value: unknown): value is AbortSignal { + return ( + value !== null && + typeof value === 'object' && + 'aborted' in value && + 'addEventListener' in value && + 'removeEventListener' in value + ); +} + +function isPlainObject(value: unknown): value is Record { + if (value === null || typeof value !== 'object') { + return false; + } + + const prototype = Object.getPrototypeOf(value); + return prototype === Object.prototype || prototype === null; +} + +function hasTransportValue(value: unknown): value is { toTransportValue(): unknown | Promise } { + return ( + value !== null && + typeof value === 'object' && + 'toTransportValue' in value && + typeof (value as { toTransportValue?: unknown }).toTransportValue === 'function' + ); +} + +function createAbortError(message: string): Error { + const error = new Error(message); + error.name = 'AbortError'; + return error; +} + +function createCircularReferenceError(capabilityId: string, path: string): AppHostUsageError { + return new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' contains a circular reference. ` + + 'Circular references are not supported by the AppHost transport.' + ); +} + // ============================================================================ // Handle // ============================================================================ @@ -136,6 +178,92 @@ export class Handle { } } +// ============================================================================ +// CancellationToken +// ============================================================================ + +/** + * Represents a transport-safe cancellation token value for the generated SDK. + * + * Use a plain {@link AbortSignal} when you create cancellation in user code. + * Generated APIs accept either an {@link AbortSignal} or a {@link CancellationToken}. + * + * Values returned from generated callbacks and context/property getters are + * {@link CancellationToken} instances because they may reference remote + * cancellation token handles received from the AppHost. + * + * @example + * ```typescript + * const controller = new AbortController(); + * await connectionStringExpression.getValue(controller.signal); + * ``` + * + * @example + * ```typescript + * const cancellationToken = await context.cancellationToken.get(); + * const connectionStringExpression = await db.uriExpression.get(); + * const connectionString = await connectionStringExpression.getValue(cancellationToken); + * ``` + */ +export class CancellationToken { + private readonly _signal?: AbortSignal; + private readonly _remoteTokenId?: string; + + constructor(signal?: AbortSignal); + constructor(tokenId?: string); + constructor(value?: AbortSignal | string | null) { + if (typeof value === 'string') { + this._remoteTokenId = value; + } else if (isAbortSignal(value)) { + this._signal = value; + } + } + + /** + * Creates a cancellation token from a local {@link AbortSignal}. + */ + static from(signal?: AbortSignal): CancellationToken { + return new CancellationToken(signal); + } + + /** + * Creates a cancellation token from a transport value. + * Generated code uses this to materialize values that come from the AppHost. + */ + static fromValue(value: unknown): CancellationToken { + if (value instanceof CancellationToken) { + return value; + } + + if (typeof value === 'string') { + return new CancellationToken(value); + } + + if (isAbortSignal(value)) { + return new CancellationToken(value); + } + + return new CancellationToken(); + } + + /** + * Serializes the token for JSON-RPC transport. + */ + toJSON(): string | undefined { + return this._remoteTokenId; + } + + register(client?: AspireClient): string | undefined { + if (this._remoteTokenId !== undefined) { + return this._remoteTokenId; + } + + return client + ? registerCancellation(client, this._signal) + : registerCancellation(this._signal); + } +} + // ============================================================================ // Handle Wrapper Registry // ============================================================================ @@ -167,22 +295,35 @@ export function registerHandleWrapper(typeId: string, factory: HandleWrapperFact * @param client - Optional client for creating typed wrapper instances */ export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { - if (value && typeof value === 'object') { - if (isMarshalledHandle(value)) { - const handle = new Handle(value); - const typeId = value.$type; - - // Try to find a registered wrapper factory for this type - if (typeId && client) { - const factory = handleWrapperRegistry.get(typeId); - if (factory) { - return factory(handle, client); - } + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); } + } + + return handle; + } - return handle; + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + value[i] = wrapIfHandle(value[i], client); + } + + return value; + } + + if (isPlainObject(value)) { + for (const [key, nestedValue] of Object.entries(value)) { + value[key] = wrapIfHandle(nestedValue, client); } } + return value; } @@ -213,6 +354,76 @@ export class CapabilityError extends Error { } } +/** + * Error thrown when the AppHost script uses the generated SDK incorrectly. + */ +export class AppHostUsageError extends Error { + constructor(message: string) { + super(message); + this.name = 'AppHostUsageError'; + } +} + +function isPromiseLike(value: unknown): value is PromiseLike { + return ( + value !== null && + (typeof value === 'object' || typeof value === 'function') && + 'then' in value && + typeof (value as { then?: unknown }).then === 'function' + ); +} + +function validateCapabilityArgs( + capabilityId: string, + args?: Record +): void { + if (!args) { + return; + } + + const validateValue = (value: unknown, path: string, ancestors: Set): void => { + if (value === null || value === undefined) { + return; + } + + if (isPromiseLike(value)) { + throw new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' is a Promise-like value. ` + + `This usually means an async builder call was not awaited. ` + + `Did you forget 'await' on a call like builder.addPostgres(...) or resource.addDatabase(...)?` + ); + } + + if (typeof value !== 'object') { + return; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + ancestors.add(value); + try { + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + validateValue(value[i], `${path}[${i}]`, ancestors); + } + return; + } + + for (const [key, nestedValue] of Object.entries(value)) { + validateValue(nestedValue, `${path}.${key}`, ancestors); + } + } finally { + ancestors.delete(value); + } + }; + + for (const [key, value] of Object.entries(args)) { + validateValue(value, key, new Set()); + } +} + // ============================================================================ // Callback Registry // ============================================================================ @@ -324,21 +535,50 @@ export function getCallbackCount(): number { */ const cancellationRegistry = new Map void>(); let cancellationIdCounter = 0; +const connectedClients = new Set(); -/** - * A reference to the current AspireClient for sending cancel requests. - * Set by AspireClient.connect(). - */ -let currentClient: AspireClient | null = null; +function resolveCancellationClient(client?: AspireClient): AspireClient { + if (client) { + return client; + } + + if (connectedClients.size === 1) { + return connectedClients.values().next().value as AspireClient; + } + + if (connectedClients.size === 0) { + throw new Error( + 'registerCancellation(signal) requires a connected AspireClient. ' + + 'Pass the client explicitly or connect the client first.' + ); + } + + throw new Error( + 'registerCancellation(signal) is ambiguous when multiple AspireClient instances are connected. ' + + 'Pass the client explicitly.' + ); +} /** - * Register an AbortSignal for cancellation support. - * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * Registers cancellation support for a local signal or SDK cancellation token. + * Returns a cancellation ID that should be passed to methods accepting cancellation input. * * When the AbortSignal is aborted, sends a cancelToken request to the host. * - * @param signal - The AbortSignal to register (optional) - * @returns The cancellation ID, or undefined if no signal provided + * @param client - The AspireClient that should route the cancellation request + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + */ +export function registerCancellation(client: AspireClient, signalOrToken?: AbortSignal | CancellationToken): string | undefined; +/** + * Registers cancellation support using the single connected AspireClient. + * + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + * + * @example + * const controller = new AbortController(); + * await expression.getValue(controller.signal); * * @example * const controller = new AbortController(); @@ -346,14 +586,29 @@ let currentClient: AspireClient | null = null; * // Pass id to capability invocation * // Later: controller.abort() will cancel the operation */ -export function registerCancellation(signal?: AbortSignal): string | undefined { - if (!signal) { +export function registerCancellation(signalOrToken?: AbortSignal | CancellationToken): string | undefined; +export function registerCancellation( + clientOrSignalOrToken?: AspireClient | AbortSignal | CancellationToken, + maybeSignalOrToken?: AbortSignal | CancellationToken +): string | undefined { + const client = clientOrSignalOrToken instanceof AspireClient ? clientOrSignalOrToken : undefined; + const signalOrToken = client + ? maybeSignalOrToken + : clientOrSignalOrToken as AbortSignal | CancellationToken | undefined; + + if (!signalOrToken) { return undefined; } - // Already aborted? Don't register + if (signalOrToken instanceof CancellationToken) { + return signalOrToken.register(client); + } + + const signal = signalOrToken; + const cancellationClient = resolveCancellationClient(client); + if (signal.aborted) { - return undefined; + throw createAbortError('The operation was aborted before it was sent to the AppHost.'); } const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; @@ -361,8 +616,8 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { // Set up the abort listener const onAbort = () => { // Send cancel request to host - if (currentClient?.connected) { - currentClient.cancelToken(cancellationId).catch(() => { + if (cancellationClient.connected) { + cancellationClient.cancelToken(cancellationId).catch(() => { // Ignore errors - the operation may have already completed }); } @@ -381,6 +636,56 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { return cancellationId; } +async function marshalTransportValue( + value: unknown, + client: AspireClient, + cancellationIds: string[], + capabilityId: string, + path: string = 'args', + ancestors: Set = new Set() +): Promise { + if (value === null || value === undefined || typeof value !== 'object') { + return value; + } + + if (value instanceof CancellationToken) { + const cancellationId = value.register(client); + if (cancellationId !== undefined) { + cancellationIds.push(cancellationId); + } + + return cancellationId; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + const nextAncestors = new Set(ancestors); + nextAncestors.add(value); + + if (hasTransportValue(value)) { + return await marshalTransportValue(await value.toTransportValue(), client, cancellationIds, capabilityId, path, nextAncestors); + } + + if (Array.isArray(value)) { + return await Promise.all( + value.map((item, index) => marshalTransportValue(item, client, cancellationIds, capabilityId, `${path}[${index}]`, nextAncestors)) + ); + } + + if (isPlainObject(value)) { + const entries = await Promise.all( + Object.entries(value).map(async ([key, nestedValue]) => + [key, await marshalTransportValue(nestedValue, client, cancellationIds, capabilityId, `${path}.${key}`, nextAncestors)] as const) + ); + + return Object.fromEntries(entries); + } + + return value; +} + /** * Unregister a cancellation token by its ID. * Call this when the operation completes to clean up resources. @@ -411,6 +716,8 @@ export class AspireClient { private socket: net.Socket | null = null; private disconnectCallbacks: (() => void)[] = []; private _pendingCalls = 0; + private _connectPromise: Promise | null = null; + private _disconnectNotified = false; constructor(private socketPath: string) { } @@ -422,6 +729,12 @@ export class AspireClient { } private notifyDisconnect(): void { + if (this._disconnectNotified) { + return; + } + + this._disconnectNotified = true; + for (const callback of this.disconnectCallbacks) { try { callback(); @@ -432,30 +745,106 @@ export class AspireClient { } connect(timeoutMs: number = 5000): Promise { - return new Promise((resolve, reject) => { - const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + if (this.connected) { + return Promise.resolve(); + } + + if (this._connectPromise) { + return this._connectPromise; + } + + this._disconnectNotified = false; + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this._connectPromise = new Promise((resolve, reject) => { + const socket = net.createConnection(pipePath); + this.socket = socket; - // On Windows, use named pipes; on Unix, use Unix domain sockets - const isWindows = process.platform === 'win32'; - const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + let settled = false; - this.socket = net.createConnection(pipePath); + const cleanupPendingListeners = () => { + socket.removeListener('connect', onConnect); + socket.removeListener('error', onPendingError); + socket.removeListener('close', onPendingClose); + }; - this.socket.once('error', (error: Error) => { + const failConnect = (error: Error) => { + if (settled) { + return; + } + + settled = true; clearTimeout(timeout); + cleanupPendingListeners(); + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + if (!socket.destroyed) { + socket.destroy(); + } + reject(error); - }); + }; + + const onConnectedSocketError = (error: Error) => { + console.error('Socket error:', error); + }; + + const onConnectedSocketClose = () => { + socket.removeListener('error', onConnectedSocketError); + + if (this.socket && this.socket !== socket) { + return; + } + + const connection = this.connection; + this.connection = null; + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + this.notifyDisconnect(); + }; + + const onPendingError = (error: Error) => { + failConnect(error); + }; + + const onPendingClose = () => { + failConnect(new Error('Connection closed before JSON-RPC was established')); + }; + + const onConnect = async () => { + if (settled) { + return; + } - this.socket.once('connect', () => { clearTimeout(timeout); + cleanupPendingListeners(); + try { - const reader = new rpc.SocketMessageReader(this.socket!); - const writer = new rpc.SocketMessageWriter(this.socket!); + const reader = new rpc.SocketMessageReader(socket); + const writer = new rpc.SocketMessageWriter(socket); this.connection = rpc.createMessageConnection(reader, writer); this.connection.onClose(() => { this.connection = null; - this.notifyDisconnect(); }); this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); @@ -475,26 +864,39 @@ export class AspireClient { } }); + socket.on('error', onConnectedSocketError); + socket.on('close', onConnectedSocketClose); + + const authToken = process.env.ASPIRE_REMOTE_APPHOST_TOKEN; + if (!authToken) { + throw new Error('ASPIRE_REMOTE_APPHOST_TOKEN environment variable is not set.'); + } this.connection.listen(); + const authenticated = await this.connection.sendRequest('authenticate', authToken); + if (!authenticated) { + throw new Error('Failed to authenticate to the AppHost server.'); + } - // Set the current client for cancellation registry - currentClient = this; + connectedClients.add(this); + this._connectPromise = null; + settled = true; resolve(); - } catch (e) { - reject(e); + } catch (error) { + failConnect(error instanceof Error ? error : new Error(String(error))); } - }); + }; - this.socket.on('close', () => { - this.connection?.dispose(); - this.connection = null; - if (currentClient === this) { - currentClient = null; - } - this.notifyDisconnect(); - }); + const timeout = setTimeout(() => { + failConnect(new Error('Connection timeout')); + }, timeoutMs); + + socket.once('error', onPendingError); + socket.once('close', onPendingClose); + socket.once('connect', onConnect); }); + + return this._connectPromise; } ping(): Promise { @@ -533,39 +935,66 @@ export class AspireClient { throw new Error('Not connected to AppHost'); } - // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. - // We ref() during RPC calls so the process doesn't exit mid-call, and - // unref() when idle so the process can exit naturally after all work completes. - if (this._pendingCalls === 0) { - this.socket?.ref(); - } - this._pendingCalls++; + validateCapabilityArgs(capabilityId, args); + const cancellationIds: string[] = []; try { - const result = await this.connection.sendRequest( - 'invokeCapability', - capabilityId, - args ?? null - ); + const rpcArgs = await marshalTransportValue(args ?? null, this, cancellationIds, capabilityId); - // Check for structured error response - if (isAtsError(result)) { - throw new CapabilityError(result.$error); + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); } + this._pendingCalls++; - // Wrap handles automatically - return wrapIfHandle(result, this) as T; + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + rpcArgs + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } } finally { - this._pendingCalls--; - if (this._pendingCalls === 0) { - this.socket?.unref(); + for (const cancellationId of cancellationIds) { + unregisterCancellation(cancellationId); } } } disconnect(): void { - try { this.connection?.dispose(); } finally { this.connection = null; } - try { this.socket?.end(); } finally { this.socket = null; } + const connection = this.connection; + const socket = this.socket; + + this.connection = null; + this.socket = null; + this._connectPromise = null; + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + if (socket && !socket.destroyed) { + socket.end(); + socket.destroy(); + } } get connected(): boolean { diff --git a/samples/database-containers/ts/apphost.run.json b/samples/database-containers/ts/aspire.config.json similarity index 52% rename from samples/database-containers/ts/apphost.run.json rename to samples/database-containers/ts/aspire.config.json index 49a84323..1cb9546d 100644 --- a/samples/database-containers/ts/apphost.run.json +++ b/samples/database-containers/ts/aspire.config.json @@ -1,4 +1,14 @@ { + "appHost": { + "path": "apphost.ts", + "language": "typescript/nodejs" + }, + "packages": { + "Aspire.Hosting.JavaScript": "13.2.0", + "Aspire.Hosting.MySql": "13.2.0", + "Aspire.Hosting.SqlServer": "13.2.0", + "Aspire.Hosting.PostgreSQL": "13.2.0" + }, "profiles": { "https": { "applicationUrl": "https://localhost:11848;http://localhost:15340", @@ -8,4 +18,4 @@ } } } -} \ No newline at end of file +} diff --git a/samples/database-migrations/ts/.aspire/settings.json b/samples/database-migrations/ts/.aspire/settings.json deleted file mode 100644 index c7715292..00000000 --- a/samples/database-migrations/ts/.aspire/settings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "appHostPath": "../apphost.ts", - "language": "typescript/nodejs", - "channel": "staging", - "sdkVersion": "13.2.0-preview.1.26159.1", - "packages": { - "Aspire.Hosting.SqlServer": "13.2.0-preview.1.26159.1" - } -} \ No newline at end of file diff --git a/samples/database-migrations/ts/.modules/.codegen-hash b/samples/database-migrations/ts/.modules/.codegen-hash index 4339e3e4..fe6c2512 100644 --- a/samples/database-migrations/ts/.modules/.codegen-hash +++ b/samples/database-migrations/ts/.modules/.codegen-hash @@ -1 +1 @@ -F1454E21BA68FADAFF01DF5D95185FCD3DE865741AA895F1B5F9669DB7368188 \ No newline at end of file +C3B44D238E08091818DE514FE3D6567A45B793799B4275210282C18F49B60935 \ No newline at end of file diff --git a/samples/database-migrations/ts/.modules/aspire.ts b/samples/database-migrations/ts/.modules/aspire.ts index 07e659d2..3422e619 100644 --- a/samples/database-migrations/ts/.modules/aspire.ts +++ b/samples/database-migrations/ts/.modules/aspire.ts @@ -8,6 +8,8 @@ import { AspireClient as AspireClientRpc, Handle, MarshalledHandle, + AppHostUsageError, + CancellationToken, CapabilityError, registerCallback, wrapIfHandle, @@ -26,15 +28,36 @@ import { // Handle Type Aliases (Internal - not exported to users) // ============================================================================ +/** Handle to JavaScriptAppResource */ +type JavaScriptAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource'>; + +/** Handle to NodeAppResource */ +type NodeAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource'>; + +/** Handle to ViteAppResource */ +type ViteAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource'>; + /** Handle to SqlServerDatabaseResource */ type SqlServerDatabaseResourceHandle = Handle<'Aspire.Hosting.SqlServer/Aspire.Hosting.ApplicationModel.SqlServerDatabaseResource'>; /** Handle to SqlServerServerResource */ type SqlServerServerResourceHandle = Handle<'Aspire.Hosting.SqlServer/Aspire.Hosting.ApplicationModel.SqlServerServerResource'>; +/** Handle to AfterResourcesCreatedEvent */ +type AfterResourcesCreatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent'>; + +/** Handle to BeforeResourceStartedEvent */ +type BeforeResourceStartedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent'>; + +/** Handle to BeforeStartEvent */ +type BeforeStartEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent'>; + /** Handle to CommandLineArgsCallbackContext */ type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; +/** Handle to ConnectionStringAvailableEvent */ +type ConnectionStringAvailableEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent'>; + /** Handle to ContainerRegistryResource */ type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; @@ -44,6 +67,9 @@ type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Application /** Handle to CSharpAppResource */ type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; +/** Handle to DistributedApplicationModel */ +type DistributedApplicationModelHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel'>; + /** Handle to DotnetToolResource */ type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; @@ -62,9 +88,15 @@ type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicatio /** Handle to ExecuteCommandContext */ type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; +/** Handle to IComputeResource */ +type IComputeResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource'>; + /** Handle to IContainerFilesDestinationResource */ type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; +/** Handle to InitializeResourceEvent */ +type InitializeResourceEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent'>; + /** Handle to IResource */ type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; @@ -95,15 +127,27 @@ type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicati /** Handle to ReferenceExpressionBuilder */ type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; +/** Handle to ResourceEndpointsAllocatedEvent */ +type ResourceEndpointsAllocatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent'>; + /** Handle to ResourceLoggerService */ type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; /** Handle to ResourceNotificationService */ type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; +/** Handle to ResourceReadyEvent */ +type ResourceReadyEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent'>; + +/** Handle to ResourceStoppedEvent */ +type ResourceStoppedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent'>; + /** Handle to ResourceUrlsCallbackContext */ type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; +/** Handle to UpdateCommandStateContext */ +type UpdateCommandStateContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext'>; + /** Handle to ConnectionStringResource */ type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; @@ -128,18 +172,33 @@ type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hostin /** Handle to IResourceWithContainerFiles */ type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; -/** Handle to IResourceWithServiceDiscovery */ -type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; +/** Handle to IUserSecretsManager */ +type IUserSecretsManagerHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IUserSecretsManager'>; + +/** Handle to IReportingStep */ +type IReportingStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep'>; + +/** Handle to IReportingTask */ +type IReportingTaskHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask'>; /** Handle to PipelineConfigurationContext */ type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; +/** Handle to PipelineContext */ +type PipelineContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext'>; + /** Handle to PipelineStep */ type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; /** Handle to PipelineStepContext */ type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; +/** Handle to PipelineStepFactoryContext */ +type PipelineStepFactoryContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext'>; + +/** Handle to PipelineSummary */ +type PipelineSummaryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary'>; + /** Handle to ProjectResourceOptions */ type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; @@ -152,12 +211,18 @@ type ListanyHandle = Handle<'Aspire.Hosting/List'>; /** Handle to IConfiguration */ type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; +/** Handle to IConfigurationSection */ +type IConfigurationSectionHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfigurationSection'>; + /** Handle to IHostEnvironment */ type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; /** Handle to ILogger */ type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; +/** Handle to ILoggerFactory */ +type ILoggerFactoryHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory'>; + /** Handle to string[] */ type stringArrayHandle = Handle<'string[]'>; @@ -197,6 +262,7 @@ export enum EndpointProperty { Scheme = "Scheme", TargetPort = "TargetPort", HostAndPort = "HostAndPort", + TlsEnabled = "TlsEnabled", } /** Enum type for IconVariant */ @@ -328,6 +394,10 @@ export interface AddConnectionStringOptions { environmentVariableName?: string; } +export interface AddContainerRegistryFromStringOptions { + repository?: string; +} + export interface AddContainerRegistryOptions { repository?: ParameterResource; } @@ -341,6 +411,10 @@ export interface AddDockerfileOptions { stage?: string; } +export interface AddJavaScriptAppOptions { + runScriptName?: string; +} + export interface AddParameterFromConfigurationOptions { secret?: boolean; } @@ -349,11 +423,20 @@ export interface AddParameterOptions { secret?: boolean; } +export interface AddParameterWithValueOptions { + publishValueAsDefault?: boolean; + secret?: boolean; +} + export interface AddSqlServerOptions { password?: ParameterResource; port?: number; } +export interface AddViteAppOptions { + runScriptName?: string; +} + export interface AppendFormattedOptions { format?: string; } @@ -362,22 +445,89 @@ export interface AppendValueProviderOptions { format?: string; } +export interface CompleteStepMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteStepOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskOptions { + completionMessage?: string; + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateMarkdownTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + export interface GetValueAsyncOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface PublishAsDockerFileOptions { + configure?: (obj: ContainerResource) => Promise; +} + +export interface PublishResourceUpdateOptions { + state?: string; + stateStyle?: string; } export interface RunOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface SaveStateJsonOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskMarkdownOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; } export interface WaitForCompletionOptions { exitCode?: number; } +export interface WaitForResourceStateOptions { + targetState?: string; +} + export interface WithBindMountOptions { isReadOnly?: boolean; } +export interface WithBrowserDebuggerOptions { + browser?: string; +} + +export interface WithBuildScriptOptions { + args?: string[]; +} + +export interface WithBunOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithCommandOptions { commandOptions?: CommandOptions; } @@ -474,6 +624,12 @@ export interface WithMcpServerOptions { endpointName?: string; } +export interface WithNpmOptions { + install?: boolean; + installCommand?: string; + installArgs?: string[]; +} + export interface WithPipelineStepFactoryOptions { dependsOn?: string[]; requiredBy?: string[]; @@ -481,15 +637,25 @@ export interface WithPipelineStepFactoryOptions { description?: string; } +export interface WithPnpmOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithReferenceOptions { connectionName?: string; optional?: boolean; + name?: string; } export interface WithRequiredCommandOptions { helpLink?: string; } +export interface WithRunScriptOptions { + args?: string[]; +} + export interface WithUrlExpressionOptions { displayText?: string; } @@ -503,6 +669,122 @@ export interface WithVolumeOptions { isReadOnly?: boolean; } +export interface WithYarnOptions { + install?: boolean; + installArgs?: string[]; +} + +// ============================================================================ +// AfterResourcesCreatedEvent +// ============================================================================ + +/** + * Type class for AfterResourcesCreatedEvent. + */ +export class AfterResourcesCreatedEvent { + constructor(private _handle: AfterResourcesCreatedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeResourceStartedEvent +// ============================================================================ + +/** + * Type class for BeforeResourceStartedEvent. + */ +export class BeforeResourceStartedEvent { + constructor(private _handle: BeforeResourceStartedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeStartEvent +// ============================================================================ + +/** + * Type class for BeforeStartEvent. + */ +export class BeforeStartEvent { + constructor(private _handle: BeforeStartEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + // ============================================================================ // CommandLineArgsCallbackContext // ============================================================================ @@ -532,11 +814,12 @@ export class CommandLineArgsCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, }; @@ -551,6 +834,65 @@ export class CommandLineArgsCallbackContext { }, }; + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ConnectionStringAvailableEvent +// ============================================================================ + +/** + * Type class for ConnectionStringAvailableEvent. + */ +export class ConnectionStringAvailableEvent { + constructor(private _handle: ConnectionStringAvailableEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + } // ============================================================================ @@ -568,9 +910,9 @@ export class DistributedApplication { /** Runs the distributed application */ /** @internal */ - async _runInternal(cancellationToken?: AbortSignal): Promise { + async _runInternal(cancellationToken?: AbortSignal | CancellationToken): Promise { const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); await this._client.invokeCapability( 'Aspire.Hosting/run', rpcArgs @@ -644,6 +986,17 @@ export class DistributedApplicationExecutionContext { }, }; + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the IsPublishMode property */ isPublishMode = { get: async (): Promise => { @@ -666,6 +1019,70 @@ export class DistributedApplicationExecutionContext { } +// ============================================================================ +// DistributedApplicationModel +// ============================================================================ + +/** + * Type class for DistributedApplicationModel. + */ +export class DistributedApplicationModel { + constructor(private _handle: DistributedApplicationModelHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets resources from the distributed application model */ + async getResources(): Promise { + const rpcArgs: Record = { model: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResources', + rpcArgs + ); + } + + /** Finds a resource by name */ + /** @internal */ + async _findResourceByNameInternal(name: string): Promise { + const rpcArgs: Record = { model: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/findResourceByName', + rpcArgs + ); + return new Resource(result, this._client); + } + + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._findResourceByNameInternal(name)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationModel that enables fluent chaining. + */ +export class DistributedApplicationModelPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationModel) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets resources from the distributed application model */ + getResources(): Promise { + return this._promise.then(obj => obj.getResources()); + } + + /** Finds a resource by name */ + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.findResourceByName(name))); + } + +} + // ============================================================================ // EndpointReference // ============================================================================ @@ -679,6 +1096,17 @@ export class EndpointReference { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.resource', + { context: this._handle } + ); + return new ResourceWithEndpoints(handle, this._client); + }, + }; + /** Gets the EndpointName property */ endpointName = { get: async (): Promise => { @@ -745,6 +1173,16 @@ export class EndpointReference { }, }; + /** Gets the TlsEnabled property */ + tlsEnabled = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.tlsEnabled', + { context: this._handle } + ); + }, + }; + /** Gets the Port property */ port = { get: async (): Promise => { @@ -799,13 +1237,22 @@ export class EndpointReference { async getValueAsync(options?: GetValueAsyncOptions): Promise { const cancellationToken = options?.cancellationToken; const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); return await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/getValueAsync', rpcArgs ); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + async getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + const rpcArgs: Record = { context: this._handle, enabledValue, disabledValue }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.getTlsValue', + rpcArgs + ); + } + } /** @@ -826,6 +1273,11 @@ export class EndpointReferencePromise implements PromiseLike return this._promise.then(obj => obj.getValueAsync(options)); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + return this._promise.then(obj => obj.getTlsValue(enabledValue, disabledValue)); + } + } // ============================================================================ @@ -903,11 +1355,34 @@ export class EnvironmentCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; @@ -937,6 +1412,17 @@ export class ExecuteCommandContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the ResourceName property */ resourceName = { get: async (): Promise => { @@ -955,16 +1441,17 @@ export class ExecuteCommandContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, - set: async (value: AbortSignal): Promise => { + set: async (value: AbortSignal | CancellationToken): Promise => { await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', - { context: this._handle, value } + { context: this._handle, value: CancellationToken.fromValue(value) } ); } }; @@ -972,34 +1459,126 @@ export class ExecuteCommandContext { } // ============================================================================ -// PipelineConfigurationContext +// InitializeResourceEvent // ============================================================================ /** - * Type class for PipelineConfigurationContext. + * Type class for InitializeResourceEvent. */ -export class PipelineConfigurationContext { - constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} +export class InitializeResourceEvent { + constructor(private _handle: InitializeResourceEventHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the Steps property */ - steps = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.resource', { context: this._handle } ); + return new Resource(handle, this._client); }, - set: async (value: PipelineStep[]): Promise => { - await this._client.invokeCapability( + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Notifications property */ + notifications = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.notifications', + { context: this._handle } + ); + return new ResourceNotificationService(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + { context: this._handle } + ); + }, + set: async (value: PipelineStep[]): Promise => { + await this._client.invokeCapability( 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', { context: this._handle, value } ); } }; + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + /** Gets pipeline steps with the specified tag */ async getStepsByTag(tag: string): Promise { const rpcArgs: Record = { context: this._handle, tag }; @@ -1031,6 +1610,93 @@ export class PipelineConfigurationContextPromise implements PromiseLike => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + set: async (value: AbortSignal | CancellationToken): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.setCancellationToken', + { context: this._handle, value: CancellationToken.fromValue(value) } + ); + } + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + // ============================================================================ // PipelineStep // ============================================================================ @@ -1118,6 +1784,17 @@ export class PipelineStep { return this._tags; } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + /** Adds a dependency on another step by name */ /** @internal */ async _dependsOnInternal(stepName: string): Promise { @@ -1188,6 +1865,39 @@ export class PipelineStepContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the ReportingStep property */ + reportingStep = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.reportingStep', + { context: this._handle } + ); + return new ReportingStep(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + /** Gets the ExecutionContext property */ executionContext = { get: async (): Promise => { @@ -1199,18 +1909,159 @@ export class PipelineStepContext { }, }; + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineStepFactoryContext +// ============================================================================ + +/** + * Type class for PipelineStepFactoryContext. + */ +export class PipelineStepFactoryContext { + constructor(private _handle: PipelineStepFactoryContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; } +// ============================================================================ +// PipelineSummary +// ============================================================================ + +/** + * Type class for PipelineSummary. + */ +export class PipelineSummary { + constructor(private _handle: PipelineSummaryHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Add method */ + /** @internal */ + async _addInternal(key: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, key, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineSummary.add', + rpcArgs + ); + return this; + } + + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addInternal(key, value)); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + /** @internal */ + async _addMarkdownInternal(key: string, markdownString: string): Promise { + const rpcArgs: Record = { summary: this._handle, key, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/addMarkdown', + rpcArgs + ); + return this; + } + + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addMarkdownInternal(key, markdownString)); + } + +} + +/** + * Thenable wrapper for PipelineSummary that enables fluent chaining. + */ +export class PipelineSummaryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineSummary) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Add method */ + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.add(key, value))); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.addMarkdown(key, markdownString))); + } + +} + // ============================================================================ // ProjectResourceOptions // ============================================================================ @@ -1393,8414 +2244,8172 @@ export class ReferenceExpressionBuilderPromise implements PromiseLike; - get urls(): AspireList { - if (!this._urls) { - this._urls = new AspireList( - this._handle, - this._client, - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' - ); - } - return this._urls; - } - - /** Gets the CancellationToken property */ - cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.resource', { context: this._handle } ); + return new Resource(handle, this._client); }, }; - /** Gets the ExecutionContext property */ - executionContext = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.services', { context: this._handle } ); - return new DistributedApplicationExecutionContext(handle, this._client); + return new ServiceProvider(handle, this._client); }, }; } // ============================================================================ -// DistributedApplicationBuilder +// ResourceLoggerService // ============================================================================ /** - * Type class for DistributedApplicationBuilder. + * Type class for ResourceLoggerService. */ -export class DistributedApplicationBuilder { - constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} +export class ResourceLoggerService { + constructor(private _handle: ResourceLoggerServiceHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the AppHostDirectory property */ - appHostDirectory = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', - { context: this._handle } - ); - }, - }; - - /** Gets the Eventing property */ - eventing = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', - { context: this._handle } - ); - return new DistributedApplicationEventing(handle, this._client); - }, - }; - - /** Gets the ExecutionContext property */ - executionContext = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', - { context: this._handle } - ); - return new DistributedApplicationExecutionContext(handle, this._client); - }, - }; - - /** Builds the distributed application */ + /** Completes the log stream for a resource */ /** @internal */ - async _buildInternal(): Promise { - const rpcArgs: Record = { context: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/build', + async _completeLogInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { loggerService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLog', rpcArgs ); - return new DistributedApplication(result, this._client); + return this; } - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._buildInternal()); + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogInternal(resource)); } - /** Adds a connection string with a builder callback */ + /** Completes the log stream by resource name */ /** @internal */ - async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { - const connectionStringBuilderId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; - const obj = new ReferenceExpressionBuilder(objHandle, this._client); - await connectionStringBuilder(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionStringBuilder', + async _completeLogByNameInternal(resourceName: string): Promise { + const rpcArgs: Record = { loggerService: this._handle, resourceName }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLogByName', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return this; } - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogByNameInternal(resourceName)); } - /** Adds a container registry resource */ - /** @internal */ - async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpoint }; - if (repository !== undefined) rpcArgs.repository = repository; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainerRegistry', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } +} - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - const repository = options?.repository; - return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); - } +/** + * Thenable wrapper for ResourceLoggerService that enables fluent chaining. + */ +export class ResourceLoggerServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** Adds a container resource */ - /** @internal */ - async _addContainerInternal(name: string, image: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, image }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainer', - rpcArgs - ); - return new ContainerResource(result, this._client); + then( + onfulfilled?: ((value: ResourceLoggerService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._addContainerInternal(name, image)); + /** Completes the log stream for a resource */ + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLog(resource))); } - /** Adds a container resource built from a Dockerfile */ - /** @internal */ - async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDockerfile', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Completes the log stream by resource name */ + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLogByName(resourceName))); } - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); - } +} - /** Adds a .NET tool resource */ - /** @internal */ - async _addDotnetToolInternal(name: string, packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDotnetTool', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } +// ============================================================================ +// ResourceNotificationService +// ============================================================================ - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); - } +/** + * Type class for ResourceNotificationService. + */ +export class ResourceNotificationService { + constructor(private _handle: ResourceNotificationServiceHandle, private _client: AspireClientRpc) {} - /** Adds an executable resource */ + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Waits for a resource to reach a specified state */ /** @internal */ - async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExecutable', + async _waitForResourceStateInternal(resourceName: string, targetState?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + if (targetState !== undefined) rpcArgs.targetState = targetState; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceState', rpcArgs ); - return new ExecutableResource(result, this._client); + return this; } - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + const targetState = options?.targetState; + return new ResourceNotificationServicePromise(this._waitForResourceStateInternal(resourceName, targetState)); } - /** Adds an external service resource */ - /** @internal */ - async _addExternalServiceInternal(name: string, url: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, url }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExternalService', + /** Waits for a resource to reach one of the specified states */ + async waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName, targetStates }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStates', rpcArgs ); - return new ExternalServiceResource(result, this._client); - } - - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); } - /** Adds a parameter resource */ - /** @internal */ - async _addParameterInternal(name: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameter', + /** Waits for a resource to become healthy */ + async waitForResourceHealthy(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceHealthy', rpcArgs ); - return new ParameterResource(result, this._client); - } - - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterInternal(name, secret)); } - /** Adds a parameter sourced from configuration */ + /** Waits for all dependencies of a resource to be ready */ /** @internal */ - async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name, configurationKey }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameterFromConfiguration', + async _waitForDependenciesInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForDependencies', rpcArgs ); - return new ParameterResource(result, this._client); + return this; } - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._waitForDependenciesInternal(resource)); } - /** Adds a connection string resource */ - /** @internal */ - async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionString', + /** Tries to get the current state of a resource */ + async tryGetResourceState(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/tryGetResourceState', rpcArgs ); - return new ResourceWithConnectionString(result, this._client); } - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - const environmentVariableName = options?.environmentVariableName; - return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); - } - - /** Adds a .NET project resource */ + /** Publishes an update for a resource's state */ /** @internal */ - async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProject', + async _publishResourceUpdateInternal(resource: ResourceBuilderBase, state?: string, stateStyle?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + if (state !== undefined) rpcArgs.state = state; + if (stateStyle !== undefined) rpcArgs.stateStyle = stateStyle; + await this._client.invokeCapability( + 'Aspire.Hosting/publishResourceUpdate', rpcArgs ); - return new ProjectResource(result, this._client); + return this; } - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + const state = options?.state; + const stateStyle = options?.stateStyle; + return new ResourceNotificationServicePromise(this._publishResourceUpdateInternal(resource, state, stateStyle)); } - /** Adds a project resource with configuration options */ - /** @internal */ - async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProjectWithOptions', - rpcArgs - ); - return new ProjectResource(result, this._client); - } +} - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); +/** + * Thenable wrapper for ResourceNotificationService that enables fluent chaining. + */ +export class ResourceNotificationServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceNotificationService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a C# application resource */ - /** @internal */ - async _addCSharpAppInternal(name: string, path: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, path }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpApp', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Waits for a resource to reach a specified state */ + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForResourceState(resourceName, options))); } - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + /** Waits for a resource to reach one of the specified states */ + waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + return this._promise.then(obj => obj.waitForResourceStates(resourceName, targetStates)); } - /** Adds a C# application resource with configuration options */ - /** @internal */ - async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpAppWithOptions', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Waits for a resource to become healthy */ + waitForResourceHealthy(resourceName: string): Promise { + return this._promise.then(obj => obj.waitForResourceHealthy(resourceName)); } - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + /** Waits for all dependencies of a resource to be ready */ + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForDependencies(resource))); } - /** Adds a SQL Server container resource */ - /** @internal */ - async _addSqlServerInternal(name: string, password?: ParameterResource, port?: number): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (password !== undefined) rpcArgs.password = password; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.SqlServer/addSqlServer', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Tries to get the current state of a resource */ + tryGetResourceState(resourceName: string): Promise { + return this._promise.then(obj => obj.tryGetResourceState(resourceName)); } - addSqlServer(name: string, options?: AddSqlServerOptions): SqlServerServerResourcePromise { - const password = options?.password; - const port = options?.port; - return new SqlServerServerResourcePromise(this._addSqlServerInternal(name, password, port)); + /** Publishes an update for a resource's state */ + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.publishResourceUpdate(resource, options))); } } +// ============================================================================ +// ResourceReadyEvent +// ============================================================================ + /** - * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + * Type class for ResourceReadyEvent. */ -export class DistributedApplicationBuilderPromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ResourceReadyEvent { + constructor(private _handle: ResourceReadyEventHandle, private _client: AspireClientRpc) {} - then( - onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Builds the distributed application */ - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); - } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; - /** Adds a connection string with a builder callback */ - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); - } + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; - /** Adds a container registry resource */ - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); - } +} - /** Adds a container resource */ - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); - } +// ============================================================================ +// ResourceStoppedEvent +// ============================================================================ - /** Adds a container resource built from a Dockerfile */ - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); - } +/** + * Type class for ResourceStoppedEvent. + */ +export class ResourceStoppedEvent { + constructor(private _handle: ResourceStoppedEventHandle, private _client: AspireClientRpc) {} - /** Adds a .NET tool resource */ - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Adds an executable resource */ - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); - } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; - /** Adds an external service resource */ - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); - } + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; - /** Adds a parameter resource */ - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); - } +} - /** Adds a parameter sourced from configuration */ - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); - } +// ============================================================================ +// ResourceUrlsCallbackContext +// ============================================================================ - /** Adds a connection string resource */ - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); - } +/** + * Type class for ResourceUrlsCallbackContext. + */ +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} - /** Adds a .NET project resource */ - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Adds a project resource with configuration options */ - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); - } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; - /** Adds a C# application resource */ - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; } - /** Adds a C# application resource with configuration options */ - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); - } + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + }; - /** Adds a SQL Server container resource */ - addSqlServer(name: string, options?: AddSqlServerOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.addSqlServer(name, options))); - } + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; } // ============================================================================ -// DistributedApplicationEventing +// UpdateCommandStateContext // ============================================================================ /** - * Type class for DistributedApplicationEventing. + * Type class for UpdateCommandStateContext. */ -export class DistributedApplicationEventing { - constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} +export class UpdateCommandStateContext { + constructor(private _handle: UpdateCommandStateContextHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Invokes the Unsubscribe method */ - /** @internal */ - async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { - const rpcArgs: Record = { context: this._handle, subscription }; - await this._client.invokeCapability( - 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', - rpcArgs - ); - return this; - } - - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); - } + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/UpdateCommandStateContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; } +// ============================================================================ +// Configuration +// ============================================================================ + /** - * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + * Type class for Configuration. */ -export class DistributedApplicationEventingPromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class Configuration { + constructor(private _handle: IConfigurationHandle, private _client: AspireClientRpc) {} - then( - onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Invokes the Unsubscribe method */ - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + /** Gets a configuration value by key */ + async getConfigValue(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConfigValue', + rpcArgs + ); } -} - -// ============================================================================ -// ConnectionStringResource -// ============================================================================ - -export class ConnectionStringResource extends ResourceBuilderBase { - constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Gets a connection string by name */ + async getConnectionString(name: string): Promise { + const rpcArgs: Record = { configuration: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionString', + rpcArgs + ); } - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + /** Gets a configuration section by key */ + async getSection(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getSection', rpcArgs ); - return new ConnectionStringResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + /** Gets child configuration sections */ + async getChildren(): Promise { + const rpcArgs: Record = { configuration: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getChildren', + rpcArgs + ); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + /** Checks whether a configuration section exists */ + async exists(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/exists', rpcArgs ); - return new ConnectionStringResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); +} + +/** + * Thenable wrapper for Configuration that enables fluent chaining. + */ +export class ConfigurationPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Configuration) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); + /** Gets a configuration value by key */ + getConfigValue(key: string): Promise { + return this._promise.then(obj => obj.getConfigValue(key)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { - const helpLink = options?.helpLink; - return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Gets a connection string by name */ + getConnectionString(name: string): Promise { + return this._promise.then(obj => obj.getConnectionString(name)); } - /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); + /** Gets a configuration section by key */ + getSection(key: string): Promise { + return this._promise.then(obj => obj.getSection(key)); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Gets child configuration sections */ + getChildren(): Promise { + return this._promise.then(obj => obj.getChildren()); } - /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); + /** Checks whether a configuration section exists */ + exists(key: string): Promise { + return this._promise.then(obj => obj.exists(key)); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); - } +} + +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Environment property */ + environment = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.environment', + { context: this._handle } + ); + return new HostEnvironment(handle, this._client); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the UserSecretsManager property */ + userSecretsManager = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.userSecretsManager', + { context: this._handle } + ); + return new UserSecretsManager(handle, this._client); + }, + }; + /** Builds the distributed application */ /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DistributedApplication(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); } + /** Adds a connection string with a reference expression */ /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + async _addConnectionStringExpressionInternal(name: string, connectionStringExpression: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, connectionStringExpression }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + 'Aspire.Hosting/addConnectionStringExpression', rpcArgs ); return new ConnectionStringResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringExpressionInternal(name, connectionStringExpression)); } + /** Adds a connection string with a builder callback */ /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + 'Aspire.Hosting/addConnectionStringBuilder', rpcArgs ); return new ConnectionStringResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { - const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); } + /** Adds a container registry resource */ /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { - const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); } + /** Adds a container registry with string endpoint */ /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + async _addContainerRegistryFromStringInternal(name: string, endpoint: string, repository?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistryFromString', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryFromStringInternal(name, endpoint, repository)); } + /** Adds a container resource */ /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); } + /** Adds a container resource built from a Dockerfile */ /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); } + /** Adds a .NET tool resource */ /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); } + /** Adds an executable resource */ /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); } + /** Adds an external service resource */ /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); } + /** Adds an external service with a URI */ /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + async _addExternalServiceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceUri', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceUriInternal(name, uri)); } + /** Adds an external service with a parameter URL */ /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + async _addExternalServiceParameterInternal(name: string, urlParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, urlParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceParameter', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - const exitCode = options?.exitCode; - return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceParameterInternal(name, urlParameter)); } + /** Adds a parameter resource */ /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); } + /** Adds a parameter with a default value */ /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + async _addParameterWithValueInternal(name: string, value: string, publishValueAsDefault?: boolean, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + if (publishValueAsDefault !== undefined) rpcArgs.publishValueAsDefault = publishValueAsDefault; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterWithValue', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { - const commandOptions = options?.commandOptions; - return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + const publishValueAsDefault = options?.publishValueAsDefault; + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterWithValueInternal(name, value, publishValueAsDefault, secret)); } + /** Adds a parameter sourced from configuration */ /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); } + /** Adds a connection string resource */ /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ResourceWithConnectionString(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); } + /** Adds a .NET project resource */ /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { - const iconVariant = options?.iconVariant; - return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); } + /** Adds a project resource with configuration options */ /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); } + /** Adds a C# application resource */ /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); } + /** Adds a C# application resource with configuration options */ /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); } + /** Gets the application configuration */ /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + async _getConfigurationInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getConfiguration', + rpcArgs + ); + return new Configuration(result, this._client); + } + + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._getConfigurationInternal()); + } + + /** Subscribes to the BeforeStart event */ + async subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as BeforeStartEventHandle; + const arg = new BeforeStartEvent(argHandle, this._client); await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeBeforeStart', rpcArgs ); - return new ConnectionStringResource(result, this._client); - } - - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + /** Subscribes to the AfterResourcesCreated event */ + async subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as AfterResourcesCreatedEventHandle; + const arg = new AfterResourcesCreatedEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeAfterResourcesCreated', rpcArgs ); - return new ConnectionStringResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds a Node.js application resource */ + /** @internal */ + async _addNodeAppInternal(name: string, appDirectory: string, scriptPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory, scriptPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addNodeApp', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._addNodeAppInternal(name, appDirectory, scriptPath)); } + /** Adds a JavaScript application resource */ /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + async _addJavaScriptAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addJavaScriptApp', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + const runScriptName = options?.runScriptName; + return new JavaScriptAppResourcePromise(this._addJavaScriptAppInternal(name, appDirectory, runScriptName)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** Adds a Vite application resource */ + /** @internal */ + async _addViteAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addViteApp', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + const runScriptName = options?.runScriptName; + return new ViteAppResourcePromise(this._addViteAppInternal(name, appDirectory, runScriptName)); + } + + /** Adds a SQL Server container resource */ + /** @internal */ + async _addSqlServerInternal(name: string, password?: ParameterResource, port?: number): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (password !== undefined) rpcArgs.password = password; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/addSqlServer', rpcArgs ); + return new SqlServerServerResource(result, this._client); + } + + addSqlServer(name: string, options?: AddSqlServerOptions): SqlServerServerResourcePromise { + const password = options?.password; + const port = options?.port; + return new SqlServerServerResourcePromise(this._addSqlServerInternal(name, password, port)); } } /** - * Thenable wrapper for ConnectionStringResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. */ -export class ConnectionStringResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds a connection string with a reference expression */ + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringExpression(name, connectionStringExpression))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); - } - - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); - } - - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Adds a container registry with string endpoint */ + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistryFromString(name, endpoint, options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Adds an external service with a URI */ + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceUri(name, uri))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Adds an external service with a parameter URL */ + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceParameter(name, urlParameter))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Adds a parameter with a default value */ + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterWithValue(name, value, options))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Gets the application configuration */ + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._promise.then(obj => obj.getConfiguration())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Subscribes to the BeforeStart event */ + subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeBeforeStart(callback)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Subscribes to the AfterResourcesCreated event */ + subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeAfterResourcesCreated(callback)); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds a Node.js application resource */ + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.addNodeApp(name, appDirectory, scriptPath))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Adds a JavaScript application resource */ + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.addJavaScriptApp(name, appDirectory, options))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Adds a Vite application resource */ + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.addViteApp(name, appDirectory, options))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Adds a SQL Server container resource */ + addSqlServer(name: string, options?: AddSqlServerOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.addSqlServer(name, options))); } } // ============================================================================ -// ContainerRegistryResource +// DistributedApplicationEventing // ============================================================================ -export class ContainerRegistryResource extends ResourceBuilderBase { - constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { - super(handle, client); - } +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Invokes the Unsubscribe method */ /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', +} + +// ============================================================================ +// HostEnvironment +// ============================================================================ + +/** + * Type class for HostEnvironment. + */ +export class HostEnvironment { + constructor(private _handle: IHostEnvironmentHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Checks if running in Development environment */ + async isDevelopment(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isDevelopment', rpcArgs ); - return new ContainerRegistryResource(result, this._client); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { - const helpLink = options?.helpLink; - return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + /** Checks if running in Production environment */ + async isProduction(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isProduction', rpcArgs ); - return new ContainerRegistryResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Checks if running in Staging environment */ + async isStaging(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isStaging', + rpcArgs + ); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + /** Checks if the environment matches the specified name */ + async isEnvironment(environmentName: string): Promise { + const rpcArgs: Record = { environment: this._handle, environmentName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isEnvironment', rpcArgs ); - return new ContainerRegistryResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); +} + +/** + * Thenable wrapper for HostEnvironment that enables fluent chaining. + */ +export class HostEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: HostEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Checks if running in Development environment */ + isDevelopment(): Promise { + return this._promise.then(obj => obj.isDevelopment()); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { - const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + /** Checks if running in Production environment */ + isProduction(): Promise { + return this._promise.then(obj => obj.isProduction()); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Checks if running in Staging environment */ + isStaging(): Promise { + return this._promise.then(obj => obj.isStaging()); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { - const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Checks if the environment matches the specified name */ + isEnvironment(environmentName: string): Promise { + return this._promise.then(obj => obj.isEnvironment(environmentName)); } +} + +// ============================================================================ +// Logger +// ============================================================================ + +/** + * Type class for Logger. + */ +export class Logger { + constructor(private _handle: ILoggerHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Logs an information message */ /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + async _logInformationInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logInformation', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._logInformationInternal(message)); } + /** Logs a warning message */ /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + async _logWarningInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logWarning', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._logWarningInternal(message)); } + /** Logs an error message */ /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + async _logErrorInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logError', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + logError(message: string): LoggerPromise { + return new LoggerPromise(this._logErrorInternal(message)); } + /** Logs a debug message */ /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + async _logDebugInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logDebug', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._logDebugInternal(message)); } + /** Logs a message with specified level */ /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + async _logInternal(level: string, message: string): Promise { + const rpcArgs: Record = { logger: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/log', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._logInternal(level, message)); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); +} + +/** + * Thenable wrapper for Logger that enables fluent chaining. + */ +export class LoggerPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Logger) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + /** Logs an information message */ + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logInformation(message))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Logs a warning message */ + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logWarning(message))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + /** Logs an error message */ + logError(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logError(message))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Logs a debug message */ + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logDebug(message))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Logs a message with specified level */ + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.log(level, message))); } +} + +// ============================================================================ +// LoggerFactory +// ============================================================================ + +/** + * Type class for LoggerFactory. + */ +export class LoggerFactory { + constructor(private _handle: ILoggerFactoryHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Creates a logger for a category */ /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + async _createLoggerInternal(categoryName: string): Promise { + const rpcArgs: Record = { loggerFactory: this._handle, categoryName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createLogger', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new Logger(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._createLoggerInternal(categoryName)); + } + +} + +/** + * Thenable wrapper for LoggerFactory that enables fluent chaining. + */ +export class LoggerFactoryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: LoggerFactory) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Creates a logger for a category */ + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.createLogger(categoryName))); } +} + +// ============================================================================ +// ReportingStep +// ============================================================================ + +/** + * Type class for ReportingStep. + */ +export class ReportingStep { + constructor(private _handle: IReportingStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Creates a reporting task with plain-text status text */ /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + async _createTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createTask', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ReportingTask(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createTaskInternal(statusText, cancellationToken)); } + /** Creates a reporting task with Markdown-formatted status text */ /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + async _createMarkdownTaskInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createMarkdownTask', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ReportingTask(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createMarkdownTaskInternal(markdownString, cancellationToken)); } + /** Logs a plain-text message for the reporting step */ /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + async _logStepInternal(level: string, message: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStep', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepInternal(level, message)); } + /** Logs a Markdown-formatted message for the reporting step */ /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + async _logStepMarkdownInternal(level: string, markdownString: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStepMarkdown', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepMarkdownInternal(level, markdownString)); } + /** Completes the reporting step with plain-text completion text */ /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + async _completeStepInternal(completionText: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, completionText }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStep', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepInternal(completionText, completionState, cancellationToken)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** Completes the reporting step with Markdown-formatted completion text */ + /** @internal */ + async _completeStepMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStepMarkdown', rpcArgs ); + return this; + } + + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepMarkdownInternal(markdownString, completionState, cancellationToken)); } } /** - * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); + * Thenable wrapper for ReportingStep that enables fluent chaining. */ -export class ContainerRegistryResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ReportingStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ReportingStep) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Creates a reporting task with plain-text status text */ + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createTask(statusText, options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Creates a reporting task with Markdown-formatted status text */ + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createMarkdownTask(markdownString, options))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Logs a plain-text message for the reporting step */ + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStep(level, message))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Logs a Markdown-formatted message for the reporting step */ + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStepMarkdown(level, markdownString))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Completes the reporting step with plain-text completion text */ + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStep(completionText, options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Completes the reporting step with Markdown-formatted completion text */ + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStepMarkdown(markdownString, options))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } +} - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } +// ============================================================================ +// ReportingTask +// ============================================================================ - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } +/** + * Type class for ReportingTask. + */ +export class ReportingTask { + constructor(private _handle: IReportingTaskHandle, private _client: AspireClientRpc) {} - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Updates the reporting task with plain-text status text */ + /** @internal */ + async _updateTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTask', + rpcArgs + ); + return this; } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskInternal(statusText, cancellationToken)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Updates the reporting task with Markdown-formatted status text */ + /** @internal */ + async _updateTaskMarkdownInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTaskMarkdown', + rpcArgs + ); + return this; } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskMarkdownInternal(markdownString, cancellationToken)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Completes the reporting task with plain-text completion text */ + /** @internal */ + async _completeTaskInternal(completionMessage?: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle }; + if (completionMessage !== undefined) rpcArgs.completionMessage = completionMessage; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTask', + rpcArgs + ); + return this; } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + const completionMessage = options?.completionMessage; + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskInternal(completionMessage, completionState, cancellationToken)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Completes the reporting task with Markdown-formatted completion text */ + /** @internal */ + async _completeTaskMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTaskMarkdown', + rpcArgs + ); + return this; } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskMarkdownInternal(markdownString, completionState, cancellationToken)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); +} + +/** + * Thenable wrapper for ReportingTask that enables fluent chaining. + */ +export class ReportingTaskPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReportingTask) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Updates the reporting task with plain-text status text */ + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTask(statusText, options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Updates the reporting task with Markdown-formatted status text */ + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTaskMarkdown(markdownString, options))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Completes the reporting task with plain-text completion text */ + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTask(options))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Completes the reporting task with Markdown-formatted completion text */ + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTaskMarkdown(markdownString, options))); } } // ============================================================================ -// ContainerResource +// ServiceProvider // ============================================================================ -export class ContainerResource extends ResourceBuilderBase { - constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { - super(handle, client); - } +/** + * Type class for ServiceProvider. + */ +export class ServiceProvider { + constructor(private _handle: IServiceProviderHandle, private _client: AspireClientRpc) {} + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the distributed application eventing service from the service provider */ /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + async _getEventingInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getEventing', rpcArgs ); - return new ContainerResource(result, this._client); + return new DistributedApplicationEventing(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._getEventingInternal()); } + /** Gets the logger factory from the service provider */ /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + async _getLoggerFactoryInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getLoggerFactory', rpcArgs ); - return new ContainerResource(result, this._client); + return new LoggerFactory(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._getLoggerFactoryInternal()); } + /** Gets the resource logger service from the service provider */ /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + async _getResourceLoggerServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceLoggerService', rpcArgs ); - return new ContainerResource(result, this._client); + return new ResourceLoggerService(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._getResourceLoggerServiceInternal()); } + /** Gets the distributed application model from the service provider */ /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + async _getDistributedApplicationModelInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getDistributedApplicationModel', rpcArgs ); - return new ContainerResource(result, this._client); + return new DistributedApplicationModel(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterInternal()); + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._getDistributedApplicationModelInternal()); } + /** Gets the resource notification service from the service provider */ /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + async _getResourceNotificationServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceNotificationService', rpcArgs ); - return new ContainerResource(result, this._client); + return new ResourceNotificationService(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._getResourceNotificationServiceInternal()); } + /** Gets the user secrets manager from the service provider */ /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + async _getUserSecretsManagerInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getUserSecretsManager', rpcArgs ); - return new ContainerResource(result, this._client); + return new UserSecretsManager(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - const helpLink = options?.helpLink; - return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getUserSecretsManagerInternal()); } - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ContainerResource(result, this._client); +} + +/** + * Thenable wrapper for ServiceProvider that enables fluent chaining. + */ +export class ServiceProviderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ServiceProvider) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + /** Gets the distributed application eventing service from the service provider */ + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.getEventing())); } - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets the logger factory from the service provider */ + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._promise.then(obj => obj.getLoggerFactory())); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Gets the resource logger service from the service provider */ + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.getResourceLoggerService())); } - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets the distributed application model from the service provider */ + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._promise.then(obj => obj.getDistributedApplicationModel())); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Gets the resource notification service from the service provider */ + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.getResourceNotificationService())); } - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets the user secrets manager from the service provider */ + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getUserSecretsManager())); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); +} + +// ============================================================================ +// UserSecretsManager +// ============================================================================ + +/** + * Type class for UserSecretsManager. + */ +export class UserSecretsManager { + constructor(private _handle: IUserSecretsManagerHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the IsAvailable property */ + isAvailable = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.isAvailable', + { context: this._handle } + ); + }, + }; + + /** Gets the FilePath property */ + filePath = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.filePath', + { context: this._handle } + ); + }, + }; + + /** Attempts to set a user secret value */ + async trySetSecret(name: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, name, value }; + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.trySetSecret', + rpcArgs + ); } + /** Saves state to user secrets from a JSON string */ /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + async _saveStateJsonInternal(json: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, json }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/saveStateJson', rpcArgs ); - return new ContainerResource(result, this._client); + return this; } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + const cancellationToken = options?.cancellationToken; + return new UserSecretsManagerPromise(this._saveStateJsonInternal(json, cancellationToken)); } + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + async _getOrSetSecretInternal(resourceBuilder: ResourceBuilderBase, name: string, value: string): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, resourceBuilder, name, value }; + await this._client.invokeCapability( + 'Aspire.Hosting/getOrSetSecret', rpcArgs ); - return new ContainerResource(result, this._client); + return this; } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getOrSetSecretInternal(resourceBuilder, name, value)); } - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new ContainerResource(result, this._client); +} + +/** + * Thenable wrapper for UserSecretsManager that enables fluent chaining. + */ +export class UserSecretsManagerPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: UserSecretsManager) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Attempts to set a user secret value */ + trySetSecret(name: string, value: string): Promise { + return this._promise.then(obj => obj.trySetSecret(name, value)); + } + + /** Saves state to user secrets from a JSON string */ + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.saveStateJson(json, options))); + } + + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getOrSetSecret(resourceBuilder, name, value))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsInternal(args)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + return new ConnectionStringResource(result, this._client); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromManifestInternal()); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForInternal(dependency)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartInternal(dependency)); - } - - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExplicitStartInternal()); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - const exitCode = options?.exitCode; - return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onConnectionStringAvailableInternal(callback)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - const password = options?.password; - return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceReadyInternal(callback)); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new ContainerResource(result, this._client); +} + +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', - rpcArgs - ); - return new ContainerResource(result, this._client); - } - - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromMcpInternal()); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } -} - -/** - * Thenable wrapper for ContainerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ContainerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); - } +} - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); - } +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); - } - - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); - } - - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); - } - - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); - } - -} - -// ============================================================================ -// CSharpAppResource -// ============================================================================ - -export class CSharpAppResource extends ResourceBuilderBase { - constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { - super(handle, client); + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new CSharpAppResource(result, this._client); - } - - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withReplicasInternal(replicas: number): Promise { - const rpcArgs: Record = { builder: this._handle, replicas }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReplicas', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _disableForwardedHeadersInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/disableForwardedHeaders', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - const helpLink = options?.helpLink; - return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceReadyInternal(callback)); } - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new CSharpAppResource(result, this._client); +} + +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsInternal(args)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// ContainerResource +// ============================================================================ + +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _publishAsContainerInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', rpcArgs ); - return new CSharpAppResource(result, this._client); - } - - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + return new ContainerResource(result, this._client); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); } /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _withOtlpExporterInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - const exitCode = options?.exitCode; - return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - const commandOptions = options?.commandOptions; - return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - const password = options?.password; - return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new CSharpAppResource(result, this._client); - } - - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - const iconVariant = options?.iconVariant; - return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); + return new ContainerResource(result, this._client); } -} + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + } -/** - * Thenable wrapper for CSharpAppResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class CSharpAppResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + const exitCode = options?.exitCode; + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + const password = options?.password; + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); - } - - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); - } - - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); } /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); - } - -} - -// ============================================================================ -// DotnetToolResource -// ============================================================================ - -export class DotnetToolResource extends ResourceBuilderBase { - constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { - super(handle, client); + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withToolPackageInternal(packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPackage', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withToolVersionInternal(version: string): Promise { - const rpcArgs: Record = { builder: this._handle, version }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolVersion', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withToolPrereleaseInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPrerelease', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceReadyInternal(callback)); } - /** @internal */ - private async _withToolSourceInternal(source: string): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolSource', - rpcArgs - ); - return new DotnetToolResource(result, this._client); +} + +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withToolIgnoreExistingFeedsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreExistingFeeds', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } - /** @internal */ - private async _withToolIgnoreFailedSourcesInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreFailedSources', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** @internal */ - private async _publishAsDockerFileInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFile', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); } - /** @internal */ - private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; - const obj = new ContainerResource(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFileWithConfigure', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } - /** @internal */ - private async _withExecutableCommandInternal(command: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExecutableCommand', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); } - /** @internal */ - private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { - const rpcArgs: Record = { builder: this._handle, workingDirectory }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withWorkingDirectory', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); } - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); } - /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); } - /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - const helpLink = options?.helpLink; - return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsInternal(args)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { - const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { - const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForInternal(dependency)); +} + +// ============================================================================ +// CSharpAppResource +// ============================================================================ + +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withOtlpExporterInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { - const exitCode = options?.exitCode; - return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _disableForwardedHeadersInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { - const commandOptions = options?.commandOptions; - return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + const configure = options?.configure; + return new CSharpAppResourcePromise(this._publishAsDockerFileInternal(configure)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { - const password = options?.password; - return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { - const iconVariant = options?.iconVariant; - return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); - } - - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', rpcArgs ); + return new CSharpAppResource(result, this._client); } -} - -/** - * Thenable wrapper for DotnetToolResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class DotnetToolResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } - then( - onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); } - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + const exitCode = options?.exitCode; + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + const commandOptions = options?.commandOptions; + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + const password = options?.password; + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } - - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); - } - - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); - } - - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); - } - - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); - } - - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); - } - - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } -} - -// ============================================================================ -// ExecutableResource -// ============================================================================ - -export class ExecutableResource extends ResourceBuilderBase { - constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + const iconVariant = options?.iconVariant; + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - const helpLink = options?.helpLink; - return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new ExecutableResource(result, this._client); - } - - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsInternal(args)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceReadyInternal(callback)); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new ExecutableResource(result, this._client); +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { - const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { - const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); - } - - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new ExecutableResource(result, this._client); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromManifestInternal()); - } - - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new ExecutableResource(result, this._client); + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExplicitStartInternal()); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { - const exitCode = options?.exitCode; - return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { - const commandOptions = options?.commandOptions; - return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { - const password = options?.password; - return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// DotnetToolResource +// ============================================================================ + +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { - const iconVariant = options?.iconVariant; - return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); + return new DotnetToolResource(result, this._client); } -} - -/** - * Thenable wrapper for ExecutableResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ExecutableResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); - } - - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); } - /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } - - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); - } - - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); - } - - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); - } - - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); - } - - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); - } - - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); - } - - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } -} - -// ============================================================================ -// ExternalServiceResource -// ============================================================================ - -export class ExternalServiceResource extends ResourceBuilderBase { - constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - const helpLink = options?.helpLink; - return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - const commandOptions = options?.commandOptions; - return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - const iconVariant = options?.iconVariant; - return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + const exitCode = options?.exitCode; + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + const commandOptions = options?.commandOptions; + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); + return new DotnetToolResource(result, this._client); } -} - -/** - * Thenable wrapper for ExternalServiceResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ExternalServiceResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + const password = options?.password; + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + const iconVariant = options?.iconVariant; + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); - } - -} - -// ============================================================================ -// ParameterResource -// ============================================================================ - -export class ParameterResource extends ResourceBuilderBase { - constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { - super(handle, client); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new ParameterResource(result, this._client); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, description }; - if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDescription', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - const enableMarkdown = options?.enableMarkdown; - return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - const helpLink = options?.helpLink; - return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceReadyInternal(callback)); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new ParameterResource(result, this._client); - } +} - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); +/** + * Thenable wrapper for DotnetToolResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromManifestInternal()); + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._withExplicitStartInternal()); + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); } - /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - const commandOptions = options?.commandOptions; - return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - const iconVariant = options?.iconVariant; - return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromMcpInternal()); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new ParameterResource(result, this._client); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } -} - -/** - * Thenable wrapper for ParameterResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ParameterResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -9808,383 +10417,410 @@ export class ParameterResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ -// ProjectResource +// ExecutableResource // ============================================================================ -export class ProjectResource extends ResourceBuilderBase { - constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { const path = options?.path; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { + private async _withOtlpExporterInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterInternal()); + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { const helpLink = options?.helpLink; - return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); - } - - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); - } - - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -10194,15 +10830,15 @@ export class ProjectResource extends ResourceBuilderBase if (isProxied !== undefined) rpcArgs.isProxied = isProxied; if (isExternal !== undefined) rpcArgs.isExternal = isExternal; if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -10211,72 +10847,72 @@ export class ProjectResource extends ResourceBuilderBase const isProxied = options?.isProxied; const isExternal = options?.isExternal; const protocol = options?.protocol; - return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -10289,293 +10925,278 @@ export class ProjectResource extends ResourceBuilderBase } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); - } - - /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { const exitCode = options?.exitCode; - return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -10583,130 +11204,130 @@ export class ProjectResource extends ResourceBuilderBase }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { const commandOptions = options?.commandOptions; - return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { const password = options?.password; - return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { const iconVariant = options?.iconVariant; - return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -10715,15 +11336,15 @@ export class ProjectResource extends ResourceBuilderBase if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -10731,56 +11352,56 @@ export class ProjectResource extends ResourceBuilderBase const failureThreshold = options?.failureThreshold; const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -10791,60 +11412,60 @@ export class ProjectResource extends ResourceBuilderBase if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; if (tags !== undefined) rpcArgs.tags = tags; if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -10856,151 +11477,251 @@ export class ProjectResource extends ResourceBuilderBase ); } -} - + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceReadyInternal(callback)); + } + +} + /** - * Thenable wrapper for ProjectResource that enables fluent chaining. + * Thenable wrapper for ExecutableResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ProjectResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -11009,163 +11730,158 @@ export class ProjectResourcePromise implements PromiseLike { } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -11173,299 +11889,252 @@ export class ProjectResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } -} - -// ============================================================================ -// SqlServerDatabaseResource -// ============================================================================ + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } -export class SqlServerDatabaseResource extends ResourceBuilderBase { - constructor(handle: SqlServerDatabaseResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Gets the Parent property */ - parent = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.parent', - { context: this._handle } - ); - return new SqlServerServerResource(handle, this._client); - }, - }; + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } - /** Gets the ConnectionStringExpression property */ - connectionStringExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.connectionStringExpression', - { context: this._handle } - ); - }, - }; + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } - /** Gets the UriExpression property */ - uriExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.uriExpression', - { context: this._handle } - ); - }, - }; + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } - /** Gets the JdbcConnectionString property */ - jdbcConnectionString = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.jdbcConnectionString', - { context: this._handle } - ); - }, - }; +} - /** Gets the DatabaseName property */ - databaseName = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.databaseName', - { context: this._handle } - ); - }, - }; +// ============================================================================ +// ExternalServiceResource +// ============================================================================ - /** Gets the Name property */ - name = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.name', - { context: this._handle } - ); - }, - }; +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); + } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerDatabaseResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new SqlServerDatabaseResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); - } - - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new SqlServerDatabaseResource(result, this._client); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerDatabaseResourcePromise { - const helpLink = options?.helpLink; - return new SqlServerDatabaseResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); } /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): SqlServerDatabaseResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { const displayText = options?.displayText; - return new SqlServerDatabaseResourcePromise(this._withUrlInternal(url, displayText)); + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerDatabaseResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { const displayText = options?.displayText; - return new SqlServerDatabaseResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -11473,113 +12142,83 @@ export class SqlServerDatabaseResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerDatabaseResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { const commandOptions = options?.commandOptions; - return new SqlServerDatabaseResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): SqlServerDatabaseResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { const iconVariant = options?.iconVariant; - return new SqlServerDatabaseResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._excludeFromMcpInternal()); - } - - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new SqlServerDatabaseResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new SqlServerDatabaseResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -11590,60 +12229,60 @@ export class SqlServerDatabaseResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerDatabaseResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new SqlServerDatabaseResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -11656,150 +12295,200 @@ export class SqlServerDatabaseResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, script }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.SqlServer/withCreationScript', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Defines the SQL script used to create the database */ - withCreationScript(script: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withCreationScriptInternal(script)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceReadyInternal(callback)); } } /** - * Thenable wrapper for SqlServerDatabaseResource that enables fluent chaining. + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class SqlServerDatabaseResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: SqlServerDatabaseResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Prevents resource from starting automatically */ - withExplicitStart(): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Adds a health check by key */ - withHealthCheck(key: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -11807,810 +12496,8767 @@ export class SqlServerDatabaseResourcePromise implements PromiseLike obj.getResourceName()); } - /** Defines the SQL script used to create the database */ - withCreationScript(script: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withCreationScript(script))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } -} - -// ============================================================================ -// SqlServerServerResource -// ============================================================================ - -export class SqlServerServerResource extends ResourceBuilderBase { - constructor(handle: SqlServerServerResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Gets the PrimaryEndpoint property */ - primaryEndpoint = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.primaryEndpoint', - { context: this._handle } - ); - return new EndpointReference(handle, this._client); - }, - }; - - /** Gets the Host property */ - host = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.host', - { context: this._handle } - ); - return new EndpointReferenceExpression(handle, this._client); - }, - }; - - /** Gets the Port property */ - port = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.port', - { context: this._handle } - ); - return new EndpointReferenceExpression(handle, this._client); - }, - }; - - /** Gets the UserNameReference property */ - userNameReference = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.userNameReference', - { context: this._handle } - ); - }, - }; + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } - /** Gets the UriExpression property */ - uriExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.uriExpression', - { context: this._handle } - ); - }, - }; + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } - /** Gets the JdbcConnectionString property */ - jdbcConnectionString = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.jdbcConnectionString', - { context: this._handle } - ); - }, - }; +} - /** Gets the ConnectionStringExpression property */ - connectionStringExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.connectionStringExpression', - { context: this._handle } - ); - }, - }; +// ============================================================================ +// JavaScriptAppResource +// ============================================================================ - /** Gets the Databases property */ - private _databases?: AspireDict; - get databases(): AspireDict { - if (!this._databases) { - this._databases = new AspireDict( - this._handle, - this._client, - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.databases', - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.databases' - ); - } - return this._databases; +export class JavaScriptAppResource extends ResourceBuilderBase { + constructor(handle: JavaScriptAppResourceHandle, client: AspireClientRpc) { + super(handle, client); } - /** Gets the Entrypoint property */ - entrypoint = { + /** Gets the Command property */ + command = { get: async (): Promise => { return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.entrypoint', + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', { context: this._handle } ); }, - set: async (value: string): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.setEntrypoint', - { context: this._handle, value } - ); - } }; - /** Gets the ShellExecution property */ - shellExecution = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.shellExecution', + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', { context: this._handle } ); }, - set: async (value: boolean): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.setShellExecution', - { context: this._handle, value } - ); - } }; /** Gets the Name property */ name = { get: async (): Promise => { return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.name', + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', { context: this._handle } ); }, }; /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): SqlServerServerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new SqlServerServerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new JavaScriptAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new JavaScriptAppResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + const helpLink = options?.helpLink; + return new JavaScriptAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new JavaScriptAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new JavaScriptAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new JavaScriptAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new JavaScriptAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + const displayText = options?.displayText; + return new JavaScriptAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + const displayText = options?.displayText; + return new JavaScriptAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + const exitCode = options?.exitCode; + return new JavaScriptAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + const commandOptions = options?.commandOptions; + return new JavaScriptAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + const password = options?.password; + return new JavaScriptAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + const iconVariant = options?.iconVariant; + return new JavaScriptAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new JavaScriptAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withYarnInternal(install, installArgs)); + } + + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withPnpmInternal(install, installArgs)); + } + + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withRunScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + const browser = options?.browser; + return new JavaScriptAppResourcePromise(this._withBrowserDebuggerInternal(browser)); + } + +} + +/** + * Thenable wrapper for JavaScriptAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class JavaScriptAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: JavaScriptAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + +} + +// ============================================================================ +// NodeAppResource +// ============================================================================ + +export class NodeAppResource extends ResourceBuilderBase { + constructor(handle: NodeAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new NodeAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + const helpLink = options?.helpLink; + return new NodeAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new NodeAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new NodeAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + const exitCode = options?.exitCode; + return new NodeAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + const commandOptions = options?.commandOptions; + return new NodeAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + const password = options?.password; + return new NodeAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + const iconVariant = options?.iconVariant; + return new NodeAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new NodeAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withYarnInternal(install, installArgs)); + } + + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withPnpmInternal(install, installArgs)); + } + + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withRunScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + const browser = options?.browser; + return new NodeAppResourcePromise(this._withBrowserDebuggerInternal(browser)); + } + +} + +/** + * Thenable wrapper for NodeAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class NodeAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: NodeAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceReadyInternal(callback)); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + const configure = options?.configure; + return new ProjectResourcePromise(this._publishAsDockerFileInternal(configure)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceReadyInternal(callback)); + } + +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// SqlServerDatabaseResource +// ============================================================================ + +export class SqlServerDatabaseResource extends ResourceBuilderBase { + constructor(handle: SqlServerDatabaseResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Parent property */ + parent = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.parent', + { context: this._handle } + ); + return new SqlServerServerResource(handle, this._client); + }, + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the JdbcConnectionString property */ + jdbcConnectionString = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.jdbcConnectionString', + { context: this._handle } + ); + }, + }; + + /** Gets the DatabaseName property */ + databaseName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.databaseName', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerDatabaseResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new SqlServerDatabaseResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerDatabaseResourcePromise { + const helpLink = options?.helpLink; + return new SqlServerDatabaseResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): SqlServerDatabaseResourcePromise { + const displayText = options?.displayText; + return new SqlServerDatabaseResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerDatabaseResourcePromise { + const displayText = options?.displayText; + return new SqlServerDatabaseResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerDatabaseResourcePromise { + const commandOptions = options?.commandOptions; + return new SqlServerDatabaseResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): SqlServerDatabaseResourcePromise { + const iconVariant = options?.iconVariant; + return new SqlServerDatabaseResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerDatabaseResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new SqlServerDatabaseResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._onConnectionStringAvailableInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withCreationScriptInternal(script: string): Promise { + const rpcArgs: Record = { builder: this._handle, script }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withCreationScript', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Defines the SQL script used to create the database */ + withCreationScript(script: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withCreationScriptInternal(script)); + } + +} + +/** + * Thenable wrapper for SqlServerDatabaseResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class SqlServerDatabaseResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: SqlServerDatabaseResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Defines the SQL script used to create the database */ + withCreationScript(script: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withCreationScript(script))); + } + +} + +// ============================================================================ +// SqlServerServerResource +// ============================================================================ + +export class SqlServerServerResource extends ResourceBuilderBase { + constructor(handle: SqlServerServerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the PrimaryEndpoint property */ + primaryEndpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.primaryEndpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.host', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.port', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the PasswordParameter property */ + passwordParameter = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.passwordParameter', + { context: this._handle } + ); + return new ParameterResource(handle, this._client); + }, + }; + + /** Gets the UserNameReference property */ + userNameReference = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.userNameReference', + { context: this._handle } + ); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the JdbcConnectionString property */ + jdbcConnectionString = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.jdbcConnectionString', + { context: this._handle } + ); + }, + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the Databases property */ + private _databases?: AspireDict; + get databases(): AspireDict { + if (!this._databases) { + this._databases = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.databases', + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.databases' + ); + } + return this._databases; + } + + /** Gets the Entrypoint property */ + entrypoint = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.entrypoint', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.setEntrypoint', + { context: this._handle, value } + ); + } + }; + + /** Gets the ShellExecution property */ + shellExecution = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.shellExecution', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.setShellExecution', + { context: this._handle, value } + ); + } + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): SqlServerServerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new SqlServerServerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): SqlServerServerResourcePromise { + const tag = options?.tag; + return new SqlServerServerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): SqlServerServerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new SqlServerServerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerServerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new SqlServerServerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): SqlServerServerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new SqlServerServerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerServerResourcePromise { + const helpLink = options?.helpLink; + return new SqlServerServerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): SqlServerServerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new SqlServerServerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): SqlServerServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new SqlServerServerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): SqlServerServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new SqlServerServerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): SqlServerServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new SqlServerServerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): SqlServerServerResourcePromise { + const displayText = options?.displayText; + return new SqlServerServerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerServerResourcePromise { + const displayText = options?.displayText; + return new SqlServerServerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): SqlServerServerResourcePromise { + const exitCode = options?.exitCode; + return new SqlServerServerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): SqlServerServerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new SqlServerServerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerServerResourcePromise { + const commandOptions = options?.commandOptions; + return new SqlServerServerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): SqlServerServerResourcePromise { + const password = options?.password; + return new SqlServerServerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): SqlServerServerResourcePromise { + const iconVariant = options?.iconVariant; + return new SqlServerServerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): SqlServerServerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new SqlServerServerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerServerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new SqlServerServerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): SqlServerServerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new SqlServerServerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._onConnectionStringAvailableInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _addDatabaseInternal(name: string, databaseName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (databaseName !== undefined) rpcArgs.databaseName = databaseName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/addDatabase', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a SQL Server database resource */ + addDatabase(name: string, options?: AddDatabaseOptions): SqlServerDatabaseResourcePromise { + const databaseName = options?.databaseName; + return new SqlServerDatabaseResourcePromise(this._addDatabaseInternal(name, databaseName)); + } + + /** @internal */ + private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withDataVolume', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a named volume for the SQL Server data folder */ + withDataVolume(options?: WithDataVolumeOptions): SqlServerServerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new SqlServerServerResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + } + + /** @internal */ + private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withDataBindMount', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a bind mount for the SQL Server data folder */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): SqlServerServerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new SqlServerServerResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); + } + + /** @internal */ + private async _withPasswordInternal(password: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, password }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withPassword', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures the password for the SQL Server resource */ + withPassword(password: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withPasswordInternal(password)); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withHostPort', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the host port for the SQL Server resource */ + withHostPort(options?: WithHostPortOptions): SqlServerServerResourcePromise { + const port = options?.port; + return new SqlServerServerResourcePromise(this._withHostPortInternal(port)); + } + +} + +/** + * Thenable wrapper for SqlServerServerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class SqlServerServerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: SqlServerServerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Adds arguments */ + withArgs(args: string[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Sets the container image tag */ - withImageTag(tag: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withImageTagInternal(tag)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Sets the container image registry */ - withImageRegistry(registry: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withImageRegistryInternal(registry)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): SqlServerServerResourcePromise { - const tag = options?.tag; - return new SqlServerServerResourcePromise(this._withImageInternal(image, tag)); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } - /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withImageSHA256Internal(sha256)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } - /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withLifetimeInternal(lifetime)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Adds a SQL Server database resource */ + addDatabase(name: string, options?: AddDatabaseOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.addDatabase(name, options))); } - /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Adds a named volume for the SQL Server data folder */ + withDataVolume(options?: WithDataVolumeOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); } - /** Configures the resource to be published as a container */ - publishAsContainer(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._publishAsContainerInternal()); + /** Adds a bind mount for the SQL Server data folder */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); } - /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Configures the password for the SQL Server resource */ + withPassword(password: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPassword(password))); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): SqlServerServerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new SqlServerServerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Sets the host port for the SQL Server resource */ + withHostPort(options?: WithHostPortOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + +} + +// ============================================================================ +// ViteAppResource +// ============================================================================ + +export class ViteAppResource extends ResourceBuilderBase { + constructor(handle: ViteAppResourceHandle, client: AspireClientRpc) { + super(handle, client); } + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withContainerNameInternal(name)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withBuildArgInternal(name, value)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ViteAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withBuildSecretInternal(name, value)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerServerResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new SqlServerServerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): SqlServerServerResourcePromise { + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { const path = options?.path; const endpointName = options?.endpointName; - return new SqlServerServerResourcePromise(this._withMcpServerInternal(path, endpointName)); + return new ViteAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { + private async _withOtlpExporterInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures OTLP telemetry export */ - withOtlpExporter(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withOtlpExporterInternal()); + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); - } - - /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); - } - - /** Publishes the resource as a connection string */ - publishAsConnectionString(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._publishAsConnectionStringInternal()); + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerServerResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { const helpLink = options?.helpLink; - return new SqlServerServerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } - - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + return new ViteAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); - } - - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withConnectionPropertyInternal(name, value)); - } - - /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); - } - - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withConnectionPropertyValueInternal(name, value)); - } - - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): SqlServerServerResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new SqlServerServerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ViteAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -12620,15 +21266,15 @@ export class SqlServerServerResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): SqlServerServerResourcePromise { + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -12637,72 +21283,72 @@ export class SqlServerServerResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): SqlServerServerResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new SqlServerServerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): SqlServerServerResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new SqlServerServerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -12715,278 +21361,308 @@ export class SqlServerServerResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): SqlServerServerResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new SqlServerServerResourcePromise(this._withUrlInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerServerResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new SqlServerServerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): SqlServerServerResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { const exitCode = options?.exitCode; - return new SqlServerServerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ViteAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): SqlServerServerResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new SqlServerServerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new ViteAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -12994,130 +21670,130 @@ export class SqlServerServerResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerServerResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { const commandOptions = options?.commandOptions; - return new SqlServerServerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ViteAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): SqlServerServerResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { const password = options?.password; - return new SqlServerServerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new ViteAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): SqlServerServerResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { const iconVariant = options?.iconVariant; - return new SqlServerServerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ViteAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -13126,15 +21802,15 @@ export class SqlServerServerResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): SqlServerServerResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -13142,56 +21818,56 @@ export class SqlServerServerResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -13202,79 +21878,60 @@ export class SqlServerServerResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerServerResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new SqlServerServerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ViteAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withPipelineConfigurationInternal(callback)); - } - - /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): SqlServerServerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new SqlServerServerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -13287,330 +21944,394 @@ export class SqlServerServerResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name }; - if (databaseName !== undefined) rpcArgs.databaseName = databaseName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.SqlServer/addDatabase', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a SQL Server database resource */ - addDatabase(name: string, options?: AddDatabaseOptions): SqlServerDatabaseResourcePromise { - const databaseName = options?.databaseName; - return new SqlServerDatabaseResourcePromise(this._addDatabaseInternal(name, databaseName)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.SqlServer/withDataVolume', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a named volume for the SQL Server data folder */ - withDataVolume(options?: WithDataVolumeOptions): SqlServerServerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new SqlServerServerResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.SqlServer/withDataBindMount', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a bind mount for the SQL Server data folder */ - withDataBindMount(source: string, options?: WithDataBindMountOptions): SqlServerServerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new SqlServerServerResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withPasswordInternal(password: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, password }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.SqlServer/withPassword', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures the password for the SQL Server resource */ - withPassword(password: ParameterResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withPasswordInternal(password)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withHostPortInternal(port?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.SqlServer/withHostPort', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets the host port for the SQL Server resource */ - withHostPort(options?: WithHostPortOptions): SqlServerServerResourcePromise { - const port = options?.port; - return new SqlServerServerResourcePromise(this._withHostPortInternal(port)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceReadyInternal(callback)); } -} - -/** - * Thenable wrapper for SqlServerServerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class SqlServerServerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** @internal */ + private async _withViteConfigInternal(configPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, configPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withViteConfig', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } - then( - onfulfilled?: ((value: SqlServerServerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withViteConfigInternal(configPath)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withBunInternal(install, installArgs)); } - /** Sets the container image registry */ - withImageRegistry(registry: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withYarnInternal(install, installArgs)); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withPnpmInternal(install, installArgs)); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); } - /** Configures the resource to be published as a container */ - publishAsContainer(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } - /** Sets the container name */ - withContainerName(name: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + const browser = options?.browser; + return new ViteAppResourcePromise(this._withBrowserDebuggerInternal(browser)); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); +} + +/** + * Thenable wrapper for ViteAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ViteAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ViteAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); - } - - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); - } - - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -13619,163 +22340,168 @@ export class SqlServerServerResourcePromise implements PromiseLike obj.asHttp2Service())); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -13783,29 +22509,137 @@ export class SqlServerServerResourcePromise implements PromiseLike obj.getResourceName()); } - /** Adds a SQL Server database resource */ - addDatabase(name: string, options?: AddDatabaseOptions): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.addDatabase(name, options))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Adds a named volume for the SQL Server data folder */ - withDataVolume(options?: WithDataVolumeOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withViteConfig(configPath))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + +} + +// ============================================================================ +// ComputeResource +// ============================================================================ + +export class ComputeResource extends ResourceBuilderBase { + constructor(handle: IComputeResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Adds a bind mount for the SQL Server data folder */ - withDataBindMount(source: string, options?: WithDataBindMountOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); +} + +/** + * Thenable wrapper for ComputeResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ComputeResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ComputeResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Configures the password for the SQL Server resource */ - withPassword(password: ParameterResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPassword(password))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Sets the host port for the SQL Server resource */ - withHostPort(options?: WithHostPortOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } } @@ -13823,7 +22657,7 @@ export class ContainerFilesDestinationResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); return new ContainerFilesDestinationResource(result, this._client); @@ -14082,7 +22916,7 @@ export class Resource extends ResourceBuilderBase { private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new Resource(result, this._client); @@ -14097,7 +22931,7 @@ export class Resource extends ResourceBuilderBase { private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new Resource(result, this._client); @@ -14140,36 +22974,6 @@ export class Resource extends ResourceBuilderBase { return new ResourcePromise(this._excludeFromMcpInternal()); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -14247,6 +23051,86 @@ export class Resource extends ResourceBuilderBase { ); } + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -14344,16 +23228,6 @@ export class ResourcePromise implements PromiseLike { return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); @@ -14374,6 +23248,26 @@ export class ResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -14513,6 +23407,35 @@ export class ResourceWithConnectionString extends ResourceBuilderBase { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._onConnectionStringAvailableInternal(callback)); + } + } /** @@ -14540,6 +23463,16 @@ export class ResourceWithConnectionStringPromise implements PromiseLike obj.withConnectionPropertyValue(name, value))); } + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + } // ============================================================================ @@ -14828,6 +23761,26 @@ export class ResourceWithEndpoints extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + } /** @@ -14895,6 +23848,11 @@ export class ResourceWithEndpointsPromise implements PromiseLike obj.withHttpProbe(probeType, options))); } + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + } // ============================================================================ @@ -14937,41 +23895,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -14982,43 +23910,38 @@ export class ResourceWithEnvironment extends ResourceBuilderBase Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -15052,10 +23975,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -15067,37 +23991,8 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -15180,7 +24075,7 @@ export class ResourceWithEnvironment extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ResourceWithEnvironment(result, this._client); @@ -15234,31 +24129,21 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withOtlpExporterProtocol(protocol))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -15274,16 +24159,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -15321,34 +24196,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike { - constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { - super(handle, client); - } - -} - -/** - * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ResourceWithServiceDiscoveryPromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - -} - // ============================================================================ // ResourceWithWaitSupport // ============================================================================ @@ -15362,7 +24209,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -15392,7 +24239,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -15423,7 +24270,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -15542,7 +24389,7 @@ export async function createBuilder(options?: CreateBuilderOptions): Promise { const error = reason instanceof Error ? reason : new Error(String(reason)); - if (reason instanceof CapabilityError) { + if (reason instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else if (reason instanceof CapabilityError) { console.error(`\n❌ Capability Error: ${error.message}`); console.error(` Code: ${(reason as CapabilityError).code}`); if ((reason as CapabilityError).capability) { @@ -15573,8 +24422,12 @@ process.on('unhandledRejection', (reason: unknown) => { }); process.on('uncaughtException', (error: Error) => { - console.error(`\n❌ Uncaught Exception: ${error.message}`); - if (error.stack) { + if (error instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + } + if (!(error instanceof AppHostUsageError) && error.stack) { console.error(error.stack); } process.exit(1); @@ -15585,21 +24438,44 @@ process.on('uncaughtException', (error: Error) => { // ============================================================================ // Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent', (handle, client) => new AfterResourcesCreatedEvent(handle as AfterResourcesCreatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent', (handle, client) => new BeforeResourceStartedEvent(handle as BeforeResourceStartedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent', (handle, client) => new BeforeStartEvent(handle as BeforeStartEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent', (handle, client) => new ConnectionStringAvailableEvent(handle as ConnectionStringAvailableEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel', (handle, client) => new DistributedApplicationModel(handle as DistributedApplicationModelHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent', (handle, client) => new InitializeResourceEvent(handle as InitializeResourceEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext', (handle, client) => new PipelineContext(handle as PipelineContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext', (handle, client) => new PipelineStepFactoryContext(handle as PipelineStepFactoryContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary', (handle, client) => new PipelineSummary(handle as PipelineSummaryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent', (handle, client) => new ResourceEndpointsAllocatedEvent(handle as ResourceEndpointsAllocatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService', (handle, client) => new ResourceLoggerService(handle as ResourceLoggerServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService', (handle, client) => new ResourceNotificationService(handle as ResourceNotificationServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent', (handle, client) => new ResourceReadyEvent(handle as ResourceReadyEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent', (handle, client) => new ResourceStoppedEvent(handle as ResourceStoppedEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext', (handle, client) => new UpdateCommandStateContext(handle as UpdateCommandStateContextHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration', (handle, client) => new Configuration(handle as IConfigurationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment', (handle, client) => new HostEnvironment(handle as IHostEnvironmentHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger', (handle, client) => new Logger(handle as ILoggerHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory', (handle, client) => new LoggerFactory(handle as ILoggerFactoryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep', (handle, client) => new ReportingStep(handle as IReportingStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask', (handle, client) => new ReportingTask(handle as IReportingTaskHandle, client)); +registerHandleWrapper('System.ComponentModel/System.IServiceProvider', (handle, client) => new ServiceProvider(handle as IServiceProviderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IUserSecretsManager', (handle, client) => new UserSecretsManager(handle as IUserSecretsManagerHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); @@ -15607,10 +24483,14 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppR registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource', (handle, client) => new JavaScriptAppResource(handle as JavaScriptAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource', (handle, client) => new NodeAppResource(handle as NodeAppResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.SqlServer/Aspire.Hosting.ApplicationModel.SqlServerDatabaseResource', (handle, client) => new SqlServerDatabaseResource(handle as SqlServerDatabaseResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.SqlServer/Aspire.Hosting.ApplicationModel.SqlServerServerResource', (handle, client) => new SqlServerServerResource(handle as SqlServerServerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource', (handle, client) => new ViteAppResource(handle as ViteAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource', (handle, client) => new ComputeResource(handle as IComputeResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); @@ -15618,6 +24498,5 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceW registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); diff --git a/samples/database-migrations/ts/.modules/base.ts b/samples/database-migrations/ts/.modules/base.ts index 7778b0f1..b3d8b8be 100644 --- a/samples/database-migrations/ts/.modules/base.ts +++ b/samples/database-migrations/ts/.modules/base.ts @@ -1,8 +1,8 @@ -// aspire.ts - Core Aspire types: base classes, ReferenceExpression -import { Handle, AspireClient, MarshalledHandle } from './transport.js'; +// base.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle, CancellationToken, registerCancellation, registerHandleWrapper, unregisterCancellation } from './transport.js'; // Re-export transport types for convenience -export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export { Handle, AspireClient, CapabilityError, CancellationToken, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; @@ -43,22 +43,46 @@ export class ReferenceExpression { private readonly _format?: string; private readonly _valueProviders?: unknown[]; + // Conditional mode fields + private readonly _condition?: unknown; + private readonly _whenTrue?: ReferenceExpression; + private readonly _whenFalse?: ReferenceExpression; + private readonly _matchValue?: string; + // Handle mode fields (when wrapping a server-returned handle) private readonly _handle?: Handle; private readonly _client?: AspireClient; constructor(format: string, valueProviders: unknown[]); constructor(handle: Handle, client: AspireClient); - constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { - if (typeof handleOrFormat === 'string') { - this._format = handleOrFormat; - this._valueProviders = clientOrValueProviders as unknown[]; + constructor(condition: unknown, matchValue: string, whenTrue: ReferenceExpression, whenFalse: ReferenceExpression); + constructor( + handleOrFormatOrCondition: Handle | string | unknown, + clientOrValueProvidersOrMatchValue: AspireClient | unknown[] | string, + whenTrueOrWhenFalse?: ReferenceExpression, + whenFalse?: ReferenceExpression + ) { + if (typeof handleOrFormatOrCondition === 'string') { + this._format = handleOrFormatOrCondition; + this._valueProviders = clientOrValueProvidersOrMatchValue as unknown[]; + } else if (handleOrFormatOrCondition instanceof Handle) { + this._handle = handleOrFormatOrCondition; + this._client = clientOrValueProvidersOrMatchValue as AspireClient; } else { - this._handle = handleOrFormat; - this._client = clientOrValueProviders as AspireClient; + this._condition = handleOrFormatOrCondition; + this._matchValue = (clientOrValueProvidersOrMatchValue as string) ?? 'True'; + this._whenTrue = whenTrueOrWhenFalse; + this._whenFalse = whenFalse; } } + /** + * Gets whether this reference expression is conditional. + */ + get isConditional(): boolean { + return this._condition !== undefined; + } + /** * Creates a reference expression from a tagged template literal. * @@ -82,16 +106,46 @@ export class ReferenceExpression { return new ReferenceExpression(format, valueProviders); } + /** + * Creates a conditional reference expression from its constituent parts. + * + * @param condition - A value provider whose result is compared to matchValue + * @param whenTrue - The expression to use when the condition matches + * @param whenFalse - The expression to use when the condition does not match + * @param matchValue - The value to compare the condition against (defaults to "True") + * @returns A ReferenceExpression instance in conditional mode + */ + static createConditional( + condition: unknown, + matchValue: string, + whenTrue: ReferenceExpression, + whenFalse: ReferenceExpression + ): ReferenceExpression { + return new ReferenceExpression(condition, matchValue, whenTrue, whenFalse); + } + /** * Serializes the reference expression for JSON-RPC transport. - * In template-literal mode, uses the $expr format. + * In expression mode, uses the $expr format with format + valueProviders. + * In conditional mode, uses the $expr format with condition + whenTrue + whenFalse. * In handle mode, delegates to the handle's serialization. */ - toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } | { condition: unknown; whenTrue: unknown; whenFalse: unknown; matchValue: string } } | MarshalledHandle { if (this._handle) { return this._handle.toJSON(); } + if (this.isConditional) { + return { + $expr: { + condition: extractHandleForExpr(this._condition), + whenTrue: this._whenTrue!.toJSON(), + whenFalse: this._whenFalse!.toJSON(), + matchValue: this._matchValue! + } + }; + } + return { $expr: { format: this._format!, @@ -100,6 +154,30 @@ export class ReferenceExpression { }; } + /** + * Resolves the expression to its string value on the server. + * Only available on server-returned ReferenceExpression instances (handle mode). + * + * @param cancellationToken - Optional AbortSignal or CancellationToken for cancellation support + * @returns The resolved string value, or null if the expression resolves to null + */ + async getValue(cancellationToken?: AbortSignal | CancellationToken): Promise { + if (!this._handle || !this._client) { + throw new Error('getValue is only available on server-returned ReferenceExpression instances'); + } + const cancellationTokenId = registerCancellation(this._client, cancellationToken); + try { + const rpcArgs: Record = { context: this._handle }; + if (cancellationTokenId !== undefined) rpcArgs.cancellationToken = cancellationTokenId; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValue', + rpcArgs + ); + } finally { + unregisterCancellation(cancellationTokenId); + } + } + /** * String representation for debugging. */ @@ -107,10 +185,17 @@ export class ReferenceExpression { if (this._handle) { return `ReferenceExpression(handle)`; } + if (this.isConditional) { + return `ReferenceExpression(conditional)`; + } return `ReferenceExpression(${this._format})`; } } +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression', (handle, client) => + new ReferenceExpression(handle, client) +); + /** * Extracts a value for use in reference expressions. * Supports handles (objects) and string literals. @@ -136,15 +221,15 @@ function extractHandleForExpr(value: unknown): unknown { return value.toJSON(); } - // Objects with $handle property (already in handle format) - if (typeof value === 'object' && value !== null && '$handle' in value) { + // Objects with marshalled expression/handle payloads + if (typeof value === 'object' && value !== null && ('$handle' in value || '$expr' in value)) { return value; } - // Objects with toJSON that returns a handle + // Objects with toJSON that returns a marshalled expression or handle if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { const json = value.toJSON(); - if (json && typeof json === 'object' && '$handle' in json) { + if (json && typeof json === 'object' && ('$handle' in json || '$expr' in json)) { return json; } } @@ -307,11 +392,20 @@ export class AspireList { }) as T[]; } - toJSON(): MarshalledHandle { - if (this._resolvedHandle) { - return this._resolvedHandle.toJSON(); + async toTransportValue(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireList must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); } - return this._handleOrContext.toJSON(); + + return this._resolvedHandle.toJSON(); } } @@ -466,8 +560,19 @@ export class AspireDict { }) as Record; } - async toJSON(): Promise { + async toTransportValue(): Promise { const handle = await this._ensureHandle(); return handle.toJSON(); } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireDict must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); + } + + return this._resolvedHandle.toJSON(); + } } diff --git a/samples/database-migrations/ts/.modules/transport.ts b/samples/database-migrations/ts/.modules/transport.ts index 7bddd74b..6d29cf28 100644 --- a/samples/database-migrations/ts/.modules/transport.ts +++ b/samples/database-migrations/ts/.modules/transport.ts @@ -77,7 +77,8 @@ export function isAtsError(value: unknown): value is { $error: AtsError } { value !== null && typeof value === 'object' && '$error' in value && - typeof (value as { $error: unknown }).$error === 'object' + typeof (value as { $error: unknown }).$error === 'object' && + (value as { $error: unknown }).$error !== null ); } @@ -93,6 +94,47 @@ export function isMarshalledHandle(value: unknown): value is MarshalledHandle { ); } +function isAbortSignal(value: unknown): value is AbortSignal { + return ( + value !== null && + typeof value === 'object' && + 'aborted' in value && + 'addEventListener' in value && + 'removeEventListener' in value + ); +} + +function isPlainObject(value: unknown): value is Record { + if (value === null || typeof value !== 'object') { + return false; + } + + const prototype = Object.getPrototypeOf(value); + return prototype === Object.prototype || prototype === null; +} + +function hasTransportValue(value: unknown): value is { toTransportValue(): unknown | Promise } { + return ( + value !== null && + typeof value === 'object' && + 'toTransportValue' in value && + typeof (value as { toTransportValue?: unknown }).toTransportValue === 'function' + ); +} + +function createAbortError(message: string): Error { + const error = new Error(message); + error.name = 'AbortError'; + return error; +} + +function createCircularReferenceError(capabilityId: string, path: string): AppHostUsageError { + return new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' contains a circular reference. ` + + 'Circular references are not supported by the AppHost transport.' + ); +} + // ============================================================================ // Handle // ============================================================================ @@ -136,6 +178,92 @@ export class Handle { } } +// ============================================================================ +// CancellationToken +// ============================================================================ + +/** + * Represents a transport-safe cancellation token value for the generated SDK. + * + * Use a plain {@link AbortSignal} when you create cancellation in user code. + * Generated APIs accept either an {@link AbortSignal} or a {@link CancellationToken}. + * + * Values returned from generated callbacks and context/property getters are + * {@link CancellationToken} instances because they may reference remote + * cancellation token handles received from the AppHost. + * + * @example + * ```typescript + * const controller = new AbortController(); + * await connectionStringExpression.getValue(controller.signal); + * ``` + * + * @example + * ```typescript + * const cancellationToken = await context.cancellationToken.get(); + * const connectionStringExpression = await db.uriExpression.get(); + * const connectionString = await connectionStringExpression.getValue(cancellationToken); + * ``` + */ +export class CancellationToken { + private readonly _signal?: AbortSignal; + private readonly _remoteTokenId?: string; + + constructor(signal?: AbortSignal); + constructor(tokenId?: string); + constructor(value?: AbortSignal | string | null) { + if (typeof value === 'string') { + this._remoteTokenId = value; + } else if (isAbortSignal(value)) { + this._signal = value; + } + } + + /** + * Creates a cancellation token from a local {@link AbortSignal}. + */ + static from(signal?: AbortSignal): CancellationToken { + return new CancellationToken(signal); + } + + /** + * Creates a cancellation token from a transport value. + * Generated code uses this to materialize values that come from the AppHost. + */ + static fromValue(value: unknown): CancellationToken { + if (value instanceof CancellationToken) { + return value; + } + + if (typeof value === 'string') { + return new CancellationToken(value); + } + + if (isAbortSignal(value)) { + return new CancellationToken(value); + } + + return new CancellationToken(); + } + + /** + * Serializes the token for JSON-RPC transport. + */ + toJSON(): string | undefined { + return this._remoteTokenId; + } + + register(client?: AspireClient): string | undefined { + if (this._remoteTokenId !== undefined) { + return this._remoteTokenId; + } + + return client + ? registerCancellation(client, this._signal) + : registerCancellation(this._signal); + } +} + // ============================================================================ // Handle Wrapper Registry // ============================================================================ @@ -167,22 +295,35 @@ export function registerHandleWrapper(typeId: string, factory: HandleWrapperFact * @param client - Optional client for creating typed wrapper instances */ export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { - if (value && typeof value === 'object') { - if (isMarshalledHandle(value)) { - const handle = new Handle(value); - const typeId = value.$type; - - // Try to find a registered wrapper factory for this type - if (typeId && client) { - const factory = handleWrapperRegistry.get(typeId); - if (factory) { - return factory(handle, client); - } + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); } + } + + return handle; + } - return handle; + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + value[i] = wrapIfHandle(value[i], client); + } + + return value; + } + + if (isPlainObject(value)) { + for (const [key, nestedValue] of Object.entries(value)) { + value[key] = wrapIfHandle(nestedValue, client); } } + return value; } @@ -213,6 +354,76 @@ export class CapabilityError extends Error { } } +/** + * Error thrown when the AppHost script uses the generated SDK incorrectly. + */ +export class AppHostUsageError extends Error { + constructor(message: string) { + super(message); + this.name = 'AppHostUsageError'; + } +} + +function isPromiseLike(value: unknown): value is PromiseLike { + return ( + value !== null && + (typeof value === 'object' || typeof value === 'function') && + 'then' in value && + typeof (value as { then?: unknown }).then === 'function' + ); +} + +function validateCapabilityArgs( + capabilityId: string, + args?: Record +): void { + if (!args) { + return; + } + + const validateValue = (value: unknown, path: string, ancestors: Set): void => { + if (value === null || value === undefined) { + return; + } + + if (isPromiseLike(value)) { + throw new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' is a Promise-like value. ` + + `This usually means an async builder call was not awaited. ` + + `Did you forget 'await' on a call like builder.addPostgres(...) or resource.addDatabase(...)?` + ); + } + + if (typeof value !== 'object') { + return; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + ancestors.add(value); + try { + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + validateValue(value[i], `${path}[${i}]`, ancestors); + } + return; + } + + for (const [key, nestedValue] of Object.entries(value)) { + validateValue(nestedValue, `${path}.${key}`, ancestors); + } + } finally { + ancestors.delete(value); + } + }; + + for (const [key, value] of Object.entries(args)) { + validateValue(value, key, new Set()); + } +} + // ============================================================================ // Callback Registry // ============================================================================ @@ -324,21 +535,50 @@ export function getCallbackCount(): number { */ const cancellationRegistry = new Map void>(); let cancellationIdCounter = 0; +const connectedClients = new Set(); -/** - * A reference to the current AspireClient for sending cancel requests. - * Set by AspireClient.connect(). - */ -let currentClient: AspireClient | null = null; +function resolveCancellationClient(client?: AspireClient): AspireClient { + if (client) { + return client; + } + + if (connectedClients.size === 1) { + return connectedClients.values().next().value as AspireClient; + } + + if (connectedClients.size === 0) { + throw new Error( + 'registerCancellation(signal) requires a connected AspireClient. ' + + 'Pass the client explicitly or connect the client first.' + ); + } + + throw new Error( + 'registerCancellation(signal) is ambiguous when multiple AspireClient instances are connected. ' + + 'Pass the client explicitly.' + ); +} /** - * Register an AbortSignal for cancellation support. - * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * Registers cancellation support for a local signal or SDK cancellation token. + * Returns a cancellation ID that should be passed to methods accepting cancellation input. * * When the AbortSignal is aborted, sends a cancelToken request to the host. * - * @param signal - The AbortSignal to register (optional) - * @returns The cancellation ID, or undefined if no signal provided + * @param client - The AspireClient that should route the cancellation request + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + */ +export function registerCancellation(client: AspireClient, signalOrToken?: AbortSignal | CancellationToken): string | undefined; +/** + * Registers cancellation support using the single connected AspireClient. + * + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + * + * @example + * const controller = new AbortController(); + * await expression.getValue(controller.signal); * * @example * const controller = new AbortController(); @@ -346,14 +586,29 @@ let currentClient: AspireClient | null = null; * // Pass id to capability invocation * // Later: controller.abort() will cancel the operation */ -export function registerCancellation(signal?: AbortSignal): string | undefined { - if (!signal) { +export function registerCancellation(signalOrToken?: AbortSignal | CancellationToken): string | undefined; +export function registerCancellation( + clientOrSignalOrToken?: AspireClient | AbortSignal | CancellationToken, + maybeSignalOrToken?: AbortSignal | CancellationToken +): string | undefined { + const client = clientOrSignalOrToken instanceof AspireClient ? clientOrSignalOrToken : undefined; + const signalOrToken = client + ? maybeSignalOrToken + : clientOrSignalOrToken as AbortSignal | CancellationToken | undefined; + + if (!signalOrToken) { return undefined; } - // Already aborted? Don't register + if (signalOrToken instanceof CancellationToken) { + return signalOrToken.register(client); + } + + const signal = signalOrToken; + const cancellationClient = resolveCancellationClient(client); + if (signal.aborted) { - return undefined; + throw createAbortError('The operation was aborted before it was sent to the AppHost.'); } const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; @@ -361,8 +616,8 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { // Set up the abort listener const onAbort = () => { // Send cancel request to host - if (currentClient?.connected) { - currentClient.cancelToken(cancellationId).catch(() => { + if (cancellationClient.connected) { + cancellationClient.cancelToken(cancellationId).catch(() => { // Ignore errors - the operation may have already completed }); } @@ -381,6 +636,56 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { return cancellationId; } +async function marshalTransportValue( + value: unknown, + client: AspireClient, + cancellationIds: string[], + capabilityId: string, + path: string = 'args', + ancestors: Set = new Set() +): Promise { + if (value === null || value === undefined || typeof value !== 'object') { + return value; + } + + if (value instanceof CancellationToken) { + const cancellationId = value.register(client); + if (cancellationId !== undefined) { + cancellationIds.push(cancellationId); + } + + return cancellationId; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + const nextAncestors = new Set(ancestors); + nextAncestors.add(value); + + if (hasTransportValue(value)) { + return await marshalTransportValue(await value.toTransportValue(), client, cancellationIds, capabilityId, path, nextAncestors); + } + + if (Array.isArray(value)) { + return await Promise.all( + value.map((item, index) => marshalTransportValue(item, client, cancellationIds, capabilityId, `${path}[${index}]`, nextAncestors)) + ); + } + + if (isPlainObject(value)) { + const entries = await Promise.all( + Object.entries(value).map(async ([key, nestedValue]) => + [key, await marshalTransportValue(nestedValue, client, cancellationIds, capabilityId, `${path}.${key}`, nextAncestors)] as const) + ); + + return Object.fromEntries(entries); + } + + return value; +} + /** * Unregister a cancellation token by its ID. * Call this when the operation completes to clean up resources. @@ -411,6 +716,8 @@ export class AspireClient { private socket: net.Socket | null = null; private disconnectCallbacks: (() => void)[] = []; private _pendingCalls = 0; + private _connectPromise: Promise | null = null; + private _disconnectNotified = false; constructor(private socketPath: string) { } @@ -422,6 +729,12 @@ export class AspireClient { } private notifyDisconnect(): void { + if (this._disconnectNotified) { + return; + } + + this._disconnectNotified = true; + for (const callback of this.disconnectCallbacks) { try { callback(); @@ -432,30 +745,106 @@ export class AspireClient { } connect(timeoutMs: number = 5000): Promise { - return new Promise((resolve, reject) => { - const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + if (this.connected) { + return Promise.resolve(); + } + + if (this._connectPromise) { + return this._connectPromise; + } + + this._disconnectNotified = false; + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this._connectPromise = new Promise((resolve, reject) => { + const socket = net.createConnection(pipePath); + this.socket = socket; - // On Windows, use named pipes; on Unix, use Unix domain sockets - const isWindows = process.platform === 'win32'; - const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + let settled = false; - this.socket = net.createConnection(pipePath); + const cleanupPendingListeners = () => { + socket.removeListener('connect', onConnect); + socket.removeListener('error', onPendingError); + socket.removeListener('close', onPendingClose); + }; - this.socket.once('error', (error: Error) => { + const failConnect = (error: Error) => { + if (settled) { + return; + } + + settled = true; clearTimeout(timeout); + cleanupPendingListeners(); + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + if (!socket.destroyed) { + socket.destroy(); + } + reject(error); - }); + }; + + const onConnectedSocketError = (error: Error) => { + console.error('Socket error:', error); + }; + + const onConnectedSocketClose = () => { + socket.removeListener('error', onConnectedSocketError); + + if (this.socket && this.socket !== socket) { + return; + } + + const connection = this.connection; + this.connection = null; + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + this.notifyDisconnect(); + }; + + const onPendingError = (error: Error) => { + failConnect(error); + }; + + const onPendingClose = () => { + failConnect(new Error('Connection closed before JSON-RPC was established')); + }; + + const onConnect = async () => { + if (settled) { + return; + } - this.socket.once('connect', () => { clearTimeout(timeout); + cleanupPendingListeners(); + try { - const reader = new rpc.SocketMessageReader(this.socket!); - const writer = new rpc.SocketMessageWriter(this.socket!); + const reader = new rpc.SocketMessageReader(socket); + const writer = new rpc.SocketMessageWriter(socket); this.connection = rpc.createMessageConnection(reader, writer); this.connection.onClose(() => { this.connection = null; - this.notifyDisconnect(); }); this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); @@ -475,26 +864,39 @@ export class AspireClient { } }); + socket.on('error', onConnectedSocketError); + socket.on('close', onConnectedSocketClose); + + const authToken = process.env.ASPIRE_REMOTE_APPHOST_TOKEN; + if (!authToken) { + throw new Error('ASPIRE_REMOTE_APPHOST_TOKEN environment variable is not set.'); + } this.connection.listen(); + const authenticated = await this.connection.sendRequest('authenticate', authToken); + if (!authenticated) { + throw new Error('Failed to authenticate to the AppHost server.'); + } - // Set the current client for cancellation registry - currentClient = this; + connectedClients.add(this); + this._connectPromise = null; + settled = true; resolve(); - } catch (e) { - reject(e); + } catch (error) { + failConnect(error instanceof Error ? error : new Error(String(error))); } - }); + }; - this.socket.on('close', () => { - this.connection?.dispose(); - this.connection = null; - if (currentClient === this) { - currentClient = null; - } - this.notifyDisconnect(); - }); + const timeout = setTimeout(() => { + failConnect(new Error('Connection timeout')); + }, timeoutMs); + + socket.once('error', onPendingError); + socket.once('close', onPendingClose); + socket.once('connect', onConnect); }); + + return this._connectPromise; } ping(): Promise { @@ -533,39 +935,66 @@ export class AspireClient { throw new Error('Not connected to AppHost'); } - // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. - // We ref() during RPC calls so the process doesn't exit mid-call, and - // unref() when idle so the process can exit naturally after all work completes. - if (this._pendingCalls === 0) { - this.socket?.ref(); - } - this._pendingCalls++; + validateCapabilityArgs(capabilityId, args); + const cancellationIds: string[] = []; try { - const result = await this.connection.sendRequest( - 'invokeCapability', - capabilityId, - args ?? null - ); + const rpcArgs = await marshalTransportValue(args ?? null, this, cancellationIds, capabilityId); - // Check for structured error response - if (isAtsError(result)) { - throw new CapabilityError(result.$error); + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); } + this._pendingCalls++; - // Wrap handles automatically - return wrapIfHandle(result, this) as T; + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + rpcArgs + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } } finally { - this._pendingCalls--; - if (this._pendingCalls === 0) { - this.socket?.unref(); + for (const cancellationId of cancellationIds) { + unregisterCancellation(cancellationId); } } } disconnect(): void { - try { this.connection?.dispose(); } finally { this.connection = null; } - try { this.socket?.end(); } finally { this.socket = null; } + const connection = this.connection; + const socket = this.socket; + + this.connection = null; + this.socket = null; + this._connectPromise = null; + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + if (socket && !socket.destroyed) { + socket.end(); + socket.destroy(); + } } get connected(): boolean { diff --git a/samples/database-migrations/ts/apphost.run.json b/samples/database-migrations/ts/aspire.config.json similarity index 61% rename from samples/database-migrations/ts/apphost.run.json rename to samples/database-migrations/ts/aspire.config.json index fdb86060..8c120b7a 100644 --- a/samples/database-migrations/ts/apphost.run.json +++ b/samples/database-migrations/ts/aspire.config.json @@ -1,4 +1,12 @@ { + "appHost": { + "path": "apphost.ts", + "language": "typescript/nodejs" + }, + "packages": { + "Aspire.Hosting.JavaScript": "13.2.0", + "Aspire.Hosting.SqlServer": "13.2.0" + }, "profiles": { "https": { "applicationUrl": "https://localhost:17120;http://localhost:39492", @@ -8,4 +16,4 @@ } } } -} \ No newline at end of file +} diff --git a/samples/health-checks-ui/ts/.aspire/settings.json b/samples/health-checks-ui/ts/.aspire/settings.json deleted file mode 100644 index 0785bef5..00000000 --- a/samples/health-checks-ui/ts/.aspire/settings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "appHostPath": "../apphost.ts", - "language": "typescript/nodejs", - "channel": "staging", - "sdkVersion": "13.2.0-preview.1.26159.1", - "packages": { - "Aspire.Hosting.Redis": "13.2.0-preview.1.26159.1", - "Aspire.Hosting.Docker": "13.2.0-preview.1.26159.1" - } -} \ No newline at end of file diff --git a/samples/health-checks-ui/ts/.modules/.codegen-hash b/samples/health-checks-ui/ts/.modules/.codegen-hash index b983a78d..7b30f2a4 100644 --- a/samples/health-checks-ui/ts/.modules/.codegen-hash +++ b/samples/health-checks-ui/ts/.modules/.codegen-hash @@ -1 +1 @@ -515A3230DD89FC07B770D55FBBBFBC9A78A2CD226301458C2AE764DB5B64389A \ No newline at end of file +9FF6A18FA538DEA277213AC8EE899874E456FF302E050183695D3FD03C5BB871 \ No newline at end of file diff --git a/samples/health-checks-ui/ts/.modules/aspire.ts b/samples/health-checks-ui/ts/.modules/aspire.ts index a5902685..da1a7d57 100644 --- a/samples/health-checks-ui/ts/.modules/aspire.ts +++ b/samples/health-checks-ui/ts/.modules/aspire.ts @@ -8,6 +8,8 @@ import { AspireClient as AspireClientRpc, Handle, MarshalledHandle, + AppHostUsageError, + CancellationToken, CapabilityError, registerCallback, wrapIfHandle, @@ -38,6 +40,15 @@ type DockerComposeServiceResourceHandle = Handle<'Aspire.Hosting.Docker/Aspire.H /** Handle to Service */ type ServiceHandle = Handle<'Aspire.Hosting.Docker/Aspire.Hosting.Docker.Resources.ComposeNodes.Service'>; +/** Handle to JavaScriptAppResource */ +type JavaScriptAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource'>; + +/** Handle to NodeAppResource */ +type NodeAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource'>; + +/** Handle to ViteAppResource */ +type ViteAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource'>; + /** Handle to RedisResource */ type RedisResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting.ApplicationModel.RedisResource'>; @@ -47,9 +58,21 @@ type RedisCommanderResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting. /** Handle to RedisInsightResource */ type RedisInsightResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisInsightResource'>; +/** Handle to AfterResourcesCreatedEvent */ +type AfterResourcesCreatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent'>; + +/** Handle to BeforeResourceStartedEvent */ +type BeforeResourceStartedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent'>; + +/** Handle to BeforeStartEvent */ +type BeforeStartEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent'>; + /** Handle to CommandLineArgsCallbackContext */ type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; +/** Handle to ConnectionStringAvailableEvent */ +type ConnectionStringAvailableEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent'>; + /** Handle to ContainerRegistryResource */ type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; @@ -59,6 +82,9 @@ type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Application /** Handle to CSharpAppResource */ type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; +/** Handle to DistributedApplicationModel */ +type DistributedApplicationModelHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel'>; + /** Handle to DotnetToolResource */ type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; @@ -83,6 +109,9 @@ type IComputeResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationM /** Handle to IContainerFilesDestinationResource */ type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; +/** Handle to InitializeResourceEvent */ +type InitializeResourceEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent'>; + /** Handle to IResource */ type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; @@ -113,15 +142,27 @@ type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicati /** Handle to ReferenceExpressionBuilder */ type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; +/** Handle to ResourceEndpointsAllocatedEvent */ +type ResourceEndpointsAllocatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent'>; + /** Handle to ResourceLoggerService */ type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; /** Handle to ResourceNotificationService */ type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; +/** Handle to ResourceReadyEvent */ +type ResourceReadyEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent'>; + +/** Handle to ResourceStoppedEvent */ +type ResourceStoppedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent'>; + /** Handle to ResourceUrlsCallbackContext */ type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; +/** Handle to UpdateCommandStateContext */ +type UpdateCommandStateContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext'>; + /** Handle to ConnectionStringResource */ type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; @@ -146,18 +187,33 @@ type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hostin /** Handle to IResourceWithContainerFiles */ type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; -/** Handle to IResourceWithServiceDiscovery */ -type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; +/** Handle to IUserSecretsManager */ +type IUserSecretsManagerHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IUserSecretsManager'>; + +/** Handle to IReportingStep */ +type IReportingStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep'>; + +/** Handle to IReportingTask */ +type IReportingTaskHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask'>; /** Handle to PipelineConfigurationContext */ type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; +/** Handle to PipelineContext */ +type PipelineContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext'>; + /** Handle to PipelineStep */ type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; /** Handle to PipelineStepContext */ type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; +/** Handle to PipelineStepFactoryContext */ +type PipelineStepFactoryContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext'>; + +/** Handle to PipelineSummary */ +type PipelineSummaryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary'>; + /** Handle to ProjectResourceOptions */ type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; @@ -170,12 +226,18 @@ type ListanyHandle = Handle<'Aspire.Hosting/List'>; /** Handle to IConfiguration */ type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; +/** Handle to IConfigurationSection */ +type IConfigurationSectionHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfigurationSection'>; + /** Handle to IHostEnvironment */ type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; /** Handle to ILogger */ type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; +/** Handle to ILoggerFactory */ +type ILoggerFactoryHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory'>; + /** Handle to string[] */ type stringArrayHandle = Handle<'string[]'>; @@ -215,6 +277,7 @@ export enum EndpointProperty { Scheme = "Scheme", TargetPort = "TargetPort", HostAndPort = "HostAndPort", + TlsEnabled = "TlsEnabled", } /** Enum type for IconVariant */ @@ -346,6 +409,10 @@ export interface AddConnectionStringOptions { environmentVariableName?: string; } +export interface AddContainerRegistryFromStringOptions { + repository?: string; +} + export interface AddContainerRegistryOptions { repository?: ParameterResource; } @@ -355,6 +422,10 @@ export interface AddDockerfileOptions { stage?: string; } +export interface AddJavaScriptAppOptions { + runScriptName?: string; +} + export interface AddParameterFromConfigurationOptions { secret?: boolean; } @@ -363,6 +434,11 @@ export interface AddParameterOptions { secret?: boolean; } +export interface AddParameterWithValueOptions { + publishValueAsDefault?: boolean; + secret?: boolean; +} + export interface AddRedisOptions { port?: number; password?: ParameterResource; @@ -372,6 +448,10 @@ export interface AddRedisWithPortOptions { port?: number; } +export interface AddViteAppOptions { + runScriptName?: string; +} + export interface AppendFormattedOptions { format?: string; } @@ -380,22 +460,89 @@ export interface AppendValueProviderOptions { format?: string; } +export interface CompleteStepMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteStepOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskOptions { + completionMessage?: string; + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateMarkdownTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + export interface GetValueAsyncOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface PublishAsDockerFileOptions { + configure?: (obj: ContainerResource) => Promise; +} + +export interface PublishResourceUpdateOptions { + state?: string; + stateStyle?: string; } export interface RunOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface SaveStateJsonOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskMarkdownOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; } export interface WaitForCompletionOptions { exitCode?: number; } +export interface WaitForResourceStateOptions { + targetState?: string; +} + export interface WithBindMountOptions { isReadOnly?: boolean; } +export interface WithBrowserDebuggerOptions { + browser?: string; +} + +export interface WithBuildScriptOptions { + args?: string[]; +} + +export interface WithBunOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithCommandOptions { commandOptions?: CommandOptions; } @@ -500,6 +647,12 @@ export interface WithMcpServerOptions { endpointName?: string; } +export interface WithNpmOptions { + install?: boolean; + installCommand?: string; + installArgs?: string[]; +} + export interface WithPersistenceOptions { interval?: number; keysChangedThreshold?: number; @@ -512,6 +665,11 @@ export interface WithPipelineStepFactoryOptions { description?: string; } +export interface WithPnpmOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithRedisCommanderOptions { configureContainer?: (obj: RedisCommanderResource) => Promise; containerName?: string; @@ -525,12 +683,17 @@ export interface WithRedisInsightOptions { export interface WithReferenceOptions { connectionName?: string; optional?: boolean; + name?: string; } export interface WithRequiredCommandOptions { helpLink?: string; } +export interface WithRunScriptOptions { + args?: string[]; +} + export interface WithUrlExpressionOptions { displayText?: string; } @@ -544,6 +707,122 @@ export interface WithVolumeOptions { isReadOnly?: boolean; } +export interface WithYarnOptions { + install?: boolean; + installArgs?: string[]; +} + +// ============================================================================ +// AfterResourcesCreatedEvent +// ============================================================================ + +/** + * Type class for AfterResourcesCreatedEvent. + */ +export class AfterResourcesCreatedEvent { + constructor(private _handle: AfterResourcesCreatedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeResourceStartedEvent +// ============================================================================ + +/** + * Type class for BeforeResourceStartedEvent. + */ +export class BeforeResourceStartedEvent { + constructor(private _handle: BeforeResourceStartedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeStartEvent +// ============================================================================ + +/** + * Type class for BeforeStartEvent. + */ +export class BeforeStartEvent { + constructor(private _handle: BeforeStartEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + // ============================================================================ // CommandLineArgsCallbackContext // ============================================================================ @@ -573,11 +852,12 @@ export class CommandLineArgsCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, }; @@ -592,6 +872,65 @@ export class CommandLineArgsCallbackContext { }, }; + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ConnectionStringAvailableEvent +// ============================================================================ + +/** + * Type class for ConnectionStringAvailableEvent. + */ +export class ConnectionStringAvailableEvent { + constructor(private _handle: ConnectionStringAvailableEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + } // ============================================================================ @@ -609,9 +948,9 @@ export class DistributedApplication { /** Runs the distributed application */ /** @internal */ - async _runInternal(cancellationToken?: AbortSignal): Promise { + async _runInternal(cancellationToken?: AbortSignal | CancellationToken): Promise { const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); await this._client.invokeCapability( 'Aspire.Hosting/run', rpcArgs @@ -685,6 +1024,17 @@ export class DistributedApplicationExecutionContext { }, }; + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the IsPublishMode property */ isPublishMode = { get: async (): Promise => { @@ -707,6 +1057,70 @@ export class DistributedApplicationExecutionContext { } +// ============================================================================ +// DistributedApplicationModel +// ============================================================================ + +/** + * Type class for DistributedApplicationModel. + */ +export class DistributedApplicationModel { + constructor(private _handle: DistributedApplicationModelHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets resources from the distributed application model */ + async getResources(): Promise { + const rpcArgs: Record = { model: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResources', + rpcArgs + ); + } + + /** Finds a resource by name */ + /** @internal */ + async _findResourceByNameInternal(name: string): Promise { + const rpcArgs: Record = { model: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/findResourceByName', + rpcArgs + ); + return new Resource(result, this._client); + } + + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._findResourceByNameInternal(name)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationModel that enables fluent chaining. + */ +export class DistributedApplicationModelPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationModel) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets resources from the distributed application model */ + getResources(): Promise { + return this._promise.then(obj => obj.getResources()); + } + + /** Finds a resource by name */ + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.findResourceByName(name))); + } + +} + // ============================================================================ // EndpointReference // ============================================================================ @@ -720,6 +1134,17 @@ export class EndpointReference { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.resource', + { context: this._handle } + ); + return new ResourceWithEndpoints(handle, this._client); + }, + }; + /** Gets the EndpointName property */ endpointName = { get: async (): Promise => { @@ -786,6 +1211,16 @@ export class EndpointReference { }, }; + /** Gets the TlsEnabled property */ + tlsEnabled = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.tlsEnabled', + { context: this._handle } + ); + }, + }; + /** Gets the Port property */ port = { get: async (): Promise => { @@ -840,13 +1275,22 @@ export class EndpointReference { async getValueAsync(options?: GetValueAsyncOptions): Promise { const cancellationToken = options?.cancellationToken; const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); return await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/getValueAsync', rpcArgs ); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + async getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + const rpcArgs: Record = { context: this._handle, enabledValue, disabledValue }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.getTlsValue', + rpcArgs + ); + } + } /** @@ -867,6 +1311,11 @@ export class EndpointReferencePromise implements PromiseLike return this._promise.then(obj => obj.getValueAsync(options)); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + return this._promise.then(obj => obj.getTlsValue(enabledValue, disabledValue)); + } + } // ============================================================================ @@ -944,11 +1393,34 @@ export class EnvironmentCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; @@ -978,6 +1450,17 @@ export class ExecuteCommandContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the ResourceName property */ resourceName = { get: async (): Promise => { @@ -996,16 +1479,17 @@ export class ExecuteCommandContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, - set: async (value: AbortSignal): Promise => { + set: async (value: AbortSignal | CancellationToken): Promise => { await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', - { context: this._handle, value } + { context: this._handle, value: CancellationToken.fromValue(value) } ); } }; @@ -1013,27 +1497,108 @@ export class ExecuteCommandContext { } // ============================================================================ -// PipelineConfigurationContext +// InitializeResourceEvent // ============================================================================ /** - * Type class for PipelineConfigurationContext. + * Type class for InitializeResourceEvent. */ -export class PipelineConfigurationContext { - constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} +export class InitializeResourceEvent { + constructor(private _handle: InitializeResourceEventHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the Steps property */ - steps = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.resource', { context: this._handle } ); + return new Resource(handle, this._client); }, - set: async (value: PipelineStep[]): Promise => { + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Notifications property */ + notifications = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.notifications', + { context: this._handle } + ); + return new ResourceNotificationService(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + { context: this._handle } + ); + }, + set: async (value: PipelineStep[]): Promise => { await this._client.invokeCapability( 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', { context: this._handle, value } @@ -1041,6 +1606,17 @@ export class PipelineConfigurationContext { } }; + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + /** Gets pipeline steps with the specified tag */ async getStepsByTag(tag: string): Promise { const rpcArgs: Record = { context: this._handle, tag }; @@ -1072,6 +1648,93 @@ export class PipelineConfigurationContextPromise implements PromiseLike => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + set: async (value: AbortSignal | CancellationToken): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.setCancellationToken', + { context: this._handle, value: CancellationToken.fromValue(value) } + ); + } + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + // ============================================================================ // PipelineStep // ============================================================================ @@ -1159,6 +1822,17 @@ export class PipelineStep { return this._tags; } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + /** Adds a dependency on another step by name */ /** @internal */ async _dependsOnInternal(stepName: string): Promise { @@ -1229,6 +1903,39 @@ export class PipelineStepContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the ReportingStep property */ + reportingStep = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.reportingStep', + { context: this._handle } + ); + return new ReportingStep(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + /** Gets the ExecutionContext property */ executionContext = { get: async (): Promise => { @@ -1240,18 +1947,159 @@ export class PipelineStepContext { }, }; + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineStepFactoryContext +// ============================================================================ + +/** + * Type class for PipelineStepFactoryContext. + */ +export class PipelineStepFactoryContext { + constructor(private _handle: PipelineStepFactoryContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; } +// ============================================================================ +// PipelineSummary +// ============================================================================ + +/** + * Type class for PipelineSummary. + */ +export class PipelineSummary { + constructor(private _handle: PipelineSummaryHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Add method */ + /** @internal */ + async _addInternal(key: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, key, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineSummary.add', + rpcArgs + ); + return this; + } + + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addInternal(key, value)); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + /** @internal */ + async _addMarkdownInternal(key: string, markdownString: string): Promise { + const rpcArgs: Record = { summary: this._handle, key, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/addMarkdown', + rpcArgs + ); + return this; + } + + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addMarkdownInternal(key, markdownString)); + } + +} + +/** + * Thenable wrapper for PipelineSummary that enables fluent chaining. + */ +export class PipelineSummaryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineSummary) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Add method */ + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.add(key, value))); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.addMarkdown(key, markdownString))); + } + +} + // ============================================================================ // ProjectResourceOptions // ============================================================================ @@ -1434,82 +2282,424 @@ export class ReferenceExpressionBuilderPromise implements PromiseLike; - get urls(): AspireList { - if (!this._urls) { - this._urls = new AspireList( - this._handle, - this._client, - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' - ); - } - return this._urls; - } - - /** Gets the CancellationToken property */ - cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.resource', { context: this._handle } ); + return new Resource(handle, this._client); }, }; - /** Gets the ExecutionContext property */ - executionContext = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.services', { context: this._handle } ); - return new DistributedApplicationExecutionContext(handle, this._client); + return new ServiceProvider(handle, this._client); }, }; } // ============================================================================ -// Service +// ResourceLoggerService // ============================================================================ /** - * Type class for Service. + * Type class for ResourceLoggerService. */ -export class Service { - constructor(private _handle: ServiceHandle, private _client: AspireClientRpc) {} +export class ResourceLoggerService { + constructor(private _handle: ResourceLoggerServiceHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the Image property */ - image = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.image', - { context: this._handle } - ); - }, - set: async (value: string): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.setImage', - { context: this._handle, value } - ); - } + /** Completes the log stream for a resource */ + /** @internal */ + async _completeLogInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { loggerService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLog', + rpcArgs + ); + return this; + } + + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogInternal(resource)); + } + + /** Completes the log stream by resource name */ + /** @internal */ + async _completeLogByNameInternal(resourceName: string): Promise { + const rpcArgs: Record = { loggerService: this._handle, resourceName }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLogByName', + rpcArgs + ); + return this; + } + + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogByNameInternal(resourceName)); + } + +} + +/** + * Thenable wrapper for ResourceLoggerService that enables fluent chaining. + */ +export class ResourceLoggerServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceLoggerService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Completes the log stream for a resource */ + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLog(resource))); + } + + /** Completes the log stream by resource name */ + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLogByName(resourceName))); + } + +} + +// ============================================================================ +// ResourceNotificationService +// ============================================================================ + +/** + * Type class for ResourceNotificationService. + */ +export class ResourceNotificationService { + constructor(private _handle: ResourceNotificationServiceHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Waits for a resource to reach a specified state */ + /** @internal */ + async _waitForResourceStateInternal(resourceName: string, targetState?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + if (targetState !== undefined) rpcArgs.targetState = targetState; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceState', + rpcArgs + ); + return this; + } + + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + const targetState = options?.targetState; + return new ResourceNotificationServicePromise(this._waitForResourceStateInternal(resourceName, targetState)); + } + + /** Waits for a resource to reach one of the specified states */ + async waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName, targetStates }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStates', + rpcArgs + ); + } + + /** Waits for a resource to become healthy */ + async waitForResourceHealthy(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceHealthy', + rpcArgs + ); + } + + /** Waits for all dependencies of a resource to be ready */ + /** @internal */ + async _waitForDependenciesInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForDependencies', + rpcArgs + ); + return this; + } + + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._waitForDependenciesInternal(resource)); + } + + /** Tries to get the current state of a resource */ + async tryGetResourceState(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/tryGetResourceState', + rpcArgs + ); + } + + /** Publishes an update for a resource's state */ + /** @internal */ + async _publishResourceUpdateInternal(resource: ResourceBuilderBase, state?: string, stateStyle?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + if (state !== undefined) rpcArgs.state = state; + if (stateStyle !== undefined) rpcArgs.stateStyle = stateStyle; + await this._client.invokeCapability( + 'Aspire.Hosting/publishResourceUpdate', + rpcArgs + ); + return this; + } + + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + const state = options?.state; + const stateStyle = options?.stateStyle; + return new ResourceNotificationServicePromise(this._publishResourceUpdateInternal(resource, state, stateStyle)); + } + +} + +/** + * Thenable wrapper for ResourceNotificationService that enables fluent chaining. + */ +export class ResourceNotificationServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceNotificationService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Waits for a resource to reach a specified state */ + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForResourceState(resourceName, options))); + } + + /** Waits for a resource to reach one of the specified states */ + waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + return this._promise.then(obj => obj.waitForResourceStates(resourceName, targetStates)); + } + + /** Waits for a resource to become healthy */ + waitForResourceHealthy(resourceName: string): Promise { + return this._promise.then(obj => obj.waitForResourceHealthy(resourceName)); + } + + /** Waits for all dependencies of a resource to be ready */ + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForDependencies(resource))); + } + + /** Tries to get the current state of a resource */ + tryGetResourceState(resourceName: string): Promise { + return this._promise.then(obj => obj.tryGetResourceState(resourceName)); + } + + /** Publishes an update for a resource's state */ + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.publishResourceUpdate(resource, options))); + } + +} + +// ============================================================================ +// ResourceReadyEvent +// ============================================================================ + +/** + * Type class for ResourceReadyEvent. + */ +export class ResourceReadyEvent { + constructor(private _handle: ResourceReadyEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ResourceStoppedEvent +// ============================================================================ + +/** + * Type class for ResourceStoppedEvent. + */ +export class ResourceStoppedEvent { + constructor(private _handle: ResourceStoppedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ResourceUrlsCallbackContext +// ============================================================================ + +/** + * Type class for ResourceUrlsCallbackContext. + */ +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; + } + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// Service +// ============================================================================ + +/** + * Type class for Service. + */ +export class Service { + constructor(private _handle: ServiceHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Image property */ + image = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.image', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker.Resources.ComposeNodes/Service.setImage', + { context: this._handle, value } + ); + } }; /** Gets the PullPolicy property */ @@ -2129,41 +3319,178 @@ export class Service { } // ============================================================================ -// DistributedApplicationBuilder +// UpdateCommandStateContext // ============================================================================ /** - * Type class for DistributedApplicationBuilder. + * Type class for UpdateCommandStateContext. */ -export class DistributedApplicationBuilder { - constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} +export class UpdateCommandStateContext { + constructor(private _handle: UpdateCommandStateContextHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the AppHostDirectory property */ - appHostDirectory = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/UpdateCommandStateContext.serviceProvider', { context: this._handle } ); + return new ServiceProvider(handle, this._client); }, }; - /** Gets the Eventing property */ - eventing = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', - { context: this._handle } - ); - return new DistributedApplicationEventing(handle, this._client); - }, - }; +} - /** Gets the ExecutionContext property */ - executionContext = { +// ============================================================================ +// Configuration +// ============================================================================ + +/** + * Type class for Configuration. + */ +export class Configuration { + constructor(private _handle: IConfigurationHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets a configuration value by key */ + async getConfigValue(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConfigValue', + rpcArgs + ); + } + + /** Gets a connection string by name */ + async getConnectionString(name: string): Promise { + const rpcArgs: Record = { configuration: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionString', + rpcArgs + ); + } + + /** Gets a configuration section by key */ + async getSection(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getSection', + rpcArgs + ); + } + + /** Gets child configuration sections */ + async getChildren(): Promise { + const rpcArgs: Record = { configuration: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getChildren', + rpcArgs + ); + } + + /** Checks whether a configuration section exists */ + async exists(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/exists', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for Configuration that enables fluent chaining. + */ +export class ConfigurationPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Configuration) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets a configuration value by key */ + getConfigValue(key: string): Promise { + return this._promise.then(obj => obj.getConfigValue(key)); + } + + /** Gets a connection string by name */ + getConnectionString(name: string): Promise { + return this._promise.then(obj => obj.getConnectionString(name)); + } + + /** Gets a configuration section by key */ + getSection(key: string): Promise { + return this._promise.then(obj => obj.getSection(key)); + } + + /** Gets child configuration sections */ + getChildren(): Promise { + return this._promise.then(obj => obj.getChildren()); + } + + /** Checks whether a configuration section exists */ + exists(key: string): Promise { + return this._promise.then(obj => obj.exists(key)); + } + +} + +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Environment property */ + environment = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.environment', + { context: this._handle } + ); + return new HostEnvironment(handle, this._client); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { get: async (): Promise => { const handle = await this._client.invokeCapability( 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', @@ -2173,6 +3500,17 @@ export class DistributedApplicationBuilder { }, }; + /** Gets the UserSecretsManager property */ + userSecretsManager = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.userSecretsManager', + { context: this._handle } + ); + return new UserSecretsManager(handle, this._client); + }, + }; + /** Builds the distributed application */ /** @internal */ async _buildInternal(): Promise { @@ -2188,6 +3526,21 @@ export class DistributedApplicationBuilder { return new DistributedApplicationPromise(this._buildInternal()); } + /** Adds a connection string with a reference expression */ + /** @internal */ + async _addConnectionStringExpressionInternal(name: string, connectionStringExpression: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, connectionStringExpression }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionStringExpression', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringExpressionInternal(name, connectionStringExpression)); + } + /** Adds a connection string with a builder callback */ /** @internal */ async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { @@ -2225,6 +3578,23 @@ export class DistributedApplicationBuilder { return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); } + /** Adds a container registry with string endpoint */ + /** @internal */ + async _addContainerRegistryFromStringInternal(name: string, endpoint: string, repository?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistryFromString', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); + } + + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryFromStringInternal(name, endpoint, repository)); + } + /** Adds a container resource */ /** @internal */ async _addContainerInternal(name: string, image: string): Promise { @@ -2304,6 +3674,36 @@ export class DistributedApplicationBuilder { return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); } + /** Adds an external service with a URI */ + /** @internal */ + async _addExternalServiceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceUri', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceUriInternal(name, uri)); + } + + /** Adds an external service with a parameter URL */ + /** @internal */ + async _addExternalServiceParameterInternal(name: string, urlParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, urlParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceParameter', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceParameterInternal(name, urlParameter)); + } + /** Adds a parameter resource */ /** @internal */ async _addParameterInternal(name: string, secret?: boolean): Promise { @@ -2321,6 +3721,25 @@ export class DistributedApplicationBuilder { return new ParameterResourcePromise(this._addParameterInternal(name, secret)); } + /** Adds a parameter with a default value */ + /** @internal */ + async _addParameterWithValueInternal(name: string, value: string, publishValueAsDefault?: boolean, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + if (publishValueAsDefault !== undefined) rpcArgs.publishValueAsDefault = publishValueAsDefault; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterWithValue', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + const publishValueAsDefault = options?.publishValueAsDefault; + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterWithValueInternal(name, value, publishValueAsDefault, secret)); + } + /** Adds a parameter sourced from configuration */ /** @internal */ async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { @@ -2425,6 +3844,98 @@ export class DistributedApplicationBuilder { return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); } + /** Gets the application configuration */ + /** @internal */ + async _getConfigurationInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getConfiguration', + rpcArgs + ); + return new Configuration(result, this._client); + } + + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._getConfigurationInternal()); + } + + /** Subscribes to the BeforeStart event */ + async subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeStartEventHandle; + const arg = new BeforeStartEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeBeforeStart', + rpcArgs + ); + } + + /** Subscribes to the AfterResourcesCreated event */ + async subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as AfterResourcesCreatedEventHandle; + const arg = new AfterResourcesCreatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeAfterResourcesCreated', + rpcArgs + ); + } + + /** Adds a Node.js application resource */ + /** @internal */ + async _addNodeAppInternal(name: string, appDirectory: string, scriptPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory, scriptPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addNodeApp', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._addNodeAppInternal(name, appDirectory, scriptPath)); + } + + /** Adds a JavaScript application resource */ + /** @internal */ + async _addJavaScriptAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addJavaScriptApp', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + const runScriptName = options?.runScriptName; + return new JavaScriptAppResourcePromise(this._addJavaScriptAppInternal(name, appDirectory, runScriptName)); + } + + /** Adds a Vite application resource */ + /** @internal */ + async _addViteAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addViteApp', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + const runScriptName = options?.runScriptName; + return new ViteAppResourcePromise(this._addViteAppInternal(name, appDirectory, runScriptName)); + } + /** Adds a Redis container resource with specific port */ /** @internal */ async _addRedisWithPortInternal(name: string, port?: number): Promise { @@ -2496,6 +4007,11 @@ export class DistributedApplicationBuilderPromise implements PromiseLike obj.build())); } + /** Adds a connection string with a reference expression */ + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringExpression(name, connectionStringExpression))); + } + /** Adds a connection string with a builder callback */ addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); @@ -2506,6 +4022,11 @@ export class DistributedApplicationBuilderPromise implements PromiseLike obj.addContainerRegistry(name, endpoint, options))); } + /** Adds a container registry with string endpoint */ + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistryFromString(name, endpoint, options))); + } + /** Adds a container resource */ addContainer(name: string, image: string): ContainerResourcePromise { return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); @@ -2531,11 +4052,26 @@ export class DistributedApplicationBuilderPromise implements PromiseLike obj.addExternalService(name, url))); } + /** Adds an external service with a URI */ + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceUri(name, uri))); + } + + /** Adds an external service with a parameter URL */ + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceParameter(name, urlParameter))); + } + /** Adds a parameter resource */ addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); } + /** Adds a parameter with a default value */ + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterWithValue(name, value, options))); + } + /** Adds a parameter sourced from configuration */ addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); @@ -2566,6 +4102,36 @@ export class DistributedApplicationBuilderPromise implements PromiseLike obj.addCSharpAppWithOptions(name, path, configure))); } + /** Gets the application configuration */ + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._promise.then(obj => obj.getConfiguration())); + } + + /** Subscribes to the BeforeStart event */ + subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeBeforeStart(callback)); + } + + /** Subscribes to the AfterResourcesCreated event */ + subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeAfterResourcesCreated(callback)); + } + + /** Adds a Node.js application resource */ + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.addNodeApp(name, appDirectory, scriptPath))); + } + + /** Adds a JavaScript application resource */ + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.addJavaScriptApp(name, appDirectory, options))); + } + + /** Adds a Vite application resource */ + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.addViteApp(name, appDirectory, options))); + } + /** Adds a Redis container resource with specific port */ addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { return new RedisResourcePromise(this._promise.then(obj => obj.addRedisWithPort(name, options))); @@ -2634,979 +4200,1213 @@ export class DistributedApplicationEventingPromise implements PromiseLike { - constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { - super(handle, client); - } +/** + * Type class for HostEnvironment. + */ +export class HostEnvironment { + constructor(private _handle: IHostEnvironmentHandle, private _client: AspireClientRpc) {} - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Checks if running in Development environment */ + async isDevelopment(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isDevelopment', rpcArgs ); - return new ConnectionStringResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + /** Checks if running in Production environment */ + async isProduction(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isProduction', + rpcArgs + ); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + /** Checks if running in Staging environment */ + async isStaging(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isStaging', rpcArgs ); - return new ConnectionStringResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Checks if the environment matches the specified name */ + async isEnvironment(environmentName: string): Promise { + const rpcArgs: Record = { environment: this._handle, environmentName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isEnvironment', + rpcArgs + ); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); +} + +/** + * Thenable wrapper for HostEnvironment that enables fluent chaining. + */ +export class HostEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: HostEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { - const helpLink = options?.helpLink; - return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Checks if running in Development environment */ + isDevelopment(): Promise { + return this._promise.then(obj => obj.isDevelopment()); } - /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); + /** Checks if running in Production environment */ + isProduction(): Promise { + return this._promise.then(obj => obj.isProduction()); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Checks if running in Staging environment */ + isStaging(): Promise { + return this._promise.then(obj => obj.isStaging()); + } + + /** Checks if the environment matches the specified name */ + isEnvironment(environmentName: string): Promise { + return this._promise.then(obj => obj.isEnvironment(environmentName)); } +} + +// ============================================================================ +// Logger +// ============================================================================ + +/** + * Type class for Logger. + */ +export class Logger { + constructor(private _handle: ILoggerHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Logs an information message */ /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', + async _logInformationInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logInformation', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return this; } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._logInformationInternal(message)); } + /** Logs a warning message */ /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + async _logWarningInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logWarning', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return this; } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._logWarningInternal(message)); } + /** Logs an error message */ /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + async _logErrorInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logError', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return this; } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + logError(message: string): LoggerPromise { + return new LoggerPromise(this._logErrorInternal(message)); } + /** Logs a debug message */ /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + async _logDebugInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logDebug', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return this; } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { - const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._logDebugInternal(message)); } + /** Logs a message with specified level */ /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + async _logInternal(level: string, message: string): Promise { + const rpcArgs: Record = { logger: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/log', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return this; } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { - const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._logInternal(level, message)); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); +} + +/** + * Thenable wrapper for Logger that enables fluent chaining. + */ +export class LoggerPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Logger) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Logs an information message */ + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logInformation(message))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); + /** Logs a warning message */ + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logWarning(message))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + /** Logs an error message */ + logError(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logError(message))); } - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); + /** Logs a debug message */ + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logDebug(message))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + /** Logs a message with specified level */ + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.log(level, message))); } +} + +// ============================================================================ +// LoggerFactory +// ============================================================================ + +/** + * Type class for LoggerFactory. + */ +export class LoggerFactory { + constructor(private _handle: ILoggerFactoryHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Creates a logger for a category */ /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + async _createLoggerInternal(categoryName: string): Promise { + const rpcArgs: Record = { loggerFactory: this._handle, categoryName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createLogger', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new Logger(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._createLoggerInternal(categoryName)); + } + +} + +/** + * Thenable wrapper for LoggerFactory that enables fluent chaining. + */ +export class LoggerFactoryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: LoggerFactory) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Creates a logger for a category */ + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.createLogger(categoryName))); } +} + +// ============================================================================ +// ReportingStep +// ============================================================================ + +/** + * Type class for ReportingStep. + */ +export class ReportingStep { + constructor(private _handle: IReportingStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Creates a reporting task with plain-text status text */ /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + async _createTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createTask', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ReportingTask(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createTaskInternal(statusText, cancellationToken)); } + /** Creates a reporting task with Markdown-formatted status text */ /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + async _createMarkdownTaskInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createMarkdownTask', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ReportingTask(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createMarkdownTaskInternal(markdownString, cancellationToken)); } + /** Logs a plain-text message for the reporting step */ /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + async _logStepInternal(level: string, message: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStep', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return this; } - /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepInternal(level, message)); } + /** Logs a Markdown-formatted message for the reporting step */ /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + async _logStepMarkdownInternal(level: string, markdownString: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStepMarkdown', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return this; } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - const exitCode = options?.exitCode; - return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepMarkdownInternal(level, markdownString)); } + /** Completes the reporting step with plain-text completion text */ /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + async _completeStepInternal(completionText: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, completionText }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStep', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return this; } - /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepInternal(completionText, completionState, cancellationToken)); } + /** Completes the reporting step with Markdown-formatted completion text */ /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + async _completeStepMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStepMarkdown', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return this; } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { - const commandOptions = options?.commandOptions; - return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepMarkdownInternal(markdownString, completionState, cancellationToken)); + } + +} + +/** + * Thenable wrapper for ReportingStep that enables fluent chaining. + */ +export class ReportingStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReportingStep) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Creates a reporting task with plain-text status text */ + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createTask(statusText, options))); + } + + /** Creates a reporting task with Markdown-formatted status text */ + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createMarkdownTask(markdownString, options))); + } + + /** Logs a plain-text message for the reporting step */ + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStep(level, message))); + } + + /** Logs a Markdown-formatted message for the reporting step */ + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStepMarkdown(level, markdownString))); + } + + /** Completes the reporting step with plain-text completion text */ + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStep(completionText, options))); + } + + /** Completes the reporting step with Markdown-formatted completion text */ + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStepMarkdown(markdownString, options))); } +} + +// ============================================================================ +// ReportingTask +// ============================================================================ + +/** + * Type class for ReportingTask. + */ +export class ReportingTask { + constructor(private _handle: IReportingTaskHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Updates the reporting task with plain-text status text */ /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + async _updateTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTask', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return this; } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskInternal(statusText, cancellationToken)); } + /** Updates the reporting task with Markdown-formatted status text */ /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + async _updateTaskMarkdownInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTaskMarkdown', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return this; } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskMarkdownInternal(markdownString, cancellationToken)); } + /** Completes the reporting task with plain-text completion text */ /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + async _completeTaskInternal(completionMessage?: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle }; + if (completionMessage !== undefined) rpcArgs.completionMessage = completionMessage; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTask', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return this; } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { - const iconVariant = options?.iconVariant; - return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + const completionMessage = options?.completionMessage; + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskInternal(completionMessage, completionState, cancellationToken)); } + /** Completes the reporting task with Markdown-formatted completion text */ /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + async _completeTaskMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTaskMarkdown', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return this; } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskMarkdownInternal(markdownString, completionState, cancellationToken)); + } + +} + +/** + * Thenable wrapper for ReportingTask that enables fluent chaining. + */ +export class ReportingTaskPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReportingTask) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Updates the reporting task with plain-text status text */ + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTask(statusText, options))); + } + + /** Updates the reporting task with Markdown-formatted status text */ + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTaskMarkdown(markdownString, options))); } + /** Completes the reporting task with plain-text completion text */ + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTask(options))); + } + + /** Completes the reporting task with Markdown-formatted completion text */ + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTaskMarkdown(markdownString, options))); + } + +} + +// ============================================================================ +// ServiceProvider +// ============================================================================ + +/** + * Type class for ServiceProvider. + */ +export class ServiceProvider { + constructor(private _handle: IServiceProviderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the distributed application eventing service from the service provider */ /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + async _getEventingInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getEventing', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DistributedApplicationEventing(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._getEventingInternal()); } + /** Gets the logger factory from the service provider */ /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + async _getLoggerFactoryInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getLoggerFactory', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new LoggerFactory(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._getLoggerFactoryInternal()); } + /** Gets the resource logger service from the service provider */ /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + async _getResourceLoggerServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceLoggerService', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ResourceLoggerService(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._getResourceLoggerServiceInternal()); } + /** Gets the distributed application model from the service provider */ /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + async _getDistributedApplicationModelInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getDistributedApplicationModel', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DistributedApplicationModel(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._getDistributedApplicationModelInternal()); } + /** Gets the resource notification service from the service provider */ /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + async _getResourceNotificationServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceNotificationService', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ResourceNotificationService(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._getResourceNotificationServiceInternal()); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** Gets the user secrets manager from the service provider */ + /** @internal */ + async _getUserSecretsManagerInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getUserSecretsManager', rpcArgs ); + return new UserSecretsManager(result, this._client); + } + + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getUserSecretsManagerInternal()); } } /** - * Thenable wrapper for ConnectionStringResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); + * Thenable wrapper for ServiceProvider that enables fluent chaining. */ -export class ConnectionStringResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ServiceProviderPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ServiceProvider) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Gets the distributed application eventing service from the service provider */ + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.getEventing())); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Gets the logger factory from the service provider */ + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._promise.then(obj => obj.getLoggerFactory())); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Gets the resource logger service from the service provider */ + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.getResourceLoggerService())); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + /** Gets the distributed application model from the service provider */ + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._promise.then(obj => obj.getDistributedApplicationModel())); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + /** Gets the resource notification service from the service provider */ + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.getResourceNotificationService())); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Gets the user secrets manager from the service provider */ + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getUserSecretsManager())); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); - } +} - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); - } +// ============================================================================ +// UserSecretsManager +// ============================================================================ - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } +/** + * Type class for UserSecretsManager. + */ +export class UserSecretsManager { + constructor(private _handle: IUserSecretsManagerHandle, private _client: AspireClientRpc) {} - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Gets the IsAvailable property */ + isAvailable = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.isAvailable', + { context: this._handle } + ); + }, + }; + + /** Gets the FilePath property */ + filePath = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.filePath', + { context: this._handle } + ); + }, + }; + + /** Attempts to set a user secret value */ + async trySetSecret(name: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, name, value }; + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.trySetSecret', + rpcArgs + ); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Saves state to user secrets from a JSON string */ + /** @internal */ + async _saveStateJsonInternal(json: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, json }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/saveStateJson', + rpcArgs + ); + return this; } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + const cancellationToken = options?.cancellationToken; + return new UserSecretsManagerPromise(this._saveStateJsonInternal(json, cancellationToken)); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); - } - - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } - - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); - } - - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ + /** @internal */ + async _getOrSetSecretInternal(resourceBuilder: ResourceBuilderBase, name: string, value: string): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, resourceBuilder, name, value }; + await this._client.invokeCapability( + 'Aspire.Hosting/getOrSetSecret', + rpcArgs + ); + return this; } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getOrSetSecretInternal(resourceBuilder, name, value)); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } +} - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } +/** + * Thenable wrapper for UserSecretsManager that enables fluent chaining. + */ +export class UserSecretsManagerPromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + then( + onfulfilled?: ((value: UserSecretsManager) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Attempts to set a user secret value */ + trySetSecret(name: string, value: string): Promise { + return this._promise.then(obj => obj.trySetSecret(name, value)); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Saves state to user secrets from a JSON string */ + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.saveStateJson(json, options))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getOrSetSecret(resourceBuilder, name, value))); } } // ============================================================================ -// ContainerRegistryResource +// ConnectionStringResource // ============================================================================ -export class ContainerRegistryResource extends ResourceBuilderBase { - constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ConnectionStringResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ConnectionStringResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ConnectionStringResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { const helpLink = options?.helpLink; - return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ConnectionStringResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ConnectionStringResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ConnectionStringResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ConnectionStringResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ConnectionStringResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ConnectionStringResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -3617,60 +5417,60 @@ export class ContainerRegistryResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ConnectionStringResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ConnectionStringResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ConnectionStringResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -3682,126 +5482,256 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onConnectionStringAvailableInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** - * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ContainerRegistryResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -3809,5275 +5739,5743 @@ export class ContainerRegistryResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ -// ContainerResource +// ContainerRegistryResource // ============================================================================ -export class ContainerResource extends ResourceBuilderBase { - constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterInternal()); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - const helpLink = options?.helpLink; - return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsInternal(args)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceReadyInternal(callback)); + } + +} + +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// ContainerResource +// ============================================================================ + +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + 'Aspire.Hosting/withBindMount', rpcArgs ); return new ContainerResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); + return new ContainerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + 'Aspire.Hosting/withImageTag', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + 'Aspire.Hosting/withImageRegistry', rpcArgs ); return new ContainerResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + 'Aspire.Hosting/withImage', rpcArgs ); return new ContainerResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + 'Aspire.Hosting/withImageSHA256', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + 'Aspire.Hosting/withLifetime', rpcArgs ); return new ContainerResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _publishAsContainerInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + 'Aspire.Hosting/publishAsContainer', rpcArgs ); return new ContainerResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromManifestInternal()); + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/withDockerfile', rpcArgs ); return new ContainerResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForInternal(dependency)); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + 'Aspire.Hosting/withContainerName', rpcArgs ); return new ContainerResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); return new ContainerResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); return new ContainerResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); return new ContainerResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExplicitStartInternal()); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); return new ContainerResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - const exitCode = options?.exitCode; - return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + 'Aspire.Hosting/withContainerNetworkAlias', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + 'Aspire.Hosting/withMcpServer', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { const path = options?.path; - const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + 'Aspire.Hosting/publishAsConnectionString', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - const password = options?.password; - return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); return new ContainerResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + 'Aspire.Hosting/withArgs', rpcArgs ); return new ContainerResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromMcpInternal()); + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + 'Aspire.Hosting/withArgsCallback', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); return new ContainerResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + 'Aspire.Hosting/withReference', rpcArgs ); return new ContainerResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + 'Aspire.Hosting/withReferenceUri', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); return new ContainerResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); + return new ContainerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { - const configureId = registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as DockerComposeServiceResourceHandle; - const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); - const arg2Handle = wrapIfHandle(args.p1) as ServiceHandle; - const arg2 = new Service(arg2Handle, this._client); - await configure(arg1, arg2); - }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; const result = await this._client.invokeCapability( - 'Aspire.Hosting.Docker/publishAsDockerComposeService', + 'Aspire.Hosting/withEndpoint', rpcArgs ); return new ContainerResource(result, this._client); } - /** Publishes the resource as a Docker Compose service with custom service configuration */ - publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } -} - -/** - * Thenable wrapper for ContainerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ContainerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } - - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } - - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); - } - - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); - } - - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); - } - - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new ContainerResource(result, this._client); } /** Waits for resource completion */ waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + const exitCode = options?.exitCode; + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); } /** Adds a health check by key */ withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); } /** Adds an HTTP health check */ withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); } /** Adds a resource command */ withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + const commandOptions = options?.commandOptions; + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ContainerResource(result, this._client); } /** Configures developer certificate trust */ withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ContainerResource(result, this._client); } /** Sets the certificate trust scope */ withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); } /** Configures HTTPS with a developer certificate */ withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + const password = options?.password; + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); } /** Removes HTTPS certificate configuration */ withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); } /** Sets the parent relationship */ withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); } /** Sets a child relationship */ withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerResource(result, this._client); } /** Sets the icon for the resource */ withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + const iconVariant = options?.iconVariant; + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ContainerResource(result, this._client); } /** Adds an HTTP health probe to the resource */ withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerResource(result, this._client); } /** Excludes the resource from MCP server exposure */ excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + return new ContainerResourcePromise(this._excludeFromMcpInternal()); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ContainerResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); - } - - /** Publishes the resource as a Docker Compose service with custom service configuration */ - publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); - } - -} - -// ============================================================================ -// CSharpAppResource -// ============================================================================ - -export class CSharpAppResource extends ResourceBuilderBase { - constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { - super(handle, client); - } - - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new CSharpAppResource(result, this._client); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); - } - - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new CSharpAppResource(result, this._client); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** @internal */ - private async _withReplicasInternal(replicas: number): Promise { - const rpcArgs: Record = { builder: this._handle, replicas }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReplicas', + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); } - /** @internal */ - private async _disableForwardedHeadersInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/disableForwardedHeaders', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new CSharpAppResource(result, this._client); - } - - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - const helpLink = options?.helpLink; - return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as DockerComposeServiceResourceHandle; + const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); + const arg2Handle = wrapIfHandle(arg2Data) as ServiceHandle; + const arg2 = new Service(arg2Handle, this._client); + await configure(arg1, arg2); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/publishAsDockerComposeService', rpcArgs ); - return new CSharpAppResource(result, this._client); - } - - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + return new ContainerResource(result, this._client); } - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); - } +} - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new CSharpAppResource(result, this._client); +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsInternal(args)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); + } + +} + +// ============================================================================ +// CSharpAppResource +// ============================================================================ + +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - const exitCode = options?.exitCode; - return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + 'Aspire.Hosting/withMcpServer', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { const path = options?.path; - const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - const commandOptions = options?.commandOptions; - return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + 'Aspire.Hosting/withReplicas', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _disableForwardedHeadersInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/disableForwardedHeaders', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - const password = options?.password; - return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; const rpcArgs: Record = { builder: this._handle }; + if (configure !== undefined) rpcArgs.configure = configureId; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + const configure = options?.configure; + return new CSharpAppResourcePromise(this._publishAsDockerFileInternal(configure)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - const iconVariant = options?.iconVariant; - return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + 'Aspire.Hosting/withArgs', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + 'Aspire.Hosting/withArgsCallback', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + 'Aspire.Hosting/withReference', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); + return new CSharpAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { - const configureId = registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as DockerComposeServiceResourceHandle; - const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); - const arg2Handle = wrapIfHandle(args.p1) as ServiceHandle; - const arg2 = new Service(arg2Handle, this._client); - await configure(arg1, arg2); - }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; const result = await this._client.invokeCapability( - 'Aspire.Hosting.Docker/publishAsDockerComposeService', + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); return new CSharpAppResource(result, this._client); } - /** Publishes the resource as a Docker Compose service with custom service configuration */ - publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } -} - -/** - * Thenable wrapper for CSharpAppResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class CSharpAppResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } - then( - onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + const displayText = options?.displayText; + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } - - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } - - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); - } - - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); - } - - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } /** Prevents resource from starting automatically */ withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } /** Waits for resource completion */ waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + const exitCode = options?.exitCode; + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } /** Adds a health check by key */ withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP health check */ withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } /** Adds a resource command */ withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + const commandOptions = options?.commandOptions; + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } /** Configures developer certificate trust */ withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } /** Sets the certificate trust scope */ withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + const password = options?.password; + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } /** Sets the parent relationship */ withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } /** Sets a child relationship */ withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } /** Sets the icon for the resource */ withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + const iconVariant = options?.iconVariant; + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } /** Sets the remote image name for publishing */ withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } /** Sets the remote image tag for publishing */ withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); - } - - /** Publishes the resource as a Docker Compose service with custom service configuration */ - publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); - } - -} - -// ============================================================================ -// DockerComposeAspireDashboardResource -// ============================================================================ - -export class DockerComposeAspireDashboardResource extends ResourceBuilderBase { - constructor(handle: DockerComposeAspireDashboardResourceHandle, client: AspireClientRpc) { - super(handle, client); - } - - /** Gets the PrimaryEndpoint property */ - primaryEndpoint = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.Docker/DockerComposeAspireDashboardResource.primaryEndpoint', - { context: this._handle } - ); - return new EndpointReference(handle, this._client); - }, - }; - - /** Gets the OtlpGrpcEndpoint property */ - otlpGrpcEndpoint = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.Docker/DockerComposeAspireDashboardResource.otlpGrpcEndpoint', - { context: this._handle } - ); - return new EndpointReference(handle, this._client); - }, - }; - - /** Gets the Entrypoint property */ - entrypoint = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.Docker/DockerComposeAspireDashboardResource.entrypoint', - { context: this._handle } - ); - }, - set: async (value: string): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.Docker/DockerComposeAspireDashboardResource.setEntrypoint', - { context: this._handle, value } - ); - } - }; - - /** Gets the ShellExecution property */ - shellExecution = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.Docker/DockerComposeAspireDashboardResource.shellExecution', - { context: this._handle } - ); - }, - set: async (value: boolean): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.Docker/DockerComposeAspireDashboardResource.setShellExecution', - { context: this._handle, value } - ); - } - }; - - /** Gets the Name property */ - name = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.Docker/DockerComposeAspireDashboardResource.name', - { context: this._handle } - ); - }, - }; - - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new DockerComposeAspireDashboardResource(result, this._client); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new DockerComposeAspireDashboardResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): DockerComposeAspireDashboardResourcePromise { - const isReadOnly = options?.isReadOnly; - return new DockerComposeAspireDashboardResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new DockerComposeAspireDashboardResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new DockerComposeAspireDashboardResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withImageTagInternal(tag)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new DockerComposeAspireDashboardResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withImageRegistryInternal(registry)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new DockerComposeAspireDashboardResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): DockerComposeAspireDashboardResourcePromise { - const tag = options?.tag; - return new DockerComposeAspireDashboardResourcePromise(this._withImageInternal(image, tag)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', + private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as DockerComposeServiceResourceHandle; + const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); + const arg2Handle = wrapIfHandle(arg2Data) as ServiceHandle; + const arg2 = new Service(arg2Handle, this._client); + await configure(arg1, arg2); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/publishAsDockerComposeService', rpcArgs ); - return new DockerComposeAspireDashboardResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withImageSHA256Internal(sha256)); + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); } - /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withLifetimeInternal(lifetime)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); } - /** Configures the resource to be published as a container */ - publishAsContainer(): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._publishAsContainerInternal()); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); } - /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): DockerComposeAspireDashboardResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new DockerComposeAspireDashboardResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets the container name */ - withContainerName(name: string): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withContainerNameInternal(name)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withBuildArgInternal(name, value)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withBuildSecretInternal(name, value)); + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DockerComposeAspireDashboardResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new DockerComposeAspireDashboardResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DockerComposeAspireDashboardResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new DockerComposeAspireDashboardResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withOtlpExporterInternal()); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._publishAsConnectionStringInternal()); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DockerComposeAspireDashboardResourcePromise { - const helpLink = options?.helpLink; - return new DockerComposeAspireDashboardResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Adds arguments */ - withArgs(args: string[]): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withArgsInternal(args)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withArgsCallbackInternal(callback)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DockerComposeAspireDashboardResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new DockerComposeAspireDashboardResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withServiceReferenceInternal(source)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); - } + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new DockerComposeAspireDashboardResource(result, this._client); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); } +} + +// ============================================================================ +// DockerComposeAspireDashboardResource +// ============================================================================ + +export class DockerComposeAspireDashboardResource extends ResourceBuilderBase { + constructor(handle: DockerComposeAspireDashboardResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the PrimaryEndpoint property */ + primaryEndpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeAspireDashboardResource.primaryEndpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the OtlpGrpcEndpoint property */ + otlpGrpcEndpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeAspireDashboardResource.otlpGrpcEndpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Entrypoint property */ + entrypoint = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeAspireDashboardResource.entrypoint', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeAspireDashboardResource.setEntrypoint', + { context: this._handle, value } + ); + } + }; + + /** Gets the ShellExecution property */ + shellExecution = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeAspireDashboardResource.shellExecution', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeAspireDashboardResource.setShellExecution', + { context: this._handle, value } + ); + } + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeAspireDashboardResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + 'Aspire.Hosting/withBindMount', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DockerComposeAspireDashboardResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new DockerComposeAspireDashboardResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): DockerComposeAspireDashboardResourcePromise { + const isReadOnly = options?.isReadOnly; + return new DockerComposeAspireDashboardResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + 'Aspire.Hosting/withEntrypoint', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DockerComposeAspireDashboardResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new DockerComposeAspireDashboardResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + 'Aspire.Hosting/withImageTag', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DockerComposeAspireDashboardResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new DockerComposeAspireDashboardResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets the container image tag */ + withImageTag(tag: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + 'Aspire.Hosting/withImageRegistry', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withExternalHttpEndpointsInternal()); - } - - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Sets the container image registry */ + withImageRegistry(registry: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + 'Aspire.Hosting/withImage', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._asHttp2ServiceInternal()); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): DockerComposeAspireDashboardResourcePromise { + const tag = options?.tag; + return new DockerComposeAspireDashboardResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + 'Aspire.Hosting/withImageSHA256', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + 'Aspire.Hosting/withLifetime', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DockerComposeAspireDashboardResourcePromise { - const displayText = options?.displayText; - return new DockerComposeAspireDashboardResourcePromise(this._withUrlInternal(url, displayText)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withLifetimeInternal(lifetime)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DockerComposeAspireDashboardResourcePromise { - const displayText = options?.displayText; - return new DockerComposeAspireDashboardResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + 'Aspire.Hosting/publishAsContainer', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Configures the resource to be published as a container */ + publishAsContainer(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + 'Aspire.Hosting/withDockerfile', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): DockerComposeAspireDashboardResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new DockerComposeAspireDashboardResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + 'Aspire.Hosting/withContainerName', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._excludeFromManifestInternal()); + /** Sets the container name */ + withContainerName(name: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withContainerNameInternal(name)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._waitForInternal(dependency)); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withBuildArgInternal(name, value)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._waitForStartInternal(dependency)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DockerComposeAspireDashboardResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new DockerComposeAspireDashboardResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + 'Aspire.Hosting/withContainerNetworkAlias', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withExplicitStartInternal()); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withContainerNetworkAliasInternal(alias)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/withMcpServer', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DockerComposeAspireDashboardResourcePromise { - const exitCode = options?.exitCode; - return new DockerComposeAspireDashboardResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DockerComposeAspireDashboardResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DockerComposeAspireDashboardResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withHealthCheckInternal(key)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DockerComposeAspireDashboardResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new DockerComposeAspireDashboardResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + 'Aspire.Hosting/publishAsConnectionString', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DockerComposeAspireDashboardResourcePromise { - const commandOptions = options?.commandOptions; - return new DockerComposeAspireDashboardResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._publishAsConnectionStringInternal()); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DockerComposeAspireDashboardResourcePromise { + const helpLink = options?.helpLink; + return new DockerComposeAspireDashboardResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DockerComposeAspireDashboardResourcePromise { - const password = options?.password; - return new DockerComposeAspireDashboardResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withoutHttpsCertificateInternal()); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withParentRelationshipInternal(parent)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + 'Aspire.Hosting/withArgs', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DockerComposeAspireDashboardResourcePromise { - const iconVariant = options?.iconVariant; - return new DockerComposeAspireDashboardResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds arguments */ + withArgs(args: string[]): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + 'Aspire.Hosting/withArgsCallback', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DockerComposeAspireDashboardResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new DockerComposeAspireDashboardResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._excludeFromMcpInternal()); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + 'Aspire.Hosting/withReference', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DockerComposeAspireDashboardResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new DockerComposeAspireDashboardResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + 'Aspire.Hosting/withReferenceUri', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DockerComposeAspireDashboardResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new DockerComposeAspireDashboardResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + 'Aspire.Hosting/withEndpoint', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DockerComposeAspireDashboardResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new DockerComposeAspireDashboardResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): DockerComposeAspireDashboardResourcePromise { + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DockerComposeAspireDashboardResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new DockerComposeAspireDashboardResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); - } - - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + const env = options?.env; + const isProxied = options?.isProxied; + return new DockerComposeAspireDashboardResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHostPortInternal(port?: number): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; const result = await this._client.invokeCapability( - 'Aspire.Hosting.Docker/withHostPort', + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Sets the host port for the Aspire dashboard */ - withHostPort(options?: WithHostPortOptions): DockerComposeAspireDashboardResourcePromise { + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DockerComposeAspireDashboardResourcePromise { const port = options?.port; - return new DockerComposeAspireDashboardResourcePromise(this._withHostPortInternal(port)); + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DockerComposeAspireDashboardResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withForwardedHeadersInternal(enabled?: boolean): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (enabled !== undefined) rpcArgs.enabled = enabled; const result = await this._client.invokeCapability( - 'Aspire.Hosting.Docker/withForwardedHeaders', + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Enables or disables forwarded headers support for the Aspire dashboard */ - withForwardedHeaders(options?: WithForwardedHeadersOptions): DockerComposeAspireDashboardResourcePromise { - const enabled = options?.enabled; - return new DockerComposeAspireDashboardResourcePromise(this._withForwardedHeadersInternal(enabled)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** @internal */ - private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { - const configureId = registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as DockerComposeServiceResourceHandle; - const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); - const arg2Handle = wrapIfHandle(args.p1) as ServiceHandle; - const arg2 = new Service(arg2Handle, this._client); - await configure(arg1, arg2); - }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting.Docker/publishAsDockerComposeService', + 'Aspire.Hosting/asHttp2Service', rpcArgs ); return new DockerComposeAspireDashboardResource(result, this._client); } - /** Publishes the resource as a Docker Compose service with custom service configuration */ - publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._asHttp2ServiceInternal()); } -} - -/** - * Thenable wrapper for DockerComposeAspireDashboardResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class DockerComposeAspireDashboardResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: DockerComposeAspireDashboardResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Sets the container image tag */ - withImageTag(tag: string): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DockerComposeAspireDashboardResourcePromise { + const displayText = options?.displayText; + return new DockerComposeAspireDashboardResourcePromise(this._withUrlInternal(url, displayText)); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DockerComposeAspireDashboardResourcePromise { + const displayText = options?.displayText; + return new DockerComposeAspireDashboardResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._excludeFromManifestInternal()); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._waitForInternal(dependency)); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._waitForStartInternal(dependency)); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Prevents resource from starting automatically */ + withExplicitStart(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withExplicitStartInternal()); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DockerComposeAspireDashboardResourcePromise { + const exitCode = options?.exitCode; + return new DockerComposeAspireDashboardResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Adds a health check by key */ + withHealthCheck(key: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withHealthCheckInternal(key)); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DockerComposeAspireDashboardResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new DockerComposeAspireDashboardResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DockerComposeAspireDashboardResourcePromise { + const commandOptions = options?.commandOptions; + return new DockerComposeAspireDashboardResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DockerComposeAspireDashboardResourcePromise { + const password = options?.password; + return new DockerComposeAspireDashboardResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withChildRelationshipInternal(child)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DockerComposeAspireDashboardResourcePromise { + const iconVariant = options?.iconVariant; + return new DockerComposeAspireDashboardResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DockerComposeAspireDashboardResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new DockerComposeAspireDashboardResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._excludeFromMcpInternal()); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DockerComposeAspireDashboardResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new DockerComposeAspireDashboardResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): DockerComposeAspireDashboardResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new DockerComposeAspireDashboardResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._onResourceReadyInternal(callback)); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/withHostPort', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Sets the host port for the Aspire dashboard */ + withHostPort(options?: WithHostPortOptions): DockerComposeAspireDashboardResourcePromise { + const port = options?.port; + return new DockerComposeAspireDashboardResourcePromise(this._withHostPortInternal(port)); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** @internal */ + private async _withForwardedHeadersInternal(enabled?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (enabled !== undefined) rpcArgs.enabled = enabled; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/withForwardedHeaders', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + /** Enables or disables forwarded headers support for the Aspire dashboard */ + withForwardedHeaders(options?: WithForwardedHeadersOptions): DockerComposeAspireDashboardResourcePromise { + const enabled = options?.enabled; + return new DockerComposeAspireDashboardResourcePromise(this._withForwardedHeadersInternal(enabled)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as DockerComposeServiceResourceHandle; + const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); + const arg2Handle = wrapIfHandle(arg2Data) as ServiceHandle; + const arg2 = new Service(arg2Handle, this._client); + await configure(arg1, arg2); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/publishAsDockerComposeService', + rpcArgs + ); + return new DockerComposeAspireDashboardResource(result, this._client); } - /** Sets the host port for the Aspire dashboard */ - withHostPort(options?: WithHostPortOptions): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withHostPort(options))); - } - - /** Enables or disables forwarded headers support for the Aspire dashboard */ - withForwardedHeaders(options?: WithForwardedHeadersOptions): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withForwardedHeaders(options))); - } - - /** Publishes the resource as a Docker Compose service with custom service configuration */ - publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): DockerComposeAspireDashboardResourcePromise { - return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); } } -// ============================================================================ -// DockerComposeEnvironmentResource -// ============================================================================ +/** + * Thenable wrapper for DockerComposeAspireDashboardResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DockerComposeAspireDashboardResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} -export class DockerComposeEnvironmentResource extends ResourceBuilderBase { - constructor(handle: DockerComposeEnvironmentResourceHandle, client: AspireClientRpc) { - super(handle, client); + then( + onfulfilled?: ((value: DockerComposeAspireDashboardResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Gets the DefaultNetworkName property */ - defaultNetworkName = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.Docker/DockerComposeEnvironmentResource.defaultNetworkName', - { context: this._handle } - ); - }, - set: async (value: string): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.Docker/DockerComposeEnvironmentResource.setDefaultNetworkName', - { context: this._handle, value } - ); - } - }; + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } - /** Gets the DashboardEnabled property */ - dashboardEnabled = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.Docker/DockerComposeEnvironmentResource.dashboardEnabled', - { context: this._handle } - ); - }, - set: async (value: boolean): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.Docker/DockerComposeEnvironmentResource.setDashboardEnabled', - { context: this._handle, value } - ); - } - }; + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } - /** Gets the Name property */ - name = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.Docker/DockerComposeEnvironmentResource.name', - { context: this._handle } - ); - }, - }; + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new DockerComposeEnvironmentResource(result, this._client); + /** Sets the container image tag */ + withImageTag(tag: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._withContainerRegistryInternal(registry)); + /** Sets the container image registry */ + withImageRegistry(registry: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new DockerComposeEnvironmentResource(result, this._client); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DockerComposeEnvironmentResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new DockerComposeEnvironmentResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new DockerComposeEnvironmentResource(result, this._client); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DockerComposeEnvironmentResourcePromise { - const helpLink = options?.helpLink; - return new DockerComposeEnvironmentResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new DockerComposeEnvironmentResource(result, this._client); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Configures the resource to be published as a container */ + publishAsContainer(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.publishAsContainer())); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new DockerComposeEnvironmentResource(result, this._client); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets the container name */ + withContainerName(name: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withContainerName(name))); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new DockerComposeEnvironmentResource(result, this._client); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DockerComposeEnvironmentResourcePromise { - const displayText = options?.displayText; - return new DockerComposeEnvironmentResourcePromise(this._withUrlInternal(url, displayText)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new DockerComposeEnvironmentResource(result, this._client); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DockerComposeEnvironmentResourcePromise { - const displayText = options?.displayText; - return new DockerComposeEnvironmentResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new DockerComposeEnvironmentResource(result, this._client); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new DockerComposeEnvironmentResource(result, this._client); + /** Configures OTLP telemetry export */ + withOtlpExporter(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._excludeFromManifestInternal()); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new DockerComposeEnvironmentResource(result, this._client); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._withExplicitStartInternal()); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new DockerComposeEnvironmentResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Adds a health check by key */ - withHealthCheck(key: string): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._withHealthCheckInternal(key)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new DockerComposeEnvironmentResource(result, this._client); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DockerComposeEnvironmentResourcePromise { - const commandOptions = options?.commandOptions; - return new DockerComposeEnvironmentResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new DockerComposeEnvironmentResource(result, this._client); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._withParentRelationshipInternal(parent)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new DockerComposeEnvironmentResource(result, this._client); + /** Adds arguments */ + withArgs(args: string[]): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new DockerComposeEnvironmentResource(result, this._client); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DockerComposeEnvironmentResourcePromise { - const iconVariant = options?.iconVariant; - return new DockerComposeEnvironmentResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new DockerComposeEnvironmentResource(result, this._client); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._excludeFromMcpInternal()); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new DockerComposeEnvironmentResource(result, this._client); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new DockerComposeEnvironmentResource(result, this._client); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new DockerComposeEnvironmentResource(result, this._client); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DockerComposeEnvironmentResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new DockerComposeEnvironmentResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new DockerComposeEnvironmentResource(result, this._client); + /** Configures resource for HTTP/2 */ + asHttp2Service(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new DockerComposeEnvironmentResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _withPropertiesInternal(configure: (obj: DockerComposeEnvironmentResource) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as DockerComposeEnvironmentResourceHandle; - const obj = new DockerComposeEnvironmentResource(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Docker/withProperties', - rpcArgs - ); - return new DockerComposeEnvironmentResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Configures properties of the Docker Compose environment */ - withProperties(configure: (obj: DockerComposeEnvironmentResource) => Promise): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._withPropertiesInternal(configure)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** @internal */ - private async _withDashboardInternal(enabled?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (enabled !== undefined) rpcArgs.enabled = enabled; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Docker/withDashboard', - rpcArgs - ); - return new DockerComposeEnvironmentResource(result, this._client); - } - - /** Enables or disables the Aspire dashboard for the Docker Compose environment */ - withDashboard(options?: WithDashboardOptions): DockerComposeEnvironmentResourcePromise { - const enabled = options?.enabled; - return new DockerComposeEnvironmentResourcePromise(this._withDashboardInternal(enabled)); - } - - /** @internal */ - private async _configureDashboardInternal(configure: (obj: DockerComposeAspireDashboardResource) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as DockerComposeAspireDashboardResourceHandle; - const obj = new DockerComposeAspireDashboardResource(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Docker/configureDashboard', - rpcArgs - ); - return new DockerComposeEnvironmentResource(result, this._client); - } - - /** Configures the Aspire dashboard resource for the Docker Compose environment */ - configureDashboard(configure: (obj: DockerComposeAspireDashboardResource) => Promise): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._configureDashboardInternal(configure)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } -} - -/** - * Thenable wrapper for DockerComposeEnvironmentResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class DockerComposeEnvironmentResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: DockerComposeEnvironmentResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Prevents resource from starting automatically */ + withExplicitStart(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Adds a health check by key */ + withHealthCheck(key: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Adds a health check by key */ - withHealthCheck(key: string): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } /** Gets the resource name */ @@ -9085,244 +11483,290 @@ export class DockerComposeEnvironmentResourcePromise implements PromiseLike obj.getResourceName()); } - /** Configures properties of the Docker Compose environment */ - withProperties(configure: (obj: DockerComposeEnvironmentResource) => Promise): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withProperties(configure))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Enables or disables the Aspire dashboard for the Docker Compose environment */ - withDashboard(options?: WithDashboardOptions): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withDashboard(options))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Configures the Aspire dashboard resource for the Docker Compose environment */ - configureDashboard(configure: (obj: DockerComposeAspireDashboardResource) => Promise): DockerComposeEnvironmentResourcePromise { - return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.configureDashboard(configure))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Sets the host port for the Aspire dashboard */ + withHostPort(options?: WithHostPortOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + + /** Enables or disables forwarded headers support for the Aspire dashboard */ + withForwardedHeaders(options?: WithForwardedHeadersOptions): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.withForwardedHeaders(options))); + } + + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): DockerComposeAspireDashboardResourcePromise { + return new DockerComposeAspireDashboardResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); } } // ============================================================================ -// DockerComposeServiceResource +// DockerComposeEnvironmentResource // ============================================================================ -export class DockerComposeServiceResource extends ResourceBuilderBase { - constructor(handle: DockerComposeServiceResourceHandle, client: AspireClientRpc) { +export class DockerComposeEnvironmentResource extends ResourceBuilderBase { + constructor(handle: DockerComposeEnvironmentResourceHandle, client: AspireClientRpc) { super(handle, client); } - /** Gets the Parent property */ - parent = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.Docker/DockerComposeServiceResource.parent', + /** Gets the DefaultNetworkName property */ + defaultNetworkName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeEnvironmentResource.defaultNetworkName', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeEnvironmentResource.setDefaultNetworkName', + { context: this._handle, value } + ); + } + }; + + /** Gets the DashboardEnabled property */ + dashboardEnabled = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeEnvironmentResource.dashboardEnabled', { context: this._handle } ); - return new DockerComposeEnvironmentResource(handle, this._client); }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeEnvironmentResource.setDashboardEnabled', + { context: this._handle, value } + ); + } }; /** Gets the Name property */ name = { get: async (): Promise => { return await this._client.invokeCapability( - 'Aspire.Hosting.Docker/DockerComposeServiceResource.name', + 'Aspire.Hosting.Docker/DockerComposeEnvironmentResource.name', { context: this._handle } ); }, }; /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new DockerComposeServiceResource(result, this._client); + return new DockerComposeEnvironmentResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new DockerComposeServiceResource(result, this._client); + return new DockerComposeEnvironmentResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DockerComposeServiceResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DockerComposeEnvironmentResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new DockerComposeServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new DockerComposeEnvironmentResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new DockerComposeServiceResource(result, this._client); + return new DockerComposeEnvironmentResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DockerComposeServiceResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DockerComposeEnvironmentResourcePromise { const helpLink = options?.helpLink; - return new DockerComposeServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new DockerComposeEnvironmentResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new DockerComposeServiceResource(result, this._client); + return new DockerComposeEnvironmentResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new DockerComposeServiceResource(result, this._client); + return new DockerComposeEnvironmentResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new DockerComposeServiceResource(result, this._client); + return new DockerComposeEnvironmentResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DockerComposeServiceResourcePromise { + withUrl(url: string, options?: WithUrlOptions): DockerComposeEnvironmentResourcePromise { const displayText = options?.displayText; - return new DockerComposeServiceResourcePromise(this._withUrlInternal(url, displayText)); + return new DockerComposeEnvironmentResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new DockerComposeServiceResource(result, this._client); + return new DockerComposeEnvironmentResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DockerComposeServiceResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DockerComposeEnvironmentResourcePromise { const displayText = options?.displayText; - return new DockerComposeServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new DockerComposeEnvironmentResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new DockerComposeServiceResource(result, this._client); + return new DockerComposeEnvironmentResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new DockerComposeServiceResource(result, this._client); + return new DockerComposeEnvironmentResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new DockerComposeServiceResource(result, this._client); + return new DockerComposeEnvironmentResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new DockerComposeServiceResource(result, this._client); + return new DockerComposeEnvironmentResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -9330,113 +11774,83 @@ export class DockerComposeServiceResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new DockerComposeServiceResource(result, this._client); + return new DockerComposeEnvironmentResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DockerComposeServiceResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DockerComposeEnvironmentResourcePromise { const commandOptions = options?.commandOptions; - return new DockerComposeServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new DockerComposeEnvironmentResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new DockerComposeServiceResource(result, this._client); + return new DockerComposeEnvironmentResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new DockerComposeServiceResource(result, this._client); + return new DockerComposeEnvironmentResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new DockerComposeServiceResource(result, this._client); + return new DockerComposeEnvironmentResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DockerComposeServiceResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): DockerComposeEnvironmentResourcePromise { const iconVariant = options?.iconVariant; - return new DockerComposeServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new DockerComposeEnvironmentResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new DockerComposeServiceResource(result, this._client); + return new DockerComposeEnvironmentResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._excludeFromMcpInternal()); - } - - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new DockerComposeServiceResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new DockerComposeServiceResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + excludeFromMcp(): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -9447,60 +11861,60 @@ export class DockerComposeServiceResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new DockerComposeServiceResource(result, this._client); + return new DockerComposeEnvironmentResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DockerComposeServiceResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DockerComposeEnvironmentResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new DockerComposeServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new DockerComposeEnvironmentResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new DockerComposeServiceResource(result, this._client); + return new DockerComposeEnvironmentResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new DockerComposeServiceResource(result, this._client); + return new DockerComposeEnvironmentResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -9512,126 +11926,253 @@ export class DockerComposeServiceResource extends ResourceBuilderBase { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: DockerComposeServiceResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withPropertiesInternal(configure: (obj: DockerComposeEnvironmentResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as DockerComposeEnvironmentResourceHandle; + const obj = new DockerComposeEnvironmentResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/withProperties', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Configures properties of the Docker Compose environment */ + withProperties(configure: (obj: DockerComposeEnvironmentResource) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._withPropertiesInternal(configure)); + } + + /** @internal */ + private async _withDashboardInternal(enabled?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (enabled !== undefined) rpcArgs.enabled = enabled; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/withDashboard', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Enables or disables the Aspire dashboard for the Docker Compose environment */ + withDashboard(options?: WithDashboardOptions): DockerComposeEnvironmentResourcePromise { + const enabled = options?.enabled; + return new DockerComposeEnvironmentResourcePromise(this._withDashboardInternal(enabled)); + } + + /** @internal */ + private async _configureDashboardInternal(configure: (obj: DockerComposeAspireDashboardResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as DockerComposeAspireDashboardResourceHandle; + const obj = new DockerComposeAspireDashboardResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/configureDashboard', + rpcArgs + ); + return new DockerComposeEnvironmentResource(result, this._client); + } + + /** Configures the Aspire dashboard resource for the Docker Compose environment */ + configureDashboard(configure: (obj: DockerComposeAspireDashboardResource) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._configureDashboardInternal(configure)); + } + +} + +/** + * Thenable wrapper for DockerComposeEnvironmentResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DockerComposeEnvironmentResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DockerComposeEnvironmentResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Prevents resource from starting automatically */ - withExplicitStart(): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Adds a health check by key */ - withHealthCheck(key: string): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + excludeFromMcp(): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DockerComposeServiceResourcePromise { - return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -9639,3718 +12180,3979 @@ export class DockerComposeServiceResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures properties of the Docker Compose environment */ + withProperties(configure: (obj: DockerComposeEnvironmentResource) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withProperties(configure))); + } + + /** Enables or disables the Aspire dashboard for the Docker Compose environment */ + withDashboard(options?: WithDashboardOptions): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.withDashboard(options))); + } + + /** Configures the Aspire dashboard resource for the Docker Compose environment */ + configureDashboard(configure: (obj: DockerComposeAspireDashboardResource) => Promise): DockerComposeEnvironmentResourcePromise { + return new DockerComposeEnvironmentResourcePromise(this._promise.then(obj => obj.configureDashboard(configure))); + } + } // ============================================================================ -// DotnetToolResource +// DockerComposeServiceResource // ============================================================================ -export class DotnetToolResource extends ResourceBuilderBase { - constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { +export class DockerComposeServiceResource extends ResourceBuilderBase { + constructor(handle: DockerComposeServiceResourceHandle, client: AspireClientRpc) { super(handle, client); } + /** Gets the Parent property */ + parent = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeServiceResource.parent', + { context: this._handle } + ); + return new DockerComposeEnvironmentResource(handle, this._client); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Docker/DockerComposeServiceResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DockerComposeServiceResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DockerComposeServiceResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DockerComposeServiceResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new DockerComposeServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withToolPackageInternal(packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPackage', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DockerComposeServiceResource(result, this._client); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DockerComposeServiceResourcePromise { + const helpLink = options?.helpLink; + return new DockerComposeServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withToolVersionInternal(version: string): Promise { - const rpcArgs: Record = { builder: this._handle, version }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolVersion', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DockerComposeServiceResource(result, this._client); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withToolPrereleaseInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPrerelease', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DockerComposeServiceResource(result, this._client); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withToolSourceInternal(source: string): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolSource', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DockerComposeServiceResource(result, this._client); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DockerComposeServiceResourcePromise { + const displayText = options?.displayText; + return new DockerComposeServiceResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withToolIgnoreExistingFeedsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreExistingFeeds', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DockerComposeServiceResource(result, this._client); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DockerComposeServiceResourcePromise { + const displayText = options?.displayText; + return new DockerComposeServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withToolIgnoreFailedSourcesInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreFailedSources', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DockerComposeServiceResource(result, this._client); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _publishAsDockerFileInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFile', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DockerComposeServiceResource(result, this._client); } - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; - const obj = new ContainerResource(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFileWithConfigure', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DockerComposeServiceResource(result, this._client); } - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + /** Prevents resource from starting automatically */ + withExplicitStart(): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withExecutableCommandInternal(command: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExecutableCommand', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DockerComposeServiceResource(result, this._client); } - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + /** Adds a health check by key */ + withHealthCheck(key: string): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { - const rpcArgs: Record = { builder: this._handle, workingDirectory }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withWorkingDirectory', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DockerComposeServiceResource(result, this._client); } - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DockerComposeServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new DockerComposeServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DockerComposeServiceResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DockerComposeServiceResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DockerComposeServiceResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DockerComposeServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new DockerComposeServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DockerComposeServiceResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - const helpLink = options?.helpLink; - return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DockerComposeServiceResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DockerComposeServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new DockerComposeServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DockerComposeServiceResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DockerComposeServiceResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DockerComposeServiceResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DockerComposeServiceResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsInternal(args)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DockerComposeServiceResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DockerComposeServiceResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._onResourceReadyInternal(callback)); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new DotnetToolResource(result, this._client); +} + +/** + * Thenable wrapper for DockerComposeServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DockerComposeServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DockerComposeServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Adds a health check by key */ + withHealthCheck(key: string): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DockerComposeServiceResourcePromise { + return new DockerComposeServiceResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// DotnetToolResource +// ============================================================================ + +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + 'Aspire.Hosting/withToolPackage', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + 'Aspire.Hosting/withToolVersion', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { - const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + 'Aspire.Hosting/withToolPrerelease', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { - const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + 'Aspire.Hosting/withToolSource', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + 'Aspire.Hosting/withToolIgnoreExistingFeeds', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _withToolIgnoreFailedSourcesInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + 'Aspire.Hosting/withToolIgnoreFailedSources', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + 'Aspire.Hosting/withMcpServer', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { - const exitCode = options?.exitCode; - return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { - const commandOptions = options?.commandOptions; - return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { - const password = options?.password; - return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withArgs', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withArgsCallback', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { - const iconVariant = options?.iconVariant; - return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + 'Aspire.Hosting/withReference', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + 'Aspire.Hosting/withReferenceUri', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); - } - + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + } + /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + 'Aspire.Hosting/withEndpoint', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', rpcArgs ); } /** @internal */ - private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { - const configureId = registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as DockerComposeServiceResourceHandle; - const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); - const arg2Handle = wrapIfHandle(args.p1) as ServiceHandle; - const arg2 = new Service(arg2Handle, this._client); - await configure(arg1, arg2); - }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting.Docker/publishAsDockerComposeService', + 'Aspire.Hosting/asHttp2Service', rpcArgs ); return new DotnetToolResource(result, this._client); } - /** Publishes the resource as a Docker Compose service with custom service configuration */ - publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); } -} - -/** - * Thenable wrapper for DotnetToolResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class DotnetToolResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } - then( - onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + const displayText = options?.displayText; + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + const exitCode = options?.exitCode; + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + const commandOptions = options?.commandOptions; + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + const password = options?.password; + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + const iconVariant = options?.iconVariant; + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as DockerComposeServiceResourceHandle; + const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); + const arg2Handle = wrapIfHandle(arg2Data) as ServiceHandle; + const arg2 = new Service(arg2Handle, this._client); + await configure(arg1, arg2); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/publishAsDockerComposeService', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } /** Publishes the resource as a Docker Compose service with custom service configuration */ publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); + return new DotnetToolResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); } } -// ============================================================================ -// ExecutableResource -// ============================================================================ - -export class ExecutableResource extends ResourceBuilderBase { - constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { - super(handle, client); - } +/** + * Thenable wrapper for DotnetToolResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new ExecutableResource(result, this._client); + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); - } - - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new ExecutableResource(result, this._client); + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); } - /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); } - /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - const helpLink = options?.helpLink; - return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsInternal(args)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); + } + +} + +// ============================================================================ +// ExecutableResource +// ============================================================================ + +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); - } - - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { + private async _publishAsDockerFileInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const rpcArgs: Record = { builder: this._handle, configure: configureId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { - const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + 'Aspire.Hosting/withMcpServer', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { - const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForInternal(dependency)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExplicitStartInternal()); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/withArgs', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { - const exitCode = options?.exitCode; - return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + 'Aspire.Hosting/withArgsCallback', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + 'Aspire.Hosting/withReference', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { - const commandOptions = options?.commandOptions; - return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + 'Aspire.Hosting/withReferenceUri', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { - const password = options?.password; - return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + 'Aspire.Hosting/withEndpoint', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs ); return new ExecutableResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { - const iconVariant = options?.iconVariant; - return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + 'Aspire.Hosting/asHttp2Service', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + 'Aspire.Hosting/withUrl', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + 'Aspire.Hosting/withUrlExpression', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); + return new ExecutableResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { - const configureId = registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as DockerComposeServiceResourceHandle; - const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); - const arg2Handle = wrapIfHandle(args.p1) as ServiceHandle; - const arg2 = new Service(arg2Handle, this._client); - await configure(arg1, arg2); - }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting.Docker/publishAsDockerComposeService', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ExecutableResource(result, this._client); } - /** Publishes the resource as a Docker Compose service with custom service configuration */ - publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); } -} - -/** - * Thenable wrapper for ExecutableResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ExecutableResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } - - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } - - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceReadyInternal(callback)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as DockerComposeServiceResourceHandle; + const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); + const arg2Handle = wrapIfHandle(arg2Data) as ServiceHandle; + const arg2 = new Service(arg2Handle, this._client); + await configure(arg1, arg2); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/publishAsDockerComposeService', + rpcArgs + ); + return new ExecutableResource(result, this._client); } /** Publishes the resource as a Docker Compose service with custom service configuration */ publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); + return new ExecutableResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); } } -// ============================================================================ -// ExternalServiceResource -// ============================================================================ - -export class ExternalServiceResource extends ResourceBuilderBase { - constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { - super(handle, client); - } - - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** @internal */ - private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalServiceHttpHealthCheck', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - const helpLink = options?.helpLink; - return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - const commandOptions = options?.commandOptions; - return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - const iconVariant = options?.iconVariant; - return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new ExternalServiceResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } -} - -/** - * Thenable wrapper for ExternalServiceResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ExternalServiceResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); } } // ============================================================================ -// ParameterResource +// ExternalServiceResource // ============================================================================ -export class ParameterResource extends ResourceBuilderBase { - constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, description }; - if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDescription', + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - const enableMarkdown = options?.enableMarkdown; - return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { const helpLink = options?.helpLink; - return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -13358,113 +16160,83 @@ export class ParameterResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { const commandOptions = options?.commandOptions; - return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { const iconVariant = options?.iconVariant; - return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromMcpInternal()); - } - - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ParameterResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ParameterResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -13475,60 +16247,60 @@ export class ParameterResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExternalServiceResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -13540,131 +16312,201 @@ export class ParameterResource extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** - * Thenable wrapper for ParameterResource that enables fluent chaining. + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ParameterResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -13672,383 +16514,435 @@ export class ParameterResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ -// ProjectResource +// JavaScriptAppResource // ============================================================================ -export class ProjectResource extends ResourceBuilderBase { - constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { +export class JavaScriptAppResource extends ResourceBuilderBase { + constructor(handle: JavaScriptAppResourceHandle, client: AspireClientRpc) { super(handle, client); } + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new JavaScriptAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _publishAsDockerFileInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', - rpcArgs - ); - return new ProjectResource(result, this._client); + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterInternal()); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - const helpLink = options?.helpLink; - return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + const helpLink = options?.helpLink; + return new JavaScriptAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new JavaScriptAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -14058,15 +16952,15 @@ export class ProjectResource extends ResourceBuilderBase if (isProxied !== undefined) rpcArgs.isProxied = isProxied; if (isExternal !== undefined) rpcArgs.isExternal = isExternal; if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -14075,72 +16969,72 @@ export class ProjectResource extends ResourceBuilderBase const isProxied = options?.isProxied; const isExternal = options?.isExternal; const protocol = options?.protocol; - return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + return new JavaScriptAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new JavaScriptAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new JavaScriptAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -14153,293 +17047,308 @@ export class ProjectResource extends ResourceBuilderBase } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + return new JavaScriptAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new JavaScriptAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _clearContainerFilesSourcesInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { const exitCode = options?.exitCode; - return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new JavaScriptAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new JavaScriptAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -14447,130 +17356,130 @@ export class ProjectResource extends ResourceBuilderBase }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { const commandOptions = options?.commandOptions; - return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new JavaScriptAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { const password = options?.password; - return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new JavaScriptAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { const iconVariant = options?.iconVariant; - return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new JavaScriptAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -14579,15 +17488,15 @@ export class ProjectResource extends ResourceBuilderBase if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -14595,56 +17504,56 @@ export class ProjectResource extends ResourceBuilderBase const failureThreshold = options?.failureThreshold; const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new JavaScriptAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -14655,60 +17564,60 @@ export class ProjectResource extends ResourceBuilderBase if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; if (tags !== undefined) rpcArgs.tags = tags; if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new JavaScriptAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -14721,173 +17630,401 @@ export class ProjectResource extends ResourceBuilderBase } /** @internal */ - private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { - const configureId = registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as DockerComposeServiceResourceHandle; - const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); - const arg2Handle = wrapIfHandle(args.p1) as ServiceHandle; - const arg2 = new Service(arg2Handle, this._client); - await configure(arg1, arg2); + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Docker/publishAsDockerComposeService', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ProjectResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Publishes the resource as a Docker Compose service with custom service configuration */ - publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); } -} - -/** - * Thenable wrapper for ProjectResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ProjectResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceReadyInternal(callback)); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withBunInternal(install, installArgs)); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withYarnInternal(install, installArgs)); } - /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withPnpmInternal(install, installArgs)); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + const browser = options?.browser; + return new JavaScriptAppResourcePromise(this._withBrowserDebuggerInternal(browser)); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** @internal */ + private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as DockerComposeServiceResourceHandle; + const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); + const arg2Handle = wrapIfHandle(arg2Data) as ServiceHandle; + const arg2 = new Service(arg2Handle, this._client); + await configure(arg1, arg2); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/publishAsDockerComposeService', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); - } +} - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); - } +/** + * Thenable wrapper for JavaScriptAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class JavaScriptAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: JavaScriptAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -14896,163 +18033,168 @@ export class ProjectResourcePromise implements PromiseLike { } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -15060,1596 +18202,1577 @@ export class ProjectResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + /** Publishes the resource as a Docker Compose service with custom service configuration */ - publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); } } // ============================================================================ -// RedisCommanderResource +// NodeAppResource // ============================================================================ -export class RedisCommanderResource extends ResourceBuilderBase { - constructor(handle: RedisCommanderResourceHandle, client: AspireClientRpc) { +export class NodeAppResource extends ResourceBuilderBase { + constructor(handle: NodeAppResourceHandle, client: AspireClientRpc) { super(handle, client); } + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisCommanderResourcePromise { - const isReadOnly = options?.isReadOnly; - return new RedisCommanderResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new NodeAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withImageTagInternal(tag)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withImageRegistryInternal(registry)); + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): RedisCommanderResourcePromise { - const tag = options?.tag; - return new RedisCommanderResourcePromise(this._withImageInternal(image, tag)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withImageSHA256Internal(sha256)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withLifetimeInternal(lifetime)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + const helpLink = options?.helpLink; + return new NodeAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._publishAsContainerInternal()); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisCommanderResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new RedisCommanderResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withContainerNameInternal(name)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withBuildArgInternal(name, value)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withBuildSecretInternal(name, value)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Adds arguments */ + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisCommanderResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new RedisCommanderResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): RedisCommanderResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new RedisCommanderResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new NodeAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withOtlpExporterInternal()); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._publishAsConnectionStringInternal()); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisCommanderResourcePromise { - const helpLink = options?.helpLink; - return new RedisCommanderResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new NodeAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withArgsInternal(args)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withArgsCallbackInternal(callback)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisCommanderResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new RedisCommanderResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withServiceReferenceInternal(source)); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._clearContainerFilesSourcesInternal()); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): RedisCommanderResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new RedisCommanderResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): RedisCommanderResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new RedisCommanderResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisCommanderResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new RedisCommanderResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Prevents resource from starting automatically */ + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + const exitCode = options?.exitCode; + return new NodeAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); + return new NodeAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._asHttp2ServiceInternal()); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + const commandOptions = options?.commandOptions; + return new NodeAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): RedisCommanderResourcePromise { - const displayText = options?.displayText; - return new RedisCommanderResourcePromise(this._withUrlInternal(url, displayText)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisCommanderResourcePromise { - const displayText = options?.displayText; - return new RedisCommanderResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + const password = options?.password; + return new NodeAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._excludeFromManifestInternal()); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._waitForInternal(dependency)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + const iconVariant = options?.iconVariant; + return new NodeAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._waitForStartInternal(dependency)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withExplicitStartInternal()); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisCommanderResourcePromise { - const exitCode = options?.exitCode; - return new RedisCommanderResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); - } - - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withHealthCheckInternal(key)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new NodeAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisCommanderResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new RedisCommanderResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisCommanderResourcePromise { - const commandOptions = options?.commandOptions; - return new RedisCommanderResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new RedisCommanderResource(result, this._client); - } - - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisCommanderResourcePromise { - const password = options?.password; - return new RedisCommanderResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withoutHttpsCertificateInternal()); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withParentRelationshipInternal(parent)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withChildRelationshipInternal(child)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): RedisCommanderResourcePromise { - const iconVariant = options?.iconVariant; - return new RedisCommanderResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisCommanderResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new RedisCommanderResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withBunInternal(install, installArgs)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._excludeFromMcpInternal()); + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withYarnInternal(install, installArgs)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withPnpmInternal(install, installArgs)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisCommanderResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new RedisCommanderResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + const browser = options?.browser; + return new NodeAppResourcePromise(this._withBrowserDebuggerInternal(browser)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); + private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as DockerComposeServiceResourceHandle; + const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); + const arg2Handle = wrapIfHandle(arg2Data) as ServiceHandle; + const arg2 = new Service(arg2Handle, this._client); + await configure(arg1, arg2); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/publishAsDockerComposeService', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withPipelineConfigurationInternal(callback)); - } - - /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): RedisCommanderResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new RedisCommanderResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); - } - - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); - } - - /** @internal */ - private async _withHostPortInternal(port?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withRedisCommanderHostPort', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); - } - - /** Sets the host port for Redis Commander */ - withHostPort(options?: WithHostPortOptions): RedisCommanderResourcePromise { - const port = options?.port; - return new RedisCommanderResourcePromise(this._withHostPortInternal(port)); - } - - /** @internal */ - private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { - const configureId = registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as DockerComposeServiceResourceHandle; - const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); - const arg2Handle = wrapIfHandle(args.p1) as ServiceHandle; - const arg2 = new Service(arg2Handle, this._client); - await configure(arg1, arg2); - }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Docker/publishAsDockerComposeService', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); - } - - /** Publishes the resource as a Docker Compose service with custom service configuration */ - publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); } } /** - * Thenable wrapper for RedisCommanderResource that enables fluent chaining. + * Thenable wrapper for NodeAppResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class RedisCommanderResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class NodeAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: RedisCommanderResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: NodeAppResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } - - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); - } - - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); - } - - /** Sets the container image tag */ - withImageTag(tag: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); - } - - /** Sets the container image registry */ - withImageRegistry(registry: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); - } - - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImage(image, options))); - } - - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); - } - - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); - } - - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); - } - - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); - } - - /** Configures the resource to be published as a container */ - publishAsContainer(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.publishAsContainer())); - } - - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); - } - - /** Sets the container name */ - withContainerName(name: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ - withOtlpExporter(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); - } - - /** Publishes the resource as a connection string */ - publishAsConnectionString(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -16658,163 +19781,173 @@ export class RedisCommanderResourcePromise implements PromiseLike obj.asHttp2Service())); + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -16822,1798 +19955,2135 @@ export class RedisCommanderResourcePromise implements PromiseLike obj.getResourceName()); } - /** Sets the host port for Redis Commander */ - withHostPort(options?: WithHostPortOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); } /** Publishes the resource as a Docker Compose service with custom service configuration */ - publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); } } // ============================================================================ -// RedisInsightResource +// ParameterResource // ============================================================================ -export class RedisInsightResource extends ResourceBuilderBase { - constructor(handle: RedisInsightResourceHandle, client: AspireClientRpc) { +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ParameterResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisInsightResourcePromise { - const isReadOnly = options?.isReadOnly; - return new RedisInsightResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withImageTagInternal(tag)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withImageRegistryInternal(registry)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): RedisInsightResourcePromise { - const tag = options?.tag; - return new RedisInsightResourcePromise(this._withImageInternal(image, tag)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withImageSHA256Internal(sha256)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withLifetimeInternal(lifetime)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _publishAsContainerInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._publishAsContainerInternal()); + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisInsightResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new RedisInsightResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withContainerNameInternal(name)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withBuildArgInternal(name, value)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withBuildSecretInternal(name, value)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new RedisInsightResource(result, this._client); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisInsightResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new RedisInsightResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); - } - - /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): RedisInsightResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new RedisInsightResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withOtlpExporterInternal()); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new RedisInsightResource(result, this._client); - } - - /** Publishes the resource as a connection string */ - publishAsConnectionString(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._publishAsConnectionStringInternal()); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisInsightResourcePromise { - const helpLink = options?.helpLink; - return new RedisInsightResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentInternal(name, value)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceReadyInternal(callback)); } - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new RedisInsightResource(result, this._client); +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', - rpcArgs - ); - return new RedisInsightResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); } - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new RedisInsightResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new RedisInsightResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new RedisInsightResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Adds arguments */ - withArgs(args: string[]): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withArgsInternal(args)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new RedisInsightResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withArgsCallbackInternal(callback)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new RedisInsightResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new RedisInsightResource(result, this._client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisInsightResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new RedisInsightResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new RedisInsightResource(result, this._client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withServiceReferenceInternal(source)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new RedisInsightResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new RedisInsightResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new RedisInsightResource(result, this._client); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new RedisInsightResource(result, this._client); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): RedisInsightResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new RedisInsightResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): RedisInsightResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new RedisInsightResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisInsightResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new RedisInsightResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withOtlpExporterInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new RedisInsightResource(result, this._client); - } - - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withExternalHttpEndpointsInternal()); + return new ProjectResource(result, this._client); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._asHttp2ServiceInternal()); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReplicasInternal(replicas)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._disableForwardedHeadersInternal()); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): RedisInsightResourcePromise { - const displayText = options?.displayText; - return new RedisInsightResourcePromise(this._withUrlInternal(url, displayText)); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + const configure = options?.configure; + return new ProjectResourcePromise(this._publishAsDockerFileInternal(configure)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisInsightResourcePromise { - const displayText = options?.displayText; - return new RedisInsightResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._excludeFromManifestInternal()); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._waitForInternal(dependency)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new RedisInsightResource(result, this._client); - } - - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); - } - - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._waitForStartInternal(dependency)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withExplicitStartInternal()); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisInsightResourcePromise { - const exitCode = options?.exitCode; - return new RedisInsightResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withHealthCheckInternal(key)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisInsightResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new RedisInsightResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisInsightResourcePromise { - const commandOptions = options?.commandOptions; - return new RedisInsightResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisInsightResourcePromise { - const password = options?.password; - return new RedisInsightResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withoutHttpsCertificateInternal()); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withParentRelationshipInternal(parent)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', rpcArgs ); - return new RedisInsightResource(result, this._client); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): RedisInsightResourcePromise { - const iconVariant = options?.iconVariant; - return new RedisInsightResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisInsightResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new RedisInsightResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._excludeFromMcpInternal()); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisInsightResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new RedisInsightResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new RedisInsightResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withHostPortInternal(port?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withRedisInsightHostPort', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the host port for Redis Insight */ - withHostPort(options?: WithHostPortOptions): RedisInsightResourcePromise { - const port = options?.port; - return new RedisInsightResourcePromise(this._withHostPortInternal(port)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withDataVolumeInternal(name?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (name !== undefined) rpcArgs.name = name; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withRedisInsightDataVolume', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a data volume for Redis Insight */ - withDataVolume(options?: WithDataVolumeOptions): RedisInsightResourcePromise { - const name = options?.name; - return new RedisInsightResourcePromise(this._withDataVolumeInternal(name)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withDataBindMountInternal(source: string): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withRedisInsightDataBindMount', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a data bind mount for Redis Insight */ - withDataBindMount(source: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withDataBindMountInternal(source)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { - const configureId = registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as DockerComposeServiceResourceHandle; - const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); - const arg2Handle = wrapIfHandle(args.p1) as ServiceHandle; - const arg2 = new Service(arg2Handle, this._client); - await configure(arg1, arg2); - }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Docker/publishAsDockerComposeService', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Publishes the resource as a Docker Compose service with custom service configuration */ - publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); } -} - -/** - * Thenable wrapper for RedisInsightResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class RedisInsightResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); + } - then( - onfulfilled?: ((value: RedisInsightResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Sets the container image registry */ - withImageRegistry(registry: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Configures the resource to be published as a container */ - publishAsContainer(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Sets the container name */ - withContainerName(name: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Adds arguments */ - withArgs(args: string[]): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceReadyInternal(callback)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as DockerComposeServiceResourceHandle; + const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); + const arg2Handle = wrapIfHandle(arg2Data) as ServiceHandle; + const arg2 = new Service(arg2Handle, this._client); + await configure(arg1, arg2); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/publishAsDockerComposeService', + rpcArgs + ); + return new ProjectResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -18621,807 +22091,6254 @@ export class RedisInsightResourcePromise implements PromiseLike obj.getResourceName()); } - /** Sets the host port for Redis Insight */ - withHostPort(options?: WithHostPortOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Adds a data volume for Redis Insight */ - withDataVolume(options?: WithDataVolumeOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Adds a data bind mount for Redis Insight */ - withDataBindMount(source: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDataBindMount(source))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } /** Publishes the resource as a Docker Compose service with custom service configuration */ - publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); } } // ============================================================================ -// RedisResource +// RedisCommanderResource // ============================================================================ -export class RedisResource extends ResourceBuilderBase { - constructor(handle: RedisResourceHandle, client: AspireClientRpc) { +export class RedisCommanderResource extends ResourceBuilderBase { + constructor(handle: RedisCommanderResourceHandle, client: AspireClientRpc) { super(handle, client); } - /** Gets the PrimaryEndpoint property */ - primaryEndpoint = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.primaryEndpoint', - { context: this._handle } - ); - return new EndpointReference(handle, this._client); - }, - }; - - /** Gets the Host property */ - host = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.host', - { context: this._handle } - ); - return new EndpointReferenceExpression(handle, this._client); - }, - }; - - /** Gets the Port property */ - port = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.port', - { context: this._handle } - ); - return new EndpointReferenceExpression(handle, this._client); - }, - }; - - /** Gets the TlsEnabled property */ - tlsEnabled = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.tlsEnabled', - { context: this._handle } - ); - }, - set: async (value: boolean): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.setTlsEnabled', - { context: this._handle, value } - ); - } - }; - - /** Gets the ConnectionStringExpression property */ - connectionStringExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.connectionStringExpression', - { context: this._handle } - ); - }, - }; - - /** Gets the UriExpression property */ - uriExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.uriExpression', - { context: this._handle } - ); - }, - }; - - /** Gets the Entrypoint property */ - entrypoint = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.entrypoint', - { context: this._handle } - ); - }, - set: async (value: string): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.setEntrypoint', - { context: this._handle, value } - ); - } - }; - - /** Gets the ShellExecution property */ - shellExecution = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.shellExecution', - { context: this._handle } - ); - }, - set: async (value: boolean): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.setShellExecution', - { context: this._handle, value } - ); - } - }; - - /** Gets the Name property */ - name = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.name', - { context: this._handle } - ); - }, - }; - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new RedisResource(result, this._client); + return new RedisCommanderResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { const rpcArgs: Record = { builder: this._handle, source, target }; if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withBindMount', rpcArgs ); - return new RedisResource(result, this._client); + return new RedisCommanderResource(result, this._client); } /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisResourcePromise { + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisCommanderResourcePromise { const isReadOnly = options?.isReadOnly; - return new RedisResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + return new RedisCommanderResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { + private async _withEntrypointInternal(entrypoint: string): Promise { const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new RedisResource(result, this._client); + return new RedisCommanderResource(result, this._client); } /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): RedisResourcePromise { - return new RedisResourcePromise(this._withEntrypointInternal(entrypoint)); + withEntrypoint(entrypoint: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { + private async _withImageTagInternal(tag: string): Promise { const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withImageTag', rpcArgs ); - return new RedisResource(result, this._client); + return new RedisCommanderResource(result, this._client); } /** Sets the container image tag */ - withImageTag(tag: string): RedisResourcePromise { - return new RedisResourcePromise(this._withImageTagInternal(tag)); + withImageTag(tag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { + private async _withImageRegistryInternal(registry: string): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new RedisResource(result, this._client); + return new RedisCommanderResource(result, this._client); } /** Sets the container image registry */ - withImageRegistry(registry: string): RedisResourcePromise { - return new RedisResourcePromise(this._withImageRegistryInternal(registry)); + withImageRegistry(registry: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { + private async _withImageInternal(image: string, tag?: string): Promise { const rpcArgs: Record = { builder: this._handle, image }; if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withImage', rpcArgs ); - return new RedisResource(result, this._client); + return new RedisCommanderResource(result, this._client); } /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): RedisResourcePromise { + withImage(image: string, options?: WithImageOptions): RedisCommanderResourcePromise { const tag = options?.tag; - return new RedisResourcePromise(this._withImageInternal(image, tag)); + return new RedisCommanderResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { + private async _withImageSHA256Internal(sha256: string): Promise { const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new RedisResource(result, this._client); + return new RedisCommanderResource(result, this._client); } /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): RedisResourcePromise { - return new RedisResourcePromise(this._withImageSHA256Internal(sha256)); + withImageSHA256(sha256: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); - return new RedisResource(result, this._client); + return new RedisCommanderResource(result, this._client); } /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): RedisResourcePromise { - return new RedisResourcePromise(this._withContainerRuntimeArgsInternal(args)); + withContainerRuntimeArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisCommanderResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new RedisCommanderResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisCommanderResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new RedisCommanderResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisCommanderResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new RedisCommanderResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisCommanderResourcePromise { + const helpLink = options?.helpLink; + return new RedisCommanderResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisCommanderResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new RedisCommanderResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisCommanderResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new RedisCommanderResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisCommanderResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisCommanderResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisCommanderResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisCommanderResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisCommanderResourcePromise { + const displayText = options?.displayText; + return new RedisCommanderResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisCommanderResourcePromise { + const displayText = options?.displayText; + return new RedisCommanderResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisCommanderResourcePromise { + const exitCode = options?.exitCode; + return new RedisCommanderResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisCommanderResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new RedisCommanderResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisCommanderResourcePromise { + const commandOptions = options?.commandOptions; + return new RedisCommanderResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisCommanderResourcePromise { + const password = options?.password; + return new RedisCommanderResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisCommanderResourcePromise { + const iconVariant = options?.iconVariant; + return new RedisCommanderResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisCommanderResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new RedisCommanderResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisCommanderResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new RedisCommanderResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisCommanderResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisCommanderResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisCommanderHostPort', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the host port for Redis Commander */ + withHostPort(options?: WithHostPortOptions): RedisCommanderResourcePromise { + const port = options?.port; + return new RedisCommanderResourcePromise(this._withHostPortInternal(port)); + } + + /** @internal */ + private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as DockerComposeServiceResourceHandle; + const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); + const arg2Handle = wrapIfHandle(arg2Data) as ServiceHandle; + const arg2 = new Service(arg2Handle, this._client); + await configure(arg1, arg2); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/publishAsDockerComposeService', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); + } + +} + +/** + * Thenable wrapper for RedisCommanderResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class RedisCommanderResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: RedisCommanderResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Sets the host port for Redis Commander */ + withHostPort(options?: WithHostPortOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); + } + +} + +// ============================================================================ +// RedisInsightResource +// ============================================================================ + +export class RedisInsightResource extends ResourceBuilderBase { + constructor(handle: RedisInsightResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisInsightResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisInsightResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisInsightResourcePromise { + const tag = options?.tag; + return new RedisInsightResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisInsightResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new RedisInsightResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisInsightResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new RedisInsightResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisInsightResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new RedisInsightResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisInsightResourcePromise { + const helpLink = options?.helpLink; + return new RedisInsightResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisInsightResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new RedisInsightResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisInsightResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new RedisInsightResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisInsightResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisInsightResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisInsightResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisInsightResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisInsightResourcePromise { + const displayText = options?.displayText; + return new RedisInsightResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisInsightResourcePromise { + const displayText = options?.displayText; + return new RedisInsightResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisInsightResourcePromise { + const exitCode = options?.exitCode; + return new RedisInsightResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisInsightResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new RedisInsightResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisInsightResourcePromise { + const commandOptions = options?.commandOptions; + return new RedisInsightResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisInsightResourcePromise { + const password = options?.password; + return new RedisInsightResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisInsightResourcePromise { + const iconVariant = options?.iconVariant; + return new RedisInsightResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisInsightResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new RedisInsightResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisInsightResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new RedisInsightResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisInsightResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsightHostPort', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the host port for Redis Insight */ + withHostPort(options?: WithHostPortOptions): RedisInsightResourcePromise { + const port = options?.port; + return new RedisInsightResourcePromise(this._withHostPortInternal(port)); + } + + /** @internal */ + private async _withDataVolumeInternal(name?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsightDataVolume', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a data volume for Redis Insight */ + withDataVolume(options?: WithDataVolumeOptions): RedisInsightResourcePromise { + const name = options?.name; + return new RedisInsightResourcePromise(this._withDataVolumeInternal(name)); + } + + /** @internal */ + private async _withDataBindMountInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsightDataBindMount', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a data bind mount for Redis Insight */ + withDataBindMount(source: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withDataBindMountInternal(source)); + } + + /** @internal */ + private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as DockerComposeServiceResourceHandle; + const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); + const arg2Handle = wrapIfHandle(arg2Data) as ServiceHandle; + const arg2 = new Service(arg2Handle, this._client); + await configure(arg1, arg2); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/publishAsDockerComposeService', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); + } + +} + +/** + * Thenable wrapper for RedisInsightResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class RedisInsightResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: RedisInsightResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Sets the host port for Redis Insight */ + withHostPort(options?: WithHostPortOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + + /** Adds a data volume for Redis Insight */ + withDataVolume(options?: WithDataVolumeOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + } + + /** Adds a data bind mount for Redis Insight */ + withDataBindMount(source: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDataBindMount(source))); + } + + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); + } + +} + +// ============================================================================ +// RedisResource +// ============================================================================ + +export class RedisResource extends ResourceBuilderBase { + constructor(handle: RedisResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the PrimaryEndpoint property */ + primaryEndpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.primaryEndpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.host', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.port', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the PasswordParameter property */ + passwordParameter = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.passwordParameter', + { context: this._handle } + ); + return new ParameterResource(handle, this._client); + }, + }; + + /** Gets the TlsEnabled property */ + tlsEnabled = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.tlsEnabled', + { context: this._handle } + ); + }, + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the Entrypoint property */ + entrypoint = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.entrypoint', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.setEntrypoint', + { context: this._handle, value } + ); + } + }; + + /** Gets the ShellExecution property */ + shellExecution = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.shellExecution', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.setShellExecution', + { context: this._handle, value } + ); + } + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisResourcePromise { + return new RedisResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisResourcePromise { + return new RedisResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisResourcePromise { + return new RedisResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisResourcePromise { + const tag = options?.tag; + return new RedisResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisResourcePromise { + return new RedisResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisResourcePromise { + return new RedisResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisResourcePromise { + return new RedisResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisResourcePromise { + return new RedisResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new RedisResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new RedisResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new RedisResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisResourcePromise { + return new RedisResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisResourcePromise { + return new RedisResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisResourcePromise { + return new RedisResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisResourcePromise { + const helpLink = options?.helpLink; + return new RedisResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new RedisResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisResourcePromise { + return new RedisResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisResourcePromise { + return new RedisResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new RedisResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisResourcePromise { + return new RedisResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisResourcePromise { + return new RedisResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisResourcePromise { + const displayText = options?.displayText; + return new RedisResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisResourcePromise { + const displayText = options?.displayText; + return new RedisResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisResourcePromise { + return new RedisResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisResourcePromise { + return new RedisResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisResourcePromise { + const exitCode = options?.exitCode; + return new RedisResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisResourcePromise { + return new RedisResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new RedisResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisResourcePromise { + const commandOptions = options?.commandOptions; + return new RedisResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisResourcePromise { + return new RedisResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisResourcePromise { + const password = options?.password; + return new RedisResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisResourcePromise { + return new RedisResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisResourcePromise { + const iconVariant = options?.iconVariant; + return new RedisResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new RedisResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisResourcePromise { + return new RedisResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisResourcePromise { + return new RedisResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisResourcePromise { + return new RedisResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new RedisResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onConnectionStringAvailableInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withRedisCommanderInternal(configureContainer?: (obj: RedisCommanderResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as RedisCommanderResourceHandle; + const obj = new RedisCommanderResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisCommander', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds Redis Commander management UI */ + withRedisCommander(options?: WithRedisCommanderOptions): RedisResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new RedisResourcePromise(this._withRedisCommanderInternal(configureContainer, containerName)); + } + + /** @internal */ + private async _withRedisInsightInternal(configureContainer?: (obj: RedisInsightResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as RedisInsightResourceHandle; + const obj = new RedisInsightResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsight', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds Redis Insight management UI */ + withRedisInsight(options?: WithRedisInsightOptions): RedisResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new RedisResourcePromise(this._withRedisInsightInternal(configureContainer, containerName)); + } + + /** @internal */ + private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withDataVolume', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a data volume with persistence */ + withDataVolume(options?: WithDataVolumeOptions): RedisResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + } + + /** @internal */ + private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withDataBindMount', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a data bind mount with persistence */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): RedisResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); + } + + /** @internal */ + private async _withPersistenceInternal(interval?: number, keysChangedThreshold?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (interval !== undefined) rpcArgs.interval = interval; + if (keysChangedThreshold !== undefined) rpcArgs.keysChangedThreshold = keysChangedThreshold; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withPersistence', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures Redis persistence */ + withPersistence(options?: WithPersistenceOptions): RedisResourcePromise { + const interval = options?.interval; + const keysChangedThreshold = options?.keysChangedThreshold; + return new RedisResourcePromise(this._withPersistenceInternal(interval, keysChangedThreshold)); + } + + /** @internal */ + private async _withPasswordInternal(password: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, password }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withPassword', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures the password for Redis */ + withPassword(password: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withPasswordInternal(password)); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withHostPort', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the host port for Redis */ + withHostPort(options?: WithHostPortOptions): RedisResourcePromise { + const port = options?.port; + return new RedisResourcePromise(this._withHostPortInternal(port)); + } + + /** @internal */ + private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as DockerComposeServiceResourceHandle; + const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); + const arg2Handle = wrapIfHandle(arg2Data) as ServiceHandle; + const arg2 = new Service(arg2Handle, this._client); + await configure(arg1, arg2); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/publishAsDockerComposeService', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); + } + +} + +/** + * Thenable wrapper for RedisResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class RedisResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: RedisResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): RedisResourcePromise { - return new RedisResourcePromise(this._withLifetimeInternal(lifetime)); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } - /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisResourcePromise { - return new RedisResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Configures the resource to be published as a container */ - publishAsContainer(): RedisResourcePromise { - return new RedisResourcePromise(this._publishAsContainerInternal()); + /** Adds Redis Commander management UI */ + withRedisCommander(options?: WithRedisCommanderOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRedisCommander(options))); } - /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Adds Redis Insight management UI */ + withRedisInsight(options?: WithRedisInsightOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRedisInsight(options))); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new RedisResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Adds a data volume with persistence */ + withDataVolume(options?: WithDataVolumeOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); } - /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Adds a data bind mount with persistence */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); } - /** Sets the container name */ - withContainerName(name: string): RedisResourcePromise { - return new RedisResourcePromise(this._withContainerNameInternal(name)); + /** Configures Redis persistence */ + withPersistence(options?: WithPersistenceOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPersistence(options))); } - /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Configures the password for Redis */ + withPassword(password: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPassword(password))); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): RedisResourcePromise { - return new RedisResourcePromise(this._withBuildArgInternal(name, value)); + /** Sets the host port for Redis */ + withHostPort(options?: WithHostPortOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHostPort(options))); } - /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): RedisResourcePromise { - return new RedisResourcePromise(this._withBuildSecretInternal(name, value)); +} + +// ============================================================================ +// ViteAppResource +// ============================================================================ + +export class ViteAppResource extends ResourceBuilderBase { + constructor(handle: ViteAppResourceHandle, client: AspireClientRpc) { + super(handle, client); } + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): RedisResourcePromise { - return new RedisResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new RedisResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); - } - - /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', - rpcArgs - ); - return new RedisResource(result, this._client); - } - - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): RedisResourcePromise { - return new RedisResourcePromise(this._withContainerNetworkAliasInternal(alias)); + return new ViteAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _publishAsDockerFileInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): RedisResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new RedisResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): RedisResourcePromise { - return new RedisResourcePromise(this._withOtlpExporterInternal()); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): RedisResourcePromise { - return new RedisResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): RedisResourcePromise { - return new RedisResourcePromise(this._publishAsConnectionStringInternal()); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisResourcePromise { - const helpLink = options?.helpLink; - return new RedisResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ViteAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentInternal(name, value)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new RedisResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + return new ViteAppResource(result, this._client); } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { + const helpLink = options?.helpLink; + return new ViteAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); - } - - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new RedisResource(result, this._client); - } - - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): RedisResourcePromise { - return new RedisResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): RedisResourcePromise { - return new RedisResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): RedisResourcePromise { - return new RedisResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new RedisResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new RedisResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new RedisResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisResourcePromise { - return new RedisResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ViteAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): RedisResourcePromise { - return new RedisResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): RedisResourcePromise { - return new RedisResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): RedisResourcePromise { - return new RedisResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -19431,15 +28348,15 @@ export class RedisResource extends ResourceBuilderBase { if (isProxied !== undefined) rpcArgs.isProxied = isProxied; if (isExternal !== undefined) rpcArgs.isExternal = isExternal; if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): RedisResourcePromise { + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -19448,72 +28365,72 @@ export class RedisResource extends ResourceBuilderBase { const isProxied = options?.isProxied; const isExternal = options?.isExternal; const protocol = options?.protocol; - return new RedisResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + return new ViteAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): RedisResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new RedisResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new RedisResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): RedisResourcePromise { - return new RedisResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -19526,278 +28443,308 @@ export class RedisResource extends ResourceBuilderBase { } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): RedisResourcePromise { - return new RedisResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): RedisResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new RedisResourcePromise(this._withUrlInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new RedisResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): RedisResourcePromise { - return new RedisResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { - return new RedisResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { - return new RedisResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): RedisResourcePromise { - return new RedisResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { const exitCode = options?.exitCode; - return new RedisResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ViteAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): RedisResourcePromise { - return new RedisResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new RedisResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new ViteAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -19805,130 +28752,130 @@ export class RedisResource extends ResourceBuilderBase { }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { const commandOptions = options?.commandOptions; - return new RedisResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ViteAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): RedisResourcePromise { - return new RedisResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): RedisResourcePromise { - return new RedisResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { const password = options?.password; - return new RedisResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new ViteAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): RedisResourcePromise { - return new RedisResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): RedisResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { const iconVariant = options?.iconVariant; - return new RedisResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ViteAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -19937,15 +28884,15 @@ export class RedisResource extends ResourceBuilderBase { if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -19953,56 +28900,56 @@ export class RedisResource extends ResourceBuilderBase { const failureThreshold = options?.failureThreshold; const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new RedisResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new ViteAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): RedisResourcePromise { - return new RedisResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): RedisResourcePromise { - return new RedisResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): RedisResourcePromise { - return new RedisResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -20013,79 +28960,60 @@ export class RedisResource extends ResourceBuilderBase { if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; if (tags !== undefined) rpcArgs.tags = tags; if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new RedisResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ViteAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withPipelineConfigurationInternal(callback)); - } - - /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', - rpcArgs - ); - return new RedisResource(result, this._client); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new RedisResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -20098,403 +29026,416 @@ export class RedisResource extends ResourceBuilderBase { } /** @internal */ - private async _withRedisCommanderInternal(configureContainer?: (obj: RedisCommanderResource) => Promise, containerName?: string): Promise { - const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as RedisCommanderResourceHandle; - const obj = new RedisCommanderResource(objHandle, this._client); - await configureContainer(obj); - }) : undefined; - const rpcArgs: Record = { builder: this._handle }; - if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; - if (containerName !== undefined) rpcArgs.containerName = containerName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withRedisCommander', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds Redis Commander management UI */ - withRedisCommander(options?: WithRedisCommanderOptions): RedisResourcePromise { - const configureContainer = options?.configureContainer; - const containerName = options?.containerName; - return new RedisResourcePromise(this._withRedisCommanderInternal(configureContainer, containerName)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withRedisInsightInternal(configureContainer?: (obj: RedisInsightResource) => Promise, containerName?: string): Promise { - const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as RedisInsightResourceHandle; - const obj = new RedisInsightResource(objHandle, this._client); - await configureContainer(obj); - }) : undefined; - const rpcArgs: Record = { builder: this._handle }; - if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; - if (containerName !== undefined) rpcArgs.containerName = containerName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withRedisInsight', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds Redis Insight management UI */ - withRedisInsight(options?: WithRedisInsightOptions): RedisResourcePromise { - const configureContainer = options?.configureContainer; - const containerName = options?.containerName; - return new RedisResourcePromise(this._withRedisInsightInternal(configureContainer, containerName)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withDataVolume', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a data volume with persistence */ - withDataVolume(options?: WithDataVolumeOptions): RedisResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new RedisResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withDataBindMount', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a data bind mount with persistence */ - withDataBindMount(source: string, options?: WithDataBindMountOptions): RedisResourcePromise { - const isReadOnly = options?.isReadOnly; - return new RedisResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withPersistenceInternal(interval?: number, keysChangedThreshold?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (interval !== undefined) rpcArgs.interval = interval; - if (keysChangedThreshold !== undefined) rpcArgs.keysChangedThreshold = keysChangedThreshold; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withPersistence', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures Redis persistence */ - withPersistence(options?: WithPersistenceOptions): RedisResourcePromise { - const interval = options?.interval; - const keysChangedThreshold = options?.keysChangedThreshold; - return new RedisResourcePromise(this._withPersistenceInternal(interval, keysChangedThreshold)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withPasswordInternal(password: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, password }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withPassword', + private async _withViteConfigInternal(configPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, configPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withViteConfig', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures the password for Redis */ - withPassword(password: ParameterResource): RedisResourcePromise { - return new RedisResourcePromise(this._withPasswordInternal(password)); + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withViteConfigInternal(configPath)); } /** @internal */ - private async _withHostPortInternal(port?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withHostPort', + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets the host port for Redis */ - withHostPort(options?: WithHostPortOptions): RedisResourcePromise { - const port = options?.port; - return new RedisResourcePromise(this._withHostPortInternal(port)); + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); } /** @internal */ - private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { - const configureId = registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as DockerComposeServiceResourceHandle; - const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); - const arg2Handle = wrapIfHandle(args.p1) as ServiceHandle; - const arg2 = new Service(arg2Handle, this._client); - await configure(arg1, arg2); - }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Docker/publishAsDockerComposeService', + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', rpcArgs ); - return new RedisResource(result, this._client); - } - - /** Publishes the resource as a Docker Compose service with custom service configuration */ - publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); - } - -} - -/** - * Thenable wrapper for RedisResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class RedisResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: RedisResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + return new ViteAppResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withBunInternal(install, installArgs)); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withYarnInternal(install, installArgs)); } - /** Sets the container image tag */ - withImageTag(tag: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withPnpmInternal(install, installArgs)); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + const browser = options?.browser; + return new ViteAppResourcePromise(this._withBrowserDebuggerInternal(browser)); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** @internal */ + private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as DockerComposeServiceResourceHandle; + const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); + const arg2Handle = wrapIfHandle(arg2Data) as ServiceHandle; + const arg2 = new Service(arg2Handle, this._client); + await configure(arg1, arg2); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Docker/publishAsDockerComposeService', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** Publishes the resource as a Docker Compose service with custom service configuration */ + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerComposeServiceInternal(configure)); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); - } +} - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); +/** + * Thenable wrapper for ViteAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ViteAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ViteAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); - } - - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); - } - - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -20503,163 +29444,168 @@ export class RedisResourcePromise implements PromiseLike { } /** Configures resource for HTTP/2 */ - asHttp2Service(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -20667,64 +29613,123 @@ export class RedisResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } - /** Adds Redis Commander management UI */ - withRedisCommander(options?: WithRedisCommanderOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withRedisCommander(options))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Adds Redis Insight management UI */ - withRedisInsight(options?: WithRedisInsightOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withRedisInsight(options))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Adds a data volume with persistence */ - withDataVolume(options?: WithDataVolumeOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Adds a data bind mount with persistence */ - withDataBindMount(source: string, options?: WithDataBindMountOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** Configures Redis persistence */ - withPersistence(options?: WithPersistenceOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withPersistence(options))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Configures the password for Redis */ - withPassword(password: ParameterResource): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withPassword(password))); + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withViteConfig(configPath))); } - /** Sets the host port for Redis */ - withHostPort(options?: WithHostPortOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); } /** Publishes the resource as a Docker Compose service with custom service configuration */ - publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); + publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); + } + +} + +// ============================================================================ +// ComputeResource +// ============================================================================ + +export class ComputeResource extends ResourceBuilderBase { + constructor(handle: IComputeResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } -} - -// ============================================================================ -// ComputeResource -// ============================================================================ + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ComputeResource(result, this._client); + } -export class ComputeResource extends ResourceBuilderBase { - constructor(handle: IComputeResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ private async _publishAsDockerComposeServiceInternal(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): Promise { - const configureId = registerCallback(async (argsData: unknown) => { - const args = argsData as { p0: unknown, p1: unknown }; - const arg1Handle = wrapIfHandle(args.p0) as DockerComposeServiceResourceHandle; + const configureId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { + const arg1Handle = wrapIfHandle(arg1Data) as DockerComposeServiceResourceHandle; const arg1 = new DockerComposeServiceResource(arg1Handle, this._client); - const arg2Handle = wrapIfHandle(args.p1) as ServiceHandle; + const arg2Handle = wrapIfHandle(arg2Data) as ServiceHandle; const arg2 = new Service(arg2Handle, this._client); await configure(arg1, arg2); }); @@ -20758,6 +29763,16 @@ export class ComputeResourcePromise implements PromiseLike { return this._promise.then(onfulfilled, onrejected); } + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + /** Publishes the resource as a Docker Compose service with custom service configuration */ publishAsDockerComposeService(configure: (arg1: DockerComposeServiceResource, arg2: Service) => Promise): ComputeResourcePromise { return new ComputeResourcePromise(this._promise.then(obj => obj.publishAsDockerComposeService(configure))); @@ -20778,7 +29793,7 @@ export class ContainerFilesDestinationResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); return new ContainerFilesDestinationResource(result, this._client); @@ -21037,7 +30052,7 @@ export class Resource extends ResourceBuilderBase { private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new Resource(result, this._client); @@ -21052,7 +30067,7 @@ export class Resource extends ResourceBuilderBase { private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new Resource(result, this._client); @@ -21095,36 +30110,6 @@ export class Resource extends ResourceBuilderBase { return new ResourcePromise(this._excludeFromMcpInternal()); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -21202,6 +30187,86 @@ export class Resource extends ResourceBuilderBase { ); } + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -21299,16 +30364,6 @@ export class ResourcePromise implements PromiseLike { return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); @@ -21329,6 +30384,26 @@ export class ResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -21468,6 +30543,35 @@ export class ResourceWithConnectionString extends ResourceBuilderBase { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._onConnectionStringAvailableInternal(callback)); + } + } /** @@ -21495,6 +30599,16 @@ export class ResourceWithConnectionStringPromise implements PromiseLike obj.withConnectionPropertyValue(name, value))); } + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + } // ============================================================================ @@ -21783,6 +30897,26 @@ export class ResourceWithEndpoints extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + } /** @@ -21850,6 +30984,11 @@ export class ResourceWithEndpointsPromise implements PromiseLike obj.withHttpProbe(probeType, options))); } + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + } // ============================================================================ @@ -21892,41 +31031,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -21937,43 +31046,38 @@ export class ResourceWithEnvironment extends ResourceBuilderBase Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -22007,10 +31111,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -22022,37 +31127,8 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -22135,7 +31211,7 @@ export class ResourceWithEnvironment extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ResourceWithEnvironment(result, this._client); @@ -22189,31 +31265,21 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withOtlpExporterProtocol(protocol))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -22229,16 +31295,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -22276,34 +31332,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike { - constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { - super(handle, client); - } - -} - -/** - * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ResourceWithServiceDiscoveryPromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - -} - // ============================================================================ // ResourceWithWaitSupport // ============================================================================ @@ -22317,7 +31345,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -22347,7 +31375,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -22378,7 +31406,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -22497,7 +31525,7 @@ export async function createBuilder(options?: CreateBuilderOptions): Promise { const error = reason instanceof Error ? reason : new Error(String(reason)); - if (reason instanceof CapabilityError) { + if (reason instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else if (reason instanceof CapabilityError) { console.error(`\n❌ Capability Error: ${error.message}`); console.error(` Code: ${(reason as CapabilityError).code}`); if ((reason as CapabilityError).capability) { @@ -22528,8 +31558,12 @@ process.on('unhandledRejection', (reason: unknown) => { }); process.on('uncaughtException', (error: Error) => { - console.error(`\n❌ Uncaught Exception: ${error.message}`); - if (error.stack) { + if (error instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + } + if (!(error instanceof AppHostUsageError) && error.stack) { console.error(error.stack); } process.exit(1); @@ -22540,22 +31574,45 @@ process.on('uncaughtException', (error: Error) => { // ============================================================================ // Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent', (handle, client) => new AfterResourcesCreatedEvent(handle as AfterResourcesCreatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent', (handle, client) => new BeforeResourceStartedEvent(handle as BeforeResourceStartedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent', (handle, client) => new BeforeStartEvent(handle as BeforeStartEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent', (handle, client) => new ConnectionStringAvailableEvent(handle as ConnectionStringAvailableEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel', (handle, client) => new DistributedApplicationModel(handle as DistributedApplicationModelHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent', (handle, client) => new InitializeResourceEvent(handle as InitializeResourceEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext', (handle, client) => new PipelineContext(handle as PipelineContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext', (handle, client) => new PipelineStepFactoryContext(handle as PipelineStepFactoryContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary', (handle, client) => new PipelineSummary(handle as PipelineSummaryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent', (handle, client) => new ResourceEndpointsAllocatedEvent(handle as ResourceEndpointsAllocatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService', (handle, client) => new ResourceLoggerService(handle as ResourceLoggerServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService', (handle, client) => new ResourceNotificationService(handle as ResourceNotificationServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent', (handle, client) => new ResourceReadyEvent(handle as ResourceReadyEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent', (handle, client) => new ResourceStoppedEvent(handle as ResourceStoppedEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); registerHandleWrapper('Aspire.Hosting.Docker/Aspire.Hosting.Docker.Resources.ComposeNodes.Service', (handle, client) => new Service(handle as ServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext', (handle, client) => new UpdateCommandStateContext(handle as UpdateCommandStateContextHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration', (handle, client) => new Configuration(handle as IConfigurationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment', (handle, client) => new HostEnvironment(handle as IHostEnvironmentHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger', (handle, client) => new Logger(handle as ILoggerHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory', (handle, client) => new LoggerFactory(handle as ILoggerFactoryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep', (handle, client) => new ReportingStep(handle as IReportingStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask', (handle, client) => new ReportingTask(handle as IReportingTaskHandle, client)); +registerHandleWrapper('System.ComponentModel/System.IServiceProvider', (handle, client) => new ServiceProvider(handle as IServiceProviderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IUserSecretsManager', (handle, client) => new UserSecretsManager(handle as IUserSecretsManagerHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); @@ -22566,11 +31623,14 @@ registerHandleWrapper('Aspire.Hosting.Docker/Aspire.Hosting.Docker.DockerCompose registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource', (handle, client) => new JavaScriptAppResource(handle as JavaScriptAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource', (handle, client) => new NodeAppResource(handle as NodeAppResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisCommanderResource', (handle, client) => new RedisCommanderResource(handle as RedisCommanderResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisInsightResource', (handle, client) => new RedisInsightResource(handle as RedisInsightResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.ApplicationModel.RedisResource', (handle, client) => new RedisResource(handle as RedisResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource', (handle, client) => new ViteAppResource(handle as ViteAppResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource', (handle, client) => new ComputeResource(handle as IComputeResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); @@ -22579,6 +31639,5 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceW registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); diff --git a/samples/health-checks-ui/ts/.modules/base.ts b/samples/health-checks-ui/ts/.modules/base.ts index 7778b0f1..b3d8b8be 100644 --- a/samples/health-checks-ui/ts/.modules/base.ts +++ b/samples/health-checks-ui/ts/.modules/base.ts @@ -1,8 +1,8 @@ -// aspire.ts - Core Aspire types: base classes, ReferenceExpression -import { Handle, AspireClient, MarshalledHandle } from './transport.js'; +// base.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle, CancellationToken, registerCancellation, registerHandleWrapper, unregisterCancellation } from './transport.js'; // Re-export transport types for convenience -export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export { Handle, AspireClient, CapabilityError, CancellationToken, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; @@ -43,22 +43,46 @@ export class ReferenceExpression { private readonly _format?: string; private readonly _valueProviders?: unknown[]; + // Conditional mode fields + private readonly _condition?: unknown; + private readonly _whenTrue?: ReferenceExpression; + private readonly _whenFalse?: ReferenceExpression; + private readonly _matchValue?: string; + // Handle mode fields (when wrapping a server-returned handle) private readonly _handle?: Handle; private readonly _client?: AspireClient; constructor(format: string, valueProviders: unknown[]); constructor(handle: Handle, client: AspireClient); - constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { - if (typeof handleOrFormat === 'string') { - this._format = handleOrFormat; - this._valueProviders = clientOrValueProviders as unknown[]; + constructor(condition: unknown, matchValue: string, whenTrue: ReferenceExpression, whenFalse: ReferenceExpression); + constructor( + handleOrFormatOrCondition: Handle | string | unknown, + clientOrValueProvidersOrMatchValue: AspireClient | unknown[] | string, + whenTrueOrWhenFalse?: ReferenceExpression, + whenFalse?: ReferenceExpression + ) { + if (typeof handleOrFormatOrCondition === 'string') { + this._format = handleOrFormatOrCondition; + this._valueProviders = clientOrValueProvidersOrMatchValue as unknown[]; + } else if (handleOrFormatOrCondition instanceof Handle) { + this._handle = handleOrFormatOrCondition; + this._client = clientOrValueProvidersOrMatchValue as AspireClient; } else { - this._handle = handleOrFormat; - this._client = clientOrValueProviders as AspireClient; + this._condition = handleOrFormatOrCondition; + this._matchValue = (clientOrValueProvidersOrMatchValue as string) ?? 'True'; + this._whenTrue = whenTrueOrWhenFalse; + this._whenFalse = whenFalse; } } + /** + * Gets whether this reference expression is conditional. + */ + get isConditional(): boolean { + return this._condition !== undefined; + } + /** * Creates a reference expression from a tagged template literal. * @@ -82,16 +106,46 @@ export class ReferenceExpression { return new ReferenceExpression(format, valueProviders); } + /** + * Creates a conditional reference expression from its constituent parts. + * + * @param condition - A value provider whose result is compared to matchValue + * @param whenTrue - The expression to use when the condition matches + * @param whenFalse - The expression to use when the condition does not match + * @param matchValue - The value to compare the condition against (defaults to "True") + * @returns A ReferenceExpression instance in conditional mode + */ + static createConditional( + condition: unknown, + matchValue: string, + whenTrue: ReferenceExpression, + whenFalse: ReferenceExpression + ): ReferenceExpression { + return new ReferenceExpression(condition, matchValue, whenTrue, whenFalse); + } + /** * Serializes the reference expression for JSON-RPC transport. - * In template-literal mode, uses the $expr format. + * In expression mode, uses the $expr format with format + valueProviders. + * In conditional mode, uses the $expr format with condition + whenTrue + whenFalse. * In handle mode, delegates to the handle's serialization. */ - toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } | { condition: unknown; whenTrue: unknown; whenFalse: unknown; matchValue: string } } | MarshalledHandle { if (this._handle) { return this._handle.toJSON(); } + if (this.isConditional) { + return { + $expr: { + condition: extractHandleForExpr(this._condition), + whenTrue: this._whenTrue!.toJSON(), + whenFalse: this._whenFalse!.toJSON(), + matchValue: this._matchValue! + } + }; + } + return { $expr: { format: this._format!, @@ -100,6 +154,30 @@ export class ReferenceExpression { }; } + /** + * Resolves the expression to its string value on the server. + * Only available on server-returned ReferenceExpression instances (handle mode). + * + * @param cancellationToken - Optional AbortSignal or CancellationToken for cancellation support + * @returns The resolved string value, or null if the expression resolves to null + */ + async getValue(cancellationToken?: AbortSignal | CancellationToken): Promise { + if (!this._handle || !this._client) { + throw new Error('getValue is only available on server-returned ReferenceExpression instances'); + } + const cancellationTokenId = registerCancellation(this._client, cancellationToken); + try { + const rpcArgs: Record = { context: this._handle }; + if (cancellationTokenId !== undefined) rpcArgs.cancellationToken = cancellationTokenId; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValue', + rpcArgs + ); + } finally { + unregisterCancellation(cancellationTokenId); + } + } + /** * String representation for debugging. */ @@ -107,10 +185,17 @@ export class ReferenceExpression { if (this._handle) { return `ReferenceExpression(handle)`; } + if (this.isConditional) { + return `ReferenceExpression(conditional)`; + } return `ReferenceExpression(${this._format})`; } } +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression', (handle, client) => + new ReferenceExpression(handle, client) +); + /** * Extracts a value for use in reference expressions. * Supports handles (objects) and string literals. @@ -136,15 +221,15 @@ function extractHandleForExpr(value: unknown): unknown { return value.toJSON(); } - // Objects with $handle property (already in handle format) - if (typeof value === 'object' && value !== null && '$handle' in value) { + // Objects with marshalled expression/handle payloads + if (typeof value === 'object' && value !== null && ('$handle' in value || '$expr' in value)) { return value; } - // Objects with toJSON that returns a handle + // Objects with toJSON that returns a marshalled expression or handle if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { const json = value.toJSON(); - if (json && typeof json === 'object' && '$handle' in json) { + if (json && typeof json === 'object' && ('$handle' in json || '$expr' in json)) { return json; } } @@ -307,11 +392,20 @@ export class AspireList { }) as T[]; } - toJSON(): MarshalledHandle { - if (this._resolvedHandle) { - return this._resolvedHandle.toJSON(); + async toTransportValue(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireList must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); } - return this._handleOrContext.toJSON(); + + return this._resolvedHandle.toJSON(); } } @@ -466,8 +560,19 @@ export class AspireDict { }) as Record; } - async toJSON(): Promise { + async toTransportValue(): Promise { const handle = await this._ensureHandle(); return handle.toJSON(); } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireDict must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); + } + + return this._resolvedHandle.toJSON(); + } } diff --git a/samples/health-checks-ui/ts/.modules/transport.ts b/samples/health-checks-ui/ts/.modules/transport.ts index 7bddd74b..6d29cf28 100644 --- a/samples/health-checks-ui/ts/.modules/transport.ts +++ b/samples/health-checks-ui/ts/.modules/transport.ts @@ -77,7 +77,8 @@ export function isAtsError(value: unknown): value is { $error: AtsError } { value !== null && typeof value === 'object' && '$error' in value && - typeof (value as { $error: unknown }).$error === 'object' + typeof (value as { $error: unknown }).$error === 'object' && + (value as { $error: unknown }).$error !== null ); } @@ -93,6 +94,47 @@ export function isMarshalledHandle(value: unknown): value is MarshalledHandle { ); } +function isAbortSignal(value: unknown): value is AbortSignal { + return ( + value !== null && + typeof value === 'object' && + 'aborted' in value && + 'addEventListener' in value && + 'removeEventListener' in value + ); +} + +function isPlainObject(value: unknown): value is Record { + if (value === null || typeof value !== 'object') { + return false; + } + + const prototype = Object.getPrototypeOf(value); + return prototype === Object.prototype || prototype === null; +} + +function hasTransportValue(value: unknown): value is { toTransportValue(): unknown | Promise } { + return ( + value !== null && + typeof value === 'object' && + 'toTransportValue' in value && + typeof (value as { toTransportValue?: unknown }).toTransportValue === 'function' + ); +} + +function createAbortError(message: string): Error { + const error = new Error(message); + error.name = 'AbortError'; + return error; +} + +function createCircularReferenceError(capabilityId: string, path: string): AppHostUsageError { + return new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' contains a circular reference. ` + + 'Circular references are not supported by the AppHost transport.' + ); +} + // ============================================================================ // Handle // ============================================================================ @@ -136,6 +178,92 @@ export class Handle { } } +// ============================================================================ +// CancellationToken +// ============================================================================ + +/** + * Represents a transport-safe cancellation token value for the generated SDK. + * + * Use a plain {@link AbortSignal} when you create cancellation in user code. + * Generated APIs accept either an {@link AbortSignal} or a {@link CancellationToken}. + * + * Values returned from generated callbacks and context/property getters are + * {@link CancellationToken} instances because they may reference remote + * cancellation token handles received from the AppHost. + * + * @example + * ```typescript + * const controller = new AbortController(); + * await connectionStringExpression.getValue(controller.signal); + * ``` + * + * @example + * ```typescript + * const cancellationToken = await context.cancellationToken.get(); + * const connectionStringExpression = await db.uriExpression.get(); + * const connectionString = await connectionStringExpression.getValue(cancellationToken); + * ``` + */ +export class CancellationToken { + private readonly _signal?: AbortSignal; + private readonly _remoteTokenId?: string; + + constructor(signal?: AbortSignal); + constructor(tokenId?: string); + constructor(value?: AbortSignal | string | null) { + if (typeof value === 'string') { + this._remoteTokenId = value; + } else if (isAbortSignal(value)) { + this._signal = value; + } + } + + /** + * Creates a cancellation token from a local {@link AbortSignal}. + */ + static from(signal?: AbortSignal): CancellationToken { + return new CancellationToken(signal); + } + + /** + * Creates a cancellation token from a transport value. + * Generated code uses this to materialize values that come from the AppHost. + */ + static fromValue(value: unknown): CancellationToken { + if (value instanceof CancellationToken) { + return value; + } + + if (typeof value === 'string') { + return new CancellationToken(value); + } + + if (isAbortSignal(value)) { + return new CancellationToken(value); + } + + return new CancellationToken(); + } + + /** + * Serializes the token for JSON-RPC transport. + */ + toJSON(): string | undefined { + return this._remoteTokenId; + } + + register(client?: AspireClient): string | undefined { + if (this._remoteTokenId !== undefined) { + return this._remoteTokenId; + } + + return client + ? registerCancellation(client, this._signal) + : registerCancellation(this._signal); + } +} + // ============================================================================ // Handle Wrapper Registry // ============================================================================ @@ -167,22 +295,35 @@ export function registerHandleWrapper(typeId: string, factory: HandleWrapperFact * @param client - Optional client for creating typed wrapper instances */ export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { - if (value && typeof value === 'object') { - if (isMarshalledHandle(value)) { - const handle = new Handle(value); - const typeId = value.$type; - - // Try to find a registered wrapper factory for this type - if (typeId && client) { - const factory = handleWrapperRegistry.get(typeId); - if (factory) { - return factory(handle, client); - } + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); } + } + + return handle; + } - return handle; + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + value[i] = wrapIfHandle(value[i], client); + } + + return value; + } + + if (isPlainObject(value)) { + for (const [key, nestedValue] of Object.entries(value)) { + value[key] = wrapIfHandle(nestedValue, client); } } + return value; } @@ -213,6 +354,76 @@ export class CapabilityError extends Error { } } +/** + * Error thrown when the AppHost script uses the generated SDK incorrectly. + */ +export class AppHostUsageError extends Error { + constructor(message: string) { + super(message); + this.name = 'AppHostUsageError'; + } +} + +function isPromiseLike(value: unknown): value is PromiseLike { + return ( + value !== null && + (typeof value === 'object' || typeof value === 'function') && + 'then' in value && + typeof (value as { then?: unknown }).then === 'function' + ); +} + +function validateCapabilityArgs( + capabilityId: string, + args?: Record +): void { + if (!args) { + return; + } + + const validateValue = (value: unknown, path: string, ancestors: Set): void => { + if (value === null || value === undefined) { + return; + } + + if (isPromiseLike(value)) { + throw new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' is a Promise-like value. ` + + `This usually means an async builder call was not awaited. ` + + `Did you forget 'await' on a call like builder.addPostgres(...) or resource.addDatabase(...)?` + ); + } + + if (typeof value !== 'object') { + return; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + ancestors.add(value); + try { + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + validateValue(value[i], `${path}[${i}]`, ancestors); + } + return; + } + + for (const [key, nestedValue] of Object.entries(value)) { + validateValue(nestedValue, `${path}.${key}`, ancestors); + } + } finally { + ancestors.delete(value); + } + }; + + for (const [key, value] of Object.entries(args)) { + validateValue(value, key, new Set()); + } +} + // ============================================================================ // Callback Registry // ============================================================================ @@ -324,21 +535,50 @@ export function getCallbackCount(): number { */ const cancellationRegistry = new Map void>(); let cancellationIdCounter = 0; +const connectedClients = new Set(); -/** - * A reference to the current AspireClient for sending cancel requests. - * Set by AspireClient.connect(). - */ -let currentClient: AspireClient | null = null; +function resolveCancellationClient(client?: AspireClient): AspireClient { + if (client) { + return client; + } + + if (connectedClients.size === 1) { + return connectedClients.values().next().value as AspireClient; + } + + if (connectedClients.size === 0) { + throw new Error( + 'registerCancellation(signal) requires a connected AspireClient. ' + + 'Pass the client explicitly or connect the client first.' + ); + } + + throw new Error( + 'registerCancellation(signal) is ambiguous when multiple AspireClient instances are connected. ' + + 'Pass the client explicitly.' + ); +} /** - * Register an AbortSignal for cancellation support. - * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * Registers cancellation support for a local signal or SDK cancellation token. + * Returns a cancellation ID that should be passed to methods accepting cancellation input. * * When the AbortSignal is aborted, sends a cancelToken request to the host. * - * @param signal - The AbortSignal to register (optional) - * @returns The cancellation ID, or undefined if no signal provided + * @param client - The AspireClient that should route the cancellation request + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + */ +export function registerCancellation(client: AspireClient, signalOrToken?: AbortSignal | CancellationToken): string | undefined; +/** + * Registers cancellation support using the single connected AspireClient. + * + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + * + * @example + * const controller = new AbortController(); + * await expression.getValue(controller.signal); * * @example * const controller = new AbortController(); @@ -346,14 +586,29 @@ let currentClient: AspireClient | null = null; * // Pass id to capability invocation * // Later: controller.abort() will cancel the operation */ -export function registerCancellation(signal?: AbortSignal): string | undefined { - if (!signal) { +export function registerCancellation(signalOrToken?: AbortSignal | CancellationToken): string | undefined; +export function registerCancellation( + clientOrSignalOrToken?: AspireClient | AbortSignal | CancellationToken, + maybeSignalOrToken?: AbortSignal | CancellationToken +): string | undefined { + const client = clientOrSignalOrToken instanceof AspireClient ? clientOrSignalOrToken : undefined; + const signalOrToken = client + ? maybeSignalOrToken + : clientOrSignalOrToken as AbortSignal | CancellationToken | undefined; + + if (!signalOrToken) { return undefined; } - // Already aborted? Don't register + if (signalOrToken instanceof CancellationToken) { + return signalOrToken.register(client); + } + + const signal = signalOrToken; + const cancellationClient = resolveCancellationClient(client); + if (signal.aborted) { - return undefined; + throw createAbortError('The operation was aborted before it was sent to the AppHost.'); } const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; @@ -361,8 +616,8 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { // Set up the abort listener const onAbort = () => { // Send cancel request to host - if (currentClient?.connected) { - currentClient.cancelToken(cancellationId).catch(() => { + if (cancellationClient.connected) { + cancellationClient.cancelToken(cancellationId).catch(() => { // Ignore errors - the operation may have already completed }); } @@ -381,6 +636,56 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { return cancellationId; } +async function marshalTransportValue( + value: unknown, + client: AspireClient, + cancellationIds: string[], + capabilityId: string, + path: string = 'args', + ancestors: Set = new Set() +): Promise { + if (value === null || value === undefined || typeof value !== 'object') { + return value; + } + + if (value instanceof CancellationToken) { + const cancellationId = value.register(client); + if (cancellationId !== undefined) { + cancellationIds.push(cancellationId); + } + + return cancellationId; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + const nextAncestors = new Set(ancestors); + nextAncestors.add(value); + + if (hasTransportValue(value)) { + return await marshalTransportValue(await value.toTransportValue(), client, cancellationIds, capabilityId, path, nextAncestors); + } + + if (Array.isArray(value)) { + return await Promise.all( + value.map((item, index) => marshalTransportValue(item, client, cancellationIds, capabilityId, `${path}[${index}]`, nextAncestors)) + ); + } + + if (isPlainObject(value)) { + const entries = await Promise.all( + Object.entries(value).map(async ([key, nestedValue]) => + [key, await marshalTransportValue(nestedValue, client, cancellationIds, capabilityId, `${path}.${key}`, nextAncestors)] as const) + ); + + return Object.fromEntries(entries); + } + + return value; +} + /** * Unregister a cancellation token by its ID. * Call this when the operation completes to clean up resources. @@ -411,6 +716,8 @@ export class AspireClient { private socket: net.Socket | null = null; private disconnectCallbacks: (() => void)[] = []; private _pendingCalls = 0; + private _connectPromise: Promise | null = null; + private _disconnectNotified = false; constructor(private socketPath: string) { } @@ -422,6 +729,12 @@ export class AspireClient { } private notifyDisconnect(): void { + if (this._disconnectNotified) { + return; + } + + this._disconnectNotified = true; + for (const callback of this.disconnectCallbacks) { try { callback(); @@ -432,30 +745,106 @@ export class AspireClient { } connect(timeoutMs: number = 5000): Promise { - return new Promise((resolve, reject) => { - const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + if (this.connected) { + return Promise.resolve(); + } + + if (this._connectPromise) { + return this._connectPromise; + } + + this._disconnectNotified = false; + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this._connectPromise = new Promise((resolve, reject) => { + const socket = net.createConnection(pipePath); + this.socket = socket; - // On Windows, use named pipes; on Unix, use Unix domain sockets - const isWindows = process.platform === 'win32'; - const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + let settled = false; - this.socket = net.createConnection(pipePath); + const cleanupPendingListeners = () => { + socket.removeListener('connect', onConnect); + socket.removeListener('error', onPendingError); + socket.removeListener('close', onPendingClose); + }; - this.socket.once('error', (error: Error) => { + const failConnect = (error: Error) => { + if (settled) { + return; + } + + settled = true; clearTimeout(timeout); + cleanupPendingListeners(); + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + if (!socket.destroyed) { + socket.destroy(); + } + reject(error); - }); + }; + + const onConnectedSocketError = (error: Error) => { + console.error('Socket error:', error); + }; + + const onConnectedSocketClose = () => { + socket.removeListener('error', onConnectedSocketError); + + if (this.socket && this.socket !== socket) { + return; + } + + const connection = this.connection; + this.connection = null; + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + this.notifyDisconnect(); + }; + + const onPendingError = (error: Error) => { + failConnect(error); + }; + + const onPendingClose = () => { + failConnect(new Error('Connection closed before JSON-RPC was established')); + }; + + const onConnect = async () => { + if (settled) { + return; + } - this.socket.once('connect', () => { clearTimeout(timeout); + cleanupPendingListeners(); + try { - const reader = new rpc.SocketMessageReader(this.socket!); - const writer = new rpc.SocketMessageWriter(this.socket!); + const reader = new rpc.SocketMessageReader(socket); + const writer = new rpc.SocketMessageWriter(socket); this.connection = rpc.createMessageConnection(reader, writer); this.connection.onClose(() => { this.connection = null; - this.notifyDisconnect(); }); this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); @@ -475,26 +864,39 @@ export class AspireClient { } }); + socket.on('error', onConnectedSocketError); + socket.on('close', onConnectedSocketClose); + + const authToken = process.env.ASPIRE_REMOTE_APPHOST_TOKEN; + if (!authToken) { + throw new Error('ASPIRE_REMOTE_APPHOST_TOKEN environment variable is not set.'); + } this.connection.listen(); + const authenticated = await this.connection.sendRequest('authenticate', authToken); + if (!authenticated) { + throw new Error('Failed to authenticate to the AppHost server.'); + } - // Set the current client for cancellation registry - currentClient = this; + connectedClients.add(this); + this._connectPromise = null; + settled = true; resolve(); - } catch (e) { - reject(e); + } catch (error) { + failConnect(error instanceof Error ? error : new Error(String(error))); } - }); + }; - this.socket.on('close', () => { - this.connection?.dispose(); - this.connection = null; - if (currentClient === this) { - currentClient = null; - } - this.notifyDisconnect(); - }); + const timeout = setTimeout(() => { + failConnect(new Error('Connection timeout')); + }, timeoutMs); + + socket.once('error', onPendingError); + socket.once('close', onPendingClose); + socket.once('connect', onConnect); }); + + return this._connectPromise; } ping(): Promise { @@ -533,39 +935,66 @@ export class AspireClient { throw new Error('Not connected to AppHost'); } - // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. - // We ref() during RPC calls so the process doesn't exit mid-call, and - // unref() when idle so the process can exit naturally after all work completes. - if (this._pendingCalls === 0) { - this.socket?.ref(); - } - this._pendingCalls++; + validateCapabilityArgs(capabilityId, args); + const cancellationIds: string[] = []; try { - const result = await this.connection.sendRequest( - 'invokeCapability', - capabilityId, - args ?? null - ); + const rpcArgs = await marshalTransportValue(args ?? null, this, cancellationIds, capabilityId); - // Check for structured error response - if (isAtsError(result)) { - throw new CapabilityError(result.$error); + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); } + this._pendingCalls++; - // Wrap handles automatically - return wrapIfHandle(result, this) as T; + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + rpcArgs + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } } finally { - this._pendingCalls--; - if (this._pendingCalls === 0) { - this.socket?.unref(); + for (const cancellationId of cancellationIds) { + unregisterCancellation(cancellationId); } } } disconnect(): void { - try { this.connection?.dispose(); } finally { this.connection = null; } - try { this.socket?.end(); } finally { this.socket = null; } + const connection = this.connection; + const socket = this.socket; + + this.connection = null; + this.socket = null; + this._connectPromise = null; + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + if (socket && !socket.destroyed) { + socket.end(); + socket.destroy(); + } } get connected(): boolean { diff --git a/samples/health-checks-ui/ts/apphost.ts b/samples/health-checks-ui/ts/apphost.ts index 1a439034..c04d1c7b 100644 --- a/samples/health-checks-ui/ts/apphost.ts +++ b/samples/health-checks-ui/ts/apphost.ts @@ -14,7 +14,7 @@ const apiService = await builder.addProject("apiservice", "../HealthChecksUI.Api const webFrontend = await builder.addProject("webfrontend", "../HealthChecksUI.Web/HealthChecksUI.Web.csproj", "https") .withReference(cache) .waitFor(cache) - .withServiceReference(apiService) + .withReference(apiService) .waitFor(apiService) .withHttpHealthCheck({ path: "/health" diff --git a/samples/health-checks-ui/ts/apphost.run.json b/samples/health-checks-ui/ts/aspire.config.json similarity index 57% rename from samples/health-checks-ui/ts/apphost.run.json rename to samples/health-checks-ui/ts/aspire.config.json index d2a34576..0d264f93 100644 --- a/samples/health-checks-ui/ts/apphost.run.json +++ b/samples/health-checks-ui/ts/aspire.config.json @@ -1,4 +1,13 @@ { + "appHost": { + "path": "apphost.ts", + "language": "typescript/nodejs" + }, + "packages": { + "Aspire.Hosting.JavaScript": "13.2.0", + "Aspire.Hosting.Redis": "13.2.0", + "Aspire.Hosting.Docker": "13.2.0" + }, "profiles": { "https": { "applicationUrl": "https://localhost:55469;http://localhost:44473", @@ -8,4 +17,4 @@ } } } -} \ No newline at end of file +} diff --git a/samples/orleans-voting/ts/.aspire/settings.json b/samples/orleans-voting/ts/.aspire/settings.json deleted file mode 100644 index 8beb9163..00000000 --- a/samples/orleans-voting/ts/.aspire/settings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "appHostPath": "../apphost.ts", - "language": "typescript/nodejs", - "channel": "staging", - "sdkVersion": "13.2.0-preview.1.26159.1", - "packages": { - "Aspire.Hosting.Redis": "13.2.0-preview.1.26159.1", - "Aspire.Hosting.Orleans": "13.2.0-preview.1.26159.1" - } -} \ No newline at end of file diff --git a/samples/orleans-voting/ts/.modules/.codegen-hash b/samples/orleans-voting/ts/.modules/.codegen-hash index c648850f..26b2ca0a 100644 --- a/samples/orleans-voting/ts/.modules/.codegen-hash +++ b/samples/orleans-voting/ts/.modules/.codegen-hash @@ -1 +1 @@ -3DF283E73348B290509CE99152467BCE5C6DBDF051EE2E9CBE17F62C050D3512 \ No newline at end of file +11585CD071A117A3D521A3B47B879FCCEE32E2533EAEB96ADBD4CE7303A735DC \ No newline at end of file diff --git a/samples/orleans-voting/ts/.modules/aspire.ts b/samples/orleans-voting/ts/.modules/aspire.ts index 366a28dd..37c96de1 100644 --- a/samples/orleans-voting/ts/.modules/aspire.ts +++ b/samples/orleans-voting/ts/.modules/aspire.ts @@ -8,6 +8,8 @@ import { AspireClient as AspireClientRpc, Handle, MarshalledHandle, + AppHostUsageError, + CancellationToken, CapabilityError, registerCallback, wrapIfHandle, @@ -26,6 +28,15 @@ import { // Handle Type Aliases (Internal - not exported to users) // ============================================================================ +/** Handle to JavaScriptAppResource */ +type JavaScriptAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource'>; + +/** Handle to NodeAppResource */ +type NodeAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource'>; + +/** Handle to ViteAppResource */ +type ViteAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource'>; + /** Handle to OrleansService */ type OrleansServiceHandle = Handle<'Aspire.Hosting.Orleans/Aspire.Hosting.Orleans.OrleansService'>; @@ -41,9 +52,21 @@ type RedisCommanderResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting. /** Handle to RedisInsightResource */ type RedisInsightResourceHandle = Handle<'Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisInsightResource'>; +/** Handle to AfterResourcesCreatedEvent */ +type AfterResourcesCreatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent'>; + +/** Handle to BeforeResourceStartedEvent */ +type BeforeResourceStartedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent'>; + +/** Handle to BeforeStartEvent */ +type BeforeStartEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent'>; + /** Handle to CommandLineArgsCallbackContext */ type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; +/** Handle to ConnectionStringAvailableEvent */ +type ConnectionStringAvailableEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent'>; + /** Handle to ContainerRegistryResource */ type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; @@ -53,6 +76,9 @@ type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Application /** Handle to CSharpAppResource */ type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; +/** Handle to DistributedApplicationModel */ +type DistributedApplicationModelHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel'>; + /** Handle to DotnetToolResource */ type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; @@ -71,9 +97,15 @@ type ExecutableResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicatio /** Handle to ExecuteCommandContext */ type ExecuteCommandContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext'>; +/** Handle to IComputeResource */ +type IComputeResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource'>; + /** Handle to IContainerFilesDestinationResource */ type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; +/** Handle to InitializeResourceEvent */ +type InitializeResourceEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent'>; + /** Handle to IResource */ type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; @@ -104,15 +136,27 @@ type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicati /** Handle to ReferenceExpressionBuilder */ type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; +/** Handle to ResourceEndpointsAllocatedEvent */ +type ResourceEndpointsAllocatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent'>; + /** Handle to ResourceLoggerService */ type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; /** Handle to ResourceNotificationService */ type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; +/** Handle to ResourceReadyEvent */ +type ResourceReadyEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent'>; + +/** Handle to ResourceStoppedEvent */ +type ResourceStoppedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent'>; + /** Handle to ResourceUrlsCallbackContext */ type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; +/** Handle to UpdateCommandStateContext */ +type UpdateCommandStateContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext'>; + /** Handle to ConnectionStringResource */ type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; @@ -137,18 +181,33 @@ type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hostin /** Handle to IResourceWithContainerFiles */ type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; -/** Handle to IResourceWithServiceDiscovery */ -type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; +/** Handle to IUserSecretsManager */ +type IUserSecretsManagerHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IUserSecretsManager'>; + +/** Handle to IReportingStep */ +type IReportingStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep'>; + +/** Handle to IReportingTask */ +type IReportingTaskHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask'>; /** Handle to PipelineConfigurationContext */ type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; +/** Handle to PipelineContext */ +type PipelineContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext'>; + /** Handle to PipelineStep */ type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; /** Handle to PipelineStepContext */ type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; +/** Handle to PipelineStepFactoryContext */ +type PipelineStepFactoryContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext'>; + +/** Handle to PipelineSummary */ +type PipelineSummaryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary'>; + /** Handle to ProjectResourceOptions */ type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; @@ -161,12 +220,18 @@ type ListanyHandle = Handle<'Aspire.Hosting/List'>; /** Handle to IConfiguration */ type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; +/** Handle to IConfigurationSection */ +type IConfigurationSectionHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfigurationSection'>; + /** Handle to IHostEnvironment */ type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; /** Handle to ILogger */ type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; +/** Handle to ILoggerFactory */ +type ILoggerFactoryHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory'>; + /** Handle to string[] */ type stringArrayHandle = Handle<'string[]'>; @@ -206,6 +271,7 @@ export enum EndpointProperty { Scheme = "Scheme", TargetPort = "TargetPort", HostAndPort = "HostAndPort", + TlsEnabled = "TlsEnabled", } /** Enum type for IconVariant */ @@ -337,6 +403,10 @@ export interface AddConnectionStringOptions { environmentVariableName?: string; } +export interface AddContainerRegistryFromStringOptions { + repository?: string; +} + export interface AddContainerRegistryOptions { repository?: ParameterResource; } @@ -346,6 +416,10 @@ export interface AddDockerfileOptions { stage?: string; } +export interface AddJavaScriptAppOptions { + runScriptName?: string; +} + export interface AddParameterFromConfigurationOptions { secret?: boolean; } @@ -354,6 +428,11 @@ export interface AddParameterOptions { secret?: boolean; } +export interface AddParameterWithValueOptions { + publishValueAsDefault?: boolean; + secret?: boolean; +} + export interface AddRedisOptions { port?: number; password?: ParameterResource; @@ -363,6 +442,10 @@ export interface AddRedisWithPortOptions { port?: number; } +export interface AddViteAppOptions { + runScriptName?: string; +} + export interface AppendFormattedOptions { format?: string; } @@ -371,22 +454,89 @@ export interface AppendValueProviderOptions { format?: string; } +export interface CompleteStepMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteStepOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskOptions { + completionMessage?: string; + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateMarkdownTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + export interface GetValueAsyncOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface PublishAsDockerFileOptions { + configure?: (obj: ContainerResource) => Promise; +} + +export interface PublishResourceUpdateOptions { + state?: string; + stateStyle?: string; } export interface RunOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface SaveStateJsonOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskMarkdownOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; } export interface WaitForCompletionOptions { exitCode?: number; } +export interface WaitForResourceStateOptions { + targetState?: string; +} + export interface WithBindMountOptions { isReadOnly?: boolean; } +export interface WithBrowserDebuggerOptions { + browser?: string; +} + +export interface WithBuildScriptOptions { + args?: string[]; +} + +export interface WithBunOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithCommandOptions { commandOptions?: CommandOptions; } @@ -483,6 +633,12 @@ export interface WithMcpServerOptions { endpointName?: string; } +export interface WithNpmOptions { + install?: boolean; + installCommand?: string; + installArgs?: string[]; +} + export interface WithPersistenceOptions { interval?: number; keysChangedThreshold?: number; @@ -495,6 +651,11 @@ export interface WithPipelineStepFactoryOptions { description?: string; } +export interface WithPnpmOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithRedisCommanderOptions { configureContainer?: (obj: RedisCommanderResource) => Promise; containerName?: string; @@ -508,12 +669,17 @@ export interface WithRedisInsightOptions { export interface WithReferenceOptions { connectionName?: string; optional?: boolean; + name?: string; } export interface WithRequiredCommandOptions { helpLink?: string; } +export interface WithRunScriptOptions { + args?: string[]; +} + export interface WithUrlExpressionOptions { displayText?: string; } @@ -527,6 +693,122 @@ export interface WithVolumeOptions { isReadOnly?: boolean; } +export interface WithYarnOptions { + install?: boolean; + installArgs?: string[]; +} + +// ============================================================================ +// AfterResourcesCreatedEvent +// ============================================================================ + +/** + * Type class for AfterResourcesCreatedEvent. + */ +export class AfterResourcesCreatedEvent { + constructor(private _handle: AfterResourcesCreatedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeResourceStartedEvent +// ============================================================================ + +/** + * Type class for BeforeResourceStartedEvent. + */ +export class BeforeResourceStartedEvent { + constructor(private _handle: BeforeResourceStartedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeStartEvent +// ============================================================================ + +/** + * Type class for BeforeStartEvent. + */ +export class BeforeStartEvent { + constructor(private _handle: BeforeStartEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + // ============================================================================ // CommandLineArgsCallbackContext // ============================================================================ @@ -556,11 +838,12 @@ export class CommandLineArgsCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, }; @@ -575,6 +858,65 @@ export class CommandLineArgsCallbackContext { }, }; + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ConnectionStringAvailableEvent +// ============================================================================ + +/** + * Type class for ConnectionStringAvailableEvent. + */ +export class ConnectionStringAvailableEvent { + constructor(private _handle: ConnectionStringAvailableEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + } // ============================================================================ @@ -592,9 +934,9 @@ export class DistributedApplication { /** Runs the distributed application */ /** @internal */ - async _runInternal(cancellationToken?: AbortSignal): Promise { + async _runInternal(cancellationToken?: AbortSignal | CancellationToken): Promise { const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); await this._client.invokeCapability( 'Aspire.Hosting/run', rpcArgs @@ -668,6 +1010,17 @@ export class DistributedApplicationExecutionContext { }, }; + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the IsPublishMode property */ isPublishMode = { get: async (): Promise => { @@ -690,6 +1043,70 @@ export class DistributedApplicationExecutionContext { } +// ============================================================================ +// DistributedApplicationModel +// ============================================================================ + +/** + * Type class for DistributedApplicationModel. + */ +export class DistributedApplicationModel { + constructor(private _handle: DistributedApplicationModelHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets resources from the distributed application model */ + async getResources(): Promise { + const rpcArgs: Record = { model: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResources', + rpcArgs + ); + } + + /** Finds a resource by name */ + /** @internal */ + async _findResourceByNameInternal(name: string): Promise { + const rpcArgs: Record = { model: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/findResourceByName', + rpcArgs + ); + return new Resource(result, this._client); + } + + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._findResourceByNameInternal(name)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationModel that enables fluent chaining. + */ +export class DistributedApplicationModelPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationModel) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets resources from the distributed application model */ + getResources(): Promise { + return this._promise.then(obj => obj.getResources()); + } + + /** Finds a resource by name */ + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.findResourceByName(name))); + } + +} + // ============================================================================ // EndpointReference // ============================================================================ @@ -703,6 +1120,17 @@ export class EndpointReference { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.resource', + { context: this._handle } + ); + return new ResourceWithEndpoints(handle, this._client); + }, + }; + /** Gets the EndpointName property */ endpointName = { get: async (): Promise => { @@ -769,6 +1197,16 @@ export class EndpointReference { }, }; + /** Gets the TlsEnabled property */ + tlsEnabled = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.tlsEnabled', + { context: this._handle } + ); + }, + }; + /** Gets the Port property */ port = { get: async (): Promise => { @@ -823,13 +1261,22 @@ export class EndpointReference { async getValueAsync(options?: GetValueAsyncOptions): Promise { const cancellationToken = options?.cancellationToken; const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); return await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/getValueAsync', rpcArgs ); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + async getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + const rpcArgs: Record = { context: this._handle, enabledValue, disabledValue }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.getTlsValue', + rpcArgs + ); + } + } /** @@ -850,6 +1297,11 @@ export class EndpointReferencePromise implements PromiseLike return this._promise.then(obj => obj.getValueAsync(options)); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + return this._promise.then(obj => obj.getTlsValue(enabledValue, disabledValue)); + } + } // ============================================================================ @@ -927,11 +1379,34 @@ export class EnvironmentCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; @@ -961,6 +1436,17 @@ export class ExecuteCommandContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the ResourceName property */ resourceName = { get: async (): Promise => { @@ -979,16 +1465,17 @@ export class ExecuteCommandContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, - set: async (value: AbortSignal): Promise => { + set: async (value: AbortSignal | CancellationToken): Promise => { await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', - { context: this._handle, value } + { context: this._handle, value: CancellationToken.fromValue(value) } ); } }; @@ -996,23 +1483,93 @@ export class ExecuteCommandContext { } // ============================================================================ -// OrleansService +// InitializeResourceEvent // ============================================================================ /** - * Type class for OrleansService. + * Type class for InitializeResourceEvent. */ -export class OrleansService { - constructor(private _handle: OrleansServiceHandle, private _client: AspireClientRpc) {} +export class InitializeResourceEvent { + constructor(private _handle: InitializeResourceEventHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Sets the Orleans cluster ID */ - /** @internal */ - async _withClusterIdInternal(clusterId: string): Promise { - const rpcArgs: Record = { orleansServiceBuilder: this._handle, clusterId }; - const result = await this._client.invokeCapability( + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Notifications property */ + notifications = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.notifications', + { context: this._handle } + ); + return new ResourceNotificationService(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// OrleansService +// ============================================================================ + +/** + * Type class for OrleansService. + */ +export class OrleansService { + constructor(private _handle: OrleansServiceHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Sets the Orleans cluster ID */ + /** @internal */ + async _withClusterIdInternal(clusterId: string): Promise { + const rpcArgs: Record = { orleansServiceBuilder: this._handle, clusterId }; + const result = await this._client.invokeCapability( 'Aspire.Hosting.Orleans/withClusterId', rpcArgs ); @@ -1292,6 +1849,17 @@ export class PipelineConfigurationContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the Steps property */ steps = { get: async (): Promise => { @@ -1308,6 +1876,17 @@ export class PipelineConfigurationContext { } }; + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + /** Gets pipeline steps with the specified tag */ async getStepsByTag(tag: string): Promise { const rpcArgs: Record = { context: this._handle, tag }; @@ -1339,6 +1918,93 @@ export class PipelineConfigurationContextPromise implements PromiseLike => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + set: async (value: AbortSignal | CancellationToken): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.setCancellationToken', + { context: this._handle, value: CancellationToken.fromValue(value) } + ); + } + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + // ============================================================================ // PipelineStep // ============================================================================ @@ -1426,6 +2092,17 @@ export class PipelineStep { return this._tags; } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + /** Adds a dependency on another step by name */ /** @internal */ async _dependsOnInternal(stepName: string): Promise { @@ -1496,6 +2173,39 @@ export class PipelineStepContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the ReportingStep property */ + reportingStep = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.reportingStep', + { context: this._handle } + ); + return new ReportingStep(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + /** Gets the ExecutionContext property */ executionContext = { get: async (): Promise => { @@ -1507,18 +2217,159 @@ export class PipelineStepContext { }, }; + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineStepFactoryContext +// ============================================================================ + +/** + * Type class for PipelineStepFactoryContext. + */ +export class PipelineStepFactoryContext { + constructor(private _handle: PipelineStepFactoryContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; } +// ============================================================================ +// PipelineSummary +// ============================================================================ + +/** + * Type class for PipelineSummary. + */ +export class PipelineSummary { + constructor(private _handle: PipelineSummaryHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Add method */ + /** @internal */ + async _addInternal(key: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, key, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineSummary.add', + rpcArgs + ); + return this; + } + + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addInternal(key, value)); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + /** @internal */ + async _addMarkdownInternal(key: string, markdownString: string): Promise { + const rpcArgs: Record = { summary: this._handle, key, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/addMarkdown', + rpcArgs + ); + return this; + } + + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addMarkdownInternal(key, markdownString)); + } + +} + +/** + * Thenable wrapper for PipelineSummary that enables fluent chaining. + */ +export class PipelineSummaryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineSummary) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Add method */ + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.add(key, value))); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.addMarkdown(key, markdownString))); + } + +} + // ============================================================================ // ProjectResourceOptions // ============================================================================ @@ -1701,3104 +2552,3394 @@ export class ReferenceExpressionBuilderPromise implements PromiseLike; - get urls(): AspireList { - if (!this._urls) { - this._urls = new AspireList( - this._handle, - this._client, - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' - ); - } - return this._urls; - } - - /** Gets the CancellationToken property */ - cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.resource', { context: this._handle } ); + return new Resource(handle, this._client); }, }; - /** Gets the ExecutionContext property */ - executionContext = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.services', { context: this._handle } ); - return new DistributedApplicationExecutionContext(handle, this._client); + return new ServiceProvider(handle, this._client); }, }; } // ============================================================================ -// DistributedApplicationBuilder +// ResourceLoggerService // ============================================================================ /** - * Type class for DistributedApplicationBuilder. + * Type class for ResourceLoggerService. */ -export class DistributedApplicationBuilder { - constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} +export class ResourceLoggerService { + constructor(private _handle: ResourceLoggerServiceHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the AppHostDirectory property */ - appHostDirectory = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', - { context: this._handle } - ); - }, - }; + /** Completes the log stream for a resource */ + /** @internal */ + async _completeLogInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { loggerService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLog', + rpcArgs + ); + return this; + } - /** Gets the Eventing property */ - eventing = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', - { context: this._handle } - ); - return new DistributedApplicationEventing(handle, this._client); - }, - }; - - /** Gets the ExecutionContext property */ - executionContext = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', - { context: this._handle } - ); - return new DistributedApplicationExecutionContext(handle, this._client); - }, - }; + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogInternal(resource)); + } - /** Builds the distributed application */ + /** Completes the log stream by resource name */ /** @internal */ - async _buildInternal(): Promise { - const rpcArgs: Record = { context: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/build', + async _completeLogByNameInternal(resourceName: string): Promise { + const rpcArgs: Record = { loggerService: this._handle, resourceName }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLogByName', rpcArgs ); - return new DistributedApplication(result, this._client); + return this; } - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._buildInternal()); + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogByNameInternal(resourceName)); } - /** Adds a connection string with a builder callback */ - /** @internal */ - async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { - const connectionStringBuilderId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; - const obj = new ReferenceExpressionBuilder(objHandle, this._client); - await connectionStringBuilder(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionStringBuilder', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } +} - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); - } +/** + * Thenable wrapper for ResourceLoggerService that enables fluent chaining. + */ +export class ResourceLoggerServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** Adds a container registry resource */ - /** @internal */ - async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpoint }; - if (repository !== undefined) rpcArgs.repository = repository; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainerRegistry', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + then( + onfulfilled?: ((value: ResourceLoggerService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - const repository = options?.repository; - return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + /** Completes the log stream for a resource */ + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLog(resource))); } - /** Adds a container resource */ - /** @internal */ - async _addContainerInternal(name: string, image: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, image }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainer', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Completes the log stream by resource name */ + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLogByName(resourceName))); } - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._addContainerInternal(name, image)); - } +} - /** Adds a container resource built from a Dockerfile */ - /** @internal */ - async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDockerfile', - rpcArgs - ); - return new ContainerResource(result, this._client); - } +// ============================================================================ +// ResourceNotificationService +// ============================================================================ - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); - } +/** + * Type class for ResourceNotificationService. + */ +export class ResourceNotificationService { + constructor(private _handle: ResourceNotificationServiceHandle, private _client: AspireClientRpc) {} - /** Adds a .NET tool resource */ + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Waits for a resource to reach a specified state */ /** @internal */ - async _addDotnetToolInternal(name: string, packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDotnetTool', + async _waitForResourceStateInternal(resourceName: string, targetState?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + if (targetState !== undefined) rpcArgs.targetState = targetState; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceState', rpcArgs ); - return new DotnetToolResource(result, this._client); + return this; } - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + const targetState = options?.targetState; + return new ResourceNotificationServicePromise(this._waitForResourceStateInternal(resourceName, targetState)); } - /** Adds an executable resource */ - /** @internal */ - async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExecutable', + /** Waits for a resource to reach one of the specified states */ + async waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName, targetStates }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStates', rpcArgs ); - return new ExecutableResource(result, this._client); - } - - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); } - /** Adds an external service resource */ - /** @internal */ - async _addExternalServiceInternal(name: string, url: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, url }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExternalService', + /** Waits for a resource to become healthy */ + async waitForResourceHealthy(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceHealthy', rpcArgs ); - return new ExternalServiceResource(result, this._client); - } - - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); } - /** Adds a parameter resource */ + /** Waits for all dependencies of a resource to be ready */ /** @internal */ - async _addParameterInternal(name: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameter', + async _waitForDependenciesInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForDependencies', rpcArgs ); - return new ParameterResource(result, this._client); + return this; } - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterInternal(name, secret)); + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._waitForDependenciesInternal(resource)); } - /** Adds a parameter sourced from configuration */ - /** @internal */ - async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name, configurationKey }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameterFromConfiguration', + /** Tries to get the current state of a resource */ + async tryGetResourceState(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/tryGetResourceState', rpcArgs ); - return new ParameterResource(result, this._client); - } - - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); } - /** Adds a connection string resource */ + /** Publishes an update for a resource's state */ /** @internal */ - async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionString', + async _publishResourceUpdateInternal(resource: ResourceBuilderBase, state?: string, stateStyle?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + if (state !== undefined) rpcArgs.state = state; + if (stateStyle !== undefined) rpcArgs.stateStyle = stateStyle; + await this._client.invokeCapability( + 'Aspire.Hosting/publishResourceUpdate', rpcArgs ); - return new ResourceWithConnectionString(result, this._client); + return this; } - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - const environmentVariableName = options?.environmentVariableName; - return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + const state = options?.state; + const stateStyle = options?.stateStyle; + return new ResourceNotificationServicePromise(this._publishResourceUpdateInternal(resource, state, stateStyle)); } - /** Adds a .NET project resource */ - /** @internal */ - async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProject', - rpcArgs - ); - return new ProjectResource(result, this._client); - } +} - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); - } +/** + * Thenable wrapper for ResourceNotificationService that enables fluent chaining. + */ +export class ResourceNotificationServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** Adds a project resource with configuration options */ - /** @internal */ - async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProjectWithOptions', - rpcArgs - ); - return new ProjectResource(result, this._client); + then( + onfulfilled?: ((value: ResourceNotificationService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + /** Waits for a resource to reach a specified state */ + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForResourceState(resourceName, options))); } - /** Adds a C# application resource */ - /** @internal */ - async _addCSharpAppInternal(name: string, path: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, path }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpApp', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Waits for a resource to reach one of the specified states */ + waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + return this._promise.then(obj => obj.waitForResourceStates(resourceName, targetStates)); } - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + /** Waits for a resource to become healthy */ + waitForResourceHealthy(resourceName: string): Promise { + return this._promise.then(obj => obj.waitForResourceHealthy(resourceName)); } - /** Adds a C# application resource with configuration options */ - /** @internal */ - async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpAppWithOptions', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Waits for all dependencies of a resource to be ready */ + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForDependencies(resource))); } - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + /** Tries to get the current state of a resource */ + tryGetResourceState(resourceName: string): Promise { + return this._promise.then(obj => obj.tryGetResourceState(resourceName)); } - /** Adds a Redis container resource with specific port */ - /** @internal */ - async _addRedisWithPortInternal(name: string, port?: number): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/addRedisWithPort', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Publishes an update for a resource's state */ + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.publishResourceUpdate(resource, options))); } - addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { - const port = options?.port; - return new RedisResourcePromise(this._addRedisWithPortInternal(name, port)); - } +} - /** Adds a Redis container resource */ - /** @internal */ - async _addRedisInternal(name: string, port?: number, password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (port !== undefined) rpcArgs.port = port; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/addRedis', - rpcArgs - ); - return new RedisResource(result, this._client); - } +// ============================================================================ +// ResourceReadyEvent +// ============================================================================ - addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { - const port = options?.port; - const password = options?.password; - return new RedisResourcePromise(this._addRedisInternal(name, port, password)); - } +/** + * Type class for ResourceReadyEvent. + */ +export class ResourceReadyEvent { + constructor(private _handle: ResourceReadyEventHandle, private _client: AspireClientRpc) {} - /** Adds an Orleans service configuration */ - /** @internal */ - async _addOrleansInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Orleans/addOrleans', - rpcArgs - ); - return new OrleansService(result, this._client); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - addOrleans(name: string): OrleansServicePromise { - return new OrleansServicePromise(this._addOrleansInternal(name)); - } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; } +// ============================================================================ +// ResourceStoppedEvent +// ============================================================================ + /** - * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + * Type class for ResourceStoppedEvent. */ -export class DistributedApplicationBuilderPromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ResourceStoppedEvent { + constructor(private _handle: ResourceStoppedEventHandle, private _client: AspireClientRpc) {} - then( - onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - - /** Builds the distributed application */ - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); - } - - /** Adds a connection string with a builder callback */ - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Adds a container registry resource */ - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); - } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; - /** Adds a container resource */ - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); - } + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; - /** Adds a container resource built from a Dockerfile */ - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); - } +} - /** Adds a .NET tool resource */ - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); - } +// ============================================================================ +// ResourceUrlsCallbackContext +// ============================================================================ - /** Adds an executable resource */ - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); - } +/** + * Type class for ResourceUrlsCallbackContext. + */ +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} - /** Adds an external service resource */ - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Adds a parameter resource */ - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); - } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; - /** Adds a parameter sourced from configuration */ - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; } - /** Adds a connection string resource */ - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); - } + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + }; - /** Adds a .NET project resource */ - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); - } + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; - /** Adds a project resource with configuration options */ - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); - } + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; - /** Adds a C# application resource */ - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); - } +} - /** Adds a C# application resource with configuration options */ - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); - } +// ============================================================================ +// UpdateCommandStateContext +// ============================================================================ - /** Adds a Redis container resource with specific port */ - addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.addRedisWithPort(name, options))); - } +/** + * Type class for UpdateCommandStateContext. + */ +export class UpdateCommandStateContext { + constructor(private _handle: UpdateCommandStateContextHandle, private _client: AspireClientRpc) {} - /** Adds a Redis container resource */ - addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.addRedis(name, options))); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Adds an Orleans service configuration */ - addOrleans(name: string): OrleansServicePromise { - return new OrleansServicePromise(this._promise.then(obj => obj.addOrleans(name))); - } + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/UpdateCommandStateContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; } // ============================================================================ -// DistributedApplicationEventing +// Configuration // ============================================================================ /** - * Type class for DistributedApplicationEventing. + * Type class for Configuration. */ -export class DistributedApplicationEventing { - constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} +export class Configuration { + constructor(private _handle: IConfigurationHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Invokes the Unsubscribe method */ - /** @internal */ - async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { - const rpcArgs: Record = { context: this._handle, subscription }; - await this._client.invokeCapability( - 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + /** Gets a configuration value by key */ + async getConfigValue(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConfigValue', rpcArgs ); - return this; } - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + /** Gets a connection string by name */ + async getConnectionString(name: string): Promise { + const rpcArgs: Record = { configuration: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionString', + rpcArgs + ); + } + + /** Gets a configuration section by key */ + async getSection(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getSection', + rpcArgs + ); + } + + /** Gets child configuration sections */ + async getChildren(): Promise { + const rpcArgs: Record = { configuration: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getChildren', + rpcArgs + ); + } + + /** Checks whether a configuration section exists */ + async exists(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/exists', + rpcArgs + ); } } /** - * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + * Thenable wrapper for Configuration that enables fluent chaining. */ -export class DistributedApplicationEventingPromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ConfigurationPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: Configuration) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Invokes the Unsubscribe method */ - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + /** Gets a configuration value by key */ + getConfigValue(key: string): Promise { + return this._promise.then(obj => obj.getConfigValue(key)); } -} - -// ============================================================================ -// ConnectionStringResource -// ============================================================================ + /** Gets a connection string by name */ + getConnectionString(name: string): Promise { + return this._promise.then(obj => obj.getConnectionString(name)); + } -export class ConnectionStringResource extends ResourceBuilderBase { - constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Gets a configuration section by key */ + getSection(key: string): Promise { + return this._promise.then(obj => obj.getSection(key)); } - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); + /** Gets child configuration sections */ + getChildren(): Promise { + return this._promise.then(obj => obj.getChildren()); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + /** Checks whether a configuration section exists */ + exists(key: string): Promise { + return this._promise.then(obj => obj.exists(key)); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', +} + +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ + +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Environment property */ + environment = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.environment', + { context: this._handle } + ); + return new HostEnvironment(handle, this._client); + }, + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the UserSecretsManager property */ + userSecretsManager = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.userSecretsManager', + { context: this._handle } + ); + return new UserSecretsManager(handle, this._client); + }, + }; + + /** Builds the distributed application */ + /** @internal */ + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DistributedApplication(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); } + /** Adds a connection string with a reference expression */ /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + async _addConnectionStringExpressionInternal(name: string, connectionStringExpression: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, connectionStringExpression }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + 'Aspire.Hosting/addConnectionStringExpression', rpcArgs ); return new ConnectionStringResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { - const helpLink = options?.helpLink; - return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringExpressionInternal(name, connectionStringExpression)); } + /** Adds a connection string with a builder callback */ /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', + 'Aspire.Hosting/addConnectionStringBuilder', rpcArgs ); return new ConnectionStringResource(result, this._client); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); } + /** Adds a container registry resource */ /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); } + /** Adds a container registry with string endpoint */ /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + async _addContainerRegistryFromStringInternal(name: string, endpoint: string, repository?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistryFromString', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerRegistryResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryFromStringInternal(name, endpoint, repository)); } + /** Adds a container resource */ /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); } + /** Adds a container resource built from a Dockerfile */ /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { - const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); } + /** Adds a .NET tool resource */ /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { - const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); } + /** Adds an executable resource */ /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); } + /** Adds an external service resource */ /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); } + /** Adds an external service with a URI */ /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + async _addExternalServiceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceUri', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceUriInternal(name, uri)); } + /** Adds an external service with a parameter URL */ /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + async _addExternalServiceParameterInternal(name: string, urlParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, urlParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceParameter', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceParameterInternal(name, urlParameter)); } + /** Adds a parameter resource */ /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); } + /** Adds a parameter with a default value */ /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + async _addParameterWithValueInternal(name: string, value: string, publishValueAsDefault?: boolean, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + if (publishValueAsDefault !== undefined) rpcArgs.publishValueAsDefault = publishValueAsDefault; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterWithValue', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + const publishValueAsDefault = options?.publishValueAsDefault; + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterWithValueInternal(name, value, publishValueAsDefault, secret)); } + /** Adds a parameter sourced from configuration */ /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); } + /** Adds a connection string resource */ /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ResourceWithConnectionString(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - const exitCode = options?.exitCode; - return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); } + /** Adds a .NET project resource */ /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); } + /** Adds a project resource with configuration options */ /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { - const commandOptions = options?.commandOptions; - return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); } + /** Adds a C# application resource */ /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); } + /** Adds a C# application resource with configuration options */ /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); } + /** Gets the application configuration */ /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + async _getConfigurationInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getConfiguration', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new Configuration(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { - const iconVariant = options?.iconVariant; - return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._getConfigurationInternal()); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + /** Subscribes to the BeforeStart event */ + async subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeStartEventHandle; + const arg = new BeforeStartEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeBeforeStart', rpcArgs ); - return new ConnectionStringResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + /** Subscribes to the AfterResourcesCreated event */ + async subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as AfterResourcesCreatedEventHandle; + const arg = new AfterResourcesCreatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeAfterResourcesCreated', + rpcArgs + ); } + /** Adds a Node.js application resource */ /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + async _addNodeAppInternal(name: string, appDirectory: string, scriptPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory, scriptPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addNodeApp', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._addNodeAppInternal(name, appDirectory, scriptPath)); } + /** Adds a JavaScript application resource */ /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + async _addJavaScriptAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addJavaScriptApp', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + const runScriptName = options?.runScriptName; + return new JavaScriptAppResourcePromise(this._addJavaScriptAppInternal(name, appDirectory, runScriptName)); } + /** Adds a Vite application resource */ /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + async _addViteAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addViteApp', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + const runScriptName = options?.runScriptName; + return new ViteAppResourcePromise(this._addViteAppInternal(name, appDirectory, runScriptName)); } + /** Adds a Redis container resource with specific port */ /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + async _addRedisWithPortInternal(name: string, port?: number): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/addRedisWithPort', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new RedisResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { + const port = options?.port; + return new RedisResourcePromise(this._addRedisWithPortInternal(name, port)); } + /** Adds a Redis container resource */ /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + async _addRedisInternal(name: string, port?: number, password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (port !== undefined) rpcArgs.port = port; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/addRedis', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new RedisResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { + const port = options?.port; + const password = options?.password; + return new RedisResourcePromise(this._addRedisInternal(name, port, password)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** Adds an Orleans service configuration */ + /** @internal */ + async _addOrleansInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/addOrleans', rpcArgs ); + return new OrleansService(result, this._client); + } + + addOrleans(name: string): OrleansServicePromise { + return new OrleansServicePromise(this._addOrleansInternal(name)); } } /** - * Thenable wrapper for ConnectionStringResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. */ -export class ConnectionStringResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds a connection string with a reference expression */ + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringExpression(name, connectionStringExpression))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + /** Adds a container registry with string endpoint */ + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistryFromString(name, endpoint, options))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Adds an external service with a URI */ + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceUri(name, uri))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Adds an external service with a parameter URL */ + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceParameter(name, urlParameter))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Adds a parameter with a default value */ + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterWithValue(name, value, options))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Gets the application configuration */ + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._promise.then(obj => obj.getConfiguration())); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Subscribes to the BeforeStart event */ + subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeBeforeStart(callback)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Subscribes to the AfterResourcesCreated event */ + subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeAfterResourcesCreated(callback)); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds a Node.js application resource */ + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.addNodeApp(name, appDirectory, scriptPath))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Adds a JavaScript application resource */ + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.addJavaScriptApp(name, appDirectory, options))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds a Vite application resource */ + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.addViteApp(name, appDirectory, options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Adds a Redis container resource with specific port */ + addRedisWithPort(name: string, options?: AddRedisWithPortOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.addRedisWithPort(name, options))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Adds a Redis container resource */ + addRedis(name: string, options?: AddRedisOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.addRedis(name, options))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Adds an Orleans service configuration */ + addOrleans(name: string): OrleansServicePromise { + return new OrleansServicePromise(this._promise.then(obj => obj.addOrleans(name))); } } // ============================================================================ -// ContainerRegistryResource +// DistributedApplicationEventing // ============================================================================ -export class ContainerRegistryResource extends ResourceBuilderBase { - constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { - super(handle, client); - } +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Invokes the Unsubscribe method */ /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', +} + +// ============================================================================ +// HostEnvironment +// ============================================================================ + +/** + * Type class for HostEnvironment. + */ +export class HostEnvironment { + constructor(private _handle: IHostEnvironmentHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Checks if running in Development environment */ + async isDevelopment(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isDevelopment', rpcArgs ); - return new ContainerRegistryResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { - const helpLink = options?.helpLink; - return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Checks if running in Production environment */ + async isProduction(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isProduction', + rpcArgs + ); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + /** Checks if running in Staging environment */ + async isStaging(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isStaging', rpcArgs ); - return new ContainerRegistryResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); - } - - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + /** Checks if the environment matches the specified name */ + async isEnvironment(environmentName: string): Promise { + const rpcArgs: Record = { environment: this._handle, environmentName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isEnvironment', rpcArgs ); - return new ContainerRegistryResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); +} + +/** + * Thenable wrapper for HostEnvironment that enables fluent chaining. + */ +export class HostEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: HostEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Checks if running in Development environment */ + isDevelopment(): Promise { + return this._promise.then(obj => obj.isDevelopment()); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { - const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + /** Checks if running in Production environment */ + isProduction(): Promise { + return this._promise.then(obj => obj.isProduction()); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Checks if running in Staging environment */ + isStaging(): Promise { + return this._promise.then(obj => obj.isStaging()); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { - const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Checks if the environment matches the specified name */ + isEnvironment(environmentName: string): Promise { + return this._promise.then(obj => obj.isEnvironment(environmentName)); } +} + +// ============================================================================ +// Logger +// ============================================================================ + +/** + * Type class for Logger. + */ +export class Logger { + constructor(private _handle: ILoggerHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Logs an information message */ /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + async _logInformationInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logInformation', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._logInformationInternal(message)); } + /** Logs a warning message */ /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + async _logWarningInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logWarning', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._logWarningInternal(message)); } + /** Logs an error message */ /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + async _logErrorInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logError', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + logError(message: string): LoggerPromise { + return new LoggerPromise(this._logErrorInternal(message)); } + /** Logs a debug message */ /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + async _logDebugInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logDebug', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._logDebugInternal(message)); } + /** Logs a message with specified level */ /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + async _logInternal(level: string, message: string): Promise { + const rpcArgs: Record = { logger: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/log', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._logInternal(level, message)); + } + +} + +/** + * Thenable wrapper for Logger that enables fluent chaining. + */ +export class LoggerPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Logger) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Logs an information message */ + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logInformation(message))); + } + + /** Logs a warning message */ + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logWarning(message))); + } + + /** Logs an error message */ + logError(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logError(message))); + } + + /** Logs a debug message */ + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logDebug(message))); + } + + /** Logs a message with specified level */ + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.log(level, message))); } +} + +// ============================================================================ +// LoggerFactory +// ============================================================================ + +/** + * Type class for LoggerFactory. + */ +export class LoggerFactory { + constructor(private _handle: ILoggerFactoryHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Creates a logger for a category */ /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + async _createLoggerInternal(categoryName: string): Promise { + const rpcArgs: Record = { loggerFactory: this._handle, categoryName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createLogger', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new Logger(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._createLoggerInternal(categoryName)); + } + +} + +/** + * Thenable wrapper for LoggerFactory that enables fluent chaining. + */ +export class LoggerFactoryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: LoggerFactory) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Creates a logger for a category */ + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.createLogger(categoryName))); } +} + +// ============================================================================ +// ReportingStep +// ============================================================================ + +/** + * Type class for ReportingStep. + */ +export class ReportingStep { + constructor(private _handle: IReportingStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Creates a reporting task with plain-text status text */ /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + async _createTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createTask', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ReportingTask(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createTaskInternal(statusText, cancellationToken)); } + /** Creates a reporting task with Markdown-formatted status text */ /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + async _createMarkdownTaskInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createMarkdownTask', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ReportingTask(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createMarkdownTaskInternal(markdownString, cancellationToken)); } + /** Logs a plain-text message for the reporting step */ /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + async _logStepInternal(level: string, message: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStep', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepInternal(level, message)); } + /** Logs a Markdown-formatted message for the reporting step */ /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + async _logStepMarkdownInternal(level: string, markdownString: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStepMarkdown', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepMarkdownInternal(level, markdownString)); } + /** Completes the reporting step with plain-text completion text */ /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + async _completeStepInternal(completionText: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, completionText }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStep', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepInternal(completionText, completionState, cancellationToken)); } + /** Completes the reporting step with Markdown-formatted completion text */ /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + async _completeStepMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStepMarkdown', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return this; } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); - } - - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); - } - - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); - } - - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepMarkdownInternal(markdownString, completionState, cancellationToken)); } } /** - * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); + * Thenable wrapper for ReportingStep that enables fluent chaining. */ -export class ContainerRegistryResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ReportingStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ReportingStep) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Creates a reporting task with plain-text status text */ + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createTask(statusText, options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Creates a reporting task with Markdown-formatted status text */ + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createMarkdownTask(markdownString, options))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Logs a plain-text message for the reporting step */ + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStep(level, message))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Logs a Markdown-formatted message for the reporting step */ + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStepMarkdown(level, markdownString))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Completes the reporting step with plain-text completion text */ + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStep(completionText, options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Completes the reporting step with Markdown-formatted completion text */ + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStepMarkdown(markdownString, options))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } +} - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } +// ============================================================================ +// ReportingTask +// ============================================================================ - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } +/** + * Type class for ReportingTask. + */ +export class ReportingTask { + constructor(private _handle: IReportingTaskHandle, private _client: AspireClientRpc) {} - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Updates the reporting task with plain-text status text */ + /** @internal */ + async _updateTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTask', + rpcArgs + ); + return this; } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskInternal(statusText, cancellationToken)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Updates the reporting task with Markdown-formatted status text */ + /** @internal */ + async _updateTaskMarkdownInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTaskMarkdown', + rpcArgs + ); + return this; } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskMarkdownInternal(markdownString, cancellationToken)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Completes the reporting task with plain-text completion text */ + /** @internal */ + async _completeTaskInternal(completionMessage?: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle }; + if (completionMessage !== undefined) rpcArgs.completionMessage = completionMessage; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTask', + rpcArgs + ); + return this; } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + const completionMessage = options?.completionMessage; + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskInternal(completionMessage, completionState, cancellationToken)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Completes the reporting task with Markdown-formatted completion text */ + /** @internal */ + async _completeTaskMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTaskMarkdown', + rpcArgs + ); + return this; } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskMarkdownInternal(markdownString, completionState, cancellationToken)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); +} + +/** + * Thenable wrapper for ReportingTask that enables fluent chaining. + */ +export class ReportingTaskPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReportingTask) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Updates the reporting task with plain-text status text */ + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTask(statusText, options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Updates the reporting task with Markdown-formatted status text */ + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTaskMarkdown(markdownString, options))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Completes the reporting task with plain-text completion text */ + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTask(options))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Completes the reporting task with Markdown-formatted completion text */ + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTaskMarkdown(markdownString, options))); } } // ============================================================================ -// ContainerResource +// ServiceProvider // ============================================================================ -export class ContainerResource extends ResourceBuilderBase { - constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { - super(handle, client); - } +/** + * Type class for ServiceProvider. + */ +export class ServiceProvider { + constructor(private _handle: IServiceProviderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the distributed application eventing service from the service provider */ /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + async _getEventingInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getEventing', rpcArgs ); - return new ContainerResource(result, this._client); + return new DistributedApplicationEventing(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._getEventingInternal()); } + /** Gets the logger factory from the service provider */ /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + async _getLoggerFactoryInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getLoggerFactory', rpcArgs ); - return new ContainerResource(result, this._client); + return new LoggerFactory(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._getLoggerFactoryInternal()); } + /** Gets the resource logger service from the service provider */ /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + async _getResourceLoggerServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceLoggerService', rpcArgs ); - return new ContainerResource(result, this._client); + return new ResourceLoggerService(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._getResourceLoggerServiceInternal()); } + /** Gets the distributed application model from the service provider */ /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + async _getDistributedApplicationModelInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getDistributedApplicationModel', rpcArgs ); - return new ContainerResource(result, this._client); + return new DistributedApplicationModel(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterInternal()); + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._getDistributedApplicationModelInternal()); } + /** Gets the resource notification service from the service provider */ /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + async _getResourceNotificationServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceNotificationService', rpcArgs ); - return new ContainerResource(result, this._client); + return new ResourceNotificationService(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._getResourceNotificationServiceInternal()); } + /** Gets the user secrets manager from the service provider */ /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + async _getUserSecretsManagerInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getUserSecretsManager', rpcArgs ); - return new ContainerResource(result, this._client); + return new UserSecretsManager(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - const helpLink = options?.helpLink; - return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getUserSecretsManagerInternal()); } - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ContainerResource(result, this._client); +} + +/** + * Thenable wrapper for ServiceProvider that enables fluent chaining. + */ +export class ServiceProviderPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ServiceProvider) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + /** Gets the distributed application eventing service from the service provider */ + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.getEventing())); } - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets the logger factory from the service provider */ + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._promise.then(obj => obj.getLoggerFactory())); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Gets the resource logger service from the service provider */ + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.getResourceLoggerService())); } - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + /** Gets the distributed application model from the service provider */ + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._promise.then(obj => obj.getDistributedApplicationModel())); + } + + /** Gets the resource notification service from the service provider */ + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.getResourceNotificationService())); + } + + /** Gets the user secrets manager from the service provider */ + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getUserSecretsManager())); + } + +} + +// ============================================================================ +// UserSecretsManager +// ============================================================================ + +/** + * Type class for UserSecretsManager. + */ +export class UserSecretsManager { + constructor(private _handle: IUserSecretsManagerHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the IsAvailable property */ + isAvailable = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.isAvailable', + { context: this._handle } + ); + }, + }; + + /** Gets the FilePath property */ + filePath = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.filePath', + { context: this._handle } + ); + }, + }; + + /** Attempts to set a user secret value */ + async trySetSecret(name: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, name, value }; + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.trySetSecret', rpcArgs ); - return new ContainerResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Saves state to user secrets from a JSON string */ + /** @internal */ + async _saveStateJsonInternal(json: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, json }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/saveStateJson', + rpcArgs + ); + return this; + } + + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + const cancellationToken = options?.cancellationToken; + return new UserSecretsManagerPromise(this._saveStateJsonInternal(json, cancellationToken)); } + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + async _getOrSetSecretInternal(resourceBuilder: ResourceBuilderBase, name: string, value: string): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, resourceBuilder, name, value }; + await this._client.invokeCapability( + 'Aspire.Hosting/getOrSetSecret', rpcArgs ); - return new ContainerResource(result, this._client); + return this; + } + + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getOrSetSecretInternal(resourceBuilder, name, value)); + } + +} + +/** + * Thenable wrapper for UserSecretsManager that enables fluent chaining. + */ +export class UserSecretsManagerPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: UserSecretsManager) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Attempts to set a user secret value */ + trySetSecret(name: string, value: string): Promise { + return this._promise.then(obj => obj.trySetSecret(name, value)); + } + + /** Saves state to user secrets from a JSON string */ + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.saveStateJson(json, options))); + } + + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getOrSetSecret(resourceBuilder, name, value))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsInternal(args)); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + return new ConnectionStringResource(result, this._client); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromManifestInternal()); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForInternal(dependency)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExplicitStartInternal()); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onConnectionStringAvailableInternal(callback)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - const exitCode = options?.exitCode; - return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new ContainerResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceReadyInternal(callback)); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new ContainerResource(result, this._client); +} + +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - const password = options?.password; - return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromMcpInternal()); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** @internal */ - private async _withOrleansClientReferenceInternal(orleansServiceClient: OrleansServiceClientHandle): Promise { - const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Orleans/withOrleansClientReference', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Adds an Orleans client reference to a resource */ - withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); - } +} + +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ + +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); + } /** @internal */ - private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { - const rpcArgs: Record = { builder: this._handle, orleansService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Orleans/withOrleansReference', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Adds an Orleans silo reference to a resource */ - withOrleansReference(orleansService: OrleansService): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOrleansReferenceInternal(orleansService)); + return new ContainerRegistryResource(result, this._client); } -} - -/** - * Thenable wrapper for ContainerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ContainerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceReadyInternal(callback)); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); - } +} - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); - } +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -4806,945 +5947,1110 @@ export class ContainerResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } - /** Adds an Orleans client reference to a resource */ - withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Adds an Orleans silo reference to a resource */ - withOrleansReference(orleansService: OrleansService): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } } // ============================================================================ -// CSharpAppResource +// ContainerResource // ============================================================================ -export class CSharpAppResource extends ResourceBuilderBase { - constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withReplicasInternal(replicas: number): Promise { - const rpcArgs: Record = { builder: this._handle, replicas }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReplicas', + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _disableForwardedHeadersInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/disableForwardedHeaders', + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - const helpLink = options?.helpLink; - return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsInternal(args)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); - } + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new CSharpAppResource(result, this._client); - } - - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + return new ContainerResource(result, this._client); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); - } + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); - } - - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - const exitCode = options?.exitCode; - return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + const displayText = options?.displayText; + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - const commandOptions = options?.commandOptions; - return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - const password = options?.password; - return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + const exitCode = options?.exitCode; + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + const password = options?.password; + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { const iconVariant = options?.iconVariant; - return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -5753,15 +7059,15 @@ export class CSharpAppResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -5769,56 +7075,56 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -5829,65 +7135,84 @@ export class CSharpAppResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; return await this._client.invokeCapability( 'Aspire.Hosting/getResourceName', rpcArgs @@ -5895,355 +7220,510 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withOrleansClientReferenceInternal(orleansServiceClient: OrleansServiceClientHandle): Promise { const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Orleans/withOrleansClientReference', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an Orleans client reference to a resource */ - withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); } /** @internal */ - private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { + private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { const rpcArgs: Record = { builder: this._handle, orleansService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Orleans/withOrleansReference', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an Orleans silo reference to a resource */ - withOrleansReference(orleansService: OrleansService): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOrleansReferenceInternal(orleansService)); + withOrleansReference(orleansService: OrleansService): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOrleansReferenceInternal(orleansService)); } } /** - * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * Thenable wrapper for ContainerResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class CSharpAppResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); } - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** Adds arguments */ + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); - } + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } /** Gets the resource name */ @@ -6251,548 +7731,407 @@ export class CSharpAppResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + /** Adds an Orleans client reference to a resource */ - withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); } /** Adds an Orleans silo reference to a resource */ - withOrleansReference(orleansService: OrleansService): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); + withOrleansReference(orleansService: OrleansService): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); } } // ============================================================================ -// DotnetToolResource +// CSharpAppResource // ============================================================================ -export class DotnetToolResource extends ResourceBuilderBase { - constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withToolPackageInternal(packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPackage', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withToolVersionInternal(version: string): Promise { - const rpcArgs: Record = { builder: this._handle, version }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolVersion', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withToolPrereleaseInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPrerelease', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); - } - - /** @internal */ - private async _withToolSourceInternal(source: string): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolSource', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); - } - - /** @internal */ - private async _withToolIgnoreExistingFeedsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreExistingFeeds', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withToolIgnoreFailedSourcesInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreFailedSources', + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); } /** @internal */ - private async _publishAsDockerFileInternal(): Promise { + private async _disableForwardedHeadersInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFile', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); } /** @internal */ - private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; const obj = new ContainerResource(objHandle, this._client); await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFileWithConfigure', + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + const configure = options?.configure; + return new CSharpAppResourcePromise(this._publishAsDockerFileInternal(configure)); } /** @internal */ - private async _withExecutableCommandInternal(command: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExecutableCommand', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); - } - - /** @internal */ - private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { - const rpcArgs: Record = { builder: this._handle, workingDirectory }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withWorkingDirectory', + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - const helpLink = options?.helpLink; - return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Adds arguments */ + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); - } - - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); - } - - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); - } - - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsInternal(args)); - } - - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); - } - - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); - } - - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -6802,15 +8141,15 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -6819,72 +8158,72 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -6897,278 +8236,293 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { const exitCode = options?.exitCode; - return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -7176,130 +8530,130 @@ export class DotnetToolResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { const commandOptions = options?.commandOptions; - return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { const password = options?.password; - return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { const iconVariant = options?.iconVariant; - return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -7308,15 +8662,15 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -7324,56 +8678,56 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -7384,60 +8738,60 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -7450,230 +8804,275 @@ export class DotnetToolResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Orleans/withOrleansClientReference', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds an Orleans client reference to a resource */ - withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { - const rpcArgs: Record = { builder: this._handle, orleansService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Orleans/withOrleansReference', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds an Orleans silo reference to a resource */ - withOrleansReference(orleansService: OrleansService): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOrleansReferenceInternal(orleansService)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceStoppedInternal(callback)); } -} - -/** - * Thenable wrapper for DotnetToolResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class DotnetToolResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceReadyInternal(callback)); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + /** @internal */ + private async _withOrleansClientReferenceInternal(orleansServiceClient: OrleansServiceClientHandle): Promise { + const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansClientReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + /** @internal */ + private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { + const rpcArgs: Record = { builder: this._handle, orleansService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansReference', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOrleansReferenceInternal(orleansService)); } - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); +} + +/** + * Thenable wrapper for CSharpAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -7682,158 +9081,163 @@ export class DotnetToolResourcePromise implements PromiseLike obj.asHttp2Service())); + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -7841,393 +9245,510 @@ export class DotnetToolResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + /** Adds an Orleans client reference to a resource */ - withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); } /** Adds an Orleans silo reference to a resource */ - withOrleansReference(orleansService: OrleansService): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); + withOrleansReference(orleansService: OrleansService): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); } } // ============================================================================ -// ExecutableResource +// DotnetToolResource // ============================================================================ -export class ExecutableResource extends ResourceBuilderBase { - constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - const helpLink = options?.helpLink; - return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + const name = options?.name; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); - } - - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); - } - - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -8237,15 +9758,15 @@ export class ExecutableResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -8254,72 +9775,72 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -8332,278 +9853,278 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { const exitCode = options?.exitCode; - return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -8611,130 +10132,130 @@ export class ExecutableResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { const commandOptions = options?.commandOptions; - return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); - } + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { const password = options?.password; - return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { const iconVariant = options?.iconVariant; - return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -8743,15 +10264,15 @@ export class ExecutableResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -8759,56 +10280,56 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -8819,60 +10340,60 @@ export class ExecutableResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -8885,180 +10406,310 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new DotnetToolResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withOrleansClientReferenceInternal(orleansServiceClient: OrleansServiceClientHandle): Promise { const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Orleans/withOrleansClientReference', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an Orleans client reference to a resource */ - withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); } /** @internal */ - private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { + private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { const rpcArgs: Record = { builder: this._handle, orleansService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Orleans/withOrleansReference', rpcArgs ); - return new ExecutableResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds an Orleans silo reference to a resource */ - withOrleansReference(orleansService: OrleansService): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOrleansReferenceInternal(orleansService)); + withOrleansReference(orleansService: OrleansService): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOrleansReferenceInternal(orleansService)); } } /** - * Thenable wrapper for ExecutableResource that enables fluent chaining. + * Thenable wrapper for DotnetToolResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ExecutableResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); - } - - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -9067,158 +10718,158 @@ export class ExecutableResourcePromise implements PromiseLike obj.asHttp2Service())); + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -9226,2486 +10877,2128 @@ export class ExecutableResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + /** Adds an Orleans client reference to a resource */ - withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); } /** Adds an Orleans silo reference to a resource */ - withOrleansReference(orleansService: OrleansService): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); + withOrleansReference(orleansService: OrleansService): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); } } // ============================================================================ -// ExternalServiceResource +// ExecutableResource // ============================================================================ -export class ExternalServiceResource extends ResourceBuilderBase { - constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + private async _publishAsDockerFileInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - const helpLink = options?.helpLink; - return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - const commandOptions = options?.commandOptions; - return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - const iconVariant = options?.iconVariant; - return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', rpcArgs ); + return new ExecutableResource(result, this._client); } -} - -/** - * Thenable wrapper for ExternalServiceResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ExternalServiceResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); - } - - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); - } - - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); - } - -} - -// ============================================================================ -// ParameterResource -// ============================================================================ - -export class ParameterResource extends ResourceBuilderBase { - constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', rpcArgs ); - return new ParameterResource(result, this._client); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new ParameterResource(result, this._client); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); - } - - /** @internal */ - private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, description }; - if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDescription', - rpcArgs - ); - return new ParameterResource(result, this._client); - } - - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - const enableMarkdown = options?.enableMarkdown; - return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); - } - - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - const helpLink = options?.helpLink; - return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromManifestInternal()); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._withExplicitStartInternal()); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ParameterResource(result, this._client); + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - const commandOptions = options?.commandOptions; - return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - const iconVariant = options?.iconVariant; - return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromMcpInternal()); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ParameterResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); + return new ExecutableResource(result, this._client); } -} - -/** - * Thenable wrapper for ParameterResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ParameterResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); - } - - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); - } - - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); - } - - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); - } - -} - -// ============================================================================ -// ProjectResource -// ============================================================================ - -export class ProjectResource extends ResourceBuilderBase { - constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { - super(handle, client); + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterInternal()); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - const helpLink = options?.helpLink; - return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ProjectResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new ProjectResource(result, this._client); - } - - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsInternal(args)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withOrleansClientReferenceInternal(orleansServiceClient: OrleansServiceClientHandle): Promise { + const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansClientReference', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { + const rpcArgs: Record = { builder: this._handle, orleansService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansReference', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOrleansReferenceInternal(orleansService)); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ProjectResource(result, this._client); +} + +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { - const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { - const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromManifestInternal()); - } - - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new ProjectResource(result, this._client); + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForInternal(dependency)); - } - - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new ProjectResource(result, this._client); + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExplicitStartInternal()); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { - const exitCode = options?.exitCode; - return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { - const commandOptions = options?.commandOptions; - return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { - const password = options?.password; - return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { - const iconVariant = options?.iconVariant; - return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); + } + +} + +// ============================================================================ +// ExternalServiceResource +// ============================================================================ + +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromMcpInternal()); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withOrleansClientReferenceInternal(orleansServiceClient: OrleansServiceClientHandle): Promise { - const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Orleans/withOrleansClientReference', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds an Orleans client reference to a resource */ - withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { - const rpcArgs: Record = { builder: this._handle, orleansService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Orleans/withOrleansReference', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds an Orleans silo reference to a resource */ - withOrleansReference(orleansService: OrleansService): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOrleansReferenceInternal(orleansService)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); } -} + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } -/** - * Thenable wrapper for ProjectResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ProjectResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + } - then( - onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceReadyInternal(callback)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); - } +} - /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); - } +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); - } - - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } - - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); - } - - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); - } - - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); - } - - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); - } - - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); - } - - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -11713,1608 +13006,1525 @@ export class ProjectResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } - /** Adds an Orleans client reference to a resource */ - withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Adds an Orleans silo reference to a resource */ - withOrleansReference(orleansService: OrleansService): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } } // ============================================================================ -// RedisCommanderResource +// JavaScriptAppResource // ============================================================================ -export class RedisCommanderResource extends ResourceBuilderBase { - constructor(handle: RedisCommanderResourceHandle, client: AspireClientRpc) { +export class JavaScriptAppResource extends ResourceBuilderBase { + constructor(handle: JavaScriptAppResourceHandle, client: AspireClientRpc) { super(handle, client); } + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisCommanderResourcePromise { - const isReadOnly = options?.isReadOnly; - return new RedisCommanderResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new JavaScriptAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withImageTagInternal(tag)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withImageRegistryInternal(registry)); + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): RedisCommanderResourcePromise { - const tag = options?.tag; - return new RedisCommanderResourcePromise(this._withImageInternal(image, tag)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withImageSHA256Internal(sha256)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withLifetimeInternal(lifetime)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + const helpLink = options?.helpLink; + return new JavaScriptAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._publishAsContainerInternal()); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisCommanderResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new RedisCommanderResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withContainerNameInternal(name)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withBuildArgInternal(name, value)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withBuildSecretInternal(name, value)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Adds arguments */ + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisCommanderResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new RedisCommanderResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): RedisCommanderResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new RedisCommanderResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new JavaScriptAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withOtlpExporterInternal()); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._publishAsConnectionStringInternal()); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisCommanderResourcePromise { - const helpLink = options?.helpLink; - return new RedisCommanderResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new JavaScriptAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new JavaScriptAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new JavaScriptAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + const displayText = options?.displayText; + return new JavaScriptAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withArgsInternal(args)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + const displayText = options?.displayText; + return new JavaScriptAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withArgsCallbackInternal(callback)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisCommanderResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new RedisCommanderResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withServiceReferenceInternal(source)); + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._clearContainerFilesSourcesInternal()); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): RedisCommanderResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new RedisCommanderResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): RedisCommanderResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new RedisCommanderResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Prevents resource from starting automatically */ + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisCommanderResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new RedisCommanderResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + const exitCode = options?.exitCode; + return new JavaScriptAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new RedisCommanderResource(result, this._client); - } - - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withExternalHttpEndpointsInternal()); + return new JavaScriptAppResource(result, this._client); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Adds a health check by key */ + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._asHttp2ServiceInternal()); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + const commandOptions = options?.commandOptions; + return new JavaScriptAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): RedisCommanderResourcePromise { - const displayText = options?.displayText; - return new RedisCommanderResourcePromise(this._withUrlInternal(url, displayText)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisCommanderResourcePromise { - const displayText = options?.displayText; - return new RedisCommanderResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + const password = options?.password; + return new JavaScriptAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._excludeFromManifestInternal()); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._waitForInternal(dependency)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + const iconVariant = options?.iconVariant; + return new JavaScriptAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._waitForStartInternal(dependency)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withExplicitStartInternal()); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisCommanderResourcePromise { - const exitCode = options?.exitCode; - return new RedisCommanderResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new JavaScriptAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withHealthCheckInternal(key)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisCommanderResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new RedisCommanderResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new RedisCommanderResource(result, this._client); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisCommanderResourcePromise { - const commandOptions = options?.commandOptions; - return new RedisCommanderResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisCommanderResourcePromise { - const password = options?.password; - return new RedisCommanderResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withoutHttpsCertificateInternal()); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withParentRelationshipInternal(parent)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withChildRelationshipInternal(child)); + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): RedisCommanderResourcePromise { - const iconVariant = options?.iconVariant; - return new RedisCommanderResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withBunInternal(install, installArgs)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisCommanderResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new RedisCommanderResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withYarnInternal(install, installArgs)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._excludeFromMcpInternal()); + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withPnpmInternal(install, installArgs)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisCommanderResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new RedisCommanderResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + const browser = options?.browser; + return new JavaScriptAppResourcePromise(this._withBrowserDebuggerInternal(browser)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withOrleansClientReferenceInternal(orleansServiceClient: OrleansServiceClientHandle): Promise { + const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansClientReference', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { + const rpcArgs: Record = { builder: this._handle, orleansService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansReference', rpcArgs ); - return new RedisCommanderResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOrleansReferenceInternal(orleansService)); } - /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): RedisCommanderResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new RedisCommanderResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); - } - - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); - } - - /** @internal */ - private async _withHostPortInternal(port?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withRedisCommanderHostPort', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); - } - - /** Sets the host port for Redis Commander */ - withHostPort(options?: WithHostPortOptions): RedisCommanderResourcePromise { - const port = options?.port; - return new RedisCommanderResourcePromise(this._withHostPortInternal(port)); - } - - /** @internal */ - private async _withOrleansClientReferenceInternal(orleansServiceClient: OrleansServiceClientHandle): Promise { - const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Orleans/withOrleansClientReference', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); - } - - /** Adds an Orleans client reference to a resource */ - withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); - } - - /** @internal */ - private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { - const rpcArgs: Record = { builder: this._handle, orleansService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Orleans/withOrleansReference', - rpcArgs - ); - return new RedisCommanderResource(result, this._client); - } - - /** Adds an Orleans silo reference to a resource */ - withOrleansReference(orleansService: OrleansService): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._withOrleansReferenceInternal(orleansService)); - } - -} +} /** - * Thenable wrapper for RedisCommanderResource that enables fluent chaining. + * Thenable wrapper for JavaScriptAppResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class RedisCommanderResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class JavaScriptAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: RedisCommanderResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: JavaScriptAppResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } - - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); - } - - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); - } - - /** Sets the container image tag */ - withImageTag(tag: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); - } - - /** Sets the container image registry */ - withImageRegistry(registry: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); - } - - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImage(image, options))); - } - - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); - } - - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); - } - - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); - } - - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); - } - - /** Configures the resource to be published as a container */ - publishAsContainer(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.publishAsContainer())); - } - - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); - } - - /** Sets the container name */ - withContainerName(name: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ - withOtlpExporter(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); - } - - /** Publishes the resource as a connection string */ - publishAsConnectionString(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -13323,163 +14533,168 @@ export class RedisCommanderResourcePromise implements PromiseLike obj.asHttp2Service())); + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -13487,1645 +14702,1590 @@ export class RedisCommanderResourcePromise implements PromiseLike obj.getResourceName()); } - /** Sets the host port for Redis Commander */ - withHostPort(options?: WithHostPortOptions): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); } /** Adds an Orleans client reference to a resource */ - withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); } /** Adds an Orleans silo reference to a resource */ - withOrleansReference(orleansService: OrleansService): RedisCommanderResourcePromise { - return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); + withOrleansReference(orleansService: OrleansService): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); } } // ============================================================================ -// RedisInsightResource +// NodeAppResource // ============================================================================ -export class RedisInsightResource extends ResourceBuilderBase { - constructor(handle: RedisInsightResourceHandle, client: AspireClientRpc) { +export class NodeAppResource extends ResourceBuilderBase { + constructor(handle: NodeAppResourceHandle, client: AspireClientRpc) { super(handle, client); } + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisInsightResourcePromise { - const isReadOnly = options?.isReadOnly; - return new RedisInsightResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new NodeAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withImageTagInternal(tag)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withImageRegistryInternal(registry)); + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): RedisInsightResourcePromise { - const tag = options?.tag; - return new RedisInsightResourcePromise(this._withImageInternal(image, tag)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withImageSHA256Internal(sha256)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withLifetimeInternal(lifetime)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + const helpLink = options?.helpLink; + return new NodeAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._publishAsContainerInternal()); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisInsightResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new RedisInsightResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withContainerNameInternal(name)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withBuildArgInternal(name, value)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withBuildSecretInternal(name, value)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Adds arguments */ + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisInsightResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new RedisInsightResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): RedisInsightResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new RedisInsightResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new NodeAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withOtlpExporterInternal()); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._publishAsConnectionStringInternal()); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new NodeAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisInsightResourcePromise { - const helpLink = options?.helpLink; - return new RedisInsightResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', rpcArgs ); - return new RedisInsightResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new RedisInsightResource(result, this._client); + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new NodeAppResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withArgsInternal(args)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withArgsCallbackInternal(callback)); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisInsightResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new RedisInsightResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._clearContainerFilesSourcesInternal()); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withServiceReferenceInternal(source)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): RedisInsightResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new RedisInsightResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Prevents resource from starting automatically */ + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): RedisInsightResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new RedisInsightResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + const exitCode = options?.exitCode; + return new NodeAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisInsightResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new RedisInsightResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds a health check by key */ + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withExternalHttpEndpointsInternal()); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); + return new NodeAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + const commandOptions = options?.commandOptions; + return new NodeAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._asHttp2ServiceInternal()); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + const password = options?.password; + return new NodeAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): RedisInsightResourcePromise { - const displayText = options?.displayText; - return new RedisInsightResourcePromise(this._withUrlInternal(url, displayText)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisInsightResourcePromise { - const displayText = options?.displayText; - return new RedisInsightResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + const iconVariant = options?.iconVariant; + return new NodeAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._excludeFromManifestInternal()); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._waitForInternal(dependency)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._waitForStartInternal(dependency)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new NodeAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withExplicitStartInternal()); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisInsightResourcePromise { - const exitCode = options?.exitCode; - return new RedisInsightResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new RedisInsightResource(result, this._client); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisInsightResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new RedisInsightResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisInsightResourcePromise { - const commandOptions = options?.commandOptions; - return new RedisInsightResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisInsightResourcePromise { - const password = options?.password; - return new RedisInsightResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withoutHttpsCertificateInternal()); + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withParentRelationshipInternal(parent)); + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withBunInternal(install, installArgs)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withChildRelationshipInternal(child)); + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withYarnInternal(install, installArgs)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): RedisInsightResourcePromise { - const iconVariant = options?.iconVariant; - return new RedisInsightResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withPnpmInternal(install, installArgs)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisInsightResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new RedisInsightResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._excludeFromMcpInternal()); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + const browser = options?.browser; + return new NodeAppResourcePromise(this._withBrowserDebuggerInternal(browser)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withOrleansClientReferenceInternal(orleansServiceClient: OrleansServiceClientHandle): Promise { + const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansClientReference', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { + const rpcArgs: Record = { builder: this._handle, orleansService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansReference', rpcArgs ); - return new RedisInsightResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisInsightResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new RedisInsightResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOrleansReferenceInternal(orleansService)); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new RedisInsightResource(result, this._client); - } +} - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); +/** + * Thenable wrapper for NodeAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class NodeAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: NodeAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new RedisInsightResource(result, this._client); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', - rpcArgs - ); - return new RedisInsightResource(result, this._client); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new RedisInsightResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** @internal */ - private async _withHostPortInternal(port?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withRedisInsightHostPort', - rpcArgs - ); - return new RedisInsightResource(result, this._client); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** Sets the host port for Redis Insight */ - withHostPort(options?: WithHostPortOptions): RedisInsightResourcePromise { - const port = options?.port; - return new RedisInsightResourcePromise(this._withHostPortInternal(port)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** @internal */ - private async _withDataVolumeInternal(name?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (name !== undefined) rpcArgs.name = name; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withRedisInsightDataVolume', - rpcArgs - ); - return new RedisInsightResource(result, this._client); + /** Configures OTLP telemetry export */ + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Adds a data volume for Redis Insight */ - withDataVolume(options?: WithDataVolumeOptions): RedisInsightResourcePromise { - const name = options?.name; - return new RedisInsightResourcePromise(this._withDataVolumeInternal(name)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** @internal */ - private async _withDataBindMountInternal(source: string): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withRedisInsightDataBindMount', - rpcArgs - ); - return new RedisInsightResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Adds a data bind mount for Redis Insight */ - withDataBindMount(source: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withDataBindMountInternal(source)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** @internal */ - private async _withOrleansClientReferenceInternal(orleansServiceClient: OrleansServiceClientHandle): Promise { - const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Orleans/withOrleansClientReference', - rpcArgs - ); - return new RedisInsightResource(result, this._client); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Adds an Orleans client reference to a resource */ - withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** @internal */ - private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { - const rpcArgs: Record = { builder: this._handle, orleansService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Orleans/withOrleansReference', - rpcArgs - ); - return new RedisInsightResource(result, this._client); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** Adds an Orleans silo reference to a resource */ - withOrleansReference(orleansService: OrleansService): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._withOrleansReferenceInternal(orleansService)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } -} + /** Adds arguments */ + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } -/** - * Thenable wrapper for RedisInsightResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class RedisInsightResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } - then( - onfulfilled?: ((value: RedisInsightResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } - - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); - } - - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); - } - - /** Sets the container image tag */ - withImageTag(tag: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); - } - - /** Sets the container image registry */ - withImageRegistry(registry: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); - } - - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImage(image, options))); - } - - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); - } - - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); - } - - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); - } - - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); - } - - /** Configures the resource to be published as a container */ - publishAsContainer(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.publishAsContainer())); - } - - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); - } - - /** Sets the container name */ - withContainerName(name: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerName(name))); - } - - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); - } - - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); - } - - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); - } - - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); - } - - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); - } - - /** Configures OTLP telemetry export */ - withOtlpExporter(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); - } - - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); - } - - /** Publishes the resource as a connection string */ - publishAsConnectionString(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); - } - - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); - } - - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); - } - - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); - } - - /** Adds arguments */ - withArgs(args: string[]): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgs(args))); - } - - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); - } - - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -15134,163 +16294,173 @@ export class RedisInsightResourcePromise implements PromiseLike obj.asHttp2Service())); + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -15298,812 +16468,8447 @@ export class RedisInsightResourcePromise implements PromiseLike obj.getResourceName()); } - /** Sets the host port for Redis Insight */ - withHostPort(options?: WithHostPortOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Adds a data volume for Redis Insight */ - withDataVolume(options?: WithDataVolumeOptions): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Adds a data bind mount for Redis Insight */ - withDataBindMount(source: string): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDataBindMount(source))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Adds an Orleans client reference to a resource */ - withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** Adds an Orleans silo reference to a resource */ - withOrleansReference(orleansService: OrleansService): RedisInsightResourcePromise { - return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } -} + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } -// ============================================================================ -// RedisResource -// ============================================================================ + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } -export class RedisResource extends ResourceBuilderBase { - constructor(handle: RedisResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); } - /** Gets the PrimaryEndpoint property */ - primaryEndpoint = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.primaryEndpoint', - { context: this._handle } - ); - return new EndpointReference(handle, this._client); - }, - }; + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } - /** Gets the Host property */ - host = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.host', - { context: this._handle } - ); - return new EndpointReferenceExpression(handle, this._client); - }, - }; + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } - /** Gets the Port property */ - port = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.port', - { context: this._handle } - ); - return new EndpointReferenceExpression(handle, this._client); - }, - }; + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } - /** Gets the TlsEnabled property */ - tlsEnabled = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.tlsEnabled', - { context: this._handle } - ); - }, - set: async (value: boolean): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.setTlsEnabled', - { context: this._handle, value } - ); - } - }; + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } - /** Gets the ConnectionStringExpression property */ - connectionStringExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.connectionStringExpression', - { context: this._handle } - ); - }, - }; + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); + } - /** Gets the UriExpression property */ - uriExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.uriExpression', - { context: this._handle } - ); - }, - }; + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); + } - /** Gets the Entrypoint property */ - entrypoint = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.entrypoint', - { context: this._handle } - ); - }, - set: async (value: string): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.setEntrypoint', - { context: this._handle, value } - ); - } - }; +} - /** Gets the ShellExecution property */ - shellExecution = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.shellExecution', - { context: this._handle } - ); - }, - set: async (value: boolean): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.setShellExecution', - { context: this._handle, value } - ); - } - }; +// ============================================================================ +// ParameterResource +// ============================================================================ - /** Gets the Name property */ - name = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/RedisResource.name', - { context: this._handle } - ); - }, - }; +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new RedisResource(result, this._client); + return new ParameterResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new RedisResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisResourcePromise { - const isReadOnly = options?.isReadOnly; - return new RedisResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', rpcArgs ); - return new RedisResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): RedisResourcePromise { - return new RedisResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new RedisResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): RedisResourcePromise { - return new RedisResourcePromise(this._withImageTagInternal(tag)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new RedisResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): RedisResourcePromise { - return new RedisResourcePromise(this._withImageRegistryInternal(registry)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new RedisResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): RedisResourcePromise { - const tag = options?.tag; - return new RedisResourcePromise(this._withImageInternal(image, tag)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', - rpcArgs - ); - return new RedisResource(result, this._client); + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): RedisResourcePromise { - return new RedisResourcePromise(this._withImageSHA256Internal(sha256)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new RedisResource(result, this._client); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceReadyInternal(callback)); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + const configure = options?.configure; + return new ProjectResourcePromise(this._publishAsDockerFileInternal(configure)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withOrleansClientReferenceInternal(orleansServiceClient: OrleansServiceClientHandle): Promise { + const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansClientReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); + } + + /** @internal */ + private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { + const rpcArgs: Record = { builder: this._handle, orleansService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOrleansReferenceInternal(orleansService)); + } + +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); + } + +} + +// ============================================================================ +// RedisCommanderResource +// ============================================================================ + +export class RedisCommanderResource extends ResourceBuilderBase { + constructor(handle: RedisCommanderResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisCommanderResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisCommanderResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisCommanderResourcePromise { + const tag = options?.tag; + return new RedisCommanderResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisCommanderResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new RedisCommanderResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisCommanderResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new RedisCommanderResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisCommanderResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new RedisCommanderResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisCommanderResourcePromise { + const helpLink = options?.helpLink; + return new RedisCommanderResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisCommanderResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new RedisCommanderResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisCommanderResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new RedisCommanderResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisCommanderResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisCommanderResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisCommanderResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisCommanderResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisCommanderResourcePromise { + const displayText = options?.displayText; + return new RedisCommanderResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisCommanderResourcePromise { + const displayText = options?.displayText; + return new RedisCommanderResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisCommanderResourcePromise { + const exitCode = options?.exitCode; + return new RedisCommanderResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisCommanderResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new RedisCommanderResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisCommanderResourcePromise { + const commandOptions = options?.commandOptions; + return new RedisCommanderResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisCommanderResourcePromise { + const password = options?.password; + return new RedisCommanderResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisCommanderResourcePromise { + const iconVariant = options?.iconVariant; + return new RedisCommanderResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisCommanderResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new RedisCommanderResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisCommanderResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new RedisCommanderResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisCommanderResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisCommanderResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisCommanderHostPort', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Sets the host port for Redis Commander */ + withHostPort(options?: WithHostPortOptions): RedisCommanderResourcePromise { + const port = options?.port; + return new RedisCommanderResourcePromise(this._withHostPortInternal(port)); + } + + /** @internal */ + private async _withOrleansClientReferenceInternal(orleansServiceClient: OrleansServiceClientHandle): Promise { + const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansClientReference', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); + } + + /** @internal */ + private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { + const rpcArgs: Record = { builder: this._handle, orleansService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansReference', + rpcArgs + ); + return new RedisCommanderResource(result, this._client); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._withOrleansReferenceInternal(orleansService)); + } + +} + +/** + * Thenable wrapper for RedisCommanderResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class RedisCommanderResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: RedisCommanderResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Sets the host port for Redis Commander */ + withHostPort(options?: WithHostPortOptions): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): RedisCommanderResourcePromise { + return new RedisCommanderResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); + } + +} + +// ============================================================================ +// RedisInsightResource +// ============================================================================ + +export class RedisInsightResource extends ResourceBuilderBase { + constructor(handle: RedisInsightResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisInsightResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisInsightResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisInsightResourcePromise { + const tag = options?.tag; + return new RedisInsightResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisInsightResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new RedisInsightResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisInsightResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new RedisInsightResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisInsightResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new RedisInsightResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisInsightResourcePromise { + const helpLink = options?.helpLink; + return new RedisInsightResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisInsightResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new RedisInsightResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisInsightResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new RedisInsightResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisInsightResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisInsightResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisInsightResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisInsightResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisInsightResourcePromise { + const displayText = options?.displayText; + return new RedisInsightResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisInsightResourcePromise { + const displayText = options?.displayText; + return new RedisInsightResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisInsightResourcePromise { + const exitCode = options?.exitCode; + return new RedisInsightResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisInsightResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new RedisInsightResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisInsightResourcePromise { + const commandOptions = options?.commandOptions; + return new RedisInsightResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisInsightResourcePromise { + const password = options?.password; + return new RedisInsightResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisInsightResourcePromise { + const iconVariant = options?.iconVariant; + return new RedisInsightResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisInsightResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new RedisInsightResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisInsightResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new RedisInsightResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisInsightResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsightHostPort', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Sets the host port for Redis Insight */ + withHostPort(options?: WithHostPortOptions): RedisInsightResourcePromise { + const port = options?.port; + return new RedisInsightResourcePromise(this._withHostPortInternal(port)); + } + + /** @internal */ + private async _withDataVolumeInternal(name?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsightDataVolume', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a data volume for Redis Insight */ + withDataVolume(options?: WithDataVolumeOptions): RedisInsightResourcePromise { + const name = options?.name; + return new RedisInsightResourcePromise(this._withDataVolumeInternal(name)); + } + + /** @internal */ + private async _withDataBindMountInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsightDataBindMount', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds a data bind mount for Redis Insight */ + withDataBindMount(source: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withDataBindMountInternal(source)); + } + + /** @internal */ + private async _withOrleansClientReferenceInternal(orleansServiceClient: OrleansServiceClientHandle): Promise { + const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansClientReference', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); + } + + /** @internal */ + private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { + const rpcArgs: Record = { builder: this._handle, orleansService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansReference', + rpcArgs + ); + return new RedisInsightResource(result, this._client); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._withOrleansReferenceInternal(orleansService)); + } + +} + +/** + * Thenable wrapper for RedisInsightResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class RedisInsightResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: RedisInsightResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Sets the host port for Redis Insight */ + withHostPort(options?: WithHostPortOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + } + + /** Adds a data volume for Redis Insight */ + withDataVolume(options?: WithDataVolumeOptions): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + } + + /** Adds a data bind mount for Redis Insight */ + withDataBindMount(source: string): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withDataBindMount(source))); + } + + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): RedisInsightResourcePromise { + return new RedisInsightResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); + } + +} + +// ============================================================================ +// RedisResource +// ============================================================================ + +export class RedisResource extends ResourceBuilderBase { + constructor(handle: RedisResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the PrimaryEndpoint property */ + primaryEndpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.primaryEndpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.host', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.port', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the PasswordParameter property */ + passwordParameter = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.passwordParameter', + { context: this._handle } + ); + return new ParameterResource(handle, this._client); + }, + }; + + /** Gets the TlsEnabled property */ + tlsEnabled = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.tlsEnabled', + { context: this._handle } + ); + }, + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the Entrypoint property */ + entrypoint = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.entrypoint', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.setEntrypoint', + { context: this._handle, value } + ); + } + }; + + /** Gets the ShellExecution property */ + shellExecution = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.shellExecution', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.setShellExecution', + { context: this._handle, value } + ); + } + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/RedisResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisResourcePromise { + return new RedisResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisResourcePromise { + return new RedisResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisResourcePromise { + return new RedisResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisResourcePromise { + const tag = options?.tag; + return new RedisResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisResourcePromise { + return new RedisResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisResourcePromise { + return new RedisResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisResourcePromise { + return new RedisResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisResourcePromise { + return new RedisResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new RedisResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new RedisResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisResourcePromise { + return new RedisResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new RedisResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisResourcePromise { + return new RedisResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisResourcePromise { + return new RedisResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisResourcePromise { + return new RedisResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisResourcePromise { + const helpLink = options?.helpLink; + return new RedisResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new RedisResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisResourcePromise { + return new RedisResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisResourcePromise { + return new RedisResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new RedisResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new RedisResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisResourcePromise { + return new RedisResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisResourcePromise { + return new RedisResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisResourcePromise { + const displayText = options?.displayText; + return new RedisResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisResourcePromise { + const displayText = options?.displayText; + return new RedisResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisResourcePromise { + return new RedisResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisResourcePromise { + return new RedisResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisResourcePromise { + const exitCode = options?.exitCode; + return new RedisResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisResourcePromise { + return new RedisResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new RedisResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisResourcePromise { + const commandOptions = options?.commandOptions; + return new RedisResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisResourcePromise { + return new RedisResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisResourcePromise { + const password = options?.password; + return new RedisResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisResourcePromise { + return new RedisResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisResourcePromise { + const iconVariant = options?.iconVariant; + return new RedisResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new RedisResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisResourcePromise { + return new RedisResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisResourcePromise { + return new RedisResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisResourcePromise { + return new RedisResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new RedisResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onConnectionStringAvailableInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withRedisCommanderInternal(configureContainer?: (obj: RedisCommanderResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as RedisCommanderResourceHandle; + const obj = new RedisCommanderResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisCommander', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds Redis Commander management UI */ + withRedisCommander(options?: WithRedisCommanderOptions): RedisResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new RedisResourcePromise(this._withRedisCommanderInternal(configureContainer, containerName)); + } + + /** @internal */ + private async _withRedisInsightInternal(configureContainer?: (obj: RedisInsightResource) => Promise, containerName?: string): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as RedisInsightResourceHandle; + const obj = new RedisInsightResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + if (containerName !== undefined) rpcArgs.containerName = containerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withRedisInsight', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds Redis Insight management UI */ + withRedisInsight(options?: WithRedisInsightOptions): RedisResourcePromise { + const configureContainer = options?.configureContainer; + const containerName = options?.containerName; + return new RedisResourcePromise(this._withRedisInsightInternal(configureContainer, containerName)); + } + + /** @internal */ + private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withDataVolume', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a data volume with persistence */ + withDataVolume(options?: WithDataVolumeOptions): RedisResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + } + + /** @internal */ + private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withDataBindMount', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds a data bind mount with persistence */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): RedisResourcePromise { + const isReadOnly = options?.isReadOnly; + return new RedisResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); + } + + /** @internal */ + private async _withPersistenceInternal(interval?: number, keysChangedThreshold?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (interval !== undefined) rpcArgs.interval = interval; + if (keysChangedThreshold !== undefined) rpcArgs.keysChangedThreshold = keysChangedThreshold; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withPersistence', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures Redis persistence */ + withPersistence(options?: WithPersistenceOptions): RedisResourcePromise { + const interval = options?.interval; + const keysChangedThreshold = options?.keysChangedThreshold; + return new RedisResourcePromise(this._withPersistenceInternal(interval, keysChangedThreshold)); + } + + /** @internal */ + private async _withPasswordInternal(password: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, password }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withPassword', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Configures the password for Redis */ + withPassword(password: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._withPasswordInternal(password)); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Redis/withHostPort', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Sets the host port for Redis */ + withHostPort(options?: WithHostPortOptions): RedisResourcePromise { + const port = options?.port; + return new RedisResourcePromise(this._withHostPortInternal(port)); + } + + /** @internal */ + private async _withOrleansClientReferenceInternal(orleansServiceClient: OrleansServiceClientHandle): Promise { + const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansClientReference', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): RedisResourcePromise { + return new RedisResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); + } + + /** @internal */ + private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { + const rpcArgs: Record = { builder: this._handle, orleansService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansReference', + rpcArgs + ); + return new RedisResource(result, this._client); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): RedisResourcePromise { + return new RedisResourcePromise(this._withOrleansReferenceInternal(orleansService)); + } + +} + +/** + * Thenable wrapper for RedisResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class RedisResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: RedisResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Adds arguments */ + withArgs(args: string[]): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Adds Redis Commander management UI */ + withRedisCommander(options?: WithRedisCommanderOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRedisCommander(options))); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): RedisResourcePromise { - return new RedisResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Adds Redis Insight management UI */ + withRedisInsight(options?: WithRedisInsightOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withRedisInsight(options))); } - /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Adds a data volume with persistence */ + withDataVolume(options?: WithDataVolumeOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): RedisResourcePromise { - return new RedisResourcePromise(this._withLifetimeInternal(lifetime)); + /** Adds a data bind mount with persistence */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); } - /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Configures Redis persistence */ + withPersistence(options?: WithPersistenceOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPersistence(options))); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisResourcePromise { - return new RedisResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Configures the password for Redis */ + withPassword(password: ParameterResource): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withPassword(password))); } - /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Sets the host port for Redis */ + withHostPort(options?: WithHostPortOptions): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withHostPort(options))); } - /** Configures the resource to be published as a container */ - publishAsContainer(): RedisResourcePromise { - return new RedisResourcePromise(this._publishAsContainerInternal()); + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); } - /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', - rpcArgs - ); - return new RedisResource(result, this._client); + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): RedisResourcePromise { + return new RedisResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new RedisResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); +} + +// ============================================================================ +// ViteAppResource +// ============================================================================ + +export class ViteAppResource extends ResourceBuilderBase { + constructor(handle: ViteAppResourceHandle, client: AspireClientRpc) { + super(handle, client); } + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): RedisResourcePromise { - return new RedisResourcePromise(this._withContainerNameInternal(name)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): RedisResourcePromise { - return new RedisResourcePromise(this._withBuildArgInternal(name, value)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ViteAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): RedisResourcePromise { - return new RedisResourcePromise(this._withBuildSecretInternal(name, value)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): RedisResourcePromise { - return new RedisResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new RedisResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): RedisResourcePromise { - return new RedisResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): RedisResourcePromise { + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { const path = options?.path; const endpointName = options?.endpointName; - return new RedisResourcePromise(this._withMcpServerInternal(path, endpointName)); + return new ViteAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { + private async _withOtlpExporterInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures OTLP telemetry export */ - withOtlpExporter(): RedisResourcePromise { - return new RedisResourcePromise(this._withOtlpExporterInternal()); + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): RedisResourcePromise { - return new RedisResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); - } - - /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', - rpcArgs - ); - return new RedisResource(result, this._client); - } - - /** Publishes the resource as a connection string */ - publishAsConnectionString(): RedisResourcePromise { - return new RedisResourcePromise(this._publishAsConnectionStringInternal()); + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { const helpLink = options?.helpLink; - return new RedisResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } - - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new RedisResource(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new RedisResource(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new RedisResource(result, this._client); - } - - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentCallbackInternal(callback)); + return new ViteAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); - } - - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new RedisResource(result, this._client); - } - - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): RedisResourcePromise { - return new RedisResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): RedisResourcePromise { - return new RedisResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): RedisResourcePromise { - return new RedisResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new RedisResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new RedisResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new RedisResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisResourcePromise { - return new RedisResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ViteAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): RedisResourcePromise { - return new RedisResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): RedisResourcePromise { - return new RedisResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): RedisResourcePromise { - return new RedisResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -16113,15 +24918,15 @@ export class RedisResource extends ResourceBuilderBase { if (isProxied !== undefined) rpcArgs.isProxied = isProxied; if (isExternal !== undefined) rpcArgs.isExternal = isExternal; if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): RedisResourcePromise { + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -16130,72 +24935,72 @@ export class RedisResource extends ResourceBuilderBase { const isProxied = options?.isProxied; const isExternal = options?.isExternal; const protocol = options?.protocol; - return new RedisResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + return new ViteAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): RedisResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new RedisResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new RedisResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): RedisResourcePromise { - return new RedisResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -16208,278 +25013,308 @@ export class RedisResource extends ResourceBuilderBase { } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): RedisResourcePromise { - return new RedisResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): RedisResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new RedisResourcePromise(this._withUrlInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new RedisResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): RedisResourcePromise { - return new RedisResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { - return new RedisResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { - return new RedisResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): RedisResourcePromise { - return new RedisResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { const exitCode = options?.exitCode; - return new RedisResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ViteAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): RedisResourcePromise { - return new RedisResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new RedisResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new ViteAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -16487,130 +25322,130 @@ export class RedisResource extends ResourceBuilderBase { }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { const commandOptions = options?.commandOptions; - return new RedisResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ViteAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): RedisResourcePromise { - return new RedisResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): RedisResourcePromise { - return new RedisResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { const password = options?.password; - return new RedisResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new ViteAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): RedisResourcePromise { - return new RedisResourcePromise(this._withoutHttpsCertificateInternal()); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): RedisResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { const iconVariant = options?.iconVariant; - return new RedisResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ViteAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -16619,15 +25454,15 @@ export class RedisResource extends ResourceBuilderBase { if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -16635,56 +25470,56 @@ export class RedisResource extends ResourceBuilderBase { const failureThreshold = options?.failureThreshold; const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new RedisResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new ViteAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): RedisResourcePromise { - return new RedisResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): RedisResourcePromise { - return new RedisResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): RedisResourcePromise { - return new RedisResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -16695,79 +25530,60 @@ export class RedisResource extends ResourceBuilderBase { if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; if (tags !== undefined) rpcArgs.tags = tags; if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new RedisResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ViteAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._withPipelineConfigurationInternal(callback)); - } - - /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', - rpcArgs - ); - return new RedisResource(result, this._client); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new RedisResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -16780,410 +25596,424 @@ export class RedisResource extends ResourceBuilderBase { } /** @internal */ - private async _withRedisCommanderInternal(configureContainer?: (obj: RedisCommanderResource) => Promise, containerName?: string): Promise { - const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as RedisCommanderResourceHandle; - const obj = new RedisCommanderResource(objHandle, this._client); - await configureContainer(obj); - }) : undefined; - const rpcArgs: Record = { builder: this._handle }; - if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; - if (containerName !== undefined) rpcArgs.containerName = containerName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withRedisCommander', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds Redis Commander management UI */ - withRedisCommander(options?: WithRedisCommanderOptions): RedisResourcePromise { - const configureContainer = options?.configureContainer; - const containerName = options?.containerName; - return new RedisResourcePromise(this._withRedisCommanderInternal(configureContainer, containerName)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withRedisInsightInternal(configureContainer?: (obj: RedisInsightResource) => Promise, containerName?: string): Promise { - const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as RedisInsightResourceHandle; - const obj = new RedisInsightResource(objHandle, this._client); - await configureContainer(obj); - }) : undefined; - const rpcArgs: Record = { builder: this._handle }; - if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; - if (containerName !== undefined) rpcArgs.containerName = containerName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withRedisInsight', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds Redis Insight management UI */ - withRedisInsight(options?: WithRedisInsightOptions): RedisResourcePromise { - const configureContainer = options?.configureContainer; - const containerName = options?.containerName; - return new RedisResourcePromise(this._withRedisInsightInternal(configureContainer, containerName)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withDataVolume', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a data volume with persistence */ - withDataVolume(options?: WithDataVolumeOptions): RedisResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new RedisResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withDataBindMount', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a data bind mount with persistence */ - withDataBindMount(source: string, options?: WithDataBindMountOptions): RedisResourcePromise { - const isReadOnly = options?.isReadOnly; - return new RedisResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withPersistenceInternal(interval?: number, keysChangedThreshold?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (interval !== undefined) rpcArgs.interval = interval; - if (keysChangedThreshold !== undefined) rpcArgs.keysChangedThreshold = keysChangedThreshold; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withPersistence', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures Redis persistence */ - withPersistence(options?: WithPersistenceOptions): RedisResourcePromise { - const interval = options?.interval; - const keysChangedThreshold = options?.keysChangedThreshold; - return new RedisResourcePromise(this._withPersistenceInternal(interval, keysChangedThreshold)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withPasswordInternal(password: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, password }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withPassword', + private async _withViteConfigInternal(configPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, configPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withViteConfig', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures the password for Redis */ - withPassword(password: ParameterResource): RedisResourcePromise { - return new RedisResourcePromise(this._withPasswordInternal(password)); + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withViteConfigInternal(configPath)); } /** @internal */ - private async _withHostPortInternal(port?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Redis/withHostPort', + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets the host port for Redis */ - withHostPort(options?: WithHostPortOptions): RedisResourcePromise { - const port = options?.port; - return new RedisResourcePromise(this._withHostPortInternal(port)); + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); } /** @internal */ - private async _withOrleansClientReferenceInternal(orleansServiceClient: OrleansServiceClientHandle): Promise { - const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Orleans/withOrleansClientReference', + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds an Orleans client reference to a resource */ - withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): RedisResourcePromise { - return new RedisResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withBunInternal(install, installArgs)); } /** @internal */ - private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { - const rpcArgs: Record = { builder: this._handle, orleansService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Orleans/withOrleansReference', + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', rpcArgs ); - return new RedisResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds an Orleans silo reference to a resource */ - withOrleansReference(orleansService: OrleansService): RedisResourcePromise { - return new RedisResourcePromise(this._withOrleansReferenceInternal(orleansService)); - } - -} - -/** - * Thenable wrapper for RedisResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class RedisResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: RedisResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } - - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withYarnInternal(install, installArgs)); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withPnpmInternal(install, installArgs)); } - /** Sets the container image registry */ - withImageRegistry(registry: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + const browser = options?.browser; + return new ViteAppResourcePromise(this._withBrowserDebuggerInternal(browser)); } - /** Configures the resource to be published as a container */ - publishAsContainer(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** @internal */ + private async _withOrleansClientReferenceInternal(orleansServiceClient: OrleansServiceClientHandle): Promise { + const rpcArgs: Record = { builder: this._handle, orleansServiceClient }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansClientReference', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOrleansClientReferenceInternal(orleansServiceClient)); } - /** Sets the container name */ - withContainerName(name: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** @internal */ + private async _withOrleansReferenceInternal(orleansService: OrleansService): Promise { + const rpcArgs: Record = { builder: this._handle, orleansService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Orleans/withOrleansReference', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOrleansReferenceInternal(orleansService)); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); +} + +/** + * Thenable wrapper for ViteAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ViteAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ViteAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); - } - - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); - } - - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -17192,163 +26022,168 @@ export class RedisResourcePromise implements PromiseLike { } /** Configures resource for HTTP/2 */ - asHttp2Service(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -17356,49 +26191,147 @@ export class RedisResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } - /** Adds Redis Commander management UI */ - withRedisCommander(options?: WithRedisCommanderOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withRedisCommander(options))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Adds Redis Insight management UI */ - withRedisInsight(options?: WithRedisInsightOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withRedisInsight(options))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Adds a data volume with persistence */ - withDataVolume(options?: WithDataVolumeOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Adds a data bind mount with persistence */ - withDataBindMount(source: string, options?: WithDataBindMountOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** Configures Redis persistence */ - withPersistence(options?: WithPersistenceOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withPersistence(options))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Configures the password for Redis */ - withPassword(password: ParameterResource): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withPassword(password))); + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withViteConfig(configPath))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + + /** Adds an Orleans client reference to a resource */ + withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); + } + + /** Adds an Orleans silo reference to a resource */ + withOrleansReference(orleansService: OrleansService): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); + } + +} + +// ============================================================================ +// ComputeResource +// ============================================================================ + +export class ComputeResource extends ResourceBuilderBase { + constructor(handle: IComputeResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Sets the host port for Redis */ - withHostPort(options?: WithHostPortOptions): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withHostPort(options))); +} + +/** + * Thenable wrapper for ComputeResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ComputeResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ComputeResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds an Orleans client reference to a resource */ - withOrleansClientReference(orleansServiceClient: OrleansServiceClientHandle): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withOrleansClientReference(orleansServiceClient))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Adds an Orleans silo reference to a resource */ - withOrleansReference(orleansService: OrleansService): RedisResourcePromise { - return new RedisResourcePromise(this._promise.then(obj => obj.withOrleansReference(orleansService))); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } } @@ -17416,7 +26349,7 @@ export class ContainerFilesDestinationResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); return new ContainerFilesDestinationResource(result, this._client); @@ -17675,7 +26608,7 @@ export class Resource extends ResourceBuilderBase { private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new Resource(result, this._client); @@ -17690,7 +26623,7 @@ export class Resource extends ResourceBuilderBase { private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new Resource(result, this._client); @@ -17733,36 +26666,6 @@ export class Resource extends ResourceBuilderBase { return new ResourcePromise(this._excludeFromMcpInternal()); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -17840,6 +26743,86 @@ export class Resource extends ResourceBuilderBase { ); } + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceReadyInternal(callback)); + } + } /** @@ -17937,16 +26920,6 @@ export class ResourcePromise implements PromiseLike { return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); @@ -17967,6 +26940,26 @@ export class ResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + } // ============================================================================ @@ -18106,6 +27099,35 @@ export class ResourceWithConnectionString extends ResourceBuilderBase { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._onConnectionStringAvailableInternal(callback)); + } + } /** @@ -18133,6 +27155,16 @@ export class ResourceWithConnectionStringPromise implements PromiseLike obj.withConnectionPropertyValue(name, value))); } + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + } // ============================================================================ @@ -18421,6 +27453,26 @@ export class ResourceWithEndpoints extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + } /** @@ -18488,6 +27540,11 @@ export class ResourceWithEndpointsPromise implements PromiseLike obj.withHttpProbe(probeType, options))); } + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + } // ============================================================================ @@ -18530,41 +27587,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -18575,43 +27602,38 @@ export class ResourceWithEnvironment extends ResourceBuilderBase Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -18645,10 +27667,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -18660,37 +27683,8 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -18773,7 +27767,7 @@ export class ResourceWithEnvironment extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ResourceWithEnvironment(result, this._client); @@ -18857,31 +27851,21 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withOtlpExporterProtocol(protocol))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -18897,16 +27881,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -18954,34 +27928,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike { - constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { - super(handle, client); - } - -} - -/** - * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ResourceWithServiceDiscoveryPromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - -} - // ============================================================================ // ResourceWithWaitSupport // ============================================================================ @@ -18995,7 +27941,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -19025,7 +27971,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -19056,7 +28002,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -19175,7 +28121,7 @@ export async function createBuilder(options?: CreateBuilderOptions): Promise { const error = reason instanceof Error ? reason : new Error(String(reason)); - if (reason instanceof CapabilityError) { + if (reason instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else if (reason instanceof CapabilityError) { console.error(`\n❌ Capability Error: ${error.message}`); console.error(` Code: ${(reason as CapabilityError).code}`); if ((reason as CapabilityError).capability) { @@ -19206,8 +28154,12 @@ process.on('unhandledRejection', (reason: unknown) => { }); process.on('uncaughtException', (error: Error) => { - console.error(`\n❌ Uncaught Exception: ${error.message}`); - if (error.stack) { + if (error instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + } + if (!(error instanceof AppHostUsageError) && error.stack) { console.error(error.stack); } process.exit(1); @@ -19218,22 +28170,45 @@ process.on('uncaughtException', (error: Error) => { // ============================================================================ // Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent', (handle, client) => new AfterResourcesCreatedEvent(handle as AfterResourcesCreatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent', (handle, client) => new BeforeResourceStartedEvent(handle as BeforeResourceStartedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent', (handle, client) => new BeforeStartEvent(handle as BeforeStartEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent', (handle, client) => new ConnectionStringAvailableEvent(handle as ConnectionStringAvailableEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel', (handle, client) => new DistributedApplicationModel(handle as DistributedApplicationModelHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent', (handle, client) => new InitializeResourceEvent(handle as InitializeResourceEventHandle, client)); registerHandleWrapper('Aspire.Hosting.Orleans/Aspire.Hosting.Orleans.OrleansService', (handle, client) => new OrleansService(handle as OrleansServiceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext', (handle, client) => new PipelineContext(handle as PipelineContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext', (handle, client) => new PipelineStepFactoryContext(handle as PipelineStepFactoryContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary', (handle, client) => new PipelineSummary(handle as PipelineSummaryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent', (handle, client) => new ResourceEndpointsAllocatedEvent(handle as ResourceEndpointsAllocatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService', (handle, client) => new ResourceLoggerService(handle as ResourceLoggerServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService', (handle, client) => new ResourceNotificationService(handle as ResourceNotificationServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent', (handle, client) => new ResourceReadyEvent(handle as ResourceReadyEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent', (handle, client) => new ResourceStoppedEvent(handle as ResourceStoppedEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext', (handle, client) => new UpdateCommandStateContext(handle as UpdateCommandStateContextHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration', (handle, client) => new Configuration(handle as IConfigurationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment', (handle, client) => new HostEnvironment(handle as IHostEnvironmentHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger', (handle, client) => new Logger(handle as ILoggerHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory', (handle, client) => new LoggerFactory(handle as ILoggerFactoryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep', (handle, client) => new ReportingStep(handle as IReportingStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask', (handle, client) => new ReportingTask(handle as IReportingTaskHandle, client)); +registerHandleWrapper('System.ComponentModel/System.IServiceProvider', (handle, client) => new ServiceProvider(handle as IServiceProviderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IUserSecretsManager', (handle, client) => new UserSecretsManager(handle as IUserSecretsManagerHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); @@ -19241,11 +28216,15 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppR registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource', (handle, client) => new JavaScriptAppResource(handle as JavaScriptAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource', (handle, client) => new NodeAppResource(handle as NodeAppResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisCommanderResource', (handle, client) => new RedisCommanderResource(handle as RedisCommanderResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.Redis.RedisInsightResource', (handle, client) => new RedisInsightResource(handle as RedisInsightResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.Redis/Aspire.Hosting.ApplicationModel.RedisResource', (handle, client) => new RedisResource(handle as RedisResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource', (handle, client) => new ViteAppResource(handle as ViteAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource', (handle, client) => new ComputeResource(handle as IComputeResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); @@ -19253,6 +28232,5 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceW registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); diff --git a/samples/orleans-voting/ts/.modules/base.ts b/samples/orleans-voting/ts/.modules/base.ts index 7778b0f1..b3d8b8be 100644 --- a/samples/orleans-voting/ts/.modules/base.ts +++ b/samples/orleans-voting/ts/.modules/base.ts @@ -1,8 +1,8 @@ -// aspire.ts - Core Aspire types: base classes, ReferenceExpression -import { Handle, AspireClient, MarshalledHandle } from './transport.js'; +// base.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle, CancellationToken, registerCancellation, registerHandleWrapper, unregisterCancellation } from './transport.js'; // Re-export transport types for convenience -export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export { Handle, AspireClient, CapabilityError, CancellationToken, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; @@ -43,22 +43,46 @@ export class ReferenceExpression { private readonly _format?: string; private readonly _valueProviders?: unknown[]; + // Conditional mode fields + private readonly _condition?: unknown; + private readonly _whenTrue?: ReferenceExpression; + private readonly _whenFalse?: ReferenceExpression; + private readonly _matchValue?: string; + // Handle mode fields (when wrapping a server-returned handle) private readonly _handle?: Handle; private readonly _client?: AspireClient; constructor(format: string, valueProviders: unknown[]); constructor(handle: Handle, client: AspireClient); - constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { - if (typeof handleOrFormat === 'string') { - this._format = handleOrFormat; - this._valueProviders = clientOrValueProviders as unknown[]; + constructor(condition: unknown, matchValue: string, whenTrue: ReferenceExpression, whenFalse: ReferenceExpression); + constructor( + handleOrFormatOrCondition: Handle | string | unknown, + clientOrValueProvidersOrMatchValue: AspireClient | unknown[] | string, + whenTrueOrWhenFalse?: ReferenceExpression, + whenFalse?: ReferenceExpression + ) { + if (typeof handleOrFormatOrCondition === 'string') { + this._format = handleOrFormatOrCondition; + this._valueProviders = clientOrValueProvidersOrMatchValue as unknown[]; + } else if (handleOrFormatOrCondition instanceof Handle) { + this._handle = handleOrFormatOrCondition; + this._client = clientOrValueProvidersOrMatchValue as AspireClient; } else { - this._handle = handleOrFormat; - this._client = clientOrValueProviders as AspireClient; + this._condition = handleOrFormatOrCondition; + this._matchValue = (clientOrValueProvidersOrMatchValue as string) ?? 'True'; + this._whenTrue = whenTrueOrWhenFalse; + this._whenFalse = whenFalse; } } + /** + * Gets whether this reference expression is conditional. + */ + get isConditional(): boolean { + return this._condition !== undefined; + } + /** * Creates a reference expression from a tagged template literal. * @@ -82,16 +106,46 @@ export class ReferenceExpression { return new ReferenceExpression(format, valueProviders); } + /** + * Creates a conditional reference expression from its constituent parts. + * + * @param condition - A value provider whose result is compared to matchValue + * @param whenTrue - The expression to use when the condition matches + * @param whenFalse - The expression to use when the condition does not match + * @param matchValue - The value to compare the condition against (defaults to "True") + * @returns A ReferenceExpression instance in conditional mode + */ + static createConditional( + condition: unknown, + matchValue: string, + whenTrue: ReferenceExpression, + whenFalse: ReferenceExpression + ): ReferenceExpression { + return new ReferenceExpression(condition, matchValue, whenTrue, whenFalse); + } + /** * Serializes the reference expression for JSON-RPC transport. - * In template-literal mode, uses the $expr format. + * In expression mode, uses the $expr format with format + valueProviders. + * In conditional mode, uses the $expr format with condition + whenTrue + whenFalse. * In handle mode, delegates to the handle's serialization. */ - toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } | { condition: unknown; whenTrue: unknown; whenFalse: unknown; matchValue: string } } | MarshalledHandle { if (this._handle) { return this._handle.toJSON(); } + if (this.isConditional) { + return { + $expr: { + condition: extractHandleForExpr(this._condition), + whenTrue: this._whenTrue!.toJSON(), + whenFalse: this._whenFalse!.toJSON(), + matchValue: this._matchValue! + } + }; + } + return { $expr: { format: this._format!, @@ -100,6 +154,30 @@ export class ReferenceExpression { }; } + /** + * Resolves the expression to its string value on the server. + * Only available on server-returned ReferenceExpression instances (handle mode). + * + * @param cancellationToken - Optional AbortSignal or CancellationToken for cancellation support + * @returns The resolved string value, or null if the expression resolves to null + */ + async getValue(cancellationToken?: AbortSignal | CancellationToken): Promise { + if (!this._handle || !this._client) { + throw new Error('getValue is only available on server-returned ReferenceExpression instances'); + } + const cancellationTokenId = registerCancellation(this._client, cancellationToken); + try { + const rpcArgs: Record = { context: this._handle }; + if (cancellationTokenId !== undefined) rpcArgs.cancellationToken = cancellationTokenId; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValue', + rpcArgs + ); + } finally { + unregisterCancellation(cancellationTokenId); + } + } + /** * String representation for debugging. */ @@ -107,10 +185,17 @@ export class ReferenceExpression { if (this._handle) { return `ReferenceExpression(handle)`; } + if (this.isConditional) { + return `ReferenceExpression(conditional)`; + } return `ReferenceExpression(${this._format})`; } } +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression', (handle, client) => + new ReferenceExpression(handle, client) +); + /** * Extracts a value for use in reference expressions. * Supports handles (objects) and string literals. @@ -136,15 +221,15 @@ function extractHandleForExpr(value: unknown): unknown { return value.toJSON(); } - // Objects with $handle property (already in handle format) - if (typeof value === 'object' && value !== null && '$handle' in value) { + // Objects with marshalled expression/handle payloads + if (typeof value === 'object' && value !== null && ('$handle' in value || '$expr' in value)) { return value; } - // Objects with toJSON that returns a handle + // Objects with toJSON that returns a marshalled expression or handle if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { const json = value.toJSON(); - if (json && typeof json === 'object' && '$handle' in json) { + if (json && typeof json === 'object' && ('$handle' in json || '$expr' in json)) { return json; } } @@ -307,11 +392,20 @@ export class AspireList { }) as T[]; } - toJSON(): MarshalledHandle { - if (this._resolvedHandle) { - return this._resolvedHandle.toJSON(); + async toTransportValue(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireList must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); } - return this._handleOrContext.toJSON(); + + return this._resolvedHandle.toJSON(); } } @@ -466,8 +560,19 @@ export class AspireDict { }) as Record; } - async toJSON(): Promise { + async toTransportValue(): Promise { const handle = await this._ensureHandle(); return handle.toJSON(); } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireDict must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); + } + + return this._resolvedHandle.toJSON(); + } } diff --git a/samples/orleans-voting/ts/.modules/transport.ts b/samples/orleans-voting/ts/.modules/transport.ts index 7bddd74b..6d29cf28 100644 --- a/samples/orleans-voting/ts/.modules/transport.ts +++ b/samples/orleans-voting/ts/.modules/transport.ts @@ -77,7 +77,8 @@ export function isAtsError(value: unknown): value is { $error: AtsError } { value !== null && typeof value === 'object' && '$error' in value && - typeof (value as { $error: unknown }).$error === 'object' + typeof (value as { $error: unknown }).$error === 'object' && + (value as { $error: unknown }).$error !== null ); } @@ -93,6 +94,47 @@ export function isMarshalledHandle(value: unknown): value is MarshalledHandle { ); } +function isAbortSignal(value: unknown): value is AbortSignal { + return ( + value !== null && + typeof value === 'object' && + 'aborted' in value && + 'addEventListener' in value && + 'removeEventListener' in value + ); +} + +function isPlainObject(value: unknown): value is Record { + if (value === null || typeof value !== 'object') { + return false; + } + + const prototype = Object.getPrototypeOf(value); + return prototype === Object.prototype || prototype === null; +} + +function hasTransportValue(value: unknown): value is { toTransportValue(): unknown | Promise } { + return ( + value !== null && + typeof value === 'object' && + 'toTransportValue' in value && + typeof (value as { toTransportValue?: unknown }).toTransportValue === 'function' + ); +} + +function createAbortError(message: string): Error { + const error = new Error(message); + error.name = 'AbortError'; + return error; +} + +function createCircularReferenceError(capabilityId: string, path: string): AppHostUsageError { + return new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' contains a circular reference. ` + + 'Circular references are not supported by the AppHost transport.' + ); +} + // ============================================================================ // Handle // ============================================================================ @@ -136,6 +178,92 @@ export class Handle { } } +// ============================================================================ +// CancellationToken +// ============================================================================ + +/** + * Represents a transport-safe cancellation token value for the generated SDK. + * + * Use a plain {@link AbortSignal} when you create cancellation in user code. + * Generated APIs accept either an {@link AbortSignal} or a {@link CancellationToken}. + * + * Values returned from generated callbacks and context/property getters are + * {@link CancellationToken} instances because they may reference remote + * cancellation token handles received from the AppHost. + * + * @example + * ```typescript + * const controller = new AbortController(); + * await connectionStringExpression.getValue(controller.signal); + * ``` + * + * @example + * ```typescript + * const cancellationToken = await context.cancellationToken.get(); + * const connectionStringExpression = await db.uriExpression.get(); + * const connectionString = await connectionStringExpression.getValue(cancellationToken); + * ``` + */ +export class CancellationToken { + private readonly _signal?: AbortSignal; + private readonly _remoteTokenId?: string; + + constructor(signal?: AbortSignal); + constructor(tokenId?: string); + constructor(value?: AbortSignal | string | null) { + if (typeof value === 'string') { + this._remoteTokenId = value; + } else if (isAbortSignal(value)) { + this._signal = value; + } + } + + /** + * Creates a cancellation token from a local {@link AbortSignal}. + */ + static from(signal?: AbortSignal): CancellationToken { + return new CancellationToken(signal); + } + + /** + * Creates a cancellation token from a transport value. + * Generated code uses this to materialize values that come from the AppHost. + */ + static fromValue(value: unknown): CancellationToken { + if (value instanceof CancellationToken) { + return value; + } + + if (typeof value === 'string') { + return new CancellationToken(value); + } + + if (isAbortSignal(value)) { + return new CancellationToken(value); + } + + return new CancellationToken(); + } + + /** + * Serializes the token for JSON-RPC transport. + */ + toJSON(): string | undefined { + return this._remoteTokenId; + } + + register(client?: AspireClient): string | undefined { + if (this._remoteTokenId !== undefined) { + return this._remoteTokenId; + } + + return client + ? registerCancellation(client, this._signal) + : registerCancellation(this._signal); + } +} + // ============================================================================ // Handle Wrapper Registry // ============================================================================ @@ -167,22 +295,35 @@ export function registerHandleWrapper(typeId: string, factory: HandleWrapperFact * @param client - Optional client for creating typed wrapper instances */ export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { - if (value && typeof value === 'object') { - if (isMarshalledHandle(value)) { - const handle = new Handle(value); - const typeId = value.$type; - - // Try to find a registered wrapper factory for this type - if (typeId && client) { - const factory = handleWrapperRegistry.get(typeId); - if (factory) { - return factory(handle, client); - } + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); } + } + + return handle; + } - return handle; + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + value[i] = wrapIfHandle(value[i], client); + } + + return value; + } + + if (isPlainObject(value)) { + for (const [key, nestedValue] of Object.entries(value)) { + value[key] = wrapIfHandle(nestedValue, client); } } + return value; } @@ -213,6 +354,76 @@ export class CapabilityError extends Error { } } +/** + * Error thrown when the AppHost script uses the generated SDK incorrectly. + */ +export class AppHostUsageError extends Error { + constructor(message: string) { + super(message); + this.name = 'AppHostUsageError'; + } +} + +function isPromiseLike(value: unknown): value is PromiseLike { + return ( + value !== null && + (typeof value === 'object' || typeof value === 'function') && + 'then' in value && + typeof (value as { then?: unknown }).then === 'function' + ); +} + +function validateCapabilityArgs( + capabilityId: string, + args?: Record +): void { + if (!args) { + return; + } + + const validateValue = (value: unknown, path: string, ancestors: Set): void => { + if (value === null || value === undefined) { + return; + } + + if (isPromiseLike(value)) { + throw new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' is a Promise-like value. ` + + `This usually means an async builder call was not awaited. ` + + `Did you forget 'await' on a call like builder.addPostgres(...) or resource.addDatabase(...)?` + ); + } + + if (typeof value !== 'object') { + return; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + ancestors.add(value); + try { + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + validateValue(value[i], `${path}[${i}]`, ancestors); + } + return; + } + + for (const [key, nestedValue] of Object.entries(value)) { + validateValue(nestedValue, `${path}.${key}`, ancestors); + } + } finally { + ancestors.delete(value); + } + }; + + for (const [key, value] of Object.entries(args)) { + validateValue(value, key, new Set()); + } +} + // ============================================================================ // Callback Registry // ============================================================================ @@ -324,21 +535,50 @@ export function getCallbackCount(): number { */ const cancellationRegistry = new Map void>(); let cancellationIdCounter = 0; +const connectedClients = new Set(); -/** - * A reference to the current AspireClient for sending cancel requests. - * Set by AspireClient.connect(). - */ -let currentClient: AspireClient | null = null; +function resolveCancellationClient(client?: AspireClient): AspireClient { + if (client) { + return client; + } + + if (connectedClients.size === 1) { + return connectedClients.values().next().value as AspireClient; + } + + if (connectedClients.size === 0) { + throw new Error( + 'registerCancellation(signal) requires a connected AspireClient. ' + + 'Pass the client explicitly or connect the client first.' + ); + } + + throw new Error( + 'registerCancellation(signal) is ambiguous when multiple AspireClient instances are connected. ' + + 'Pass the client explicitly.' + ); +} /** - * Register an AbortSignal for cancellation support. - * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * Registers cancellation support for a local signal or SDK cancellation token. + * Returns a cancellation ID that should be passed to methods accepting cancellation input. * * When the AbortSignal is aborted, sends a cancelToken request to the host. * - * @param signal - The AbortSignal to register (optional) - * @returns The cancellation ID, or undefined if no signal provided + * @param client - The AspireClient that should route the cancellation request + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + */ +export function registerCancellation(client: AspireClient, signalOrToken?: AbortSignal | CancellationToken): string | undefined; +/** + * Registers cancellation support using the single connected AspireClient. + * + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + * + * @example + * const controller = new AbortController(); + * await expression.getValue(controller.signal); * * @example * const controller = new AbortController(); @@ -346,14 +586,29 @@ let currentClient: AspireClient | null = null; * // Pass id to capability invocation * // Later: controller.abort() will cancel the operation */ -export function registerCancellation(signal?: AbortSignal): string | undefined { - if (!signal) { +export function registerCancellation(signalOrToken?: AbortSignal | CancellationToken): string | undefined; +export function registerCancellation( + clientOrSignalOrToken?: AspireClient | AbortSignal | CancellationToken, + maybeSignalOrToken?: AbortSignal | CancellationToken +): string | undefined { + const client = clientOrSignalOrToken instanceof AspireClient ? clientOrSignalOrToken : undefined; + const signalOrToken = client + ? maybeSignalOrToken + : clientOrSignalOrToken as AbortSignal | CancellationToken | undefined; + + if (!signalOrToken) { return undefined; } - // Already aborted? Don't register + if (signalOrToken instanceof CancellationToken) { + return signalOrToken.register(client); + } + + const signal = signalOrToken; + const cancellationClient = resolveCancellationClient(client); + if (signal.aborted) { - return undefined; + throw createAbortError('The operation was aborted before it was sent to the AppHost.'); } const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; @@ -361,8 +616,8 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { // Set up the abort listener const onAbort = () => { // Send cancel request to host - if (currentClient?.connected) { - currentClient.cancelToken(cancellationId).catch(() => { + if (cancellationClient.connected) { + cancellationClient.cancelToken(cancellationId).catch(() => { // Ignore errors - the operation may have already completed }); } @@ -381,6 +636,56 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { return cancellationId; } +async function marshalTransportValue( + value: unknown, + client: AspireClient, + cancellationIds: string[], + capabilityId: string, + path: string = 'args', + ancestors: Set = new Set() +): Promise { + if (value === null || value === undefined || typeof value !== 'object') { + return value; + } + + if (value instanceof CancellationToken) { + const cancellationId = value.register(client); + if (cancellationId !== undefined) { + cancellationIds.push(cancellationId); + } + + return cancellationId; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + const nextAncestors = new Set(ancestors); + nextAncestors.add(value); + + if (hasTransportValue(value)) { + return await marshalTransportValue(await value.toTransportValue(), client, cancellationIds, capabilityId, path, nextAncestors); + } + + if (Array.isArray(value)) { + return await Promise.all( + value.map((item, index) => marshalTransportValue(item, client, cancellationIds, capabilityId, `${path}[${index}]`, nextAncestors)) + ); + } + + if (isPlainObject(value)) { + const entries = await Promise.all( + Object.entries(value).map(async ([key, nestedValue]) => + [key, await marshalTransportValue(nestedValue, client, cancellationIds, capabilityId, `${path}.${key}`, nextAncestors)] as const) + ); + + return Object.fromEntries(entries); + } + + return value; +} + /** * Unregister a cancellation token by its ID. * Call this when the operation completes to clean up resources. @@ -411,6 +716,8 @@ export class AspireClient { private socket: net.Socket | null = null; private disconnectCallbacks: (() => void)[] = []; private _pendingCalls = 0; + private _connectPromise: Promise | null = null; + private _disconnectNotified = false; constructor(private socketPath: string) { } @@ -422,6 +729,12 @@ export class AspireClient { } private notifyDisconnect(): void { + if (this._disconnectNotified) { + return; + } + + this._disconnectNotified = true; + for (const callback of this.disconnectCallbacks) { try { callback(); @@ -432,30 +745,106 @@ export class AspireClient { } connect(timeoutMs: number = 5000): Promise { - return new Promise((resolve, reject) => { - const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + if (this.connected) { + return Promise.resolve(); + } + + if (this._connectPromise) { + return this._connectPromise; + } + + this._disconnectNotified = false; + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this._connectPromise = new Promise((resolve, reject) => { + const socket = net.createConnection(pipePath); + this.socket = socket; - // On Windows, use named pipes; on Unix, use Unix domain sockets - const isWindows = process.platform === 'win32'; - const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + let settled = false; - this.socket = net.createConnection(pipePath); + const cleanupPendingListeners = () => { + socket.removeListener('connect', onConnect); + socket.removeListener('error', onPendingError); + socket.removeListener('close', onPendingClose); + }; - this.socket.once('error', (error: Error) => { + const failConnect = (error: Error) => { + if (settled) { + return; + } + + settled = true; clearTimeout(timeout); + cleanupPendingListeners(); + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + if (!socket.destroyed) { + socket.destroy(); + } + reject(error); - }); + }; + + const onConnectedSocketError = (error: Error) => { + console.error('Socket error:', error); + }; + + const onConnectedSocketClose = () => { + socket.removeListener('error', onConnectedSocketError); + + if (this.socket && this.socket !== socket) { + return; + } + + const connection = this.connection; + this.connection = null; + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + this.notifyDisconnect(); + }; + + const onPendingError = (error: Error) => { + failConnect(error); + }; + + const onPendingClose = () => { + failConnect(new Error('Connection closed before JSON-RPC was established')); + }; + + const onConnect = async () => { + if (settled) { + return; + } - this.socket.once('connect', () => { clearTimeout(timeout); + cleanupPendingListeners(); + try { - const reader = new rpc.SocketMessageReader(this.socket!); - const writer = new rpc.SocketMessageWriter(this.socket!); + const reader = new rpc.SocketMessageReader(socket); + const writer = new rpc.SocketMessageWriter(socket); this.connection = rpc.createMessageConnection(reader, writer); this.connection.onClose(() => { this.connection = null; - this.notifyDisconnect(); }); this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); @@ -475,26 +864,39 @@ export class AspireClient { } }); + socket.on('error', onConnectedSocketError); + socket.on('close', onConnectedSocketClose); + + const authToken = process.env.ASPIRE_REMOTE_APPHOST_TOKEN; + if (!authToken) { + throw new Error('ASPIRE_REMOTE_APPHOST_TOKEN environment variable is not set.'); + } this.connection.listen(); + const authenticated = await this.connection.sendRequest('authenticate', authToken); + if (!authenticated) { + throw new Error('Failed to authenticate to the AppHost server.'); + } - // Set the current client for cancellation registry - currentClient = this; + connectedClients.add(this); + this._connectPromise = null; + settled = true; resolve(); - } catch (e) { - reject(e); + } catch (error) { + failConnect(error instanceof Error ? error : new Error(String(error))); } - }); + }; - this.socket.on('close', () => { - this.connection?.dispose(); - this.connection = null; - if (currentClient === this) { - currentClient = null; - } - this.notifyDisconnect(); - }); + const timeout = setTimeout(() => { + failConnect(new Error('Connection timeout')); + }, timeoutMs); + + socket.once('error', onPendingError); + socket.once('close', onPendingClose); + socket.once('connect', onConnect); }); + + return this._connectPromise; } ping(): Promise { @@ -533,39 +935,66 @@ export class AspireClient { throw new Error('Not connected to AppHost'); } - // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. - // We ref() during RPC calls so the process doesn't exit mid-call, and - // unref() when idle so the process can exit naturally after all work completes. - if (this._pendingCalls === 0) { - this.socket?.ref(); - } - this._pendingCalls++; + validateCapabilityArgs(capabilityId, args); + const cancellationIds: string[] = []; try { - const result = await this.connection.sendRequest( - 'invokeCapability', - capabilityId, - args ?? null - ); + const rpcArgs = await marshalTransportValue(args ?? null, this, cancellationIds, capabilityId); - // Check for structured error response - if (isAtsError(result)) { - throw new CapabilityError(result.$error); + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); } + this._pendingCalls++; - // Wrap handles automatically - return wrapIfHandle(result, this) as T; + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + rpcArgs + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } } finally { - this._pendingCalls--; - if (this._pendingCalls === 0) { - this.socket?.unref(); + for (const cancellationId of cancellationIds) { + unregisterCancellation(cancellationId); } } } disconnect(): void { - try { this.connection?.dispose(); } finally { this.connection = null; } - try { this.socket?.end(); } finally { this.socket = null; } + const connection = this.connection; + const socket = this.socket; + + this.connection = null; + this.socket = null; + this._connectPromise = null; + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + if (socket && !socket.destroyed) { + socket.end(); + socket.destroy(); + } } get connected(): boolean { diff --git a/samples/orleans-voting/ts/apphost.run.json b/samples/orleans-voting/ts/aspire.config.json similarity index 57% rename from samples/orleans-voting/ts/apphost.run.json rename to samples/orleans-voting/ts/aspire.config.json index a66b5698..ab886dcf 100644 --- a/samples/orleans-voting/ts/apphost.run.json +++ b/samples/orleans-voting/ts/aspire.config.json @@ -1,4 +1,13 @@ { + "appHost": { + "path": "apphost.ts", + "language": "typescript/nodejs" + }, + "packages": { + "Aspire.Hosting.JavaScript": "13.2.0", + "Aspire.Hosting.Redis": "13.2.0", + "Aspire.Hosting.Orleans": "13.2.0" + }, "profiles": { "https": { "applicationUrl": "https://localhost:31520;http://localhost:54968", @@ -8,4 +17,4 @@ } } } -} \ No newline at end of file +} diff --git a/samples/volume-mount/ts/.aspire/settings.json b/samples/volume-mount/ts/.aspire/settings.json deleted file mode 100644 index f9d36596..00000000 --- a/samples/volume-mount/ts/.aspire/settings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "appHostPath": "../apphost.ts", - "language": "typescript/nodejs", - "channel": "staging", - "sdkVersion": "13.2.0-preview.1.26159.1", - "packages": { - "Aspire.Hosting.SqlServer": "13.2.0-preview.1.26159.1", - "Aspire.Hosting.Azure.Storage": "13.2.0-preview.1.26159.1" - } -} \ No newline at end of file diff --git a/samples/volume-mount/ts/.modules/.codegen-hash b/samples/volume-mount/ts/.modules/.codegen-hash index 5628150b..687b5f49 100644 --- a/samples/volume-mount/ts/.modules/.codegen-hash +++ b/samples/volume-mount/ts/.modules/.codegen-hash @@ -1 +1 @@ -56A47AF31545CDE490D3B599CDB4136C17486DF59752D95D4B7E85432CC03DF1 \ No newline at end of file +3B8FF9B3F030B7CE022E45E12497E3B97283ECDA41BD26E7321468D70E144CAC \ No newline at end of file diff --git a/samples/volume-mount/ts/.modules/aspire.ts b/samples/volume-mount/ts/.modules/aspire.ts index 3682e0f0..19e09f21 100644 --- a/samples/volume-mount/ts/.modules/aspire.ts +++ b/samples/volume-mount/ts/.modules/aspire.ts @@ -8,6 +8,8 @@ import { AspireClient as AspireClientRpc, Handle, MarshalledHandle, + AppHostUsageError, + CancellationToken, CapabilityError, registerCallback, wrapIfHandle, @@ -77,15 +79,36 @@ type BicepOutputReferenceHandle = Handle<'Aspire.Hosting.Azure/Aspire.Hosting.Az /** Handle to IAzureKeyVaultSecretReference */ type IAzureKeyVaultSecretReferenceHandle = Handle<'Aspire.Hosting.Azure/Aspire.Hosting.Azure.IAzureKeyVaultSecretReference'>; +/** Handle to JavaScriptAppResource */ +type JavaScriptAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource'>; + +/** Handle to NodeAppResource */ +type NodeAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource'>; + +/** Handle to ViteAppResource */ +type ViteAppResourceHandle = Handle<'Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource'>; + /** Handle to SqlServerDatabaseResource */ type SqlServerDatabaseResourceHandle = Handle<'Aspire.Hosting.SqlServer/Aspire.Hosting.ApplicationModel.SqlServerDatabaseResource'>; /** Handle to SqlServerServerResource */ type SqlServerServerResourceHandle = Handle<'Aspire.Hosting.SqlServer/Aspire.Hosting.ApplicationModel.SqlServerServerResource'>; +/** Handle to AfterResourcesCreatedEvent */ +type AfterResourcesCreatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent'>; + +/** Handle to BeforeResourceStartedEvent */ +type BeforeResourceStartedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent'>; + +/** Handle to BeforeStartEvent */ +type BeforeStartEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent'>; + /** Handle to CommandLineArgsCallbackContext */ type CommandLineArgsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext'>; +/** Handle to ConnectionStringAvailableEvent */ +type ConnectionStringAvailableEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent'>; + /** Handle to ContainerRegistryResource */ type ContainerRegistryResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource'>; @@ -95,6 +118,9 @@ type ContainerResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Application /** Handle to CSharpAppResource */ type CSharpAppResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource'>; +/** Handle to DistributedApplicationModel */ +type DistributedApplicationModelHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel'>; + /** Handle to DotnetToolResource */ type DotnetToolResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource'>; @@ -119,6 +145,9 @@ type IComputeResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationM /** Handle to IContainerFilesDestinationResource */ type IContainerFilesDestinationResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource'>; +/** Handle to InitializeResourceEvent */ +type InitializeResourceEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent'>; + /** Handle to IResource */ type IResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource'>; @@ -149,15 +178,27 @@ type ReferenceExpressionHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Applicati /** Handle to ReferenceExpressionBuilder */ type ReferenceExpressionBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder'>; +/** Handle to ResourceEndpointsAllocatedEvent */ +type ResourceEndpointsAllocatedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent'>; + /** Handle to ResourceLoggerService */ type ResourceLoggerServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService'>; /** Handle to ResourceNotificationService */ type ResourceNotificationServiceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService'>; +/** Handle to ResourceReadyEvent */ +type ResourceReadyEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent'>; + +/** Handle to ResourceStoppedEvent */ +type ResourceStoppedEventHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent'>; + /** Handle to ResourceUrlsCallbackContext */ type ResourceUrlsCallbackContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext'>; +/** Handle to UpdateCommandStateContext */ +type UpdateCommandStateContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext'>; + /** Handle to ConnectionStringResource */ type ConnectionStringResourceHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ConnectionStringResource'>; @@ -182,18 +223,33 @@ type IDistributedApplicationBuilderHandle = Handle<'Aspire.Hosting/Aspire.Hostin /** Handle to IResourceWithContainerFiles */ type IResourceWithContainerFilesHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles'>; -/** Handle to IResourceWithServiceDiscovery */ -type IResourceWithServiceDiscoveryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery'>; +/** Handle to IUserSecretsManager */ +type IUserSecretsManagerHandle = Handle<'Aspire.Hosting/Aspire.Hosting.IUserSecretsManager'>; + +/** Handle to IReportingStep */ +type IReportingStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep'>; + +/** Handle to IReportingTask */ +type IReportingTaskHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask'>; /** Handle to PipelineConfigurationContext */ type PipelineConfigurationContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext'>; +/** Handle to PipelineContext */ +type PipelineContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext'>; + /** Handle to PipelineStep */ type PipelineStepHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep'>; /** Handle to PipelineStepContext */ type PipelineStepContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext'>; +/** Handle to PipelineStepFactoryContext */ +type PipelineStepFactoryContextHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext'>; + +/** Handle to PipelineSummary */ +type PipelineSummaryHandle = Handle<'Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary'>; + /** Handle to ProjectResourceOptions */ type ProjectResourceOptionsHandle = Handle<'Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions'>; @@ -206,12 +262,18 @@ type ListanyHandle = Handle<'Aspire.Hosting/List'>; /** Handle to IConfiguration */ type IConfigurationHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration'>; +/** Handle to IConfigurationSection */ +type IConfigurationSectionHandle = Handle<'Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfigurationSection'>; + /** Handle to IHostEnvironment */ type IHostEnvironmentHandle = Handle<'Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment'>; /** Handle to ILogger */ type ILoggerHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger'>; +/** Handle to ILoggerFactory */ +type ILoggerFactoryHandle = Handle<'Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory'>; + /** Handle to string[] */ type stringArrayHandle = Handle<'string[]'>; @@ -283,6 +345,7 @@ export enum EndpointProperty { Scheme = "Scheme", TargetPort = "TargetPort", HostAndPort = "HostAndPort", + TlsEnabled = "TlsEnabled", } /** Enum type for IconVariant */ @@ -418,6 +481,10 @@ export interface AddConnectionStringOptions { environmentVariableName?: string; } +export interface AddContainerRegistryFromStringOptions { + repository?: string; +} + export interface AddContainerRegistryOptions { repository?: ParameterResource; } @@ -435,6 +502,10 @@ export interface AddDockerfileOptions { stage?: string; } +export interface AddJavaScriptAppOptions { + runScriptName?: string; +} + export interface AddParameterFromConfigurationOptions { secret?: boolean; } @@ -443,6 +514,11 @@ export interface AddParameterOptions { secret?: boolean; } +export interface AddParameterWithValueOptions { + publishValueAsDefault?: boolean; + secret?: boolean; +} + export interface AddQueueOptions { queueName?: string; } @@ -452,6 +528,10 @@ export interface AddSqlServerOptions { port?: number; } +export interface AddViteAppOptions { + runScriptName?: string; +} + export interface AppendFormattedOptions { format?: string; } @@ -460,8 +540,46 @@ export interface AppendValueProviderOptions { format?: string; } +export interface CompleteStepMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteStepOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskMarkdownOptions { + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CompleteTaskOptions { + completionMessage?: string; + completionState?: string; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateMarkdownTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface CreateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + export interface GetValueAsyncOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface PublishAsDockerFileOptions { + configure?: (obj: ContainerResource) => Promise; +} + +export interface PublishResourceUpdateOptions { + state?: string; + stateStyle?: string; } export interface RunAsEmulatorOptions { @@ -469,13 +587,29 @@ export interface RunAsEmulatorOptions { } export interface RunOptions { - cancellationToken?: AbortSignal; + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface SaveStateJsonOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskMarkdownOptions { + cancellationToken?: AbortSignal | CancellationToken; +} + +export interface UpdateTaskOptions { + cancellationToken?: AbortSignal | CancellationToken; } export interface WaitForCompletionOptions { exitCode?: number; } +export interface WaitForResourceStateOptions { + targetState?: string; +} + export interface WithApiVersionCheckOptions { enable?: boolean; } @@ -484,6 +618,19 @@ export interface WithBindMountOptions { isReadOnly?: boolean; } +export interface WithBrowserDebuggerOptions { + browser?: string; +} + +export interface WithBuildScriptOptions { + args?: string[]; +} + +export interface WithBunOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithCommandOptions { commandOptions?: CommandOptions; } @@ -581,6 +728,12 @@ export interface WithMcpServerOptions { endpointName?: string; } +export interface WithNpmOptions { + install?: boolean; + installCommand?: string; + installArgs?: string[]; +} + export interface WithPipelineStepFactoryOptions { dependsOn?: string[]; requiredBy?: string[]; @@ -588,15 +741,25 @@ export interface WithPipelineStepFactoryOptions { description?: string; } +export interface WithPnpmOptions { + install?: boolean; + installArgs?: string[]; +} + export interface WithReferenceOptions { connectionName?: string; optional?: boolean; + name?: string; } export interface WithRequiredCommandOptions { helpLink?: string; } +export interface WithRunScriptOptions { + args?: string[]; +} + export interface WithUrlExpressionOptions { displayText?: string; } @@ -610,6 +773,48 @@ export interface WithVolumeOptions { isReadOnly?: boolean; } +export interface WithYarnOptions { + install?: boolean; + installArgs?: string[]; +} + +// ============================================================================ +// AfterResourcesCreatedEvent +// ============================================================================ + +/** + * Type class for AfterResourcesCreatedEvent. + */ +export class AfterResourcesCreatedEvent { + constructor(private _handle: AfterResourcesCreatedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + // ============================================================================ // AzureResourceInfrastructure // ============================================================================ @@ -651,6 +856,80 @@ export class AzureResourceInfrastructure { } +// ============================================================================ +// BeforeResourceStartedEvent +// ============================================================================ + +/** + * Type class for BeforeResourceStartedEvent. + */ +export class BeforeResourceStartedEvent { + constructor(private _handle: BeforeResourceStartedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// BeforeStartEvent +// ============================================================================ + +/** + * Type class for BeforeStartEvent. + */ +export class BeforeStartEvent { + constructor(private _handle: BeforeStartEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + +} + // ============================================================================ // BicepOutputReference // ============================================================================ @@ -725,11 +1004,12 @@ export class CommandLineArgsCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, }; @@ -744,6 +1024,65 @@ export class CommandLineArgsCallbackContext { }, }; + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ConnectionStringAvailableEvent +// ============================================================================ + +/** + * Type class for ConnectionStringAvailableEvent. + */ +export class ConnectionStringAvailableEvent { + constructor(private _handle: ConnectionStringAvailableEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + } // ============================================================================ @@ -761,9 +1100,9 @@ export class DistributedApplication { /** Runs the distributed application */ /** @internal */ - async _runInternal(cancellationToken?: AbortSignal): Promise { + async _runInternal(cancellationToken?: AbortSignal | CancellationToken): Promise { const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); await this._client.invokeCapability( 'Aspire.Hosting/run', rpcArgs @@ -837,6 +1176,17 @@ export class DistributedApplicationExecutionContext { }, }; + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/DistributedApplicationExecutionContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the IsPublishMode property */ isPublishMode = { get: async (): Promise => { @@ -859,6 +1209,70 @@ export class DistributedApplicationExecutionContext { } +// ============================================================================ +// DistributedApplicationModel +// ============================================================================ + +/** + * Type class for DistributedApplicationModel. + */ +export class DistributedApplicationModel { + constructor(private _handle: DistributedApplicationModelHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets resources from the distributed application model */ + async getResources(): Promise { + const rpcArgs: Record = { model: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResources', + rpcArgs + ); + } + + /** Finds a resource by name */ + /** @internal */ + async _findResourceByNameInternal(name: string): Promise { + const rpcArgs: Record = { model: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/findResourceByName', + rpcArgs + ); + return new Resource(result, this._client); + } + + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._findResourceByNameInternal(name)); + } + +} + +/** + * Thenable wrapper for DistributedApplicationModel that enables fluent chaining. + */ +export class DistributedApplicationModelPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationModel) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Gets resources from the distributed application model */ + getResources(): Promise { + return this._promise.then(obj => obj.getResources()); + } + + /** Finds a resource by name */ + findResourceByName(name: string): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.findResourceByName(name))); + } + +} + // ============================================================================ // EndpointReference // ============================================================================ @@ -872,6 +1286,17 @@ export class EndpointReference { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.resource', + { context: this._handle } + ); + return new ResourceWithEndpoints(handle, this._client); + }, + }; + /** Gets the EndpointName property */ endpointName = { get: async (): Promise => { @@ -938,6 +1363,16 @@ export class EndpointReference { }, }; + /** Gets the TlsEnabled property */ + tlsEnabled = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.tlsEnabled', + { context: this._handle } + ); + }, + }; + /** Gets the Port property */ port = { get: async (): Promise => { @@ -992,13 +1427,22 @@ export class EndpointReference { async getValueAsync(options?: GetValueAsyncOptions): Promise { const cancellationToken = options?.cancellationToken; const rpcArgs: Record = { context: this._handle }; - if (cancellationToken !== undefined) rpcArgs.cancellationToken = cancellationToken; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); return await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/getValueAsync', rpcArgs ); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + async getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + const rpcArgs: Record = { context: this._handle, enabledValue, disabledValue }; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EndpointReference.getTlsValue', + rpcArgs + ); + } + } /** @@ -1019,6 +1463,11 @@ export class EndpointReferencePromise implements PromiseLike return this._promise.then(obj => obj.getValueAsync(options)); } + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise { + return this._promise.then(obj => obj.getTlsValue(enabledValue, disabledValue)); + } + } // ============================================================================ @@ -1096,11 +1545,34 @@ export class EnvironmentCallbackContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; @@ -1130,6 +1602,17 @@ export class ExecuteCommandContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + /** Gets the ResourceName property */ resourceName = { get: async (): Promise => { @@ -1148,16 +1631,17 @@ export class ExecuteCommandContext { /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); }, - set: async (value: AbortSignal): Promise => { + set: async (value: AbortSignal | CancellationToken): Promise => { await this._client.invokeCapability( 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken', - { context: this._handle, value } + { context: this._handle, value: CancellationToken.fromValue(value) } ); } }; @@ -1165,34 +1649,126 @@ export class ExecuteCommandContext { } // ============================================================================ -// PipelineConfigurationContext +// InitializeResourceEvent // ============================================================================ /** - * Type class for PipelineConfigurationContext. + * Type class for InitializeResourceEvent. */ -export class PipelineConfigurationContext { - constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} +export class InitializeResourceEvent { + constructor(private _handle: InitializeResourceEventHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the Steps property */ - steps = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.resource', { context: this._handle } ); + return new Resource(handle, this._client); }, - set: async (value: PipelineStep[]): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', + }; + + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the Notifications property */ + notifications = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.notifications', + { context: this._handle } + ); + return new ResourceNotificationService(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineConfigurationContext +// ============================================================================ + +/** + * Type class for PipelineConfigurationContext. + */ +export class PipelineConfigurationContext { + constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Steps property */ + steps = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps', + { context: this._handle } + ); + }, + set: async (value: PipelineStep[]): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps', { context: this._handle, value } ); } }; + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + /** Gets pipeline steps with the specified tag */ async getStepsByTag(tag: string): Promise { const rpcArgs: Record = { context: this._handle, tag }; @@ -1224,6 +1800,93 @@ export class PipelineConfigurationContextPromise implements PromiseLike => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + set: async (value: AbortSignal | CancellationToken): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.setCancellationToken', + { context: this._handle, value: CancellationToken.fromValue(value) } + ); + } + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + // ============================================================================ // PipelineStep // ============================================================================ @@ -1311,6 +1974,17 @@ export class PipelineStep { return this._tags; } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + /** Adds a dependency on another step by name */ /** @internal */ async _dependsOnInternal(stepName: string): Promise { @@ -1381,6 +2055,39 @@ export class PipelineStepContext { /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the ReportingStep property */ + reportingStep = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.reportingStep', + { context: this._handle } + ); + return new ReportingStep(handle, this._client); + }, + }; + + /** Gets the Model property */ + model = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.model', + { context: this._handle } + ); + return new DistributedApplicationModel(handle, this._client); + }, + }; + /** Gets the ExecutionContext property */ executionContext = { get: async (): Promise => { @@ -1392,18 +2099,159 @@ export class PipelineStepContext { }, }; + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + /** Gets the CancellationToken property */ cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( + get: async (): Promise => { + const result = await this._client.invokeCapability( 'Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken', { context: this._handle } ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Summary property */ + summary = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.summary', + { context: this._handle } + ); + return new PipelineSummary(handle, this._client); + }, + }; + +} + +// ============================================================================ +// PipelineStepFactoryContext +// ============================================================================ + +/** + * Type class for PipelineStepFactoryContext. + */ +export class PipelineStepFactoryContext { + constructor(private _handle: PipelineStepFactoryContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the PipelineContext property */ + pipelineContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.pipelineContext', + { context: this._handle } + ); + return new PipelineContext(handle, this._client); + }, + }; + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); }, }; } +// ============================================================================ +// PipelineSummary +// ============================================================================ + +/** + * Type class for PipelineSummary. + */ +export class PipelineSummary { + constructor(private _handle: PipelineSummaryHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Invokes the Add method */ + /** @internal */ + async _addInternal(key: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, key, value }; + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineSummary.add', + rpcArgs + ); + return this; + } + + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addInternal(key, value)); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + /** @internal */ + async _addMarkdownInternal(key: string, markdownString: string): Promise { + const rpcArgs: Record = { summary: this._handle, key, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/addMarkdown', + rpcArgs + ); + return this; + } + + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._addMarkdownInternal(key, markdownString)); + } + +} + +/** + * Thenable wrapper for PipelineSummary that enables fluent chaining. + */ +export class PipelineSummaryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: PipelineSummary) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Add method */ + add(key: string, value: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.add(key, value))); + } + + /** Adds a Markdown-formatted value to the pipeline summary */ + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { + return new PipelineSummaryPromise(this._promise.then(obj => obj.addMarkdown(key, markdownString))); + } + +} + // ============================================================================ // ProjectResourceOptions // ============================================================================ @@ -1586,2177 +2434,2389 @@ export class ReferenceExpressionBuilderPromise implements PromiseLike; - get urls(): AspireList { - if (!this._urls) { - this._urls = new AspireList( - this._handle, - this._client, - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' - ); - } - return this._urls; - } - - /** Gets the CancellationToken property */ - cancellationToken = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.resource', { context: this._handle } ); + return new Resource(handle, this._client); }, }; - /** Gets the ExecutionContext property */ - executionContext = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.services', { context: this._handle } ); - return new DistributedApplicationExecutionContext(handle, this._client); + return new ServiceProvider(handle, this._client); }, }; } // ============================================================================ -// DistributedApplicationBuilder +// ResourceLoggerService // ============================================================================ /** - * Type class for DistributedApplicationBuilder. + * Type class for ResourceLoggerService. */ -export class DistributedApplicationBuilder { - constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} +export class ResourceLoggerService { + constructor(private _handle: ResourceLoggerServiceHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Gets the AppHostDirectory property */ - appHostDirectory = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', - { context: this._handle } - ); - }, - }; - - /** Gets the Eventing property */ - eventing = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', - { context: this._handle } - ); - return new DistributedApplicationEventing(handle, this._client); - }, - }; - - /** Gets the ExecutionContext property */ - executionContext = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', - { context: this._handle } - ); - return new DistributedApplicationExecutionContext(handle, this._client); - }, - }; - - /** Builds the distributed application */ + /** Completes the log stream for a resource */ /** @internal */ - async _buildInternal(): Promise { - const rpcArgs: Record = { context: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/build', + async _completeLogInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { loggerService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLog', rpcArgs ); - return new DistributedApplication(result, this._client); + return this; } - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._buildInternal()); + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogInternal(resource)); } - /** Adds a connection string with a builder callback */ + /** Completes the log stream by resource name */ /** @internal */ - async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { - const connectionStringBuilderId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; - const obj = new ReferenceExpressionBuilder(objHandle, this._client); - await connectionStringBuilder(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionStringBuilder', + async _completeLogByNameInternal(resourceName: string): Promise { + const rpcArgs: Record = { loggerService: this._handle, resourceName }; + await this._client.invokeCapability( + 'Aspire.Hosting/completeLogByName', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return this; } - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._completeLogByNameInternal(resourceName)); } - /** Adds a container registry resource */ - /** @internal */ - async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpoint }; - if (repository !== undefined) rpcArgs.repository = repository; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainerRegistry', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } +} - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - const repository = options?.repository; - return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); - } +/** + * Thenable wrapper for ResourceLoggerService that enables fluent chaining. + */ +export class ResourceLoggerServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** Adds a container resource */ - /** @internal */ - async _addContainerInternal(name: string, image: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, image }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addContainer', - rpcArgs - ); - return new ContainerResource(result, this._client); + then( + onfulfilled?: ((value: ResourceLoggerService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._addContainerInternal(name, image)); + /** Completes the log stream for a resource */ + completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLog(resource))); } - /** Adds a container resource built from a Dockerfile */ - /** @internal */ - async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDockerfile', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Completes the log stream by resource name */ + completeLogByName(resourceName: string): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLogByName(resourceName))); } - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); - } +} - /** Adds a .NET tool resource */ - /** @internal */ - async _addDotnetToolInternal(name: string, packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addDotnetTool', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } +// ============================================================================ +// ResourceNotificationService +// ============================================================================ - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); - } +/** + * Type class for ResourceNotificationService. + */ +export class ResourceNotificationService { + constructor(private _handle: ResourceNotificationServiceHandle, private _client: AspireClientRpc) {} - /** Adds an executable resource */ + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Waits for a resource to reach a specified state */ /** @internal */ - async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExecutable', + async _waitForResourceStateInternal(resourceName: string, targetState?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + if (targetState !== undefined) rpcArgs.targetState = targetState; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceState', rpcArgs ); - return new ExecutableResource(result, this._client); + return this; } - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + const targetState = options?.targetState; + return new ResourceNotificationServicePromise(this._waitForResourceStateInternal(resourceName, targetState)); } - /** Adds an external service resource */ - /** @internal */ - async _addExternalServiceInternal(name: string, url: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, url }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addExternalService', + /** Waits for a resource to reach one of the specified states */ + async waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName, targetStates }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStates', rpcArgs ); - return new ExternalServiceResource(result, this._client); - } - - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); } - /** Adds a parameter resource */ - /** @internal */ - async _addParameterInternal(name: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameter', + /** Waits for a resource to become healthy */ + async waitForResourceHealthy(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceHealthy', rpcArgs ); - return new ParameterResource(result, this._client); } - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterInternal(name, secret)); - } - - /** Adds a parameter sourced from configuration */ + /** Waits for all dependencies of a resource to be ready */ /** @internal */ - async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, name, configurationKey }; - if (secret !== undefined) rpcArgs.secret = secret; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addParameterFromConfiguration', + async _waitForDependenciesInternal(resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + await this._client.invokeCapability( + 'Aspire.Hosting/waitForDependencies', rpcArgs ); - return new ParameterResource(result, this._client); + return this; } - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._waitForDependenciesInternal(resource)); } - /** Adds a connection string resource */ - /** @internal */ - async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addConnectionString', + /** Tries to get the current state of a resource */ + async tryGetResourceState(resourceName: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resourceName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/tryGetResourceState', rpcArgs ); - return new ResourceWithConnectionString(result, this._client); - } - - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - const environmentVariableName = options?.environmentVariableName; - return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); } - /** Adds a .NET project resource */ + /** Publishes an update for a resource's state */ /** @internal */ - async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProject', + async _publishResourceUpdateInternal(resource: ResourceBuilderBase, state?: string, stateStyle?: string): Promise { + const rpcArgs: Record = { notificationService: this._handle, resource }; + if (state !== undefined) rpcArgs.state = state; + if (stateStyle !== undefined) rpcArgs.stateStyle = stateStyle; + await this._client.invokeCapability( + 'Aspire.Hosting/publishResourceUpdate', rpcArgs ); - return new ProjectResource(result, this._client); + return this; } - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + const state = options?.state; + const stateStyle = options?.stateStyle; + return new ResourceNotificationServicePromise(this._publishResourceUpdateInternal(resource, state, stateStyle)); } - /** Adds a project resource with configuration options */ - /** @internal */ - async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addProjectWithOptions', - rpcArgs - ); - return new ProjectResource(result, this._client); - } +} - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); +/** + * Thenable wrapper for ResourceNotificationService that enables fluent chaining. + */ +export class ResourceNotificationServicePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ResourceNotificationService) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a C# application resource */ - /** @internal */ - async _addCSharpAppInternal(name: string, path: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, path }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpApp', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Waits for a resource to reach a specified state */ + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForResourceState(resourceName, options))); } - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + /** Waits for a resource to reach one of the specified states */ + waitForResourceStates(resourceName: string, targetStates: string[]): Promise { + return this._promise.then(obj => obj.waitForResourceStates(resourceName, targetStates)); } - /** Adds a C# application resource with configuration options */ - /** @internal */ - async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/addCSharpAppWithOptions', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Waits for a resource to become healthy */ + waitForResourceHealthy(resourceName: string): Promise { + return this._promise.then(obj => obj.waitForResourceHealthy(resourceName)); } - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + /** Waits for all dependencies of a resource to be ready */ + waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.waitForDependencies(resource))); } - /** Adds a SQL Server container resource */ - /** @internal */ - async _addSqlServerInternal(name: string, password?: ParameterResource, port?: number): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (password !== undefined) rpcArgs.password = password; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.SqlServer/addSqlServer', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Tries to get the current state of a resource */ + tryGetResourceState(resourceName: string): Promise { + return this._promise.then(obj => obj.tryGetResourceState(resourceName)); } - addSqlServer(name: string, options?: AddSqlServerOptions): SqlServerServerResourcePromise { - const password = options?.password; - const port = options?.port; - return new SqlServerServerResourcePromise(this._addSqlServerInternal(name, password, port)); + /** Publishes an update for a resource's state */ + publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.publishResourceUpdate(resource, options))); } - /** Adds an Azure Storage resource */ - /** @internal */ - async _addAzureStorageInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/addAzureStorage', - rpcArgs - ); - return new AzureStorageResource(result, this._client); - } +} - addAzureStorage(name: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._addAzureStorageInternal(name)); - } +// ============================================================================ +// ResourceReadyEvent +// ============================================================================ - /** Adds an Azure Bicep template resource from a file */ - /** @internal */ - async _addBicepTemplateInternal(name: string, bicepFile: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, bicepFile }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/addBicepTemplate', - rpcArgs - ); - return new AzureBicepResource(result, this._client); - } +/** + * Type class for ResourceReadyEvent. + */ +export class ResourceReadyEvent { + constructor(private _handle: ResourceReadyEventHandle, private _client: AspireClientRpc) {} - addBicepTemplate(name: string, bicepFile: string): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._addBicepTemplateInternal(name, bicepFile)); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Adds an Azure Bicep template resource from inline Bicep content */ - /** @internal */ - async _addBicepTemplateStringInternal(name: string, bicepContent: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, bicepContent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/addBicepTemplateString', - rpcArgs - ); - return new AzureBicepResource(result, this._client); - } + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; - addBicepTemplateString(name: string, bicepContent: string): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._addBicepTemplateStringInternal(name, bicepContent)); - } + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; - /** Adds an Azure provisioning resource to the application model */ - /** @internal */ - async _addAzureInfrastructureInternal(name: string, configureInfrastructure: (obj: AzureResourceInfrastructure) => Promise): Promise { - const configureInfrastructureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; - const obj = new AzureResourceInfrastructure(objHandle, this._client); - await configureInfrastructure(obj); - }); - const rpcArgs: Record = { builder: this._handle, name, configureInfrastructure: configureInfrastructureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/addAzureInfrastructure', - rpcArgs - ); - return new AzureProvisioningResource(result, this._client); - } +} - addAzureInfrastructure(name: string, configureInfrastructure: (obj: AzureResourceInfrastructure) => Promise): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._addAzureInfrastructureInternal(name, configureInfrastructure)); +// ============================================================================ +// ResourceStoppedEvent +// ============================================================================ + +/** + * Type class for ResourceStoppedEvent. + */ +export class ResourceStoppedEvent { + constructor(private _handle: ResourceStoppedEventHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Services property */ + services = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.services', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// ResourceUrlsCallbackContext +// ============================================================================ + +/** + * Type class for ResourceUrlsCallbackContext. + */ +export class ResourceUrlsCallbackContext { + constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the Resource property */ + resource = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.resource', + { context: this._handle } + ); + return new Resource(handle, this._client); + }, + }; + + /** Gets the Urls property */ + private _urls?: AspireList; + get urls(): AspireList { + if (!this._urls) { + this._urls = new AspireList( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls', + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls' + ); + } + return this._urls; } - /** Adds Azure provisioning services to the distributed application builder */ - /** @internal */ - async _addAzureProvisioningInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/addAzureProvisioning', + /** Gets the CancellationToken property */ + cancellationToken = { + get: async (): Promise => { + const result = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken', + { context: this._handle } + ); + return CancellationToken.fromValue(result); + }, + }; + + /** Gets the Logger property */ + logger = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.logger', + { context: this._handle } + ); + return new Logger(handle, this._client); + }, + }; + + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; + +} + +// ============================================================================ +// UpdateCommandStateContext +// ============================================================================ + +/** + * Type class for UpdateCommandStateContext. + */ +export class UpdateCommandStateContext { + constructor(private _handle: UpdateCommandStateContextHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the ServiceProvider property */ + serviceProvider = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/UpdateCommandStateContext.serviceProvider', + { context: this._handle } + ); + return new ServiceProvider(handle, this._client); + }, + }; + +} + +// ============================================================================ +// Configuration +// ============================================================================ + +/** + * Type class for Configuration. + */ +export class Configuration { + constructor(private _handle: IConfigurationHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets a configuration value by key */ + async getConfigValue(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConfigValue', rpcArgs ); - return new DistributedApplicationBuilder(result, this._client); } - addAzureProvisioning(): DistributedApplicationBuilderPromise { - return new DistributedApplicationBuilderPromise(this._addAzureProvisioningInternal()); - } - - /** Adds the shared Azure environment resource to the application model */ - /** @internal */ - async _addAzureEnvironmentInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/addAzureEnvironment', + /** Gets a connection string by name */ + async getConnectionString(name: string): Promise { + const rpcArgs: Record = { configuration: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionString', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); } - addAzureEnvironment(): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._addAzureEnvironmentInternal()); + /** Gets a configuration section by key */ + async getSection(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getSection', + rpcArgs + ); } - /** Adds an Azure user-assigned identity resource */ - /** @internal */ - async _addAzureUserAssignedIdentityInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/addAzureUserAssignedIdentity', + /** Gets child configuration sections */ + async getChildren(): Promise { + const rpcArgs: Record = { configuration: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getChildren', rpcArgs ); - return new AzureUserAssignedIdentityResource(result, this._client); } - addAzureUserAssignedIdentity(name: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._addAzureUserAssignedIdentityInternal(name)); + /** Checks whether a configuration section exists */ + async exists(key: string): Promise { + const rpcArgs: Record = { configuration: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/exists', + rpcArgs + ); } } /** - * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. + * Thenable wrapper for Configuration that enables fluent chaining. */ -export class DistributedApplicationBuilderPromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ConfigurationPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: Configuration) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Builds the distributed application */ - build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); - } - - /** Adds a connection string with a builder callback */ - addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + /** Gets a configuration value by key */ + getConfigValue(key: string): Promise { + return this._promise.then(obj => obj.getConfigValue(key)); } - /** Adds a container registry resource */ - addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + /** Gets a connection string by name */ + getConnectionString(name: string): Promise { + return this._promise.then(obj => obj.getConnectionString(name)); } - /** Adds a container resource */ - addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + /** Gets a configuration section by key */ + getSection(key: string): Promise { + return this._promise.then(obj => obj.getSection(key)); } - /** Adds a container resource built from a Dockerfile */ - addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + /** Gets child configuration sections */ + getChildren(): Promise { + return this._promise.then(obj => obj.getChildren()); } - /** Adds a .NET tool resource */ - addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + /** Checks whether a configuration section exists */ + exists(key: string): Promise { + return this._promise.then(obj => obj.exists(key)); } - /** Adds an executable resource */ - addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); - } +} - /** Adds an external service resource */ - addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); - } +// ============================================================================ +// DistributedApplicationBuilder +// ============================================================================ - /** Adds a parameter resource */ - addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); - } +/** + * Type class for DistributedApplicationBuilder. + */ +export class DistributedApplicationBuilder { + constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} - /** Adds a parameter sourced from configuration */ - addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Adds a connection string resource */ - addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); - } + /** Gets the AppHostDirectory property */ + appHostDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory', + { context: this._handle } + ); + }, + }; - /** Adds a .NET project resource */ - addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); - } + /** Gets the Environment property */ + environment = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.environment', + { context: this._handle } + ); + return new HostEnvironment(handle, this._client); + }, + }; - /** Adds a project resource with configuration options */ - addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); - } + /** Gets the Eventing property */ + eventing = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', + { context: this._handle } + ); + return new DistributedApplicationEventing(handle, this._client); + }, + }; - /** Adds a C# application resource */ - addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); - } + /** Gets the ExecutionContext property */ + executionContext = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', + { context: this._handle } + ); + return new DistributedApplicationExecutionContext(handle, this._client); + }, + }; - /** Adds a C# application resource with configuration options */ - addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); - } + /** Gets the UserSecretsManager property */ + userSecretsManager = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting/IDistributedApplicationBuilder.userSecretsManager', + { context: this._handle } + ); + return new UserSecretsManager(handle, this._client); + }, + }; - /** Adds a SQL Server container resource */ - addSqlServer(name: string, options?: AddSqlServerOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.addSqlServer(name, options))); + /** Builds the distributed application */ + /** @internal */ + async _buildInternal(): Promise { + const rpcArgs: Record = { context: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/build', + rpcArgs + ); + return new DistributedApplication(result, this._client); } - /** Adds an Azure Storage resource */ - addAzureStorage(name: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.addAzureStorage(name))); + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._buildInternal()); } - /** Adds an Azure Bicep template resource from a file */ - addBicepTemplate(name: string, bicepFile: string): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.addBicepTemplate(name, bicepFile))); + /** Adds a connection string with a reference expression */ + /** @internal */ + async _addConnectionStringExpressionInternal(name: string, connectionStringExpression: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, connectionStringExpression }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionStringExpression', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); } - /** Adds an Azure Bicep template resource from inline Bicep content */ - addBicepTemplateString(name: string, bicepContent: string): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.addBicepTemplateString(name, bicepContent))); + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringExpressionInternal(name, connectionStringExpression)); } - /** Adds an Azure provisioning resource to the application model */ - addAzureInfrastructure(name: string, configureInfrastructure: (obj: AzureResourceInfrastructure) => Promise): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.addAzureInfrastructure(name, configureInfrastructure))); + /** Adds a connection string with a builder callback */ + /** @internal */ + async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { + const connectionStringBuilderId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; + const obj = new ReferenceExpressionBuilder(objHandle, this._client); + await connectionStringBuilder(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionStringBuilder', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); } - /** Adds Azure provisioning services to the distributed application builder */ - addAzureProvisioning(): DistributedApplicationBuilderPromise { - return new DistributedApplicationBuilderPromise(this._promise.then(obj => obj.addAzureProvisioning())); + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); } - /** Adds the shared Azure environment resource to the application model */ - addAzureEnvironment(): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.addAzureEnvironment())); + /** Adds a container registry resource */ + /** @internal */ + async _addContainerRegistryInternal(name: string, endpoint: ParameterResource, repository?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistry', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds an Azure user-assigned identity resource */ - addAzureUserAssignedIdentity(name: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.addAzureUserAssignedIdentity(name))); + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); } -} - -// ============================================================================ -// DistributedApplicationEventing -// ============================================================================ - -/** - * Type class for DistributedApplicationEventing. - */ -export class DistributedApplicationEventing { - constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} - - /** Serialize for JSON-RPC transport */ - toJSON(): MarshalledHandle { return this._handle.toJSON(); } - - /** Invokes the Unsubscribe method */ + /** Adds a container registry with string endpoint */ /** @internal */ - async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { - const rpcArgs: Record = { context: this._handle, subscription }; - await this._client.invokeCapability( - 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', + async _addContainerRegistryFromStringInternal(name: string, endpoint: string, repository?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpoint }; + if (repository !== undefined) rpcArgs.repository = repository; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainerRegistryFromString', rpcArgs ); - return this; - } - - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + return new ContainerRegistryResource(result, this._client); } -} - -/** - * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. - */ -export class DistributedApplicationEventingPromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + const repository = options?.repository; + return new ContainerRegistryResourcePromise(this._addContainerRegistryFromStringInternal(name, endpoint, repository)); } - /** Invokes the Unsubscribe method */ - unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + /** Adds a container resource */ + /** @internal */ + async _addContainerInternal(name: string, image: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, image }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addContainer', + rpcArgs + ); + return new ContainerResource(result, this._client); } -} - -// ============================================================================ -// AzureBicepResource -// ============================================================================ - -export class AzureBicepResource extends ResourceBuilderBase { - constructor(handle: AzureBicepResourceHandle, client: AspireClientRpc) { - super(handle, client); + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._addContainerInternal(name, image)); } + /** Adds a container resource built from a Dockerfile */ /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + async _addDockerfileInternal(name: string, contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDockerfile', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withContainerRegistryInternal(registry)); + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); } + /** Adds a .NET tool resource */ /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + async _addDotnetToolInternal(name: string, packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addDotnetTool', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBicepResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new AzureBicepResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); } + /** Adds an executable resource */ /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + async _addExecutableInternal(name: string, command: string, workingDirectory: string, args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, command, workingDirectory, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExecutable', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBicepResourcePromise { - const helpLink = options?.helpLink; - return new AzureBicepResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); } + /** Adds an external service resource */ /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + async _addExternalServiceInternal(name: string, url: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, url }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalService', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withUrlsCallbackInternal(callback)); + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); } + /** Adds an external service with a URI */ /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + async _addExternalServiceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceUri', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceUriInternal(name, uri)); } + /** Adds an external service with a parameter URL */ /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + async _addExternalServiceParameterInternal(name: string, urlParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, urlParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addExternalServiceParameter', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureBicepResourcePromise { - const displayText = options?.displayText; - return new AzureBicepResourcePromise(this._withUrlInternal(url, displayText)); + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._addExternalServiceParameterInternal(name, urlParameter)); } + /** Adds a parameter resource */ /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + async _addParameterInternal(name: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameter', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBicepResourcePromise { - const displayText = options?.displayText; - return new AzureBicepResourcePromise(this._withUrlExpressionInternal(url, displayText)); + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterInternal(name, secret)); } + /** Adds a parameter with a default value */ /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + async _addParameterWithValueInternal(name: string, value: string, publishValueAsDefault?: boolean, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + if (publishValueAsDefault !== undefined) rpcArgs.publishValueAsDefault = publishValueAsDefault; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterWithValue', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + const publishValueAsDefault = options?.publishValueAsDefault; + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterWithValueInternal(name, value, publishValueAsDefault, secret)); } + /** Adds a parameter sourced from configuration */ /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + async _addParameterFromConfigurationInternal(name: string, configurationKey: string, secret?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, name, configurationKey }; + if (secret !== undefined) rpcArgs.secret = secret; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addParameterFromConfiguration', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new ParameterResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._excludeFromManifestInternal()); + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + const secret = options?.secret; + return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); } + /** Adds a connection string resource */ /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + async _addConnectionStringInternal(name: string, environmentVariableName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (environmentVariableName !== undefined) rpcArgs.environmentVariableName = environmentVariableName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addConnectionString', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new ResourceWithConnectionString(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withExplicitStartInternal()); + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + const environmentVariableName = options?.environmentVariableName; + return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); } + /** Adds a .NET project resource */ /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + async _addProjectInternal(name: string, projectPath: string, launchProfileName: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, projectPath, launchProfileName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProject', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withHealthCheckInternal(key)); + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); } + /** Adds a project resource with configuration options */ /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); + async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addProjectWithOptions', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBicepResourcePromise { - const commandOptions = options?.commandOptions; - return new AzureBicepResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); } + /** Adds a C# application resource */ /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + async _addCSharpAppInternal(name: string, path: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, path }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpApp', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new ProjectResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withParentRelationshipInternal(parent)); + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); } + /** Adds a C# application resource with configuration options */ /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; + const obj = new ProjectResourceOptions(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/addCSharpAppWithOptions', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withChildRelationshipInternal(child)); + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); } + /** Gets the application configuration */ /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + async _getConfigurationInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getConfiguration', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new Configuration(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureBicepResourcePromise { - const iconVariant = options?.iconVariant; - return new AzureBicepResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._getConfigurationInternal()); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + /** Subscribes to the BeforeStart event */ + async subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeStartEventHandle; + const arg = new BeforeStartEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeBeforeStart', rpcArgs ); - return new AzureBicepResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._excludeFromMcpInternal()); + /** Subscribes to the AfterResourcesCreated event */ + async subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as AfterResourcesCreatedEventHandle; + const arg = new AfterResourcesCreatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + return await this._client.invokeCapability( + 'Aspire.Hosting/subscribeAfterResourcesCreated', + rpcArgs + ); } + /** Adds a Node.js application resource */ /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + async _addNodeAppInternal(name: string, appDirectory: string, scriptPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory, scriptPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addNodeApp', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new NodeAppResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._addNodeAppInternal(name, appDirectory, scriptPath)); } + /** Adds a JavaScript application resource */ /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + async _addJavaScriptAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addJavaScriptApp', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new JavaScriptAppResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + const runScriptName = options?.runScriptName; + return new JavaScriptAppResourcePromise(this._addJavaScriptAppInternal(name, appDirectory, runScriptName)); } + /** Adds a Vite application resource */ /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + async _addViteAppInternal(name: string, appDirectory: string, runScriptName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, appDirectory }; + if (runScriptName !== undefined) rpcArgs.runScriptName = runScriptName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/addViteApp', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBicepResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new AzureBicepResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + const runScriptName = options?.runScriptName; + return new ViteAppResourcePromise(this._addViteAppInternal(name, appDirectory, runScriptName)); } + /** Adds a SQL Server container resource */ /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new AzureBicepResource(result, this._client); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); - } - - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new AzureBicepResource(result, this._client); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withPipelineConfigurationInternal(callback)); - } - - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); - } - - /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + async _addSqlServerInternal(name: string, password?: ParameterResource, port?: number): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (password !== undefined) rpcArgs.password = password; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/addSqlServer', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new SqlServerServerResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + addSqlServer(name: string, options?: AddSqlServerOptions): SqlServerServerResourcePromise { + const password = options?.password; + const port = options?.port; + return new SqlServerServerResourcePromise(this._addSqlServerInternal(name, password, port)); } + /** Adds an Azure Storage resource */ /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsConnectionString', + async _addAzureStorageInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addAzureStorage', rpcArgs ); - return new AzureBicepResource(result, this._client); - } - - /** Publishes an Azure resource to the manifest as a connection string */ - publishAsConnectionString(): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._publishAsConnectionStringInternal()); + return new AzureStorageResource(result, this._client); } - /** Gets the normalized Bicep identifier for an Azure resource */ - async getBicepIdentifier(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/getBicepIdentifier', - rpcArgs - ); + addAzureStorage(name: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._addAzureStorageInternal(name)); } + /** Adds an Azure Bicep template resource from a file */ /** @internal */ - private async _clearDefaultRoleAssignmentsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; + async _addBicepTemplateInternal(name: string, bicepFile: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepFile }; const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', + 'Aspire.Hosting.Azure/addBicepTemplate', rpcArgs ); return new AzureBicepResource(result, this._client); } - /** Clears the default Azure role assignments from a resource */ - clearDefaultRoleAssignments(): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._clearDefaultRoleAssignmentsInternal()); - } - - /** Determines whether a resource is marked as existing */ - async isExisting(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/isExisting', - rpcArgs - ); + addBicepTemplate(name: string, bicepFile: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._addBicepTemplateInternal(name, bicepFile)); } + /** Adds an Azure Bicep template resource from inline Bicep content */ /** @internal */ - private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + async _addBicepTemplateStringInternal(name: string, bicepContent: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepContent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/runAsExistingFromParameters', + 'Aspire.Hosting.Azure/addBicepTemplateString', rpcArgs ); return new AzureBicepResource(result, this._client); } - /** Marks an Azure resource as existing in run mode by using parameter resources */ - runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + addBicepTemplateString(name: string, bicepContent: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._addBicepTemplateStringInternal(name, bicepContent)); } + /** Adds an Azure provisioning resource to the application model */ /** @internal */ - private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/runAsExisting', + async _addAzureInfrastructureInternal(name: string, configureInfrastructure: (obj: AzureResourceInfrastructure) => Promise): Promise { + const configureInfrastructureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; + const obj = new AzureResourceInfrastructure(objHandle, this._client); + await configureInfrastructure(obj); + }); + const rpcArgs: Record = { builder: this._handle, name, configureInfrastructure: configureInfrastructureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/addAzureInfrastructure', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Marks an Azure resource as existing in run mode */ - runAsExisting(name: string, resourceGroup: string): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._runAsExistingInternal(name, resourceGroup)); + addAzureInfrastructure(name: string, configureInfrastructure: (obj: AzureResourceInfrastructure) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._addAzureInfrastructureInternal(name, configureInfrastructure)); } + /** Adds Azure provisioning services to the distributed application builder */ /** @internal */ - private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsExistingFromParameters', + async _addAzureProvisioningInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/addAzureProvisioning', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new DistributedApplicationBuilder(result, this._client); } - /** Marks an Azure resource as existing in publish mode by using parameter resources */ - publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + addAzureProvisioning(): DistributedApplicationBuilderPromise { + return new DistributedApplicationBuilderPromise(this._addAzureProvisioningInternal()); } + /** Adds the shared Azure environment resource to the application model */ /** @internal */ - private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsExisting', + async _addAzureEnvironmentInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/addAzureEnvironment', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } - /** Marks an Azure resource as existing in publish mode */ - publishAsExisting(name: string, resourceGroup: string): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); + addAzureEnvironment(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._addAzureEnvironmentInternal()); } + /** Adds an Azure user-assigned identity resource */ /** @internal */ - private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/asExisting', + async _addAzureUserAssignedIdentityInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/addAzureUserAssignedIdentity', rpcArgs ); - return new AzureBicepResource(result, this._client); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Marks an Azure resource as existing in both run and publish modes */ - asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); + addAzureUserAssignedIdentity(name: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._addAzureUserAssignedIdentityInternal(name)); } } /** - * Thenable wrapper for AzureBicepResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); + * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. */ -export class AzureBicepResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class DistributedApplicationBuilderPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: AzureBicepResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: DistributedApplicationBuilder) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Builds the distributed application */ + build(): DistributedApplicationPromise { + return new DistributedApplicationPromise(this._promise.then(obj => obj.build())); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds a connection string with a reference expression */ + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringExpression(name, connectionStringExpression))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds a connection string with a builder callback */ + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Adds a container registry resource */ + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Adds a container registry with string endpoint */ + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistryFromString(name, endpoint, options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Adds a container resource */ + addContainer(name: string, image: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds a container resource built from a Dockerfile */ + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Adds a .NET tool resource */ + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Adds an executable resource */ + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } + /** Adds an external service resource */ + addExternalService(name: string, url: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + } - /** Adds a health check by key */ - withHealthCheck(key: string): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds an external service with a URI */ + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceUri(name, uri))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Adds an external service with a parameter URL */ + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceParameter(name, urlParameter))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Adds a parameter resource */ + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Adds a parameter with a default value */ + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterWithValue(name, value, options))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Adds a parameter sourced from configuration */ + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Adds a connection string resource */ + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds a .NET project resource */ + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Adds a project resource with configuration options */ + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds a C# application resource */ + addCSharpApp(name: string, path: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Adds a C# application resource with configuration options */ + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Gets the application configuration */ + getConfiguration(): ConfigurationPromise { + return new ConfigurationPromise(this._promise.then(obj => obj.getConfiguration())); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Subscribes to the BeforeStart event */ + subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeBeforeStart(callback)); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + /** Subscribes to the AfterResourcesCreated event */ + subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { + return this._promise.then(obj => obj.subscribeAfterResourcesCreated(callback)); } - /** Publishes an Azure resource to the manifest as a connection string */ - publishAsConnectionString(): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** Adds a Node.js application resource */ + addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.addNodeApp(name, appDirectory, scriptPath))); } - /** Gets the normalized Bicep identifier for an Azure resource */ - getBicepIdentifier(): Promise { - return this._promise.then(obj => obj.getBicepIdentifier()); + /** Adds a JavaScript application resource */ + addJavaScriptApp(name: string, appDirectory: string, options?: AddJavaScriptAppOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.addJavaScriptApp(name, appDirectory, options))); } - /** Clears the default Azure role assignments from a resource */ - clearDefaultRoleAssignments(): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + /** Adds a Vite application resource */ + addViteApp(name: string, appDirectory: string, options?: AddViteAppOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.addViteApp(name, appDirectory, options))); } - /** Determines whether a resource is marked as existing */ - isExisting(): Promise { - return this._promise.then(obj => obj.isExisting()); + /** Adds a SQL Server container resource */ + addSqlServer(name: string, options?: AddSqlServerOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.addSqlServer(name, options))); } - /** Marks an Azure resource as existing in run mode by using parameter resources */ - runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + /** Adds an Azure Storage resource */ + addAzureStorage(name: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.addAzureStorage(name))); } - /** Marks an Azure resource as existing in run mode */ - runAsExisting(name: string, resourceGroup: string): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + /** Adds an Azure Bicep template resource from a file */ + addBicepTemplate(name: string, bicepFile: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.addBicepTemplate(name, bicepFile))); } - /** Marks an Azure resource as existing in publish mode by using parameter resources */ - publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + /** Adds an Azure Bicep template resource from inline Bicep content */ + addBicepTemplateString(name: string, bicepContent: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.addBicepTemplateString(name, bicepContent))); } - /** Marks an Azure resource as existing in publish mode */ - publishAsExisting(name: string, resourceGroup: string): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + /** Adds an Azure provisioning resource to the application model */ + addAzureInfrastructure(name: string, configureInfrastructure: (obj: AzureResourceInfrastructure) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.addAzureInfrastructure(name, configureInfrastructure))); } - /** Marks an Azure resource as existing in both run and publish modes */ - asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { - return new AzureBicepResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + /** Adds Azure provisioning services to the distributed application builder */ + addAzureProvisioning(): DistributedApplicationBuilderPromise { + return new DistributedApplicationBuilderPromise(this._promise.then(obj => obj.addAzureProvisioning())); + } + + /** Adds the shared Azure environment resource to the application model */ + addAzureEnvironment(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.addAzureEnvironment())); + } + + /** Adds an Azure user-assigned identity resource */ + addAzureUserAssignedIdentity(name: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.addAzureUserAssignedIdentity(name))); } } // ============================================================================ -// AzureBlobStorageContainerResource +// DistributedApplicationEventing // ============================================================================ -export class AzureBlobStorageContainerResource extends ResourceBuilderBase { - constructor(handle: AzureBlobStorageContainerResourceHandle, client: AspireClientRpc) { - super(handle, client); - } +/** + * Type class for DistributedApplicationEventing. + */ +export class DistributedApplicationEventing { + constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** Invokes the Unsubscribe method */ /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + async _unsubscribeInternal(subscription: DistributedApplicationEventSubscriptionHandle): Promise { + const rpcArgs: Record = { context: this._handle, subscription }; + await this._client.invokeCapability( + 'Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return this; } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withContainerRegistryInternal(registry)); + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', +} + +/** + * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. + */ +export class DistributedApplicationEventingPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DistributedApplicationEventing) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Invokes the Unsubscribe method */ + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.unsubscribe(subscription))); + } + +} + +// ============================================================================ +// HostEnvironment +// ============================================================================ + +/** + * Type class for HostEnvironment. + */ +export class HostEnvironment { + constructor(private _handle: IHostEnvironmentHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Checks if running in Development environment */ + async isDevelopment(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isDevelopment', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBlobStorageContainerResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new AzureBlobStorageContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Checks if running in Production environment */ + async isProduction(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isProduction', + rpcArgs + ); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + /** Checks if running in Staging environment */ + async isStaging(): Promise { + const rpcArgs: Record = { environment: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isStaging', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBlobStorageContainerResourcePromise { - const helpLink = options?.helpLink; - return new AzureBlobStorageContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Checks if the environment matches the specified name */ + async isEnvironment(environmentName: string): Promise { + const rpcArgs: Record = { environment: this._handle, environmentName }; + return await this._client.invokeCapability( + 'Aspire.Hosting/isEnvironment', + rpcArgs + ); + } + +} + +/** + * Thenable wrapper for HostEnvironment that enables fluent chaining. + */ +export class HostEnvironmentPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: HostEnvironment) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Checks if running in Development environment */ + isDevelopment(): Promise { + return this._promise.then(obj => obj.isDevelopment()); + } + + /** Checks if running in Production environment */ + isProduction(): Promise { + return this._promise.then(obj => obj.isProduction()); + } + + /** Checks if running in Staging environment */ + isStaging(): Promise { + return this._promise.then(obj => obj.isStaging()); + } + + /** Checks if the environment matches the specified name */ + isEnvironment(environmentName: string): Promise { + return this._promise.then(obj => obj.isEnvironment(environmentName)); } +} + +// ============================================================================ +// Logger +// ============================================================================ + +/** + * Type class for Logger. + */ +export class Logger { + constructor(private _handle: ILoggerHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Logs an information message */ /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', + async _logInformationInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logInformation', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return this; } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withConnectionPropertyInternal(name, value)); + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._logInformationInternal(message)); } + /** Logs a warning message */ /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', + async _logWarningInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logWarning', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return this; } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._logWarningInternal(message)); } + /** Logs an error message */ /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + async _logErrorInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logError', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return this; } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + logError(message: string): LoggerPromise { + return new LoggerPromise(this._logErrorInternal(message)); } + /** Logs a debug message */ /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + async _logDebugInternal(message: string): Promise { + const rpcArgs: Record = { logger: this._handle, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logDebug', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return this; } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._logDebugInternal(message)); } + /** Logs a message with specified level */ /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + async _logInternal(level: string, message: string): Promise { + const rpcArgs: Record = { logger: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/log', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return this; } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureBlobStorageContainerResourcePromise { - const displayText = options?.displayText; - return new AzureBlobStorageContainerResourcePromise(this._withUrlInternal(url, displayText)); + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._logInternal(level, message)); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new AzureBlobStorageContainerResource(result, this._client); +} + +/** + * Thenable wrapper for Logger that enables fluent chaining. + */ +export class LoggerPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: Logger) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBlobStorageContainerResourcePromise { - const displayText = options?.displayText; - return new AzureBlobStorageContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Logs an information message */ + logInformation(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logInformation(message))); + } + + /** Logs a warning message */ + logWarning(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logWarning(message))); + } + + /** Logs an error message */ + logError(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logError(message))); + } + + /** Logs a debug message */ + logDebug(message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.logDebug(message))); + } + + /** Logs a message with specified level */ + log(level: string, message: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.log(level, message))); } +} + +// ============================================================================ +// LoggerFactory +// ============================================================================ + +/** + * Type class for LoggerFactory. + */ +export class LoggerFactory { + constructor(private _handle: ILoggerFactoryHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Creates a logger for a category */ /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + async _createLoggerInternal(categoryName: string): Promise { + const rpcArgs: Record = { loggerFactory: this._handle, categoryName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createLogger', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new Logger(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._createLoggerInternal(categoryName)); + } + +} + +/** + * Thenable wrapper for LoggerFactory that enables fluent chaining. + */ +export class LoggerFactoryPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: LoggerFactory) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } + /** Creates a logger for a category */ + createLogger(categoryName: string): LoggerPromise { + return new LoggerPromise(this._promise.then(obj => obj.createLogger(categoryName))); + } + +} + +// ============================================================================ +// ReportingStep +// ============================================================================ + +/** + * Type class for ReportingStep. + */ +export class ReportingStep { + constructor(private _handle: IReportingStepHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Creates a reporting task with plain-text status text */ /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + async _createTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createTask', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new ReportingTask(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._excludeFromManifestInternal()); + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createTaskInternal(statusText, cancellationToken)); } + /** Creates a reporting task with Markdown-formatted status text */ /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + async _createMarkdownTaskInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + const result = await this._client.invokeCapability( + 'Aspire.Hosting/createMarkdownTask', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new ReportingTask(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withExplicitStartInternal()); + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._createMarkdownTaskInternal(markdownString, cancellationToken)); } + /** Logs a plain-text message for the reporting step */ /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + async _logStepInternal(level: string, message: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, message }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStep', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return this; } - /** Adds a health check by key */ - withHealthCheck(key: string): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withHealthCheckInternal(key)); + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepInternal(level, message)); } + /** Logs a Markdown-formatted message for the reporting step */ /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + async _logStepMarkdownInternal(level: string, markdownString: string): Promise { + const rpcArgs: Record = { reportingStep: this._handle, level, markdownString }; + await this._client.invokeCapability( + 'Aspire.Hosting/logStepMarkdown', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return this; } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBlobStorageContainerResourcePromise { - const commandOptions = options?.commandOptions; - return new AzureBlobStorageContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._logStepMarkdownInternal(level, markdownString)); } + /** Completes the reporting step with plain-text completion text */ /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + async _completeStepInternal(completionText: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, completionText }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStep', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return this; } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withParentRelationshipInternal(parent)); + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepInternal(completionText, completionState, cancellationToken)); } + /** Completes the reporting step with Markdown-formatted completion text */ /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + async _completeStepMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingStep: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeStepMarkdown', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return this; } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withChildRelationshipInternal(child)); + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingStepPromise(this._completeStepMarkdownInternal(markdownString, completionState, cancellationToken)); + } + +} + +/** + * Thenable wrapper for ReportingStep that enables fluent chaining. + */ +export class ReportingStepPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReportingStep) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } + /** Creates a reporting task with plain-text status text */ + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createTask(statusText, options))); + } + + /** Creates a reporting task with Markdown-formatted status text */ + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.createMarkdownTask(markdownString, options))); + } + + /** Logs a plain-text message for the reporting step */ + logStep(level: string, message: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStep(level, message))); + } + + /** Logs a Markdown-formatted message for the reporting step */ + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.logStepMarkdown(level, markdownString))); + } + + /** Completes the reporting step with plain-text completion text */ + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStep(completionText, options))); + } + + /** Completes the reporting step with Markdown-formatted completion text */ + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { + return new ReportingStepPromise(this._promise.then(obj => obj.completeStepMarkdown(markdownString, options))); + } + +} + +// ============================================================================ +// ReportingTask +// ============================================================================ + +/** + * Type class for ReportingTask. + */ +export class ReportingTask { + constructor(private _handle: IReportingTaskHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Updates the reporting task with plain-text status text */ /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + async _updateTaskInternal(statusText: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, statusText }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTask', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return this; } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureBlobStorageContainerResourcePromise { - const iconVariant = options?.iconVariant; - return new AzureBlobStorageContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskInternal(statusText, cancellationToken)); } + /** Updates the reporting task with Markdown-formatted status text */ /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + async _updateTaskMarkdownInternal(markdownString: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/updateTaskMarkdown', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return this; } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._excludeFromMcpInternal()); + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._updateTaskMarkdownInternal(markdownString, cancellationToken)); } + /** Completes the reporting task with plain-text completion text */ /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + async _completeTaskInternal(completionMessage?: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle }; + if (completionMessage !== undefined) rpcArgs.completionMessage = completionMessage; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTask', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return this; } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + const completionMessage = options?.completionMessage; + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskInternal(completionMessage, completionState, cancellationToken)); } + /** Completes the reporting task with Markdown-formatted completion text */ /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + async _completeTaskMarkdownInternal(markdownString: string, completionState?: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { reportingTask: this._handle, markdownString }; + if (completionState !== undefined) rpcArgs.completionState = completionState; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/completeTaskMarkdown', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return this; } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + const completionState = options?.completionState; + const cancellationToken = options?.cancellationToken; + return new ReportingTaskPromise(this._completeTaskMarkdownInternal(markdownString, completionState, cancellationToken)); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', +} + +/** + * Thenable wrapper for ReportingTask that enables fluent chaining. + */ +export class ReportingTaskPromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ReportingTask) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Updates the reporting task with plain-text status text */ + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTask(statusText, options))); + } + + /** Updates the reporting task with Markdown-formatted status text */ + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.updateTaskMarkdown(markdownString, options))); + } + + /** Completes the reporting task with plain-text completion text */ + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTask(options))); + } + + /** Completes the reporting task with Markdown-formatted completion text */ + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { + return new ReportingTaskPromise(this._promise.then(obj => obj.completeTaskMarkdown(markdownString, options))); + } + +} + +// ============================================================================ +// ServiceProvider +// ============================================================================ + +/** + * Type class for ServiceProvider. + */ +export class ServiceProvider { + constructor(private _handle: IServiceProviderHandle, private _client: AspireClientRpc) {} + + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } + + /** Gets the distributed application eventing service from the service provider */ + /** @internal */ + async _getEventingInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getEventing', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new DistributedApplicationEventing(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBlobStorageContainerResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new AzureBlobStorageContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._getEventingInternal()); } + /** Gets the logger factory from the service provider */ /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + async _getLoggerFactoryInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getLoggerFactory', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new LoggerFactory(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._getLoggerFactoryInternal()); } + /** Gets the resource logger service from the service provider */ /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + async _getResourceLoggerServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceLoggerService', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new ResourceLoggerService(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._getResourceLoggerServiceInternal()); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** Gets the distributed application model from the service provider */ + /** @internal */ + async _getDistributedApplicationModelInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getDistributedApplicationModel', rpcArgs ); + return new DistributedApplicationModel(result, this._client); + } + + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._getDistributedApplicationModelInternal()); } + /** Gets the resource notification service from the service provider */ /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + async _getResourceNotificationServiceInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getResourceNotificationService', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new ResourceNotificationService(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._getResourceNotificationServiceInternal()); + } + + /** Gets the user secrets manager from the service provider */ + /** @internal */ + async _getUserSecretsManagerInternal(): Promise { + const rpcArgs: Record = { serviceProvider: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/getUserSecretsManager', + rpcArgs + ); + return new UserSecretsManager(result, this._client); + } + + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getUserSecretsManagerInternal()); } } /** - * Thenable wrapper for AzureBlobStorageContainerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); + * Thenable wrapper for ServiceProvider that enables fluent chaining. */ -export class AzureBlobStorageContainerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class ServiceProviderPromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: AzureBlobStorageContainerResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: ServiceProvider) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Gets the distributed application eventing service from the service provider */ + getEventing(): DistributedApplicationEventingPromise { + return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.getEventing())); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + /** Gets the logger factory from the service provider */ + getLoggerFactory(): LoggerFactoryPromise { + return new LoggerFactoryPromise(this._promise.then(obj => obj.getLoggerFactory())); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + /** Gets the resource logger service from the service provider */ + getResourceLoggerService(): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromise(this._promise.then(obj => obj.getResourceLoggerService())); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Gets the distributed application model from the service provider */ + getDistributedApplicationModel(): DistributedApplicationModelPromise { + return new DistributedApplicationModelPromise(this._promise.then(obj => obj.getDistributedApplicationModel())); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Gets the resource notification service from the service provider */ + getResourceNotificationService(): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromise(this._promise.then(obj => obj.getResourceNotificationService())); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Gets the user secrets manager from the service provider */ + getUserSecretsManager(): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getUserSecretsManager())); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } +} - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } +// ============================================================================ +// UserSecretsManager +// ============================================================================ - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } +/** + * Type class for UserSecretsManager. + */ +export class UserSecretsManager { + constructor(private _handle: IUserSecretsManagerHandle, private _client: AspireClientRpc) {} - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } + /** Serialize for JSON-RPC transport */ + toJSON(): MarshalledHandle { return this._handle.toJSON(); } - /** Adds a health check by key */ - withHealthCheck(key: string): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } + /** Gets the IsAvailable property */ + isAvailable = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.isAvailable', + { context: this._handle } + ); + }, + }; - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); - } + /** Gets the FilePath property */ + filePath = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.filePath', + { context: this._handle } + ); + }, + }; - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Attempts to set a user secret value */ + async trySetSecret(name: string, value: string): Promise { + const rpcArgs: Record = { context: this._handle, name, value }; + return await this._client.invokeCapability( + 'Aspire.Hosting/IUserSecretsManager.trySetSecret', + rpcArgs + ); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Saves state to user secrets from a JSON string */ + /** @internal */ + async _saveStateJsonInternal(json: string, cancellationToken?: AbortSignal | CancellationToken): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, json }; + if (cancellationToken !== undefined) rpcArgs.cancellationToken = CancellationToken.fromValue(cancellationToken); + await this._client.invokeCapability( + 'Aspire.Hosting/saveStateJson', + rpcArgs + ); + return this; } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + const cancellationToken = options?.cancellationToken; + return new UserSecretsManagerPromise(this._saveStateJsonInternal(json, cancellationToken)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ + /** @internal */ + async _getOrSetSecretInternal(resourceBuilder: ResourceBuilderBase, name: string, value: string): Promise { + const rpcArgs: Record = { userSecretsManager: this._handle, resourceBuilder, name, value }; + await this._client.invokeCapability( + 'Aspire.Hosting/getOrSetSecret', + rpcArgs + ); + return this; } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._getOrSetSecretInternal(resourceBuilder, name, value)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } +} - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); - } +/** + * Thenable wrapper for UserSecretsManager that enables fluent chaining. + */ +export class UserSecretsManagerPromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + then( + onfulfilled?: ((value: UserSecretsManager) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Attempts to set a user secret value */ + trySetSecret(name: string, value: string): Promise { + return this._promise.then(obj => obj.trySetSecret(name, value)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Saves state to user secrets from a JSON string */ + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.saveStateJson(json, options))); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ + getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromise(this._promise.then(obj => obj.getOrSetSecret(resourceBuilder, name, value))); } } // ============================================================================ -// AzureBlobStorageResource +// AzureBicepResource // ============================================================================ -export class AzureBlobStorageResource extends ResourceBuilderBase { - constructor(handle: AzureBlobStorageResourceHandle, client: AspireClientRpc) { +export class AzureBicepResource extends ResourceBuilderBase { + constructor(handle: AzureBicepResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBlobStorageResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBicepResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new AzureBlobStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new AzureBicepResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBlobStorageResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBicepResourcePromise { const helpLink = options?.helpLink; - return new AzureBlobStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } - - /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', - rpcArgs - ); - return new AzureBlobStorageResource(result, this._client); - } - - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withConnectionPropertyInternal(name, value)); - } - - /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', - rpcArgs - ); - return new AzureBlobStorageResource(result, this._client); - } - - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + return new AzureBicepResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureBlobStorageResourcePromise { + withUrl(url: string, options?: WithUrlOptions): AzureBicepResourcePromise { const displayText = options?.displayText; - return new AzureBlobStorageResourcePromise(this._withUrlInternal(url, displayText)); + return new AzureBicepResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBlobStorageResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBicepResourcePromise { const displayText = options?.displayText; - return new AzureBlobStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new AzureBicepResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -3764,113 +4824,83 @@ export class AzureBlobStorageResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBlobStorageResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBicepResourcePromise { const commandOptions = options?.commandOptions; - return new AzureBlobStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new AzureBicepResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureBlobStorageResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): AzureBicepResourcePromise { const iconVariant = options?.iconVariant; - return new AzureBlobStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new AzureBicepResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._excludeFromMcpInternal()); - } - - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new AzureBlobStorageResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new AzureBlobStorageResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + excludeFromMcp(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -3881,60 +4911,60 @@ export class AzureBlobStorageResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBlobStorageResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBicepResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new AzureBlobStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new AzureBicepResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -3947,972 +4977,825 @@ export class AzureBlobStorageResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._onBeforeResourceStartedInternal(callback)); } -} + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new AzureBicepResource(result, this._client); + } -/** - * Thenable wrapper for AzureBlobStorageResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class AzureBlobStorageResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._onResourceStoppedInternal(callback)); + } - then( - onfulfilled?: ((value: AzureBlobStorageResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); - } - - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); - } - - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); - } - - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); - } - - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new AzureBicepResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new AzureBicepResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._onResourceReadyInternal(callback)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureBicepResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Gets an output reference from an Azure Bicep template resource */ + async getOutput(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getOutput', + rpcArgs + ); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** @internal */ + private async _withParameterInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameter', + rpcArgs + ); + return new AzureBicepResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withParameterInternal(name)); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** @internal */ + private async _withParameterStringValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValue', + rpcArgs + ); + return new AzureBicepResource(result, this._client); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withParameterStringValueInternal(name, value)); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + /** @internal */ + private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValues', + rpcArgs + ); + return new AzureBicepResource(result, this._client); } -} - -// ============================================================================ -// AzureDataLakeStorageFileSystemResource -// ============================================================================ - -export class AzureDataLakeStorageFileSystemResource extends ResourceBuilderBase { - constructor(handle: AzureDataLakeStorageFileSystemResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withParameterStringValuesInternal(name, value)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromParameter', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withParameterFromParameterInternal(name, value)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromConnectionString', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureDataLakeStorageFileSystemResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new AzureDataLakeStorageFileSystemResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromOutput', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureDataLakeStorageFileSystemResourcePromise { - const helpLink = options?.helpLink; - return new AzureDataLakeStorageFileSystemResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withParameterFromOutputInternal(name, value)); } /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); } /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromEndpoint', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._withParameterFromEndpointInternal(name, value)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsConnectionString', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._publishAsConnectionStringInternal()); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + /** Gets the normalized Bicep identifier for an Azure resource */ + async getBicepIdentifier(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getBicepIdentifier', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); - } - - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _clearDefaultRoleAssignmentsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureDataLakeStorageFileSystemResourcePromise { - const displayText = options?.displayText; - return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlInternal(url, displayText)); + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._clearDefaultRoleAssignmentsInternal()); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + /** Determines whether a resource is marked as existing */ + async isExisting(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/isExisting', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureDataLakeStorageFileSystemResourcePromise { - const displayText = options?.displayText; - return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExistingFromParameters', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExisting', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._excludeFromManifestInternal()); + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._runAsExistingInternal(name, resourceGroup)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExistingFromParameters', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withExplicitStartInternal()); + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExisting', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withHealthCheckInternal(key)); + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/asExistingFromParameters', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureBicepResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureDataLakeStorageFileSystemResourcePromise { - const commandOptions = options?.commandOptions; - return new AzureDataLakeStorageFileSystemResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); - } +} - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withParentRelationshipInternal(parent)); +/** + * Thenable wrapper for AzureBicepResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureBicepResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureBicepResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureDataLakeStorageFileSystemResourcePromise { - const iconVariant = options?.iconVariant; - return new AzureDataLakeStorageFileSystemResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._excludeFromMcpInternal()); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); - } - - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureDataLakeStorageFileSystemResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new AzureDataLakeStorageFileSystemResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); - } - - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', - rpcArgs - ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } -} - -/** - * Thenable wrapper for AzureDataLakeStorageFileSystemResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class AzureDataLakeStorageFileSystemResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: AzureDataLakeStorageFileSystemResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Gets an output reference from an Azure Bicep template resource */ + getOutput(name: string): Promise { + return this._promise.then(obj => obj.getOutput(name)); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withParameter(name))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); } - /** Adds a health check by key */ - withHealthCheck(key: string): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Gets the normalized Bicep identifier for an Azure resource */ + getBicepIdentifier(): Promise { + return this._promise.then(obj => obj.getBicepIdentifier()); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Determines whether a resource is marked as existing */ + isExisting(): Promise { + return this._promise.then(obj => obj.isExisting()); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureBicepResourcePromise { + return new AzureBicepResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); } } // ============================================================================ -// AzureDataLakeStorageResource +// AzureBlobStorageContainerResource // ============================================================================ -export class AzureDataLakeStorageResource extends ResourceBuilderBase { - constructor(handle: AzureDataLakeStorageResourceHandle, client: AspireClientRpc) { +export class AzureBlobStorageContainerResource extends ResourceBuilderBase { + constructor(handle: AzureBlobStorageContainerResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureDataLakeStorageResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBlobStorageContainerResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new AzureDataLakeStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new AzureBlobStorageContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureDataLakeStorageResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBlobStorageContainerResourcePromise { const helpLink = options?.helpLink; - return new AzureDataLakeStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new AzureBlobStorageContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withConnectionProperty', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withConnectionPropertyInternal(name, value)); + withConnectionProperty(name: string, value: ReferenceExpression): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withConnectionPropertyInternal(name, value)); } /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withConnectionPropertyValue', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + withConnectionPropertyValue(name: string, value: string): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureDataLakeStorageResourcePromise { + withUrl(url: string, options?: WithUrlOptions): AzureBlobStorageContainerResourcePromise { const displayText = options?.displayText; - return new AzureDataLakeStorageResourcePromise(this._withUrlInternal(url, displayText)); + return new AzureBlobStorageContainerResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureDataLakeStorageResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBlobStorageContainerResourcePromise { const displayText = options?.displayText; - return new AzureDataLakeStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new AzureBlobStorageContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -4920,113 +5803,83 @@ export class AzureDataLakeStorageResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureDataLakeStorageResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBlobStorageContainerResourcePromise { const commandOptions = options?.commandOptions; - return new AzureDataLakeStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new AzureBlobStorageContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureDataLakeStorageResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): AzureBlobStorageContainerResourcePromise { const iconVariant = options?.iconVariant; - return new AzureDataLakeStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new AzureBlobStorageContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._excludeFromMcpInternal()); - } - - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new AzureDataLakeStorageResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new AzureDataLakeStorageResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + excludeFromMcp(): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -5037,60 +5890,60 @@ export class AzureDataLakeStorageResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureDataLakeStorageResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBlobStorageContainerResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new AzureDataLakeStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new AzureBlobStorageContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -5103,150 +5956,245 @@ export class AzureDataLakeStorageResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureBlobStorageContainerResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._onBeforeResourceStartedInternal(callback)); } -} + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } -/** - * Thenable wrapper for AzureDataLakeStorageResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class AzureDataLakeStorageResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._onResourceStoppedInternal(callback)); + } - then( - onfulfilled?: ((value: AzureDataLakeStorageResource) => TResult1 | PromiseLike) | null, + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._onConnectionStringAvailableInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureBlobStorageContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureBlobStorageContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureBlobStorageContainerResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + withConnectionProperty(name: string, value: ReferenceExpression): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + withConnectionPropertyValue(name: string, value: string): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + excludeFromMcp(): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -5254,213 +6202,277 @@ export class AzureDataLakeStorageResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } } // ============================================================================ -// AzureEnvironmentResource +// AzureBlobStorageResource // ============================================================================ -export class AzureEnvironmentResource extends ResourceBuilderBase { - constructor(handle: AzureEnvironmentResourceHandle, client: AspireClientRpc) { +export class AzureBlobStorageResource extends ResourceBuilderBase { + constructor(handle: AzureBlobStorageResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureEnvironmentResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBlobStorageResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new AzureEnvironmentResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new AzureBlobStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureEnvironmentResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBlobStorageResourcePromise { const helpLink = options?.helpLink; - return new AzureEnvironmentResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new AzureBlobStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureEnvironmentResourcePromise { + withUrl(url: string, options?: WithUrlOptions): AzureBlobStorageResourcePromise { const displayText = options?.displayText; - return new AzureEnvironmentResourcePromise(this._withUrlInternal(url, displayText)); + return new AzureBlobStorageResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureEnvironmentResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBlobStorageResourcePromise { const displayText = options?.displayText; - return new AzureEnvironmentResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new AzureBlobStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -5468,113 +6480,83 @@ export class AzureEnvironmentResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureEnvironmentResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBlobStorageResourcePromise { const commandOptions = options?.commandOptions; - return new AzureEnvironmentResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new AzureBlobStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureEnvironmentResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): AzureBlobStorageResourcePromise { const iconVariant = options?.iconVariant; - return new AzureEnvironmentResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new AzureBlobStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._excludeFromMcpInternal()); - } - - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new AzureEnvironmentResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new AzureEnvironmentResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + excludeFromMcp(): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -5585,60 +6567,60 @@ export class AzureEnvironmentResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureEnvironmentResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBlobStorageResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new AzureEnvironmentResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new AzureBlobStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -5651,170 +6633,245 @@ export class AzureEnvironmentResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withLocationInternal(location: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, location }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withLocation', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Sets the Azure location for the shared Azure environment resource */ - withLocation(location: ParameterResource): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withLocationInternal(location)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withResourceGroupInternal(resourceGroup: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, resourceGroup }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withResourceGroup', + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', rpcArgs ); - return new AzureEnvironmentResource(result, this._client); + return new AzureBlobStorageResource(result, this._client); } - /** Sets the Azure resource group for the shared Azure environment resource */ - withResourceGroup(resourceGroup: ParameterResource): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._withResourceGroupInternal(resourceGroup)); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._onConnectionStringAvailableInternal(callback)); } -} - -/** - * Thenable wrapper for AzureEnvironmentResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class AzureEnvironmentResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } - then( - onfulfilled?: ((value: AzureEnvironmentResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._onResourceReadyInternal(callback)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for AzureBlobStorageResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureBlobStorageResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureBlobStorageResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + excludeFromMcp(): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -5822,223 +6879,277 @@ export class AzureEnvironmentResourcePromise implements PromiseLike obj.getResourceName()); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Sets the Azure location for the shared Azure environment resource */ - withLocation(location: ParameterResource): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withLocation(location))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Sets the Azure resource group for the shared Azure environment resource */ - withResourceGroup(resourceGroup: ParameterResource): AzureEnvironmentResourcePromise { - return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withResourceGroup(resourceGroup))); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } } // ============================================================================ -// AzureProvisioningResource +// AzureDataLakeStorageFileSystemResource // ============================================================================ -export class AzureProvisioningResource extends ResourceBuilderBase { - constructor(handle: AzureProvisioningResourceHandle, client: AspireClientRpc) { +export class AzureDataLakeStorageFileSystemResource extends ResourceBuilderBase { + constructor(handle: AzureDataLakeStorageFileSystemResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureProvisioningResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureDataLakeStorageFileSystemResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new AzureProvisioningResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new AzureDataLakeStorageFileSystemResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureProvisioningResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureDataLakeStorageFileSystemResourcePromise { const helpLink = options?.helpLink; - return new AzureProvisioningResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new AzureDataLakeStorageFileSystemResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureProvisioningResourcePromise { + withUrl(url: string, options?: WithUrlOptions): AzureDataLakeStorageFileSystemResourcePromise { const displayText = options?.displayText; - return new AzureProvisioningResourcePromise(this._withUrlInternal(url, displayText)); + return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureProvisioningResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureDataLakeStorageFileSystemResourcePromise { const displayText = options?.displayText; - return new AzureProvisioningResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -6046,113 +7157,83 @@ export class AzureProvisioningResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureProvisioningResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureDataLakeStorageFileSystemResourcePromise { const commandOptions = options?.commandOptions; - return new AzureProvisioningResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new AzureDataLakeStorageFileSystemResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureProvisioningResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): AzureDataLakeStorageFileSystemResourcePromise { const iconVariant = options?.iconVariant; - return new AzureProvisioningResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new AzureDataLakeStorageFileSystemResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._excludeFromMcpInternal()); - } - - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new AzureProvisioningResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new AzureProvisioningResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + excludeFromMcp(): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -6163,60 +7244,60 @@ export class AzureProvisioningResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureProvisioningResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureDataLakeStorageFileSystemResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new AzureProvisioningResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new AzureDataLakeStorageFileSystemResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -6229,392 +7310,245 @@ export class AzureProvisioningResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new AzureProvisioningResource(result, this._client); - } - - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Gets an output reference from an Azure Bicep template resource */ - async getOutput(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/getOutput', - rpcArgs - ); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withParameterInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameter', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Adds a Bicep parameter without a value */ - withParameter(name: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withParameterInternal(name)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withParameterStringValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterStringValue', + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Adds a Bicep parameter with a string value */ - withParameterStringValue(name: string, value: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withParameterStringValueInternal(name, value)); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._onConnectionStringAvailableInternal(callback)); } /** @internal */ - private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterStringValues', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Adds a Bicep parameter with a string list value */ - withParameterStringValues(name: string, value: string[]): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withParameterStringValuesInternal(name, value)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromParameter', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new AzureProvisioningResource(result, this._client); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Adds a Bicep parameter from a parameter resource builder */ - withParameterFromParameter(name: string, value: ParameterResource): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withParameterFromParameterInternal(name, value)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromConnectionString', + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new AzureProvisioningResource(result, this._client); - } - - /** Adds a Bicep parameter from a connection string resource builder */ - withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** @internal */ - private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromOutput', - rpcArgs - ); - return new AzureProvisioningResource(result, this._client); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } - /** Adds a Bicep parameter from another Bicep output reference */ - withParameterFromOutput(name: string, value: BicepOutputReference): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withParameterFromOutputInternal(name, value)); - } - - /** @internal */ - private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', - rpcArgs - ); - return new AzureProvisioningResource(result, this._client); - } - - /** Adds a Bicep parameter from a reference expression */ - withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); - } - - /** @internal */ - private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromEndpoint', - rpcArgs - ); - return new AzureProvisioningResource(result, this._client); - } - - /** Adds a Bicep parameter from an endpoint reference */ - withParameterFromEndpoint(name: string, value: EndpointReference): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._withParameterFromEndpointInternal(name, value)); - } - - /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsConnectionString', - rpcArgs - ); - return new AzureProvisioningResource(result, this._client); - } - - /** Publishes an Azure resource to the manifest as a connection string */ - publishAsConnectionString(): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._publishAsConnectionStringInternal()); - } - - /** Gets the normalized Bicep identifier for an Azure resource */ - async getBicepIdentifier(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/getBicepIdentifier', - rpcArgs - ); - } - - /** @internal */ - private async _clearDefaultRoleAssignmentsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', - rpcArgs - ); - return new AzureProvisioningResource(result, this._client); - } - - /** Clears the default Azure role assignments from a resource */ - clearDefaultRoleAssignments(): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._clearDefaultRoleAssignmentsInternal()); - } - - /** Determines whether a resource is marked as existing */ - async isExisting(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/isExisting', - rpcArgs - ); - } - - /** @internal */ - private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/runAsExistingFromParameters', - rpcArgs - ); - return new AzureProvisioningResource(result, this._client); - } - - /** Marks an Azure resource as existing in run mode by using parameter resources */ - runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); - } - - /** @internal */ - private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/runAsExisting', - rpcArgs - ); - return new AzureProvisioningResource(result, this._client); - } - - /** Marks an Azure resource as existing in run mode */ - runAsExisting(name: string, resourceGroup: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._runAsExistingInternal(name, resourceGroup)); - } - - /** @internal */ - private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsExistingFromParameters', - rpcArgs - ); - return new AzureProvisioningResource(result, this._client); - } - - /** Marks an Azure resource as existing in publish mode by using parameter resources */ - publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); - } - - /** @internal */ - private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsExisting', - rpcArgs - ); - return new AzureProvisioningResource(result, this._client); - } - - /** Marks an Azure resource as existing in publish mode */ - publishAsExisting(name: string, resourceGroup: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); - } - - /** @internal */ - private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/asExisting', - rpcArgs - ); - return new AzureProvisioningResource(result, this._client); - } - - /** Marks an Azure resource as existing in both run and publish modes */ - asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); - } - -} +} /** - * Thenable wrapper for AzureProvisioningResource that enables fluent chaining. + * Thenable wrapper for AzureDataLakeStorageFileSystemResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class AzureProvisioningResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class AzureDataLakeStorageFileSystemResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: AzureProvisioningResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: AzureDataLakeStorageFileSystemResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + excludeFromMcp(): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -6622,333 +7556,277 @@ export class AzureProvisioningResourcePromise implements PromiseLike obj.getResourceName()); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); - } - - /** Gets an output reference from an Azure Bicep template resource */ - getOutput(name: string): Promise { - return this._promise.then(obj => obj.getOutput(name)); - } - - /** Adds a Bicep parameter without a value */ - withParameter(name: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameter(name))); - } - - /** Adds a Bicep parameter with a string value */ - withParameterStringValue(name: string, value: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); - } - - /** Adds a Bicep parameter with a string list value */ - withParameterStringValues(name: string, value: string[]): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); - } - - /** Adds a Bicep parameter from a parameter resource builder */ - withParameterFromParameter(name: string, value: ParameterResource): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); - } - - /** Adds a Bicep parameter from a connection string resource builder */ - withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); - } - - /** Adds a Bicep parameter from another Bicep output reference */ - withParameterFromOutput(name: string, value: BicepOutputReference): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); - } - - /** Adds a Bicep parameter from a reference expression */ - withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); - } - - /** Adds a Bicep parameter from an endpoint reference */ - withParameterFromEndpoint(name: string, value: EndpointReference): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); - } - - /** Publishes an Azure resource to the manifest as a connection string */ - publishAsConnectionString(): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); - } - - /** Gets the normalized Bicep identifier for an Azure resource */ - getBicepIdentifier(): Promise { - return this._promise.then(obj => obj.getBicepIdentifier()); - } - - /** Clears the default Azure role assignments from a resource */ - clearDefaultRoleAssignments(): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); - } - - /** Determines whether a resource is marked as existing */ - isExisting(): Promise { - return this._promise.then(obj => obj.isExisting()); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Marks an Azure resource as existing in run mode by using parameter resources */ - runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Marks an Azure resource as existing in run mode */ - runAsExisting(name: string, resourceGroup: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } - /** Marks an Azure resource as existing in publish mode by using parameter resources */ - publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Marks an Azure resource as existing in publish mode */ - publishAsExisting(name: string, resourceGroup: string): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Marks an Azure resource as existing in both run and publish modes */ - asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { - return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } } // ============================================================================ -// AzureQueueStorageQueueResource +// AzureDataLakeStorageResource // ============================================================================ -export class AzureQueueStorageQueueResource extends ResourceBuilderBase { - constructor(handle: AzureQueueStorageQueueResourceHandle, client: AspireClientRpc) { +export class AzureDataLakeStorageResource extends ResourceBuilderBase { + constructor(handle: AzureDataLakeStorageResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureQueueStorageQueueResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureDataLakeStorageResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new AzureQueueStorageQueueResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new AzureDataLakeStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureQueueStorageQueueResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureDataLakeStorageResourcePromise { const helpLink = options?.helpLink; - return new AzureQueueStorageQueueResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new AzureDataLakeStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withConnectionProperty', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withConnectionPropertyInternal(name, value)); + withConnectionProperty(name: string, value: ReferenceExpression): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withConnectionPropertyInternal(name, value)); } /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withConnectionPropertyValue', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + withConnectionPropertyValue(name: string, value: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureQueueStorageQueueResourcePromise { + withUrl(url: string, options?: WithUrlOptions): AzureDataLakeStorageResourcePromise { const displayText = options?.displayText; - return new AzureQueueStorageQueueResourcePromise(this._withUrlInternal(url, displayText)); + return new AzureDataLakeStorageResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureQueueStorageQueueResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureDataLakeStorageResourcePromise { const displayText = options?.displayText; - return new AzureQueueStorageQueueResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new AzureDataLakeStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -6956,113 +7834,83 @@ export class AzureQueueStorageQueueResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureQueueStorageQueueResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureDataLakeStorageResourcePromise { const commandOptions = options?.commandOptions; - return new AzureQueueStorageQueueResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new AzureDataLakeStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureQueueStorageQueueResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): AzureDataLakeStorageResourcePromise { const iconVariant = options?.iconVariant; - return new AzureQueueStorageQueueResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new AzureDataLakeStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._excludeFromMcpInternal()); - } - - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new AzureQueueStorageQueueResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new AzureQueueStorageQueueResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + excludeFromMcp(): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -7073,60 +7921,60 @@ export class AzureQueueStorageQueueResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureQueueStorageQueueResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureDataLakeStorageResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new AzureQueueStorageQueueResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new AzureDataLakeStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -7139,150 +7987,245 @@ export class AzureQueueStorageQueueResource extends ResourceBuilderBase { + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._onConnectionStringAvailableInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureDataLakeStorageResource(result, this._client); } /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } } /** - * Thenable wrapper for AzureQueueStorageQueueResource that enables fluent chaining. + * Thenable wrapper for AzureDataLakeStorageResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class AzureQueueStorageQueueResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class AzureDataLakeStorageResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: AzureQueueStorageQueueResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: AzureDataLakeStorageResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + withConnectionProperty(name: string, value: ReferenceExpression): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + withConnectionPropertyValue(name: string, value: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + excludeFromMcp(): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -7290,243 +8233,238 @@ export class AzureQueueStorageQueueResourcePromise implements PromiseLike obj.getResourceName()); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } -} + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + +} // ============================================================================ -// AzureQueueStorageResource +// AzureEnvironmentResource // ============================================================================ -export class AzureQueueStorageResource extends ResourceBuilderBase { - constructor(handle: AzureQueueStorageResourceHandle, client: AspireClientRpc) { +export class AzureEnvironmentResource extends ResourceBuilderBase { + constructor(handle: AzureEnvironmentResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureQueueStorageResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureEnvironmentResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new AzureQueueStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new AzureEnvironmentResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureQueueStorageResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureEnvironmentResourcePromise { const helpLink = options?.helpLink; - return new AzureQueueStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); - } - - /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', - rpcArgs - ); - return new AzureQueueStorageResource(result, this._client); - } - - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withConnectionPropertyInternal(name, value)); - } - - /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', - rpcArgs - ); - return new AzureQueueStorageResource(result, this._client); - } - - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + return new AzureEnvironmentResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureQueueStorageResourcePromise { + withUrl(url: string, options?: WithUrlOptions): AzureEnvironmentResourcePromise { const displayText = options?.displayText; - return new AzureQueueStorageResourcePromise(this._withUrlInternal(url, displayText)); + return new AzureEnvironmentResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureQueueStorageResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureEnvironmentResourcePromise { const displayText = options?.displayText; - return new AzureQueueStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new AzureEnvironmentResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -7534,113 +8472,83 @@ export class AzureQueueStorageResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureQueueStorageResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureEnvironmentResourcePromise { const commandOptions = options?.commandOptions; - return new AzureQueueStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new AzureEnvironmentResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureQueueStorageResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): AzureEnvironmentResourcePromise { const iconVariant = options?.iconVariant; - return new AzureQueueStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new AzureEnvironmentResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._excludeFromMcpInternal()); - } - - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new AzureQueueStorageResource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new AzureQueueStorageResource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + excludeFromMcp(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -7651,60 +8559,60 @@ export class AzureQueueStorageResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureQueueStorageResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureEnvironmentResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new AzureQueueStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new AzureEnvironmentResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -7717,150 +8625,240 @@ export class AzureQueueStorageResource extends ResourceBuilderBase { + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureEnvironmentResource(result, this._client); } /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withLocationInternal(location: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, location }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withLocation', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Sets the Azure location for the shared Azure environment resource */ + withLocation(location: ParameterResource): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withLocationInternal(location)); + } + + /** @internal */ + private async _withResourceGroupInternal(resourceGroup: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withResourceGroup', + rpcArgs + ); + return new AzureEnvironmentResource(result, this._client); + } + + /** Sets the Azure resource group for the shared Azure environment resource */ + withResourceGroup(resourceGroup: ParameterResource): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._withResourceGroupInternal(resourceGroup)); } } /** - * Thenable wrapper for AzureQueueStorageResource that enables fluent chaining. + * Thenable wrapper for AzureEnvironmentResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class AzureQueueStorageResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class AzureEnvironmentResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: AzureQueueStorageResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: AzureEnvironmentResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); - } - - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Prevents resource from starting automatically */ - withExplicitStart(): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Adds a health check by key */ - withHealthCheck(key: string): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + excludeFromMcp(): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -7868,3621 +8866,3518 @@ export class AzureQueueStorageResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Sets the Azure location for the shared Azure environment resource */ + withLocation(location: ParameterResource): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withLocation(location))); + } + + /** Sets the Azure resource group for the shared Azure environment resource */ + withResourceGroup(resourceGroup: ParameterResource): AzureEnvironmentResourcePromise { + return new AzureEnvironmentResourcePromise(this._promise.then(obj => obj.withResourceGroup(resourceGroup))); } } // ============================================================================ -// AzureStorageEmulatorResource +// AzureProvisioningResource // ============================================================================ -export class AzureStorageEmulatorResource extends ResourceBuilderBase { - constructor(handle: AzureStorageEmulatorResourceHandle, client: AspireClientRpc) { +export class AzureProvisioningResource extends ResourceBuilderBase { + constructor(handle: AzureProvisioningResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): AzureStorageEmulatorResourcePromise { - const isReadOnly = options?.isReadOnly; - return new AzureStorageEmulatorResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureProvisioningResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureProvisioningResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureProvisioningResourcePromise { + const helpLink = options?.helpLink; + return new AzureProvisioningResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withImageTagInternal(tag)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withImageRegistryInternal(registry)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): AzureStorageEmulatorResourcePromise { - const tag = options?.tag; - return new AzureStorageEmulatorResourcePromise(this._withImageInternal(image, tag)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureProvisioningResourcePromise { + const displayText = options?.displayText; + return new AzureProvisioningResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withImageSHA256Internal(sha256)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureProvisioningResourcePromise { + const displayText = options?.displayText; + return new AzureProvisioningResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withLifetimeInternal(lifetime)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._publishAsContainerInternal()); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): AzureStorageEmulatorResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new AzureStorageEmulatorResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureProvisioningResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureProvisioningResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withContainerNameInternal(name)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withBuildArgInternal(name, value)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withBuildSecretInternal(name, value)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureProvisioningResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureProvisioningResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureStorageEmulatorResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new AzureStorageEmulatorResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureProvisioningResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureProvisioningResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withContainerNetworkAliasInternal(alias)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): AzureStorageEmulatorResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new AzureStorageEmulatorResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); - } - - /** Configures OTLP telemetry export */ - withOtlpExporter(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._publishAsConnectionStringInternal()); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureStorageEmulatorResourcePromise { - const helpLink = options?.helpLink; - return new AzureStorageEmulatorResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withEnvironmentInternal(name, value)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + /** Gets an output reference from an Azure Bicep template resource */ + async getOutput(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getOutput', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); - } - - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + private async _withParameterInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameter', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterInternal(name)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withParameterStringValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValue', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterStringValueInternal(name, value)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValues', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterStringValuesInternal(name, value)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromParameter', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterFromParameterInternal(name, value)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromConnectionString', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withArgsInternal(args)); + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromOutput', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withArgsCallbackInternal(callback)); + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterFromOutputInternal(name, value)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromEndpoint', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): AzureStorageEmulatorResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new AzureStorageEmulatorResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._withParameterFromEndpointInternal(name, value)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _configureInfrastructureInternal(configure: (obj: AzureResourceInfrastructure) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; + const obj = new AzureResourceInfrastructure(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/configureInfrastructure', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withServiceReferenceInternal(source)); + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._configureInfrastructureInternal(configure)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsConnectionString', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._publishAsConnectionStringInternal()); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + /** Gets the normalized Bicep identifier for an Azure resource */ + async getBicepIdentifier(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getBicepIdentifier', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); - } - - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _clearDefaultRoleAssignmentsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._clearDefaultRoleAssignmentsInternal()); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + /** Determines whether a resource is marked as existing */ + async isExisting(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/isExisting', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); - } - - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExistingFromParameters', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): AzureStorageEmulatorResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new AzureStorageEmulatorResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExisting', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): AzureStorageEmulatorResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new AzureStorageEmulatorResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._runAsExistingInternal(name, resourceGroup)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExistingFromParameters', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureStorageEmulatorResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new AzureStorageEmulatorResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExisting', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); - } - - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withExternalHttpEndpointsInternal()); + return new AzureProvisioningResource(result, this._client); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/asExistingFromParameters', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureProvisioningResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._asHttp2ServiceInternal()); + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); +} + +/** + * Thenable wrapper for AzureProvisioningResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureProvisioningResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureProvisioningResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureStorageEmulatorResourcePromise { - const displayText = options?.displayText; - return new AzureStorageEmulatorResourcePromise(this._withUrlInternal(url, displayText)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureStorageEmulatorResourcePromise { - const displayText = options?.displayText; - return new AzureStorageEmulatorResourcePromise(this._withUrlExpressionInternal(url, displayText)); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._excludeFromManifestInternal()); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._waitForInternal(dependency)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._waitForStartInternal(dependency)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withExplicitStartInternal()); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): AzureStorageEmulatorResourcePromise { - const exitCode = options?.exitCode; - return new AzureStorageEmulatorResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); + /** Gets an output reference from an Azure Bicep template resource */ + getOutput(name: string): Promise { + return this._promise.then(obj => obj.getOutput(name)); } - /** Adds a health check by key */ - withHealthCheck(key: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withHealthCheckInternal(key)); + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameter(name))); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureStorageEmulatorResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new AzureStorageEmulatorResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureStorageEmulatorResourcePromise { - const commandOptions = options?.commandOptions; - return new AzureStorageEmulatorResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.configureInfrastructure(configure))); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): AzureStorageEmulatorResourcePromise { - const password = options?.password; - return new AzureStorageEmulatorResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Gets the normalized Bicep identifier for an Azure resource */ + getBicepIdentifier(): Promise { + return this._promise.then(obj => obj.getBicepIdentifier()); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withoutHttpsCertificateInternal()); + /** Determines whether a resource is marked as existing */ + isExisting(): Promise { + return this._promise.then(obj => obj.isExisting()); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withParentRelationshipInternal(parent)); + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withChildRelationshipInternal(child)); + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new AzureStorageEmulatorResource(result, this._client); + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureProvisioningResourcePromise { + return new AzureProvisioningResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureStorageEmulatorResourcePromise { - const iconVariant = options?.iconVariant; - return new AzureStorageEmulatorResourcePromise(this._withIconNameInternal(iconName, iconVariant)); +} + +// ============================================================================ +// AzureQueueStorageQueueResource +// ============================================================================ + +export class AzureQueueStorageQueueResource extends ResourceBuilderBase { + constructor(handle: AzureQueueStorageQueueResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureStorageEmulatorResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new AzureStorageEmulatorResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._excludeFromMcpInternal()); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureQueueStorageQueueResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureQueueStorageQueueResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureQueueStorageQueueResourcePromise { + const helpLink = options?.helpLink; + return new AzureQueueStorageQueueResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withConnectionPropertyInternal(name, value)); + } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureStorageEmulatorResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new AzureStorageEmulatorResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withConnectionPropertyValueInternal(name, value)); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): AzureStorageEmulatorResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new AzureStorageEmulatorResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); + return new AzureQueueStorageQueueResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureQueueStorageQueueResourcePromise { + const displayText = options?.displayText; + return new AzureQueueStorageQueueResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withDataBindMountInternal(path?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withDataBindMount', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Adds a bind mount for the data folder to an Azure Storage emulator resource */ - withDataBindMount(options?: WithDataBindMountOptions): AzureStorageEmulatorResourcePromise { - const path = options?.path; - const isReadOnly = options?.isReadOnly; - return new AzureStorageEmulatorResourcePromise(this._withDataBindMountInternal(path, isReadOnly)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureQueueStorageQueueResourcePromise { + const displayText = options?.displayText; + return new AzureQueueStorageQueueResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withDataVolume', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Adds a named volume for the data folder to an Azure Storage emulator resource */ - withDataVolume(options?: WithDataVolumeOptions): AzureStorageEmulatorResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new AzureStorageEmulatorResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withBlobPortInternal(port: number): Promise { - const rpcArgs: Record = { builder: this._handle, port }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withBlobPort', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Sets the host port for blob requests on the storage emulator */ - withBlobPort(port: number): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withBlobPortInternal(port)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withQueuePortInternal(port: number): Promise { - const rpcArgs: Record = { builder: this._handle, port }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withQueuePort', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Sets the host port for queue requests on the storage emulator */ - withQueuePort(port: number): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withQueuePortInternal(port)); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withTablePortInternal(port: number): Promise { - const rpcArgs: Record = { builder: this._handle, port }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withTablePort', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Sets the host port for table requests on the storage emulator */ - withTablePort(port: number): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withTablePortInternal(port)); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withApiVersionCheckInternal(enable?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (enable !== undefined) rpcArgs.enable = enable; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withApiVersionCheck', + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Configures whether the emulator checks API version validity */ - withApiVersionCheck(options?: WithApiVersionCheckOptions): AzureStorageEmulatorResourcePromise { - const enable = options?.enable; - return new AzureStorageEmulatorResourcePromise(this._withApiVersionCheckInternal(enable)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureQueueStorageQueueResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureQueueStorageQueueResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, name, secretReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureQueueStorageQueueResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureQueueStorageQueueResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { - const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new AzureStorageEmulatorResource(result, this._client); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._excludeFromMcpInternal()); } -} - -/** - * Thenable wrapper for AzureStorageEmulatorResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class AzureStorageEmulatorResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: AzureStorageEmulatorResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureQueueStorageQueueResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureQueueStorageQueueResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } - /** Sets the container image tag */ - withImageTag(tag: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Configures the resource to be published as a container */ - publishAsContainer(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._onConnectionStringAvailableInternal(callback)); } - /** Sets the container name */ - withContainerName(name: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._onResourceReadyInternal(callback)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); - } +} - /** Configures OTLP telemetry export */ - withOtlpExporter(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); - } +/** + * Thenable wrapper for AzureQueueStorageQueueResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureQueueStorageQueueResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + then( + onfulfilled?: ((value: AzureQueueStorageQueueResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Adds arguments */ - withArgs(args: string[]): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } +} - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); - } +// ============================================================================ +// AzureQueueStorageResource +// ============================================================================ - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); +export class AzureQueueStorageResource extends ResourceBuilderBase { + constructor(handle: AzureQueueStorageResourceHandle, client: AspireClientRpc) { + super(handle, client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withContainerRegistryInternal(registry)); } - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureQueueStorageResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureQueueStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } - /** Adds a health check by key */ - withHealthCheck(key: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureQueueStorageResourcePromise { + const helpLink = options?.helpLink; + return new AzureQueueStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withConnectionPropertyInternal(name, value)); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withConnectionPropertyValueInternal(name, value)); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureQueueStorageResourcePromise { + const displayText = options?.displayText; + return new AzureQueueStorageResourcePromise(this._withUrlInternal(url, displayText)); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureQueueStorageResourcePromise { + const displayText = options?.displayText; + return new AzureQueueStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); } - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); } - /** Adds a bind mount for the data folder to an Azure Storage emulator resource */ - withDataBindMount(options?: WithDataBindMountOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDataBindMount(options))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._excludeFromManifestInternal()); } - /** Adds a named volume for the data folder to an Azure Storage emulator resource */ - withDataVolume(options?: WithDataVolumeOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); } - /** Sets the host port for blob requests on the storage emulator */ - withBlobPort(port: number): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withBlobPort(port))); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withExplicitStartInternal()); } - /** Sets the host port for queue requests on the storage emulator */ - withQueuePort(port: number): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withQueuePort(port))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); } - /** Sets the host port for table requests on the storage emulator */ - withTablePort(port: number): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withTablePort(port))); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withHealthCheckInternal(key)); } - /** Configures whether the emulator checks API version validity */ - withApiVersionCheck(options?: WithApiVersionCheckOptions): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withApiVersionCheck(options))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureQueueStorageResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureQueueStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); } - /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): AzureStorageEmulatorResourcePromise { - return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); } -} - -// ============================================================================ -// AzureStorageResource -// ============================================================================ - -export class AzureStorageResource extends ResourceBuilderBase { - constructor(handle: AzureStorageResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withContainerRegistryInternal(registry)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureQueueStorageResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureQueueStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureStorageResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new AzureStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): AzureStorageResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new AzureStorageResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureQueueStorageResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureQueueStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureStorageResourcePromise { - const helpLink = options?.helpLink; - return new AzureStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): AzureStorageResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new AzureStorageResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new AzureStorageResource(result, this._client); - } - - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): AzureStorageResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new AzureStorageResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureStorageResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new AzureStorageResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new AzureStorageResource(result, this._client); - } - - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withExternalHttpEndpointsInternal()); + return new AzureQueueStorageResource(result, this._client); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._asHttp2ServiceInternal()); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._onConnectionStringAvailableInternal(callback)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureQueueStorageResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureStorageResourcePromise { - const displayText = options?.displayText; - return new AzureStorageResourcePromise(this._withUrlInternal(url, displayText)); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new AzureStorageResource(result, this._client); +} + +/** + * Thenable wrapper for AzureQueueStorageResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureQueueStorageResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureQueueStorageResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureStorageResourcePromise { - const displayText = options?.displayText; - return new AzureStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new AzureStorageResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new AzureStorageResource(result, this._client); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new AzureStorageResource(result, this._client); + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._excludeFromManifestInternal()); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new AzureStorageResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withExplicitStartInternal()); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new AzureStorageResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Adds a health check by key */ - withHealthCheck(key: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withHealthCheckInternal(key)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new AzureStorageResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureStorageResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new AzureStorageResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new AzureStorageResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureStorageResourcePromise { - const commandOptions = options?.commandOptions; - return new AzureStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new AzureStorageResource(result, this._client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withParentRelationshipInternal(parent)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new AzureStorageResource(result, this._client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withChildRelationshipInternal(child)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new AzureStorageResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureStorageResourcePromise { - const iconVariant = options?.iconVariant; - return new AzureStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', - rpcArgs - ); - return new AzureStorageResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureStorageResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new AzureStorageResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new AzureStorageResource(result, this._client); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._excludeFromMcpInternal()); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new AzureStorageResource(result, this._client); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new AzureStorageResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new AzureStorageResource(result, this._client); - } +} - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureStorageResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new AzureStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); +// ============================================================================ +// AzureStorageEmulatorResource +// ============================================================================ + +export class AzureStorageEmulatorResource extends ResourceBuilderBase { + constructor(handle: AzureStorageEmulatorResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): AzureStorageEmulatorResourcePromise { + const isReadOnly = options?.isReadOnly; + return new AzureStorageEmulatorResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _runAsEmulatorInternal(configureContainer?: (obj: AzureStorageEmulatorResource) => Promise): Promise { - const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as AzureStorageEmulatorResourceHandle; - const obj = new AzureStorageEmulatorResource(objHandle, this._client); - await configureContainer(obj); - }) : undefined; - const rpcArgs: Record = { builder: this._handle }; - if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/runAsEmulator', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Configures the Azure Storage resource to be emulated using Azurite */ - runAsEmulator(options?: RunAsEmulatorOptions): AzureStorageResourcePromise { - const configureContainer = options?.configureContainer; - return new AzureStorageResourcePromise(this._runAsEmulatorInternal(configureContainer)); + /** Sets the container image tag */ + withImageTag(tag: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _addBlobsInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/addBlobs', + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new AzureBlobStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds an Azure Blob Storage resource */ - addBlobs(name: string): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._addBlobsInternal(name)); + /** Sets the container image registry */ + withImageRegistry(registry: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _addDataLakeInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/addDataLake', + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', rpcArgs ); - return new AzureDataLakeStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds an Azure Data Lake Storage resource */ - addDataLake(name: string): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._addDataLakeInternal(name)); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): AzureStorageEmulatorResourcePromise { + const tag = options?.tag; + return new AzureStorageEmulatorResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _addBlobContainerInternal(name: string, blobContainerName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (blobContainerName !== undefined) rpcArgs.blobContainerName = blobContainerName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/addBlobContainer', + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new AzureBlobStorageContainerResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds an Azure Blob Storage container resource */ - addBlobContainer(name: string, options?: AddBlobContainerOptions): AzureBlobStorageContainerResourcePromise { - const blobContainerName = options?.blobContainerName; - return new AzureBlobStorageContainerResourcePromise(this._addBlobContainerInternal(name, blobContainerName)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _addDataLakeFileSystemInternal(name: string, dataLakeFileSystemName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (dataLakeFileSystemName !== undefined) rpcArgs.dataLakeFileSystemName = dataLakeFileSystemName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/addDataLakeFileSystem', + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); - return new AzureDataLakeStorageFileSystemResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds an Azure Data Lake Storage file system resource */ - addDataLakeFileSystem(name: string, options?: AddDataLakeFileSystemOptions): AzureDataLakeStorageFileSystemResourcePromise { - const dataLakeFileSystemName = options?.dataLakeFileSystemName; - return new AzureDataLakeStorageFileSystemResourcePromise(this._addDataLakeFileSystemInternal(name, dataLakeFileSystemName)); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _addTablesInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/addTables', + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds an Azure Table Storage resource */ - addTables(name: string): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._addTablesInternal(name)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withLifetimeInternal(lifetime)); } /** @internal */ - private async _addQueuesInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/addQueues', + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); - return new AzureQueueStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds an Azure Queue Storage resource */ - addQueues(name: string): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._addQueuesInternal(name)); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } /** @internal */ - private async _addQueueInternal(name: string, queueName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - if (queueName !== undefined) rpcArgs.queueName = queueName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/addQueue', + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', rpcArgs ); - return new AzureQueueStorageQueueResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds an Azure Storage queue resource */ - addQueue(name: string, options?: AddQueueOptions): AzureQueueStorageQueueResourcePromise { - const queueName = options?.queueName; - return new AzureQueueStorageQueueResourcePromise(this._addQueueInternal(name, queueName)); + /** Configures the resource to be published as a container */ + publishAsContainer(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): AzureStorageEmulatorResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new AzureStorageEmulatorResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } - /** Gets an output reference from an Azure Bicep template resource */ - async getOutput(name: string): Promise { + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/getOutput', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', rpcArgs ); + return new AzureStorageEmulatorResource(result, this._client); } - /** @internal */ - private async _withParameterInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameter', - rpcArgs - ); - return new AzureStorageResource(result, this._client); - } - - /** Adds a Bicep parameter without a value */ - withParameter(name: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withParameterInternal(name)); + /** Sets the container name */ + withContainerName(name: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withContainerNameInternal(name)); } /** @internal */ - private async _withParameterStringValueInternal(name: string, value: string): Promise { + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterStringValue', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a Bicep parameter with a string value */ - withParameterStringValue(name: string, value: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withParameterStringValueInternal(name, value)); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withBuildArgInternal(name, value)); } /** @internal */ - private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterStringValues', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a Bicep parameter with a string list value */ - withParameterStringValues(name: string, value: string[]): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withParameterStringValuesInternal(name, value)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withBuildSecretInternal(name, value)); } /** @internal */ - private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromParameter', + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a Bicep parameter from a parameter resource builder */ - withParameterFromParameter(name: string, value: ParameterResource): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withParameterFromParameterInternal(name, value)); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); } /** @internal */ - private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromConnectionString', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a Bicep parameter from a connection string resource builder */ - withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureStorageEmulatorResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureStorageEmulatorResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromOutput', + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a Bicep parameter from another Bicep output reference */ - withParameterFromOutput(name: string, value: BicepOutputReference): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withParameterFromOutputInternal(name, value)); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withContainerNetworkAliasInternal(alias)); } /** @internal */ - private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a Bicep parameter from a reference expression */ - withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): AzureStorageEmulatorResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new AzureStorageEmulatorResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromEndpoint', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a Bicep parameter from an endpoint reference */ - withParameterFromEndpoint(name: string, value: EndpointReference): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._withParameterFromEndpointInternal(name, value)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _configureInfrastructureInternal(configure: (obj: AzureResourceInfrastructure) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; - const obj = new AzureResourceInfrastructure(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/configureInfrastructure', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Configures the Azure provisioning infrastructure callback */ - configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._configureInfrastructureInternal(configure)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { + private async _publishAsConnectionStringInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsConnectionString', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Publishes an Azure resource to the manifest as a connection string */ - publishAsConnectionString(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._publishAsConnectionStringInternal()); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._publishAsConnectionStringInternal()); } - /** Gets the normalized Bicep identifier for an Azure resource */ - async getBicepIdentifier(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/getBicepIdentifier', + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureStorageEmulatorResourcePromise { + const helpLink = options?.helpLink; + return new AzureStorageEmulatorResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _clearDefaultRoleAssignmentsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Clears the default Azure role assignments from a resource */ - clearDefaultRoleAssignments(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentCallbackInternal(callback)); } - /** Determines whether a resource is marked as existing */ - async isExisting(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/isExisting', + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/runAsExistingFromParameters', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Marks an Azure resource as existing in run mode by using parameter resources */ - runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/runAsExisting', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Marks an Azure resource as existing in run mode */ - runAsExisting(name: string, resourceGroup: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._runAsExistingInternal(name, resourceGroup)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsExistingFromParameters', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Marks an Azure resource as existing in publish mode by using parameter resources */ - publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsExisting', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new AzureStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Marks an Azure resource as existing in publish mode */ - publishAsExisting(name: string, resourceGroup: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); + /** Adds arguments */ + withArgs(args: string[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/asExisting', + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new AzureStorageResource(result, this._client); - } - - /** Marks an Azure resource as existing in both run and publish modes */ - asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); + return new AzureStorageEmulatorResource(result, this._client); } -} - -/** - * Thenable wrapper for AzureStorageResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class AzureStorageResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: AzureStorageResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withArgsCallbackInternal(callback)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): AzureStorageEmulatorResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new AzureStorageEmulatorResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withReferenceUriInternal(name, uri)); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): AzureStorageEmulatorResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new AzureStorageEmulatorResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): AzureStorageEmulatorResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new AzureStorageEmulatorResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureStorageEmulatorResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new AzureStorageEmulatorResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** Adds a health check by key */ - withHealthCheck(key: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._asHttp2ServiceInternal()); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureStorageEmulatorResourcePromise { + const displayText = options?.displayText; + return new AzureStorageEmulatorResourcePromise(this._withUrlInternal(url, displayText)); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureStorageEmulatorResourcePromise { + const displayText = options?.displayText; + return new AzureStorageEmulatorResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Configures the Azure Storage resource to be emulated using Azurite */ - runAsEmulator(options?: RunAsEmulatorOptions): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.runAsEmulator(options))); + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds an Azure Blob Storage resource */ - addBlobs(name: string): AzureBlobStorageResourcePromise { - return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.addBlobs(name))); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } - /** Adds an Azure Data Lake Storage resource */ - addDataLake(name: string): AzureDataLakeStorageResourcePromise { - return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.addDataLake(name))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds an Azure Blob Storage container resource */ - addBlobContainer(name: string, options?: AddBlobContainerOptions): AzureBlobStorageContainerResourcePromise { - return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.addBlobContainer(name, options))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._excludeFromManifestInternal()); } - /** Adds an Azure Data Lake Storage file system resource */ - addDataLakeFileSystem(name: string, options?: AddDataLakeFileSystemOptions): AzureDataLakeStorageFileSystemResourcePromise { - return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.addDataLakeFileSystem(name, options))); + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds an Azure Table Storage resource */ - addTables(name: string): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.addTables(name))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._waitForInternal(dependency)); } - /** Adds an Azure Queue Storage resource */ - addQueues(name: string): AzureQueueStorageResourcePromise { - return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.addQueues(name))); + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds an Azure Storage queue resource */ - addQueue(name: string, options?: AddQueueOptions): AzureQueueStorageQueueResourcePromise { - return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.addQueue(name, options))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Gets an output reference from an Azure Bicep template resource */ - getOutput(name: string): Promise { - return this._promise.then(obj => obj.getOutput(name)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._waitForStartInternal(dependency)); } - /** Adds a Bicep parameter without a value */ - withParameter(name: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameter(name))); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a Bicep parameter with a string value */ - withParameterStringValue(name: string, value: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Adds a Bicep parameter with a string list value */ - withParameterStringValues(name: string, value: string[]): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a Bicep parameter from a parameter resource builder */ - withParameterFromParameter(name: string, value: ParameterResource): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withExplicitStartInternal()); } - /** Adds a Bicep parameter from a connection string resource builder */ - withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); - } - - /** Adds a Bicep parameter from another Bicep output reference */ - withParameterFromOutput(name: string, value: BicepOutputReference): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); - } - - /** Adds a Bicep parameter from a reference expression */ - withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); - } - - /** Adds a Bicep parameter from an endpoint reference */ - withParameterFromEndpoint(name: string, value: EndpointReference): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); - } - - /** Configures the Azure provisioning infrastructure callback */ - configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.configureInfrastructure(configure))); - } - - /** Publishes an Azure resource to the manifest as a connection string */ - publishAsConnectionString(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Gets the normalized Bicep identifier for an Azure resource */ - getBicepIdentifier(): Promise { - return this._promise.then(obj => obj.getBicepIdentifier()); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): AzureStorageEmulatorResourcePromise { + const exitCode = options?.exitCode; + return new AzureStorageEmulatorResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Clears the default Azure role assignments from a resource */ - clearDefaultRoleAssignments(): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Determines whether a resource is marked as existing */ - isExisting(): Promise { - return this._promise.then(obj => obj.isExisting()); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withHealthCheckInternal(key)); } - /** Marks an Azure resource as existing in run mode by using parameter resources */ - runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Marks an Azure resource as existing in run mode */ - runAsExisting(name: string, resourceGroup: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureStorageEmulatorResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new AzureStorageEmulatorResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Marks an Azure resource as existing in publish mode by using parameter resources */ - publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Marks an Azure resource as existing in publish mode */ - publishAsExisting(name: string, resourceGroup: string): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureStorageEmulatorResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureStorageEmulatorResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Marks an Azure resource as existing in both run and publish modes */ - asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { - return new AzureStorageResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } -} - -// ============================================================================ -// AzureTableStorageResource -// ============================================================================ - -export class AzureTableStorageResource extends ResourceBuilderBase { - constructor(handle: AzureTableStorageResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withContainerRegistryInternal(registry)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureTableStorageResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new AzureTableStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): AzureStorageEmulatorResourcePromise { + const password = options?.password; + return new AzureStorageEmulatorResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureTableStorageResourcePromise { - const helpLink = options?.helpLink; - return new AzureTableStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureStorageEmulatorResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureStorageEmulatorResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); - } - - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new AzureTableStorageResource(result, this._client); - } - - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureTableStorageResourcePromise { - const displayText = options?.displayText; - return new AzureTableStorageResourcePromise(this._withUrlInternal(url, displayText)); - } - - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new AzureTableStorageResource(result, this._client); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureTableStorageResourcePromise { - const displayText = options?.displayText; - return new AzureTableStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); - } - - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new AzureTableStorageResource(result, this._client); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); - } - - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new AzureTableStorageResource(result, this._client); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._excludeFromManifestInternal()); - } - - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new AzureTableStorageResource(result, this._client); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withExplicitStartInternal()); - } - - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new AzureTableStorageResource(result, this._client); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withHealthCheckInternal(key)); - } - - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new AzureTableStorageResource(result, this._client); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureTableStorageResourcePromise { - const commandOptions = options?.commandOptions; - return new AzureTableStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); - } - - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new AzureTableStorageResource(result, this._client); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withParentRelationshipInternal(parent)); - } - - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new AzureTableStorageResource(result, this._client); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withChildRelationshipInternal(child)); - } - - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new AzureTableStorageResource(result, this._client); - } - - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureTableStorageResourcePromise { - const iconVariant = options?.iconVariant; - return new AzureTableStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureStorageEmulatorResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new AzureStorageEmulatorResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -11493,60 +12388,79 @@ export class AzureTableStorageResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureTableStorageResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureStorageEmulatorResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new AzureTableStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new AzureStorageEmulatorResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new AzureTableStorageResource(result, this._client); + return new AzureStorageEmulatorResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): AzureStorageEmulatorResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new AzureStorageEmulatorResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); } /** Gets the resource name */ @@ -11559,1376 +12473,1104 @@ export class AzureTableStorageResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', - rpcArgs - ); - return new AzureTableStorageResource(result, this._client); + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._onBeforeResourceStartedInternal(callback)); } -} + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); + } -/** - * Thenable wrapper for AzureTableStorageResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class AzureTableStorageResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._onResourceStoppedInternal(callback)); + } - then( - onfulfilled?: ((value: AzureTableStorageResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._onResourceReadyInternal(callback)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withDataBindMountInternal(path?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withDataBindMount', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Adds a bind mount for the data folder to an Azure Storage emulator resource */ + withDataBindMount(options?: WithDataBindMountOptions): AzureStorageEmulatorResourcePromise { + const path = options?.path; + const isReadOnly = options?.isReadOnly; + return new AzureStorageEmulatorResourcePromise(this._withDataBindMountInternal(path, isReadOnly)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withDataVolume', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds a named volume for the data folder to an Azure Storage emulator resource */ + withDataVolume(options?: WithDataVolumeOptions): AzureStorageEmulatorResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new AzureStorageEmulatorResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withBlobPortInternal(port: number): Promise { + const rpcArgs: Record = { builder: this._handle, port }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withBlobPort', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Sets the host port for blob requests on the storage emulator */ + withBlobPort(port: number): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withBlobPortInternal(port)); } - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _withQueuePortInternal(port: number): Promise { + const rpcArgs: Record = { builder: this._handle, port }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withQueuePort', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Sets the host port for queue requests on the storage emulator */ + withQueuePort(port: number): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withQueuePortInternal(port)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _withTablePortInternal(port: number): Promise { + const rpcArgs: Record = { builder: this._handle, port }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withTablePort', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Sets the host port for table requests on the storage emulator */ + withTablePort(port: number): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withTablePortInternal(port)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _withApiVersionCheckInternal(enable?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (enable !== undefined) rpcArgs.enable = enable; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withApiVersionCheck', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Configures whether the emulator checks API version validity */ + withApiVersionCheck(options?: WithApiVersionCheckOptions): AzureStorageEmulatorResourcePromise { + const enable = options?.enable; + return new AzureStorageEmulatorResourcePromise(this._withApiVersionCheckInternal(enable)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withUserAssignedIdentityAzureUserAssignedIdentity', + rpcArgs + ); + return new AzureStorageEmulatorResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureTableStorageResourcePromise { - return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); } } -// ============================================================================ -// AzureUserAssignedIdentityResource -// ============================================================================ - -export class AzureUserAssignedIdentityResource extends ResourceBuilderBase { - constructor(handle: AzureUserAssignedIdentityResourceHandle, client: AspireClientRpc) { - super(handle, client); - } +/** + * Thenable wrapper for AzureStorageEmulatorResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureStorageEmulatorResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + then( + onfulfilled?: ((value: AzureStorageEmulatorResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureUserAssignedIdentityResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new AzureUserAssignedIdentityResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Sets the container image tag */ + withImageTag(tag: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureUserAssignedIdentityResourcePromise { - const helpLink = options?.helpLink; - return new AzureUserAssignedIdentityResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the container image registry */ + withImageRegistry(registry: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureUserAssignedIdentityResourcePromise { - const displayText = options?.displayText; - return new AzureUserAssignedIdentityResourcePromise(this._withUrlInternal(url, displayText)); + /** Configures the resource to be published as a container */ + publishAsContainer(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsContainer())); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureUserAssignedIdentityResourcePromise { - const displayText = options?.displayText; - return new AzureUserAssignedIdentityResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Sets the container name */ + withContainerName(name: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerName(name))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._excludeFromManifestInternal()); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withExplicitStartInternal()); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Configures OTLP telemetry export */ + withOtlpExporter(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Adds a health check by key */ - withHealthCheck(key: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withHealthCheckInternal(key)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureUserAssignedIdentityResourcePromise { - const commandOptions = options?.commandOptions; - return new AzureUserAssignedIdentityResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withParentRelationshipInternal(parent)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withChildRelationshipInternal(child)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureUserAssignedIdentityResourcePromise { - const iconVariant = options?.iconVariant; - return new AzureUserAssignedIdentityResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds arguments */ + withArgs(args: string[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._excludeFromMcpInternal()); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureUserAssignedIdentityResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new AzureUserAssignedIdentityResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Gets an output reference from an Azure Bicep template resource */ - async getOutput(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/getOutput', - rpcArgs - ); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** @internal */ - private async _withParameterInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameter', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Adds a Bicep parameter without a value */ - withParameter(name: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withParameterInternal(name)); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** @internal */ - private async _withParameterStringValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterStringValue', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Adds a Bicep parameter with a string value */ - withParameterStringValue(name: string, value: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withParameterStringValueInternal(name, value)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** @internal */ - private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterStringValues', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Adds a Bicep parameter with a string list value */ - withParameterStringValues(name: string, value: string[]): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withParameterStringValuesInternal(name, value)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** @internal */ - private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromParameter', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Adds a Bicep parameter from a parameter resource builder */ - withParameterFromParameter(name: string, value: ParameterResource): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromParameterInternal(name, value)); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromConnectionString', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** Adds a Bicep parameter from a connection string resource builder */ - withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromOutput', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** Adds a Bicep parameter from another Bicep output reference */ - withParameterFromOutput(name: string, value: BicepOutputReference): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromOutputInternal(name, value)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** @internal */ - private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** Adds a Bicep parameter from a reference expression */ - withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** @internal */ - private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withParameterFromEndpoint', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** Adds a Bicep parameter from an endpoint reference */ - withParameterFromEndpoint(name: string, value: EndpointReference): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromEndpointInternal(name, value)); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** @internal */ - private async _configureInfrastructureInternal(configure: (obj: AzureResourceInfrastructure) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; - const obj = new AzureResourceInfrastructure(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/configureInfrastructure', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Configures the Azure provisioning infrastructure callback */ - configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._configureInfrastructureInternal(configure)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsConnectionString', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Publishes an Azure resource to the manifest as a connection string */ - publishAsConnectionString(): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._publishAsConnectionStringInternal()); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Gets the normalized Bicep identifier for an Azure resource */ - async getBicepIdentifier(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/getBicepIdentifier', - rpcArgs - ); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _clearDefaultRoleAssignmentsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Clears the default Azure role assignments from a resource */ - clearDefaultRoleAssignments(): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._clearDefaultRoleAssignmentsInternal()); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** Determines whether a resource is marked as existing */ - async isExisting(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting.Azure/isExisting', - rpcArgs - ); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/runAsExistingFromParameters', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Marks an Azure resource as existing in run mode by using parameter resources */ - runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** @internal */ - private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/runAsExisting', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } - /** Marks an Azure resource as existing in run mode */ - runAsExisting(name: string, resourceGroup: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._runAsExistingInternal(name, resourceGroup)); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** @internal */ - private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsExistingFromParameters', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Marks an Azure resource as existing in publish mode by using parameter resources */ - publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** @internal */ - private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/publishAsExisting', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Marks an Azure resource as existing in publish mode */ - publishAsExisting(name: string, resourceGroup: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** @internal */ - private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/asExisting', - rpcArgs - ); - return new AzureUserAssignedIdentityResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Marks an Azure resource as existing in both run and publish modes */ - asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); + /** Adds a bind mount for the data folder to an Azure Storage emulator resource */ + withDataBindMount(options?: WithDataBindMountOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDataBindMount(options))); } -} - -/** - * Thenable wrapper for AzureUserAssignedIdentityResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class AzureUserAssignedIdentityResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: AzureUserAssignedIdentityResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Adds a named volume for the data folder to an Azure Storage emulator resource */ + withDataVolume(options?: WithDataVolumeOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Sets the host port for blob requests on the storage emulator */ + withBlobPort(port: number): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withBlobPort(port))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Sets the host port for queue requests on the storage emulator */ + withQueuePort(port: number): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withQueuePort(port))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets the host port for table requests on the storage emulator */ + withTablePort(port: number): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withTablePort(port))); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); - } - - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); - } - - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withExplicitStart())); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); - } - - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); - } - - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); - } - - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Configures whether the emulator checks API version validity */ + withApiVersionCheck(options?: WithApiVersionCheckOptions): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withApiVersionCheck(options))); } /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); - } - - /** Gets an output reference from an Azure Bicep template resource */ - getOutput(name: string): Promise { - return this._promise.then(obj => obj.getOutput(name)); - } - - /** Adds a Bicep parameter without a value */ - withParameter(name: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameter(name))); - } - - /** Adds a Bicep parameter with a string value */ - withParameterStringValue(name: string, value: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); - } - - /** Adds a Bicep parameter with a string list value */ - withParameterStringValues(name: string, value: string[]): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); - } - - /** Adds a Bicep parameter from a parameter resource builder */ - withParameterFromParameter(name: string, value: ParameterResource): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); - } - - /** Adds a Bicep parameter from a connection string resource builder */ - withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); - } - - /** Adds a Bicep parameter from another Bicep output reference */ - withParameterFromOutput(name: string, value: BicepOutputReference): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); - } - - /** Adds a Bicep parameter from a reference expression */ - withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); - } - - /** Adds a Bicep parameter from an endpoint reference */ - withParameterFromEndpoint(name: string, value: EndpointReference): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); - } - - /** Configures the Azure provisioning infrastructure callback */ - configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.configureInfrastructure(configure))); - } - - /** Publishes an Azure resource to the manifest as a connection string */ - publishAsConnectionString(): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); - } - - /** Gets the normalized Bicep identifier for an Azure resource */ - getBicepIdentifier(): Promise { - return this._promise.then(obj => obj.getBicepIdentifier()); - } - - /** Clears the default Azure role assignments from a resource */ - clearDefaultRoleAssignments(): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); - } - - /** Determines whether a resource is marked as existing */ - isExisting(): Promise { - return this._promise.then(obj => obj.isExisting()); - } - - /** Marks an Azure resource as existing in run mode by using parameter resources */ - runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); - } - - /** Marks an Azure resource as existing in run mode */ - runAsExisting(name: string, resourceGroup: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } - /** Marks an Azure resource as existing in publish mode by using parameter resources */ - publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); } - /** Marks an Azure resource as existing in publish mode */ - publishAsExisting(name: string, resourceGroup: string): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); } - /** Marks an Azure resource as existing in both run and publish modes */ - asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { - return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): AzureStorageEmulatorResourcePromise { + return new AzureStorageEmulatorResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); } } // ============================================================================ -// ConnectionStringResource +// AzureStorageResource // ============================================================================ -export class ConnectionStringResource extends ResourceBuilderBase { - constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { +export class AzureStorageResource extends ResourceBuilderBase { + constructor(handle: AzureStorageResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureStorageResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureStorageResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureStorageResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new AzureStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): AzureStorageResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new AzureStorageResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureStorageResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureStorageResourcePromise { const helpLink = options?.helpLink; - return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new AzureStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } - - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): AzureStorageResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new AzureStorageResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): AzureStorageResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new AzureStorageResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureStorageResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new AzureStorageResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureStorageResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureStorageResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureStorageResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + withUrl(url: string, options?: WithUrlOptions): AzureStorageResourcePromise { const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); + return new AzureStorageResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureStorageResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureStorageResourcePromise { const displayText = options?.displayText; - return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new AzureStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureStorageResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ConnectionStringResource(result, this._client); - } - - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + return new AzureStorageResource(result, this._client); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } - - /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); - } - - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } - - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - const exitCode = options?.exitCode; - return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); - } - - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureStorageResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new AzureStorageResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -12936,113 +13578,112 @@ export class ConnectionStringResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureStorageResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureStorageResourcePromise { const commandOptions = options?.commandOptions; - return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new AzureStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureStorageResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureStorageResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureStorageResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): AzureStorageResourcePromise { const iconVariant = options?.iconVariant; - return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); - } - - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new ConnectionStringResource(result, this._client); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); + return new AzureStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureStorageResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new AzureStorageResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -13053,60 +13694,60 @@ export class ConnectionStringResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureStorageResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureStorageResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new AzureStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureStorageResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureStorageResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -13119,713 +13760,685 @@ export class ConnectionStringResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._onBeforeResourceStartedInternal(callback)); } -} + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new AzureStorageResource(result, this._client); + } -/** - * Thenable wrapper for ConnectionStringResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ConnectionStringResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._onResourceStoppedInternal(callback)); + } - then( - onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._onResourceReadyInternal(callback)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); - } - - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); - } - - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); - } - - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); - } - - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); - } - - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); - } - - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _runAsEmulatorInternal(configureContainer?: (obj: AzureStorageEmulatorResource) => Promise): Promise { + const configureContainerId = configureContainer ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as AzureStorageEmulatorResourceHandle; + const obj = new AzureStorageEmulatorResource(objHandle, this._client); + await configureContainer(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configureContainer !== undefined) rpcArgs.configureContainer = configureContainerId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/runAsEmulator', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Configures the Azure Storage resource to be emulated using Azurite */ + runAsEmulator(options?: RunAsEmulatorOptions): AzureStorageResourcePromise { + const configureContainer = options?.configureContainer; + return new AzureStorageResourcePromise(this._runAsEmulatorInternal(configureContainer)); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _addBlobsInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addBlobs', + rpcArgs + ); + return new AzureBlobStorageResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Adds an Azure Blob Storage resource */ + addBlobs(name: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._addBlobsInternal(name)); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** @internal */ + private async _addDataLakeInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addDataLake', + rpcArgs + ); + return new AzureDataLakeStorageResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Adds an Azure Data Lake Storage resource */ + addDataLake(name: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._addDataLakeInternal(name)); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _addBlobContainerInternal(name: string, blobContainerName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (blobContainerName !== undefined) rpcArgs.blobContainerName = blobContainerName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addBlobContainer', + rpcArgs + ); + return new AzureBlobStorageContainerResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Adds an Azure Blob Storage container resource */ + addBlobContainer(name: string, options?: AddBlobContainerOptions): AzureBlobStorageContainerResourcePromise { + const blobContainerName = options?.blobContainerName; + return new AzureBlobStorageContainerResourcePromise(this._addBlobContainerInternal(name, blobContainerName)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _addDataLakeFileSystemInternal(name: string, dataLakeFileSystemName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (dataLakeFileSystemName !== undefined) rpcArgs.dataLakeFileSystemName = dataLakeFileSystemName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addDataLakeFileSystem', + rpcArgs + ); + return new AzureDataLakeStorageFileSystemResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Adds an Azure Data Lake Storage file system resource */ + addDataLakeFileSystem(name: string, options?: AddDataLakeFileSystemOptions): AzureDataLakeStorageFileSystemResourcePromise { + const dataLakeFileSystemName = options?.dataLakeFileSystemName; + return new AzureDataLakeStorageFileSystemResourcePromise(this._addDataLakeFileSystemInternal(name, dataLakeFileSystemName)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _addTablesInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addTables', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds an Azure Table Storage resource */ + addTables(name: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._addTablesInternal(name)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _addQueuesInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addQueues', + rpcArgs + ); + return new AzureQueueStorageResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Adds an Azure Queue Storage resource */ + addQueues(name: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._addQueuesInternal(name)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _addQueueInternal(name: string, queueName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (queueName !== undefined) rpcArgs.queueName = queueName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/addQueue', + rpcArgs + ); + return new AzureQueueStorageQueueResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Adds an Azure Storage queue resource */ + addQueue(name: string, options?: AddQueueOptions): AzureQueueStorageQueueResourcePromise { + const queueName = options?.queueName; + return new AzureQueueStorageQueueResourcePromise(this._addQueueInternal(name, queueName)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureStorageResource(result, this._client); } /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } -} - -// ============================================================================ -// ContainerRegistryResource -// ============================================================================ - -export class ContainerRegistryResource extends ResourceBuilderBase { - constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Gets an output reference from an Azure Bicep template resource */ + async getOutput(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getOutput', + rpcArgs + ); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withParameterInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameter', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterInternal(name)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withParameterStringValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValue', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterStringValueInternal(name, value)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValues', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { - const helpLink = options?.helpLink; - return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterStringValuesInternal(name, value)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromParameter', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterFromParameterInternal(name, value)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromConnectionString', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromOutput', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { - const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterFromOutputInternal(name, value)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { - const displayText = options?.displayText; - return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromEndpoint', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._withParameterFromEndpointInternal(name, value)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _configureInfrastructureInternal(configure: (obj: AzureResourceInfrastructure) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; + const obj = new AzureResourceInfrastructure(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/configureInfrastructure', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._configureInfrastructureInternal(configure)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _publishAsConnectionStringInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsConnectionString', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._publishAsConnectionStringInternal()); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + /** Gets the normalized Bicep identifier for an Azure resource */ + async getBicepIdentifier(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getBicepIdentifier', rpcArgs ); - return new ContainerRegistryResource(result, this._client); - } - - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _clearDefaultRoleAssignmentsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._clearDefaultRoleAssignmentsInternal()); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + /** Determines whether a resource is marked as existing */ + async isExisting(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/isExisting', rpcArgs ); - return new ContainerRegistryResource(result, this._client); - } - - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExistingFromParameters', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExisting', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._runAsExistingInternal(name, resourceGroup)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExistingFromParameters', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExisting', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/asExistingFromParameters', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new AzureStorageResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); - } +} - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); - } +/** + * Thenable wrapper for AzureStorageResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureStorageResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + then( + onfulfilled?: ((value: AzureStorageResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', - rpcArgs - ); - return new ContainerRegistryResource(result, this._client); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } -} - -/** - * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ContainerRegistryResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Adds a health check by key */ - withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); - } - - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + withIconName(iconName: string, options?: WithIconNameOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -13833,2894 +14446,3158 @@ export class ContainerRegistryResourcePromise implements PromiseLike obj.getResourceName()); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } -} + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } -// ============================================================================ -// ContainerResource -// ============================================================================ + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } -export class ContainerResource extends ResourceBuilderBase { - constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + /** Configures the Azure Storage resource to be emulated using Azurite */ + runAsEmulator(options?: RunAsEmulatorOptions): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.runAsEmulator(options))); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds an Azure Blob Storage resource */ + addBlobs(name: string): AzureBlobStorageResourcePromise { + return new AzureBlobStorageResourcePromise(this._promise.then(obj => obj.addBlobs(name))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds an Azure Data Lake Storage resource */ + addDataLake(name: string): AzureDataLakeStorageResourcePromise { + return new AzureDataLakeStorageResourcePromise(this._promise.then(obj => obj.addDataLake(name))); } - /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds an Azure Blob Storage container resource */ + addBlobContainer(name: string, options?: AddBlobContainerOptions): AzureBlobStorageContainerResourcePromise { + return new AzureBlobStorageContainerResourcePromise(this._promise.then(obj => obj.addBlobContainer(name, options))); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds an Azure Data Lake Storage file system resource */ + addDataLakeFileSystem(name: string, options?: AddDataLakeFileSystemOptions): AzureDataLakeStorageFileSystemResourcePromise { + return new AzureDataLakeStorageFileSystemResourcePromise(this._promise.then(obj => obj.addDataLakeFileSystem(name, options))); + } + + /** Adds an Azure Table Storage resource */ + addTables(name: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.addTables(name))); + } + + /** Adds an Azure Queue Storage resource */ + addQueues(name: string): AzureQueueStorageResourcePromise { + return new AzureQueueStorageResourcePromise(this._promise.then(obj => obj.addQueues(name))); + } + + /** Adds an Azure Storage queue resource */ + addQueue(name: string, options?: AddQueueOptions): AzureQueueStorageQueueResourcePromise { + return new AzureQueueStorageQueueResourcePromise(this._promise.then(obj => obj.addQueue(name, options))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Gets an output reference from an Azure Bicep template resource */ + getOutput(name: string): Promise { + return this._promise.then(obj => obj.getOutput(name)); + } + + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameter(name))); + } + + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); + } + + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); + } + + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); + } + + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); + } + + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); + } + + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); + } + + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); + } + + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.configureInfrastructure(configure))); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + getBicepIdentifier(): Promise { + return this._promise.then(obj => obj.getBicepIdentifier()); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + } + + /** Determines whether a resource is marked as existing */ + isExisting(): Promise { + return this._promise.then(obj => obj.isExisting()); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureStorageResourcePromise { + return new AzureStorageResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + } + +} + +// ============================================================================ +// AzureTableStorageResource +// ============================================================================ + +export class AzureTableStorageResource extends ResourceBuilderBase { + constructor(handle: AzureTableStorageResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterInternal()); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureTableStorageResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureTableStorageResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { const rpcArgs: Record = { builder: this._handle, command }; if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureTableStorageResourcePromise { const helpLink = options?.helpLink; - return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new AzureTableStorageResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withConnectionPropertyInternal(name, value)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureTableStorageResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withConnectionPropertyValueInternal(name, value)); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureTableStorageResourcePromise { + const displayText = options?.displayText; + return new AzureTableStorageResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureTableStorageResourcePromise { + const displayText = options?.displayText; + return new AzureTableStorageResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsInternal(args)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new AzureTableStorageResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureTableStorageResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureTableStorageResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceInternal(source)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureTableStorageResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureTableStorageResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureTableStorageResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureTableStorageResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ContainerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); + return new AzureTableStorageResource(result, this._client); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._asHttp2ServiceInternal()); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._onConnectionStringAvailableInternal(callback)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureTableStorageResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new ContainerResource(result, this._client); +} + +/** + * Thenable wrapper for AzureTableStorageResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureTableStorageResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureTableStorageResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - const displayText = options?.displayText; - return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromManifestInternal()); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForInternal(dependency)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withExplicitStartInternal()); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - const exitCode = options?.exitCode; - return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withHealthCheckInternal(key)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - const commandOptions = options?.commandOptions; - return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new ContainerResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureTableStorageResourcePromise { + return new AzureTableStorageResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new ContainerResource(result, this._client); - } +} - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - const password = options?.password; - return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); +// ============================================================================ +// AzureUserAssignedIdentityResource +// ============================================================================ + +export class AzureUserAssignedIdentityResource extends ResourceBuilderBase { + constructor(handle: AzureUserAssignedIdentityResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureUserAssignedIdentityResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new AzureUserAssignedIdentityResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureUserAssignedIdentityResourcePromise { + const helpLink = options?.helpLink; + return new AzureUserAssignedIdentityResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - const iconVariant = options?.iconVariant; - return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new ContainerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._excludeFromMcpInternal()); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureUserAssignedIdentityResourcePromise { + const displayText = options?.displayText; + return new AzureUserAssignedIdentityResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureUserAssignedIdentityResourcePromise { + const displayText = options?.displayText; + return new AzureUserAssignedIdentityResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withHealthCheckInternal(key)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); + return new AzureUserAssignedIdentityResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureUserAssignedIdentityResourcePromise { + const commandOptions = options?.commandOptions; + return new AzureUserAssignedIdentityResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, name, secretReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new ContainerResource(result, this._client); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureUserAssignedIdentityResourcePromise { + const iconVariant = options?.iconVariant; + return new AzureUserAssignedIdentityResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { - const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ContainerResource(result, this._client); - } - - /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + return new AzureUserAssignedIdentityResource(result, this._client); } -} - -/** - * Thenable wrapper for ContainerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ContainerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._excludeFromMcpInternal()); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureUserAssignedIdentityResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new AzureUserAssignedIdentityResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Adds arguments */ - withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._onResourceReadyInternal(callback)); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Gets an output reference from an Azure Bicep template resource */ + async getOutput(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getOutput', + rpcArgs + ); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _withParameterInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameter', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterInternal(name)); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _withParameterStringValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValue', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterStringValueInternal(name, value)); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _withParameterStringValuesInternal(name: string, value: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterStringValues', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterStringValuesInternal(name, value)); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _withParameterFromParameterInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromParameter', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromParameterInternal(name, value)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _withParameterFromConnectionStringInternal(name: string, value: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromConnectionString', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromConnectionStringInternal(name, value)); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withParameterFromOutputInternal(name: string, value: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromOutput', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromOutputInternal(name, value)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withParameterFromReferenceExpressionInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromReferenceExpression', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromReferenceExpressionInternal(name, value)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withParameterFromEndpointInternal(name: string, value: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withParameterFromEndpoint', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._withParameterFromEndpointInternal(name, value)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _configureInfrastructureInternal(configure: (obj: AzureResourceInfrastructure) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as AzureResourceInfrastructureHandle; + const obj = new AzureResourceInfrastructure(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/configureInfrastructure', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._configureInfrastructureInternal(configure)); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsConnectionString', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._publishAsConnectionStringInternal()); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** Gets the normalized Bicep identifier for an Azure resource */ + async getBicepIdentifier(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/getBicepIdentifier', + rpcArgs + ); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _clearDefaultRoleAssignmentsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/clearDefaultRoleAssignments', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._clearDefaultRoleAssignmentsInternal()); } - /** Adds a health check by key */ - withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Determines whether a resource is marked as existing */ + async isExisting(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting.Azure/isExisting', + rpcArgs + ); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** @internal */ + private async _runAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExistingFromParameters', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._runAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** @internal */ + private async _runAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/runAsExisting', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._runAsExistingInternal(name, resourceGroup)); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** @internal */ + private async _publishAsExistingFromParametersInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExistingFromParameters', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._publishAsExistingFromParametersInternal(nameParameter, resourceGroupParameter)); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** @internal */ + private async _publishAsExistingInternal(name: string, resourceGroup: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, resourceGroup }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/publishAsExisting', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._publishAsExistingInternal(name, resourceGroup)); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** @internal */ + private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/asExistingFromParameters', + rpcArgs + ); + return new AzureUserAssignedIdentityResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); - } +} - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); +/** + * Thenable wrapper for AzureUserAssignedIdentityResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class AzureUserAssignedIdentityResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: AzureUserAssignedIdentityResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } -} - -// ============================================================================ -// CSharpAppResource -// ============================================================================ + /** Prevents resource from starting automatically */ + withExplicitStart(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } -export class CSharpAppResource extends ResourceBuilderBase { - constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Adds a health check by key */ + withHealthCheck(key: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** @internal */ - private async _withReplicasInternal(replicas: number): Promise { - const rpcArgs: Record = { builder: this._handle, replicas }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReplicas', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** @internal */ - private async _disableForwardedHeadersInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/disableForwardedHeaders', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Gets an output reference from an Azure Bicep template resource */ + getOutput(name: string): Promise { + return this._promise.then(obj => obj.getOutput(name)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - const helpLink = options?.helpLink; - return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Adds a Bicep parameter without a value */ + withParameter(name: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameter(name))); } - /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a Bicep parameter with a string value */ + withParameterStringValue(name: string, value: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterStringValue(name, value))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + /** Adds a Bicep parameter with a string list value */ + withParameterStringValues(name: string, value: string[]): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterStringValues(name, value))); } - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a Bicep parameter from a parameter resource builder */ + withParameterFromParameter(name: string, value: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromParameter(name, value))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Adds a Bicep parameter from a connection string resource builder */ + withParameterFromConnectionString(name: string, value: ResourceBuilderBase): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromConnectionString(name, value))); } - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a Bicep parameter from another Bicep output reference */ + withParameterFromOutput(name: string, value: BicepOutputReference): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromOutput(name, value))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Adds a Bicep parameter from a reference expression */ + withParameterFromReferenceExpression(name: string, value: ReferenceExpression): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromReferenceExpression(name, value))); } - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a Bicep parameter from an endpoint reference */ + withParameterFromEndpoint(name: string, value: EndpointReference): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.withParameterFromEndpoint(name, value))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Configures the Azure provisioning infrastructure callback */ + configureInfrastructure(configure: (obj: AzureResourceInfrastructure) => Promise): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.configureInfrastructure(configure))); + } + + /** Publishes an Azure resource to the manifest as a connection string */ + publishAsConnectionString(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Gets the normalized Bicep identifier for an Azure resource */ + getBicepIdentifier(): Promise { + return this._promise.then(obj => obj.getBicepIdentifier()); + } + + /** Clears the default Azure role assignments from a resource */ + clearDefaultRoleAssignments(): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.clearDefaultRoleAssignments())); + } + + /** Determines whether a resource is marked as existing */ + isExisting(): Promise { + return this._promise.then(obj => obj.isExisting()); + } + + /** Marks an Azure resource as existing in run mode by using parameter resources */ + runAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.runAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in run mode */ + runAsExisting(name: string, resourceGroup: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.runAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in publish mode by using parameter resources */ + publishAsExistingFromParameters(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.publishAsExistingFromParameters(nameParameter, resourceGroupParameter))); + } + + /** Marks an Azure resource as existing in publish mode */ + publishAsExisting(name: string, resourceGroup: string): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); + } + + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ + asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureUserAssignedIdentityResourcePromise { + return new AzureUserAssignedIdentityResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); + } + +} + +// ============================================================================ +// ConnectionStringResource +// ============================================================================ + +export class ConnectionStringResource extends ResourceBuilderBase { + constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ConnectionStringResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + const helpLink = options?.helpLink; + return new ConnectionStringResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsInternal(args)); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyInternal(name, value)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new ConnectionStringResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceInternal(source)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + const displayText = options?.displayText; + return new ConnectionStringResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new CSharpAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new CSharpAppResource(result, this._client); - } - - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); + return new ConnectionStringResource(result, this._client); } - /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + const exitCode = options?.exitCode; + return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + const commandOptions = options?.commandOptions; + return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - const displayText = options?.displayText; - return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + const iconVariant = options?.iconVariant; + return new ConnectionStringResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ConnectionStringResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new CSharpAppResource(result, this._client); - } - - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onConnectionStringAvailableInternal(callback)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withExplicitStartInternal()); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - const exitCode = options?.exitCode; - return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new ConnectionStringResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new CSharpAppResource(result, this._client); - } +} - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); - } +/** + * Thenable wrapper for ConnectionStringResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ConnectionStringResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + then( + onfulfilled?: ((value: ConnectionStringResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - const commandOptions = options?.commandOptions; - return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - const password = options?.password; - return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - const iconVariant = options?.iconVariant; - return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; - if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { - const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; - const endpointName = options?.endpointName; - return new CSharpAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + /** Prevents resource from starting automatically */ + withExplicitStart(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); + /** Adds a health check by key */ + withHealthCheck(key: string): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); - } - - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); - } - - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** @internal */ - private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withEnvironmentFromOutput', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } - /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** @internal */ - private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, name, secretReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', - rpcArgs - ); - return new CSharpAppResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// ContainerRegistryResource +// ============================================================================ + +export class ContainerRegistryResource extends ResourceBuilderBase { + constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { + super(handle, client); } /** @internal */ - private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { - const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); - } - - /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + return new ContainerRegistryResource(result, this._client); } -} - -/** - * Thenable wrapper for CSharpAppResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class CSharpAppResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerRegistryResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + const helpLink = options?.helpLink; + return new ContainerRegistryResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets the number of replicas */ - withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Disables forwarded headers for the project */ - disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlInternal(url, displayText)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + const displayText = options?.displayText; + return new ContainerRegistryResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromManifestInternal()); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withExplicitStartInternal()); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withHealthCheckInternal(key)); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + const commandOptions = options?.commandOptions; + return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + const iconVariant = options?.iconVariant; + return new ContainerRegistryResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._excludeFromMcpInternal()); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ContainerRegistryResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onBeforeResourceStartedInternal(callback)); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceStoppedInternal(callback)); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onInitializeResourceInternal(callback)); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._onResourceReadyInternal(callback)); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new ContainerRegistryResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); - } +} - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); +/** + * Thenable wrapper for ContainerRegistryResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerRegistryResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerRegistryResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -16728,558 +17605,608 @@ export class CSharpAppResourcePromise implements PromiseLike return this._promise.then(obj => obj.getResourceName()); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } } // ============================================================================ -// DotnetToolResource +// ContainerResource // ============================================================================ -export class DotnetToolResource extends ResourceBuilderBase { - constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { +export class ContainerResource extends ResourceBuilderBase { + constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); } /** @internal */ - private async _withToolPackageInternal(packageId: string): Promise { - const rpcArgs: Record = { builder: this._handle, packageId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPackage', + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEntrypointInternal(entrypoint)); } /** @internal */ - private async _withToolVersionInternal(version: string): Promise { - const rpcArgs: Record = { builder: this._handle, version }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolVersion', + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageTagInternal(tag)); } /** @internal */ - private async _withToolPrereleaseInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolPrerelease', + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageRegistryInternal(registry)); } /** @internal */ - private async _withToolSourceInternal(source: string): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolSource', + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + const tag = options?.tag; + return new ContainerResourcePromise(this._withImageInternal(image, tag)); } /** @internal */ - private async _withToolIgnoreExistingFeedsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreExistingFeeds', + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImageSHA256Internal(sha256)); } /** @internal */ - private async _withToolIgnoreFailedSourcesInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withToolIgnoreFailedSources', + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerRuntimeArgsInternal(args)); } /** @internal */ - private async _publishAsDockerFileInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFile', + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._withLifetimeInternal(lifetime)); } /** @internal */ - private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { - const configureId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; - const obj = new ContainerResource(objHandle, this._client); - await configure(obj); - }); - const rpcArgs: Record = { builder: this._handle, configure: configureId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsDockerFileWithConfigure', + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); } /** @internal */ - private async _withExecutableCommandInternal(command: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExecutableCommand', + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsContainerInternal()); } /** @internal */ - private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { - const rpcArgs: Record = { builder: this._handle, workingDirectory }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withWorkingDirectory', + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new ContainerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNameInternal(name)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ContainerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withContainerNetworkAliasInternal(alias)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - const helpLink = options?.helpLink; - return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ContainerResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + const helpLink = options?.helpLink; + return new ContainerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new DotnetToolResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ContainerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -17289,15 +18216,15 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -17306,72 +18233,72 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new ContainerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new ContainerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -17384,278 +18311,278 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); + return new ContainerResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { const displayText = options?.displayText; - return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ContainerResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { const exitCode = options?.exitCode; - return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new ContainerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -17663,130 +18590,130 @@ export class DotnetToolResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { const commandOptions = options?.commandOptions; - return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { const password = options?.password; - return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new ContainerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { const iconVariant = options?.iconVariant; - return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ContainerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -17795,15 +18722,15 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -17811,56 +18738,56 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -17871,60 +18798,79 @@ export class DotnetToolResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ContainerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new ContainerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); } /** Gets the resource name */ @@ -17937,260 +18883,375 @@ export class DotnetToolResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, name, secretReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { - const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new ContainerResource(result, this._client); } - /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } -} + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ContainerResource(result, this._client); + } -/** - * Thenable wrapper for DotnetToolResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class DotnetToolResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._onResourceReadyInternal(callback)); + } - then( - onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + } + + /** @internal */ + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + } + + /** @internal */ + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withUserAssignedIdentityAzureUserAssignedIdentity', + rpcArgs + ); + return new ContainerResource(result, this._client); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + } + +} + +/** + * Thenable wrapper for ContainerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ContainerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ContainerResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); } - /** Sets the tool package ID */ - withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } - /** Sets the tool version */ - withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + /** Sets the container image tag */ + withImageTag(tag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); } - /** Allows prerelease tool versions */ - withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + /** Sets the container image registry */ + withImageRegistry(registry: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); } - /** Adds a NuGet source for the tool */ - withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); } - /** Ignores existing NuGet feeds */ - withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); } - /** Ignores failed NuGet sources */ - withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } - /** Publishes the executable as a Docker container */ - publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); } - /** Publishes an executable as a Docker file with optional container configuration */ - publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } - /** Sets the executable command */ - withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + /** Configures the resource to be published as a container */ + publishAsContainer(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); } - /** Sets the executable working directory */ - withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ - withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + withOtlpExporter(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Publishes the resource as a connection string */ + publishAsConnectionString(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -18199,158 +19260,163 @@ export class DotnetToolResourcePromise implements PromiseLike obj.asHttp2Service())); + asHttp2Service(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); } /** Gets the resource name */ @@ -18358,403 +19424,417 @@ export class DotnetToolResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); } /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); } /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ContainerResourcePromise { + return new ContainerResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); } } // ============================================================================ -// ExecutableResource +// CSharpAppResource // ============================================================================ -export class ExecutableResource extends ResourceBuilderBase { - constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { +export class CSharpAppResource extends ResourceBuilderBase { + constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new CSharpAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { const path = options?.path; const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); + return new CSharpAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { + private async _withOtlpExporterInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterInternal()); + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - const helpLink = options?.helpLink; - return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReplicasInternal(replicas)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._disableForwardedHeadersInternal()); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + const configure = options?.configure; + return new CSharpAppResourcePromise(this._publishAsDockerFileInternal(configure)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + const helpLink = options?.helpLink; + return new CSharpAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ExecutableResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new CSharpAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -18764,15 +19844,15 @@ export class ExecutableResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -18781,72 +19861,72 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new CSharpAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new CSharpAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -18859,278 +19939,293 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); + return new CSharpAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { const displayText = options?.displayText; - return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new CSharpAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromManifestInternal()); + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForInternal(dependency)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { const exitCode = options?.exitCode; - return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new CSharpAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -19138,130 +20233,130 @@ export class ExecutableResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { const commandOptions = options?.commandOptions; - return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { const password = options?.password; - return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new CSharpAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { const iconVariant = options?.iconVariant; - return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new CSharpAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -19270,15 +20365,15 @@ export class ExecutableResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -19286,56 +20381,56 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -19346,60 +20441,60 @@ export class ExecutableResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new CSharpAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -19412,210 +20507,305 @@ export class ExecutableResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withEnvironmentFromOutput', - rpcArgs + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new CSharpAppResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new CSharpAppResource(result, this._client); } /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); } /** @internal */ - private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, name, secretReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); } /** @internal */ - private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withUserAssignedIdentityAzureUserAssignedIdentity', rpcArgs ); - return new ExecutableResource(result, this._client); + return new CSharpAppResource(result, this._client); } /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); } } /** - * Thenable wrapper for ExecutableResource that enables fluent chaining. + * Thenable wrapper for CSharpAppResource that enables fluent chaining. * @example * await builder.addSomething().withX().withY(); */ -export class ExecutableResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} +export class CSharpAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - then( - onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + then( + onfulfilled?: ((value: CSharpAppResource) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): PromiseLike { return this._promise.then(onfulfilled, onrejected); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ - withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + withOtlpExporter(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Sets the number of replicas */ + withReplicas(replicas: number): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -19624,158 +20814,163 @@ export class ExecutableResourcePromise implements PromiseLike obj.asHttp2Service())); + asHttp2Service(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); - } + waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -19783,3235 +20978,3223 @@ export class ExecutableResourcePromise implements PromiseLike obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); } /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); } /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): CSharpAppResourcePromise { + return new CSharpAppResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); } } // ============================================================================ -// ExternalServiceResource +// DotnetToolResource // ============================================================================ -export class ExternalServiceResource extends ResourceBuilderBase { - constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { +export class DotnetToolResource extends ResourceBuilderBase { + constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new DotnetToolResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalServiceHttpHealthCheck', + private async _withToolPackageInternal(packageId: string): Promise { + const rpcArgs: Record = { builder: this._handle, packageId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPackage', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPackageInternal(packageId)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withToolVersionInternal(version: string): Promise { + const rpcArgs: Record = { builder: this._handle, version }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolVersion', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - const helpLink = options?.helpLink; - return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolVersionInternal(version)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + private async _withToolPrereleaseInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolPrerelease', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolPrereleaseInternal()); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + private async _withToolSourceInternal(source: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolSource', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolSourceInternal(source)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _withToolIgnoreExistingFeedsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreExistingFeeds', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreExistingFeedsInternal()); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _withToolIgnoreFailedSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withToolIgnoreFailedSources', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - const displayText = options?.displayText; - return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withToolIgnoreFailedSourcesInternal()); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - const commandOptions = options?.commandOptions; - return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - const iconVariant = options?.iconVariant; - return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + const helpLink = options?.helpLink; + return new DotnetToolResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); - } + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsInternal(args)); + } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); + return new DotnetToolResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } -} - -/** - * Thenable wrapper for ExternalServiceResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ExternalServiceResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new DotnetToolResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds an HTTP health check to an external service */ - withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceUriInternal(name, uri)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new DotnetToolResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Adds a health check by key */ - withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new DotnetToolResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); - } - - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); - } - - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); - } - -} - -// ============================================================================ -// ParameterResource -// ============================================================================ - -export class ParameterResource extends ResourceBuilderBase { - constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { - super(handle, client); - } - - /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', - rpcArgs - ); - return new ParameterResource(result, this._client); - } - - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); - } - - /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', - rpcArgs - ); - return new ParameterResource(result, this._client); - } - - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); - } - - /** @internal */ - private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, description }; - if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDescription', - rpcArgs - ); - return new ParameterResource(result, this._client); - } - - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - const enableMarkdown = options?.enableMarkdown; - return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); - } - - /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', - rpcArgs - ); - return new ParameterResource(result, this._client); - } - - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - const helpLink = options?.helpLink; - return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures resource for HTTP/2 */ + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + return new DotnetToolResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { const displayText = options?.displayText; - return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new DotnetToolResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromManifestInternal()); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _excludeFromManifestInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._withExplicitStartInternal()); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - const commandOptions = options?.commandOptions; - return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - const iconVariant = options?.iconVariant; - return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._excludeFromMcpInternal()); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + const exitCode = options?.exitCode; + return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + const commandOptions = options?.commandOptions; + return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ParameterResource(result, this._client); - } - - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new DotnetToolResource(result, this._client); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new ParameterResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ParameterResourcePromise { - return new ParameterResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + const password = options?.password; + return new DotnetToolResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } -} - -/** - * Thenable wrapper for ParameterResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ParameterResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Sets a parameter description */ - withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + const iconVariant = options?.iconVariant; + return new DotnetToolResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); - } - - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new DotnetToolResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._excludeFromMcpInternal()); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new DotnetToolResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new DotnetToolResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); - } - - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); - } - -} - -// ============================================================================ -// ProjectResource -// ============================================================================ - -export class ProjectResource extends ResourceBuilderBase { - constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { - super(handle, client); + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ProjectResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new ProjectResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new ProjectResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new ProjectResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterInternal()); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new ProjectResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new ProjectResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - const helpLink = options?.helpLink; - return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', rpcArgs ); - return new ProjectResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', rpcArgs ); - return new ProjectResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withUserAssignedIdentityAzureUserAssignedIdentity', rpcArgs ); - return new ProjectResource(result, this._client); + return new DotnetToolResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); } - /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', - rpcArgs - ); - return new ProjectResource(result, this._client); +} + +/** + * Thenable wrapper for DotnetToolResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class DotnetToolResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: DotnetToolResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets the tool package ID */ + withToolPackage(packageId: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); } - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets the tool version */ + withToolVersion(version: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + /** Allows prerelease tool versions */ + withToolPrerelease(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); } - /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a NuGet source for the tool */ + withToolSource(source: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Ignores existing NuGet feeds */ + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); } - /** @internal */ - private async _withArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgs', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Ignores failed NuGet sources */ + withToolIgnoreFailedSources(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); } - /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsInternal(args)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallback', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + /** Sets the executable command */ + withExecutableCommand(command: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; - const arg = new CommandLineArgsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withArgsCallbackAsync', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (connectionName !== undefined) rpcArgs.connectionName = connectionName; - if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReference', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Configures OTLP telemetry export */ + withOtlpExporter(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { - const connectionName = options?.connectionName; - const optional = options?.optional; - return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceInternal(source)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceUri', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { - const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceExternalService', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds arguments */ + withArgs(args: string[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withReferenceEndpoint', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (scheme !== undefined) rpcArgs.scheme = scheme; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - if (isExternal !== undefined) rpcArgs.isExternal = isExternal; - if (protocol !== undefined) rpcArgs.protocol = protocol; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpoint', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const scheme = options?.scheme; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - const isExternal = options?.isExternal; - const protocol = options?.protocol; - return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } - /** @internal */ - private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpEndpoint', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - if (targetPort !== undefined) rpcArgs.targetPort = targetPort; - if (name !== undefined) rpcArgs.name = name; - if (env !== undefined) rpcArgs.env = env; - if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsEndpoint', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { - const port = options?.port; - const targetPort = options?.targetPort; - const name = options?.name; - const env = options?.env; - const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); - } - - /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExternalHttpEndpoints', - rpcArgs - ); - return new ProjectResource(result, this._client); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ - async getEndpoint(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getEndpoint', - rpcArgs - ); - } - - /** @internal */ - private async _asHttp2ServiceInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/asHttp2Service', - rpcArgs - ); - return new ProjectResource(result, this._client); + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._asHttp2ServiceInternal()); - } - - /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', - rpcArgs - ); - return new ProjectResource(result, this._client); + asHttp2Service(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } - /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } - /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { - const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } - /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { - const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } - /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); - return await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpointFactory', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } - /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, destinationPath }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Prevents resource from starting automatically */ + withExplicitStart(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } - /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a health check by key */ + withHealthCheck(key: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromManifestInternal()); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } - /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForInternal(dependency)); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } - /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForWithBehavior', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } - /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } - /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { - const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStartWithBehavior', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } - /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } - /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExplicitStartInternal()); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { - const rpcArgs: Record = { builder: this._handle, dependency }; - if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { - const exitCode = options?.exitCode; - return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } - /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } - /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } - /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (statusCode !== undefined) rpcArgs.statusCode = statusCode; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpHealthCheck', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { - const path = options?.path; - const statusCode = options?.statusCode; - const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { - const commandOptions = options?.commandOptions; - return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDeveloperCertificateTrust', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { - const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCertificateTrustScope', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } - /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', - rpcArgs - ); - return new ProjectResource(result, this._client); + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { - const password = options?.password; - return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); } - /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): DotnetToolResourcePromise { + return new DotnetToolResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + } + +} + +// ============================================================================ +// ExecutableResource +// ============================================================================ + +export class ExecutableResource extends ResourceBuilderBase { + constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withoutHttpsCertificate', + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExecutableResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { - const iconVariant = options?.iconVariant; - return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { - const rpcArgs: Record = { builder: this._handle, probeType }; + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; - if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; - if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; - if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; - if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; - if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpProbe', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { const path = options?.path; - const initialDelaySeconds = options?.initialDelaySeconds; - const periodSeconds = options?.periodSeconds; - const timeoutSeconds = options?.timeoutSeconds; - const failureThreshold = options?.failureThreshold; - const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new ExecutableResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _excludeFromMcpInternal(): Promise { + private async _withOtlpExporterInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromMcpInternal()); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + const helpLink = options?.helpLink; + return new ExecutableResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentInternal(name, value)); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); + return new ExecutableResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, name, secretReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { - const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new ProjectResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } -} - -/** - * Thenable wrapper for ProjectResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ProjectResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } - then( - onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ExecutableResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceUriInternal(name, uri)); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ExecutableResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ExecutableResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds arguments */ - withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExternalHttpEndpointsInternal()); } - /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); } - /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._asHttp2ServiceInternal()); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); } - /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } - /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlInternal(url, displayText)); } - /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + const displayText = options?.displayText; + return new ExecutableResourcePromise(this._withUrlExpressionInternal(url, displayText)); } - /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Gets an endpoint reference */ - getEndpoint(name: string): Promise { - return this._promise.then(obj => obj.getEndpoint(name)); + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } - /** Configures resource for HTTP/2 */ - asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromManifestInternal()); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForInternal(dependency)); } - /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); } - /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } - /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExecutableResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withExplicitStartInternal()); } - /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + const exitCode = options?.exitCode; + return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } - /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + /** Adds a health check by key */ + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withHealthCheckInternal(key)); } - /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } - /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + const commandOptions = options?.commandOptions; + return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withCertificateTrustScopeInternal(scope)); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + const password = options?.password; + return new ExecutableResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withoutHttpsCertificateInternal()); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); } - /** Gets the resource name */ - getResourceName(): Promise { - return this._promise.then(obj => obj.getResourceName()); + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); } - /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExecutableResource(result, this._client); } - /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + const iconVariant = options?.iconVariant; + return new ExecutableResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } - /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ExecutableResource(result, this._client); } -} + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ExecutableResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } -// ============================================================================ -// SqlServerDatabaseResource -// ============================================================================ + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } -export class SqlServerDatabaseResource extends ResourceBuilderBase { - constructor(handle: SqlServerDatabaseResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._excludeFromMcpInternal()); } - /** Gets the Parent property */ - parent = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.parent', - { context: this._handle } - ); - return new SqlServerServerResource(handle, this._client); - }, - }; + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ExecutableResource(result, this._client); + } - /** Gets the ConnectionStringExpression property */ - connectionStringExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.connectionStringExpression', - { context: this._handle } - ); - }, - }; - - /** Gets the UriExpression property */ - uriExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.uriExpression', - { context: this._handle } - ); - }, - }; - - /** Gets the JdbcConnectionString property */ - jdbcConnectionString = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.jdbcConnectionString', - { context: this._handle } - ); - }, - }; - - /** Gets the DatabaseName property */ - databaseName = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.databaseName', - { context: this._handle } - ); - }, - }; - - /** Gets the Name property */ - name = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.name', - { context: this._handle } - ); - }, - }; + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withContainerRegistryInternal(registry)); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (buildImage !== undefined) rpcArgs.buildImage = buildImage; - if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfileBaseImage', + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerDatabaseResourcePromise { - const buildImage = options?.buildImage; - const runtimeImage = options?.runtimeImage; - return new SqlServerDatabaseResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExecutableResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerDatabaseResourcePromise { - const helpLink = options?.helpLink; - return new SqlServerDatabaseResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); } - /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); - } - - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withConnectionPropertyValueInternal(name, value)); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); - await callback(obj); + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallback', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withUrlsCallbackInternal(callback)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; - const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlsCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrl', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): SqlServerDatabaseResourcePromise { - const displayText = options?.displayText; - return new SqlServerDatabaseResourcePromise(this._withUrlInternal(url, displayText)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { - const rpcArgs: Record = { builder: this._handle, url }; - if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlExpression', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerDatabaseResourcePromise { - const displayText = options?.displayText; - return new SqlServerDatabaseResourcePromise(this._withUrlExpressionInternal(url, displayText)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; - await callback(obj); + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); }); - const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withUrlForEndpoint', + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromManifest', + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._excludeFromManifestInternal()); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withExplicitStart', - rpcArgs + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Prevents resource from starting automatically */ - withExplicitStart(): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withExplicitStartInternal()); + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { - const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHealthCheck', + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a health check by key */ - withHealthCheck(key: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withHealthCheckInternal(key)); + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { - const executeCommandId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); - return await executeCommand(arg); - }); - const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; - if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withCommand', + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withUserAssignedIdentityAzureUserAssignedIdentity', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ExecutableResource(result, this._client); } - /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerDatabaseResourcePromise { - const commandOptions = options?.commandOptions; - return new SqlServerDatabaseResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); } - /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', - rpcArgs - ); - return new SqlServerDatabaseResource(result, this._client); - } +} - /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withParentRelationshipInternal(parent)); - } +/** + * Thenable wrapper for ExecutableResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExecutableResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} - /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', - rpcArgs - ); - return new SqlServerDatabaseResource(result, this._client); + then( + onfulfilled?: ((value: ExecutableResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withChildRelationshipInternal(child)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } - /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { - const rpcArgs: Record = { builder: this._handle, iconName }; - if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withIconName', - rpcArgs - ); - return new SqlServerDatabaseResource(result, this._client); + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): SqlServerDatabaseResourcePromise { - const iconVariant = options?.iconVariant; - return new SqlServerDatabaseResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** @internal */ - private async _excludeFromMcpInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/excludeFromMcp', - rpcArgs - ); - return new SqlServerDatabaseResource(result, this._client); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._excludeFromMcpInternal()); + /** Sets the executable command */ + withExecutableCommand(command: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new SqlServerDatabaseResource(result, this._client); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new SqlServerDatabaseResource(result, this._client); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; - if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; - if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; - if (tags !== undefined) rpcArgs.tags = tags; - if (description !== undefined) rpcArgs.description = description; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineStepFactory', - rpcArgs - ); - return new SqlServerDatabaseResource(result, this._client); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } - /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerDatabaseResourcePromise { - const dependsOn = options?.dependsOn; - const requiredBy = options?.requiredBy; - const tags = options?.tags; - const description = options?.description; - return new SqlServerDatabaseResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; - const arg = new PipelineConfigurationContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfigurationAsync', - rpcArgs - ); - return new SqlServerDatabaseResource(result, this._client); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } - /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withPipelineConfiguration', - rpcArgs - ); - return new SqlServerDatabaseResource(result, this._client); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } - /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withPipelineConfigurationInternal(callback)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } - /** Gets the resource name */ - async getResourceName(): Promise { - const rpcArgs: Record = { resource: this._handle }; - return await this._client.invokeCapability( - 'Aspire.Hosting/getResourceName', - rpcArgs - ); + /** Adds arguments */ + withArgs(args: string[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); } - /** @internal */ - private async _withCreationScriptInternal(script: string): Promise { - const rpcArgs: Record = { builder: this._handle, script }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.SqlServer/withCreationScript', - rpcArgs - ); - return new SqlServerDatabaseResource(result, this._client); + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } - /** Defines the SQL script used to create the database */ - withCreationScript(script: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withCreationScriptInternal(script)); + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } - /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', - rpcArgs - ); - return new SqlServerDatabaseResource(result, this._client); + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } -} + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } -/** - * Thenable wrapper for SqlServerDatabaseResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class SqlServerDatabaseResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } - then( - onfulfilled?: ((value: SqlServerDatabaseResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } - /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + /** Configures resource for HTTP/2 */ + asHttp2Service(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -23019,815 +24202,9774 @@ export class SqlServerDatabaseResourcePromise implements PromiseLike obj.getResourceName()); } - /** Defines the SQL script used to create the database */ - withCreationScript(script: string): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withCreationScript(script))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ExecutableResourcePromise { + return new ExecutableResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); } } // ============================================================================ -// SqlServerServerResource +// ExternalServiceResource // ============================================================================ -export class SqlServerServerResource extends ResourceBuilderBase { - constructor(handle: SqlServerServerResourceHandle, client: AspireClientRpc) { +export class ExternalServiceResource extends ResourceBuilderBase { + constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { super(handle, client); } - /** Gets the PrimaryEndpoint property */ - primaryEndpoint = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.primaryEndpoint', - { context: this._handle } - ); - return new EndpointReference(handle, this._client); - }, - }; + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } - /** Gets the Host property */ - host = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.host', - { context: this._handle } - ); - return new EndpointReferenceExpression(handle, this._client); - }, - }; + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + } - /** Gets the Port property */ - port = { - get: async (): Promise => { - const handle = await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.port', - { context: this._handle } - ); - return new EndpointReferenceExpression(handle, this._client); - }, - }; - - /** Gets the UserNameReference property */ - userNameReference = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.userNameReference', - { context: this._handle } - ); - }, - }; - - /** Gets the UriExpression property */ - uriExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.uriExpression', - { context: this._handle } - ); - }, - }; - - /** Gets the JdbcConnectionString property */ - jdbcConnectionString = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.jdbcConnectionString', - { context: this._handle } - ); - }, - }; - - /** Gets the ConnectionStringExpression property */ - connectionStringExpression = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.connectionStringExpression', - { context: this._handle } - ); - }, - }; - - /** Gets the Databases property */ - private _databases?: AspireDict; - get databases(): AspireDict { - if (!this._databases) { - this._databases = new AspireDict( - this._handle, - this._client, - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.databases', - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.databases' - ); - } - return this._databases; + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); } - /** Gets the Entrypoint property */ - entrypoint = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.entrypoint', - { context: this._handle } - ); - }, - set: async (value: string): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.setEntrypoint', - { context: this._handle, value } - ); - } - }; - - /** Gets the ShellExecution property */ - shellExecution = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.shellExecution', - { context: this._handle } - ); - }, - set: async (value: boolean): Promise => { - await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.setShellExecution', - { context: this._handle, value } - ); - } - }; - - /** Gets the Name property */ - name = { - get: async (): Promise => { - return await this._client.invokeCapability( - 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.name', - { context: this._handle } - ); - }, - }; + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ExternalServiceResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRegistry', + private async _withExternalServiceHttpHealthCheckInternal(path?: string, statusCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalServiceHttpHealthCheck', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withContainerRegistryInternal(registry)); + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + return new ExternalServiceResourcePromise(this._withExternalServiceHttpHealthCheckInternal(path, statusCode)); } /** @internal */ - private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source, target }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBindMount', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): SqlServerServerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new SqlServerServerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + const helpLink = options?.helpLink; + return new ExternalServiceResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEntrypointInternal(entrypoint: string): Promise { - const rpcArgs: Record = { builder: this._handle, entrypoint }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEntrypoint', + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEntrypointInternal(entrypoint)); + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withImageTagInternal(tag: string): Promise { - const rpcArgs: Record = { builder: this._handle, tag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageTag', + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Sets the container image tag */ - withImageTag(tag: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withImageTagInternal(tag)); + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withImageRegistryInternal(registry: string): Promise { - const rpcArgs: Record = { builder: this._handle, registry }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageRegistry', + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withImageRegistryInternal(registry)); + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withImageInternal(image: string, tag?: string): Promise { - const rpcArgs: Record = { builder: this._handle, image }; - if (tag !== undefined) rpcArgs.tag = tag; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImage', + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): SqlServerServerResourcePromise { - const tag = options?.tag; - return new SqlServerServerResourcePromise(this._withImageInternal(image, tag)); + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + const displayText = options?.displayText; + return new ExternalServiceResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withImageSHA256Internal(sha256: string): Promise { - const rpcArgs: Record = { builder: this._handle, sha256 }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImageSHA256', + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ExternalServiceResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + const commandOptions = options?.commandOptions; + return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + const iconVariant = options?.iconVariant; + return new ExternalServiceResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ExternalServiceResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new ExternalServiceResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for ExternalServiceResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ExternalServiceResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ExternalServiceResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds an HTTP health check to an external service */ + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// JavaScriptAppResource +// ============================================================================ + +export class JavaScriptAppResource extends ResourceBuilderBase { + constructor(handle: JavaScriptAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new JavaScriptAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + const helpLink = options?.helpLink; + return new JavaScriptAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new JavaScriptAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new JavaScriptAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new JavaScriptAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new JavaScriptAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + const displayText = options?.displayText; + return new JavaScriptAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + const displayText = options?.displayText; + return new JavaScriptAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + const exitCode = options?.exitCode; + return new JavaScriptAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + const commandOptions = options?.commandOptions; + return new JavaScriptAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + const password = options?.password; + return new JavaScriptAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + const iconVariant = options?.iconVariant; + return new JavaScriptAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new JavaScriptAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new JavaScriptAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withYarnInternal(install, installArgs)); + } + + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new JavaScriptAppResourcePromise(this._withPnpmInternal(install, installArgs)); + } + + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + const args = options?.args; + return new JavaScriptAppResourcePromise(this._withRunScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + const browser = options?.browser; + return new JavaScriptAppResourcePromise(this._withBrowserDebuggerInternal(browser)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + } + + /** @internal */ + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + } + + /** @internal */ + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withUserAssignedIdentityAzureUserAssignedIdentity', + rpcArgs + ); + return new JavaScriptAppResource(result, this._client); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + } + +} + +/** + * Thenable wrapper for JavaScriptAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class JavaScriptAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: JavaScriptAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): JavaScriptAppResourcePromise { + return new JavaScriptAppResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + } + +} + +// ============================================================================ +// NodeAppResource +// ============================================================================ + +export class NodeAppResource extends ResourceBuilderBase { + constructor(handle: NodeAppResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new NodeAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _publishAsDockerFileInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileInternal()); + } + + /** @internal */ + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + } + + /** @internal */ + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExecutableCommandInternal(command)); + } + + /** @internal */ + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + const helpLink = options?.helpLink; + return new NodeAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new NodeAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new NodeAppResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new NodeAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + const displayText = options?.displayText; + return new NodeAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + const exitCode = options?.exitCode; + return new NodeAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + const commandOptions = options?.commandOptions; + return new NodeAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + const password = options?.password; + return new NodeAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + const iconVariant = options?.iconVariant; + return new NodeAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new NodeAppResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new NodeAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); + } + + /** @internal */ + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withBunInternal(install, installArgs)); + } + + /** @internal */ + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withYarnInternal(install, installArgs)); + } + + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new NodeAppResourcePromise(this._withPnpmInternal(install, installArgs)); + } + + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + const args = options?.args; + return new NodeAppResourcePromise(this._withRunScriptInternal(scriptName, args)); + } + + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + const browser = options?.browser; + return new NodeAppResourcePromise(this._withBrowserDebuggerInternal(browser)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + } + + /** @internal */ + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + } + + /** @internal */ + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withUserAssignedIdentityAzureUserAssignedIdentity', + rpcArgs + ); + return new NodeAppResource(result, this._client); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + } + +} + +/** + * Thenable wrapper for NodeAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class NodeAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: NodeAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + } + + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + } + + /** Sets the executable command */ + withExecutableCommand(command: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + } + + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): NodeAppResourcePromise { + return new NodeAppResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + } + +} + +// ============================================================================ +// ParameterResource +// ============================================================================ + +export class ParameterResource extends ResourceBuilderBase { + constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ParameterResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withDescriptionInternal(description: string, enableMarkdown?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, description }; + if (enableMarkdown !== undefined) rpcArgs.enableMarkdown = enableMarkdown; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDescription', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + const enableMarkdown = options?.enableMarkdown; + return new ParameterResourcePromise(this._withDescriptionInternal(description, enableMarkdown)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + const helpLink = options?.helpLink; + return new ParameterResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + const displayText = options?.displayText; + return new ParameterResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + const commandOptions = options?.commandOptions; + return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + const iconVariant = options?.iconVariant; + return new ParameterResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ParameterResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new ParameterResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ParameterResourcePromise { + return new ParameterResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for ParameterResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ParameterResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ParameterResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Sets a parameter description */ + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ParameterResourcePromise { + return new ParameterResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// ProjectResource +// ============================================================================ + +export class ProjectResource extends ResourceBuilderBase { + constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _withReplicasInternal(replicas: number): Promise { + const rpcArgs: Record = { builder: this._handle, replicas }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReplicas', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReplicasInternal(replicas)); + } + + /** @internal */ + private async _disableForwardedHeadersInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableForwardedHeaders', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._disableForwardedHeadersInternal()); + } + + /** @internal */ + private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { + const configureId = configure ? registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }) : undefined; + const rpcArgs: Record = { builder: this._handle }; + if (configure !== undefined) rpcArgs.configure = configureId; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + const configure = options?.configure; + return new ProjectResourcePromise(this._publishAsDockerFileInternal(configure)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + const helpLink = options?.helpLink; + return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + const displayText = options?.displayText; + return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, source, destinationPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishWithContainerFilesFromResource', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + const exitCode = options?.exitCode; + return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + const commandOptions = options?.commandOptions; + return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + const password = options?.password; + return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + const iconVariant = options?.iconVariant; + return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + } + + /** @internal */ + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + } + + /** @internal */ + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withUserAssignedIdentityAzureUserAssignedIdentity', + rpcArgs + ); + return new ProjectResource(result, this._client); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + } + +} + +/** + * Thenable wrapper for ProjectResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ProjectResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ProjectResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Sets the number of replicas */ + withReplicas(replicas: number): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + } + + /** Disables forwarded headers for the project */ + disableForwardedHeaders(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + } + + /** Publishes a project as a Docker file with optional container configuration */ + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds arguments */ + withArgs(args: string[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Configures the resource to copy container files from the specified source during publishing */ + publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ProjectResourcePromise { + return new ProjectResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + } + +} + +// ============================================================================ +// SqlServerDatabaseResource +// ============================================================================ + +export class SqlServerDatabaseResource extends ResourceBuilderBase { + constructor(handle: SqlServerDatabaseResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the Parent property */ + parent = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.parent', + { context: this._handle } + ); + return new SqlServerServerResource(handle, this._client); + }, + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the JdbcConnectionString property */ + jdbcConnectionString = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.jdbcConnectionString', + { context: this._handle } + ); + }, + }; + + /** Gets the DatabaseName property */ + databaseName = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.databaseName', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerDatabaseResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerDatabaseResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new SqlServerDatabaseResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerDatabaseResourcePromise { + const helpLink = options?.helpLink; + return new SqlServerDatabaseResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): SqlServerDatabaseResourcePromise { + const displayText = options?.displayText; + return new SqlServerDatabaseResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerDatabaseResourcePromise { + const displayText = options?.displayText; + return new SqlServerDatabaseResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerDatabaseResourcePromise { + const commandOptions = options?.commandOptions; + return new SqlServerDatabaseResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): SqlServerDatabaseResourcePromise { + const iconVariant = options?.iconVariant; + return new SqlServerDatabaseResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerDatabaseResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new SqlServerDatabaseResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._onConnectionStringAvailableInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _withCreationScriptInternal(script: string): Promise { + const rpcArgs: Record = { builder: this._handle, script }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withCreationScript', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Defines the SQL script used to create the database */ + withCreationScript(script: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withCreationScriptInternal(script)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + +} + +/** + * Thenable wrapper for SqlServerDatabaseResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class SqlServerDatabaseResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: SqlServerDatabaseResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Defines the SQL script used to create the database */ + withCreationScript(script: string): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withCreationScript(script))); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + } + +} + +// ============================================================================ +// SqlServerServerResource +// ============================================================================ + +export class SqlServerServerResource extends ResourceBuilderBase { + constructor(handle: SqlServerServerResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** Gets the PrimaryEndpoint property */ + primaryEndpoint = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.primaryEndpoint', + { context: this._handle } + ); + return new EndpointReference(handle, this._client); + }, + }; + + /** Gets the Host property */ + host = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.host', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the Port property */ + port = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.port', + { context: this._handle } + ); + return new EndpointReferenceExpression(handle, this._client); + }, + }; + + /** Gets the PasswordParameter property */ + passwordParameter = { + get: async (): Promise => { + const handle = await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.passwordParameter', + { context: this._handle } + ); + return new ParameterResource(handle, this._client); + }, + }; + + /** Gets the UserNameReference property */ + userNameReference = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.userNameReference', + { context: this._handle } + ); + }, + }; + + /** Gets the UriExpression property */ + uriExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.uriExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the JdbcConnectionString property */ + jdbcConnectionString = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.jdbcConnectionString', + { context: this._handle } + ); + }, + }; + + /** Gets the ConnectionStringExpression property */ + connectionStringExpression = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.connectionStringExpression', + { context: this._handle } + ); + }, + }; + + /** Gets the Databases property */ + private _databases?: AspireDict; + get databases(): AspireDict { + if (!this._databases) { + this._databases = new AspireDict( + this._handle, + this._client, + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.databases', + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.databases' + ); + } + return this._databases; + } + + /** Gets the Entrypoint property */ + entrypoint = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.entrypoint', + { context: this._handle } + ); + }, + set: async (value: string): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.setEntrypoint', + { context: this._handle, value } + ); + } + }; + + /** Gets the ShellExecution property */ + shellExecution = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.shellExecution', + { context: this._handle } + ); + }, + set: async (value: boolean): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.setShellExecution', + { context: this._handle, value } + ); + } + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/SqlServerServerResource.name', + { context: this._handle } + ); + }, + }; + + /** @internal */ + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withContainerRegistryInternal(registry)); + } + + /** @internal */ + private async _withBindMountInternal(source: string, target: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source, target }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBindMount', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): SqlServerServerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new SqlServerServerResourcePromise(this._withBindMountInternal(source, target, isReadOnly)); + } + + /** @internal */ + private async _withEntrypointInternal(entrypoint: string): Promise { + const rpcArgs: Record = { builder: this._handle, entrypoint }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEntrypoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEntrypointInternal(entrypoint)); + } + + /** @internal */ + private async _withImageTagInternal(tag: string): Promise { + const rpcArgs: Record = { builder: this._handle, tag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageTag', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container image tag */ + withImageTag(tag: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withImageTagInternal(tag)); + } + + /** @internal */ + private async _withImageRegistryInternal(registry: string): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageRegistry', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withImageRegistryInternal(registry)); + } + + /** @internal */ + private async _withImageInternal(image: string, tag?: string): Promise { + const rpcArgs: Record = { builder: this._handle, image }; + if (tag !== undefined) rpcArgs.tag = tag; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImage', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): SqlServerServerResourcePromise { + const tag = options?.tag; + return new SqlServerServerResourcePromise(this._withImageInternal(image, tag)); + } + + /** @internal */ + private async _withImageSHA256Internal(sha256: string): Promise { + const rpcArgs: Record = { builder: this._handle, sha256 }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImageSHA256', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withImageSHA256Internal(sha256)); + } + + /** @internal */ + private async _withContainerRuntimeArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRuntimeArgs', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + } + + /** @internal */ + private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { + const rpcArgs: Record = { builder: this._handle, lifetime }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withLifetime', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withLifetimeInternal(lifetime)); + } + + /** @internal */ + private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { + const rpcArgs: Record = { builder: this._handle, pullPolicy }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withImagePullPolicy', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + } + + /** @internal */ + private async _publishAsContainerInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsContainer', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._publishAsContainerInternal()); + } + + /** @internal */ + private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { + const rpcArgs: Record = { builder: this._handle, contextPath }; + if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; + if (stage !== undefined) rpcArgs.stage = stage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfile', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): SqlServerServerResourcePromise { + const dockerfilePath = options?.dockerfilePath; + const stage = options?.stage; + return new SqlServerServerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + } + + /** @internal */ + private async _withContainerNameInternal(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerName', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the container name */ + withContainerName(name: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withContainerNameInternal(name)); + } + + /** @internal */ + private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildArg', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withBuildArgInternal(name, value)); + } + + /** @internal */ + private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterBuildSecret', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withBuildSecretInternal(name, value)); + } + + /** @internal */ + private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, proxyEnabled }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpointProxySupport', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + } + + /** @internal */ + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (buildImage !== undefined) rpcArgs.buildImage = buildImage; + if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDockerfileBaseImage', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerServerResourcePromise { + const buildImage = options?.buildImage; + const runtimeImage = options?.runtimeImage; + return new SqlServerServerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + } + + /** @internal */ + private async _withContainerNetworkAliasInternal(alias: string): Promise { + const rpcArgs: Record = { builder: this._handle, alias }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerNetworkAlias', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + } + + /** @internal */ + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): SqlServerServerResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new SqlServerServerResourcePromise(this._withMcpServerInternal(path, endpointName)); + } + + /** @internal */ + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withOtlpExporterInternal()); + } + + /** @internal */ + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + } + + /** @internal */ + private async _publishAsConnectionStringInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsConnectionString', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._publishAsConnectionStringInternal()); + } + + /** @internal */ + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerServerResourcePromise { + const helpLink = options?.helpLink; + return new SqlServerServerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + } + + /** @internal */ + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + } + + /** @internal */ + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentEndpoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + } + + /** @internal */ + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentInternal(name, value)); + } + + /** @internal */ + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + } + + /** @internal */ + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + } + + /** @internal */ + private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionProperty', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withConnectionPropertyInternal(name, value)); + } + + /** @internal */ + private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withConnectionPropertyValue', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + } + + /** @internal */ + private async _withArgsInternal(args: string[]): Promise { + const rpcArgs: Record = { builder: this._handle, args }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgs', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds arguments */ + withArgs(args: string[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withArgsInternal(args)); + } + + /** @internal */ + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; + const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallback', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withArgsCallbackInternal(callback)); + } + + /** @internal */ + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; + const arg = new CommandLineArgsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withArgsCallbackAsync', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (connectionName !== undefined) rpcArgs.connectionName = connectionName; + if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReference', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): SqlServerServerResourcePromise { + const connectionName = options?.connectionName; + const optional = options?.optional; + const name = options?.name; + return new SqlServerServerResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + } + + /** Gets a connection property by key */ + async getConnectionProperty(key: string): Promise { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _withReferenceUriInternal(name: string, uri: string): Promise { + const rpcArgs: Record = { builder: this._handle, name, uri }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceUri', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withReferenceUriInternal(name, uri)); + } + + /** @internal */ + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + const rpcArgs: Record = { builder: this._handle, externalService }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceExternalService', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + } + + /** @internal */ + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, endpointReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withReferenceEndpoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + } + + /** @internal */ + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (scheme !== undefined) rpcArgs.scheme = scheme; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + if (isExternal !== undefined) rpcArgs.isExternal = isExternal; + if (protocol !== undefined) rpcArgs.protocol = protocol; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEndpoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): SqlServerServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const scheme = options?.scheme; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + const isExternal = options?.isExternal; + const protocol = options?.protocol; + return new SqlServerServerResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + } + + /** @internal */ + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpEndpoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): SqlServerServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new SqlServerServerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + if (targetPort !== undefined) rpcArgs.targetPort = targetPort; + if (name !== undefined) rpcArgs.name = name; + if (env !== undefined) rpcArgs.env = env; + if (isProxied !== undefined) rpcArgs.isProxied = isProxied; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpsEndpoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): SqlServerServerResourcePromise { + const port = options?.port; + const targetPort = options?.targetPort; + const name = options?.name; + const env = options?.env; + const isProxied = options?.isProxied; + return new SqlServerServerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + } + + /** @internal */ + private async _withExternalHttpEndpointsInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExternalHttpEndpoints', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withExternalHttpEndpointsInternal()); + } + + /** Gets an endpoint reference */ + async getEndpoint(name: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getEndpoint', + rpcArgs + ); + } + + /** @internal */ + private async _asHttp2ServiceInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/asHttp2Service', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._asHttp2ServiceInternal()); + } + + /** @internal */ + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; + const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallback', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withUrlsCallbackInternal(callback)); + } + + /** @internal */ + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; + const arg = new ResourceUrlsCallbackContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlsCallbackAsync', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + } + + /** @internal */ + private async _withUrlInternal(url: string, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrl', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): SqlServerServerResourcePromise { + const displayText = options?.displayText; + return new SqlServerServerResourcePromise(this._withUrlInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + const rpcArgs: Record = { builder: this._handle, url }; + if (displayText !== undefined) rpcArgs.displayText = displayText; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlExpression', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerServerResourcePromise { + const displayText = options?.displayText; + return new SqlServerServerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + } + + /** @internal */ + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpoint', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + } + + /** @internal */ + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; + const arg = new EndpointReference(argHandle, this._client); + return await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withUrlForEndpointFactory', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromManifest', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._excludeFromManifestInternal()); + } + + /** @internal */ + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._waitForInternal(dependency)); + } + + /** @internal */ + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForWithBehavior', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._waitForStartInternal(dependency)); + } + + /** @internal */ + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForStartWithBehavior', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + } + + /** @internal */ + private async _withExplicitStartInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExplicitStart', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withExplicitStartInternal()); + } + + /** @internal */ + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + const rpcArgs: Record = { builder: this._handle, dependency }; + if (exitCode !== undefined) rpcArgs.exitCode = exitCode; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): SqlServerServerResourcePromise { + const exitCode = options?.exitCode; + return new SqlServerServerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + } + + /** @internal */ + private async _withHealthCheckInternal(key: string): Promise { + const rpcArgs: Record = { builder: this._handle, key }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHealthCheck', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withHealthCheckInternal(key)); + } + + /** @internal */ + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (statusCode !== undefined) rpcArgs.statusCode = statusCode; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpHealthCheck', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): SqlServerServerResourcePromise { + const path = options?.path; + const statusCode = options?.statusCode; + const endpointName = options?.endpointName; + return new SqlServerServerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + } + + /** @internal */ + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + const executeCommandId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; + const arg = new ExecuteCommandContext(argHandle, this._client); + return await executeCommand(arg); + }); + const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; + if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCommand', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerServerResourcePromise { + const commandOptions = options?.commandOptions; + return new SqlServerServerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + } + + /** @internal */ + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, trust }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withDeveloperCertificateTrust', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + } + + /** @internal */ + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + const rpcArgs: Record = { builder: this._handle, scope }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withCertificateTrustScope', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + } + + /** @internal */ + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (password !== undefined) rpcArgs.password = password; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): SqlServerServerResourcePromise { + const password = options?.password; + return new SqlServerServerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + } + + /** @internal */ + private async _withoutHttpsCertificateInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withoutHttpsCertificate', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withoutHttpsCertificateInternal()); + } + + /** @internal */ + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, parent }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withParentRelationshipInternal(parent)); + } + + /** @internal */ + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, child }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withChildRelationshipInternal(child)); + } + + /** @internal */ + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + const rpcArgs: Record = { builder: this._handle, iconName }; + if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withIconName', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): SqlServerServerResourcePromise { + const iconVariant = options?.iconVariant; + return new SqlServerServerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + } + + /** @internal */ + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, probeType }; + if (path !== undefined) rpcArgs.path = path; + if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; + if (periodSeconds !== undefined) rpcArgs.periodSeconds = periodSeconds; + if (timeoutSeconds !== undefined) rpcArgs.timeoutSeconds = timeoutSeconds; + if (failureThreshold !== undefined) rpcArgs.failureThreshold = failureThreshold; + if (successThreshold !== undefined) rpcArgs.successThreshold = successThreshold; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withHttpProbe', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): SqlServerServerResourcePromise { + const path = options?.path; + const initialDelaySeconds = options?.initialDelaySeconds; + const periodSeconds = options?.periodSeconds; + const timeoutSeconds = options?.timeoutSeconds; + const failureThreshold = options?.failureThreshold; + const successThreshold = options?.successThreshold; + const endpointName = options?.endpointName; + return new SqlServerServerResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + } + + /** @internal */ + private async _excludeFromMcpInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/excludeFromMcp', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._excludeFromMcpInternal()); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + } + + /** @internal */ + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; + const arg = new PipelineStepContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; + if (dependsOn !== undefined) rpcArgs.dependsOn = dependsOn; + if (requiredBy !== undefined) rpcArgs.requiredBy = requiredBy; + if (tags !== undefined) rpcArgs.tags = tags; + if (description !== undefined) rpcArgs.description = description; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineStepFactory', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerServerResourcePromise { + const dependsOn = options?.dependsOn; + const requiredBy = options?.requiredBy; + const tags = options?.tags; + const description = options?.description; + return new SqlServerServerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + } + + /** @internal */ + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; + const arg = new PipelineConfigurationContext(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfigurationAsync', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + } + + /** @internal */ + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + const callbackId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; + const obj = new PipelineConfigurationContext(objHandle, this._client); + await callback(obj); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withPipelineConfiguration', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withPipelineConfigurationInternal(callback)); + } + + /** @internal */ + private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { resource: this._handle, target }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withVolume', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): SqlServerServerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new SqlServerServerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + } + + /** Gets the resource name */ + async getResourceName(): Promise { + const rpcArgs: Record = { resource: this._handle }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getResourceName', + rpcArgs + ); + } + + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._onConnectionStringAvailableInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._onResourceReadyInternal(callback)); + } + + /** @internal */ + private async _addDatabaseInternal(name: string, databaseName?: string): Promise { + const rpcArgs: Record = { builder: this._handle, name }; + if (databaseName !== undefined) rpcArgs.databaseName = databaseName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/addDatabase', + rpcArgs + ); + return new SqlServerDatabaseResource(result, this._client); + } + + /** Adds a SQL Server database resource */ + addDatabase(name: string, options?: AddDatabaseOptions): SqlServerDatabaseResourcePromise { + const databaseName = options?.databaseName; + return new SqlServerDatabaseResourcePromise(this._addDatabaseInternal(name, databaseName)); + } + + /** @internal */ + private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (name !== undefined) rpcArgs.name = name; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withDataVolume', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a named volume for the SQL Server data folder */ + withDataVolume(options?: WithDataVolumeOptions): SqlServerServerResourcePromise { + const name = options?.name; + const isReadOnly = options?.isReadOnly; + return new SqlServerServerResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + } + + /** @internal */ + private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { + const rpcArgs: Record = { builder: this._handle, source }; + if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withDataBindMount', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Adds a bind mount for the SQL Server data folder */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): SqlServerServerResourcePromise { + const isReadOnly = options?.isReadOnly; + return new SqlServerServerResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); + } + + /** @internal */ + private async _withPasswordInternal(password: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, password }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withPassword', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Configures the password for the SQL Server resource */ + withPassword(password: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withPasswordInternal(password)); + } + + /** @internal */ + private async _withHostPortInternal(port?: number): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (port !== undefined) rpcArgs.port = port; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.SqlServer/withHostPort', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets the host port for the SQL Server resource */ + withHostPort(options?: WithHostPortOptions): SqlServerServerResourcePromise { + const port = options?.port; + return new SqlServerServerResourcePromise(this._withHostPortInternal(port)); + } + + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + } + + /** @internal */ + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + } + + /** @internal */ + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + } + + /** @internal */ + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withUserAssignedIdentityAzureUserAssignedIdentity', + rpcArgs + ); + return new SqlServerServerResource(result, this._client); + } + + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + } + +} + +/** + * Thenable wrapper for SqlServerServerResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class SqlServerServerResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: SqlServerServerResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); + } + + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + } + + /** Adds a bind mount */ + withBindMount(source: string, target: string, options?: WithBindMountOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + } + + /** Sets the container entrypoint */ + withEntrypoint(entrypoint: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + } + + /** Sets the container image tag */ + withImageTag(tag: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + } + + /** Sets the container image registry */ + withImageRegistry(registry: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + } + + /** Sets the container image */ + withImage(image: string, options?: WithImageOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + } + + /** Sets the image SHA256 digest */ + withImageSHA256(sha256: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + } + + /** Adds runtime arguments for the container */ + withContainerRuntimeArgs(args: string[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + } + + /** Sets the lifetime behavior of the container resource */ + withLifetime(lifetime: ContainerLifetime): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + } + + /** Sets the container image pull policy */ + withImagePullPolicy(pullPolicy: ImagePullPolicy): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + } + + /** Configures the resource to be published as a container */ + publishAsContainer(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + } + + /** Configures the resource to use a Dockerfile */ + withDockerfile(contextPath: string, options?: WithDockerfileOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + } + + /** Sets the container name */ + withContainerName(name: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + } + + /** Adds a build argument from a parameter resource */ + withBuildArg(name: string, value: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + } + + /** Adds a build secret from a parameter resource */ + withBuildSecret(name: string, value: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + } + + /** Configures endpoint proxy support */ + withEndpointProxySupport(proxyEnabled: boolean): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + } + + /** Sets the base image for a Dockerfile build */ + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + } + + /** Adds a network alias for the container */ + withContainerNetworkAlias(alias: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + } + + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + } + + /** Configures OTLP telemetry export */ + withOtlpExporter(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + } + + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + } + + /** Publishes the resource as a connection string */ + publishAsConnectionString(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + } + + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + } + + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + } + + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + } + + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + } + + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + } + + /** Adds a connection property with a reference expression */ + withConnectionProperty(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + } + + /** Adds a connection property with a string value */ + withConnectionPropertyValue(name: string, value: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + } + + /** Adds arguments */ + withArgs(args: string[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + } + + /** Sets command-line arguments via callback */ + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + } + + /** Sets command-line arguments via async callback */ + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + } + + /** Adds a reference to another resource */ + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + } + + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Adds a reference to a URI */ + withReferenceUri(name: string, uri: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + } + + /** Adds a reference to an external service */ + withReferenceExternalService(externalService: ExternalServiceResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + } + + /** Adds a reference to an endpoint */ + withReferenceEndpoint(endpointReference: EndpointReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + } + + /** Adds a network endpoint */ + withEndpoint(options?: WithEndpointOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + } + + /** Adds an HTTP endpoint */ + withHttpEndpoint(options?: WithHttpEndpointOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + } + + /** Adds an HTTPS endpoint */ + withHttpsEndpoint(options?: WithHttpsEndpointOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + } + + /** Makes HTTP endpoints externally accessible */ + withExternalHttpEndpoints(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + } + + /** Gets an endpoint reference */ + getEndpoint(name: string): Promise { + return this._promise.then(obj => obj.getEndpoint(name)); + } + + /** Configures resource for HTTP/2 */ + asHttp2Service(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + } + + /** Customizes displayed URLs via callback */ + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + } + + /** Customizes displayed URLs via async callback */ + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + } + + /** Adds or modifies displayed URLs */ + withUrl(url: string, options?: WithUrlOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + } + + /** Adds a URL using a reference expression */ + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + } + + /** Customizes the URL for a specific endpoint via callback */ + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + } + + /** Adds a URL for a specific endpoint via factory callback */ + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Excludes the resource from the deployment manifest */ + excludeFromManifest(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + } + + /** Waits for another resource to be ready */ + waitFor(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + } + + /** Waits for another resource with specific behavior */ + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + } + + /** Waits for another resource to start */ + waitForStart(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + } + + /** Waits for another resource to start with specific behavior */ + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + } + + /** Prevents resource from starting automatically */ + withExplicitStart(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + } + + /** Waits for resource completion */ + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + } + + /** Adds a health check by key */ + withHealthCheck(key: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + } + + /** Adds an HTTP health check */ + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + } + + /** Adds a resource command */ + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + } + + /** Configures developer certificate trust */ + withDeveloperCertificateTrust(trust: boolean): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + } + + /** Sets the certificate trust scope */ + withCertificateTrustScope(scope: CertificateTrustScope): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + } + + /** Configures HTTPS with a developer certificate */ + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + } + + /** Removes HTTPS certificate configuration */ + withoutHttpsCertificate(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + } + + /** Sets the parent relationship */ + withParentRelationship(parent: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + } + + /** Sets a child relationship */ + withChildRelationship(child: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + } + + /** Sets the icon for the resource */ + withIconName(iconName: string, options?: WithIconNameOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + } + + /** Adds an HTTP health probe to the resource */ + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + } + + /** Excludes the resource from MCP server exposure */ + excludeFromMcp(): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + + /** Adds a pipeline step to the resource */ + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + } + + /** Configures pipeline step dependencies via an async callback */ + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + } + + /** Configures pipeline step dependencies via a callback */ + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + } + + /** Adds a volume */ + withVolume(target: string, options?: WithVolumeOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + } + + /** Gets the resource name */ + getResourceName(): Promise { + return this._promise.then(obj => obj.getResourceName()); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withImageSHA256Internal(sha256)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** @internal */ - private async _withContainerRuntimeArgsInternal(args: string[]): Promise { - const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerRuntimeArgs', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withContainerRuntimeArgsInternal(args)); + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } - /** @internal */ - private async _withLifetimeInternal(lifetime: ContainerLifetime): Promise { - const rpcArgs: Record = { builder: this._handle, lifetime }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withLifetime', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withLifetimeInternal(lifetime)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** @internal */ - private async _withImagePullPolicyInternal(pullPolicy: ImagePullPolicy): Promise { - const rpcArgs: Record = { builder: this._handle, pullPolicy }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withImagePullPolicy', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withImagePullPolicyInternal(pullPolicy)); + /** Adds a SQL Server database resource */ + addDatabase(name: string, options?: AddDatabaseOptions): SqlServerDatabaseResourcePromise { + return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.addDatabase(name, options))); } - /** @internal */ - private async _publishAsContainerInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsContainer', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Adds a named volume for the SQL Server data folder */ + withDataVolume(options?: WithDataVolumeOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); } - /** Configures the resource to be published as a container */ - publishAsContainer(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._publishAsContainerInternal()); + /** Adds a bind mount for the SQL Server data folder */ + withDataBindMount(source: string, options?: WithDataBindMountOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); } - /** @internal */ - private async _withDockerfileInternal(contextPath: string, dockerfilePath?: string, stage?: string): Promise { - const rpcArgs: Record = { builder: this._handle, contextPath }; - if (dockerfilePath !== undefined) rpcArgs.dockerfilePath = dockerfilePath; - if (stage !== undefined) rpcArgs.stage = stage; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withDockerfile', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Configures the password for the SQL Server resource */ + withPassword(password: ParameterResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPassword(password))); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): SqlServerServerResourcePromise { - const dockerfilePath = options?.dockerfilePath; - const stage = options?.stage; - return new SqlServerServerResourcePromise(this._withDockerfileInternal(contextPath, dockerfilePath, stage)); + /** Sets the host port for the SQL Server resource */ + withHostPort(options?: WithHostPortOptions): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); } - /** @internal */ - private async _withContainerNameInternal(name: string): Promise { - const rpcArgs: Record = { builder: this._handle, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerName', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } - /** Sets the container name */ - withContainerName(name: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withContainerNameInternal(name)); + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); } - /** @internal */ - private async _withBuildArgInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildArg', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withBuildArgInternal(name, value)); + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): SqlServerServerResourcePromise { + return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); } - /** @internal */ - private async _withBuildSecretInternal(name: string, value: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withBuildSecret', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); - } +} - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withBuildSecretInternal(name, value)); +// ============================================================================ +// ViteAppResource +// ============================================================================ + +export class ViteAppResource extends ResourceBuilderBase { + constructor(handle: ViteAppResourceHandle, client: AspireClientRpc) { + super(handle, client); } + /** Gets the Command property */ + command = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.command', + { context: this._handle } + ); + }, + }; + + /** Gets the WorkingDirectory property */ + workingDirectory = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.workingDirectory', + { context: this._handle } + ); + }, + }; + + /** Gets the Name property */ + name = { + get: async (): Promise => { + return await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/JavaScriptAppResource.name', + { context: this._handle } + ); + }, + }; + /** @internal */ - private async _withEndpointProxySupportInternal(proxyEnabled: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, proxyEnabled }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEndpointProxySupport', + private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, registry }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEndpointProxySupportInternal(proxyEnabled)); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerRegistryInternal(registry)); } /** @internal */ - private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { + private async _withDockerfileBaseImageInternal(buildImage?: string, runtimeImage?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (buildImage !== undefined) rpcArgs.buildImage = buildImage; if (runtimeImage !== undefined) rpcArgs.runtimeImage = runtimeImage; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerServerResourcePromise { + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new SqlServerServerResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); - } - - /** @internal */ - private async _withContainerNetworkAliasInternal(alias: string): Promise { - const rpcArgs: Record = { builder: this._handle, alias }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withContainerNetworkAlias', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); - } - - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withContainerNetworkAliasInternal(alias)); + return new ViteAppResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ - private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + private async _publishAsDockerFileInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - if (path !== undefined) rpcArgs.path = path; - if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withMcpServer', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFile', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): SqlServerServerResourcePromise { - const path = options?.path; - const endpointName = options?.endpointName; - return new SqlServerServerResourcePromise(this._withMcpServerInternal(path, endpointName)); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileInternal()); } /** @internal */ - private async _withOtlpExporterInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporter', + private async _publishAsDockerFileWithConfigureInternal(configure: (obj: ContainerResource) => Promise): Promise { + const configureId = registerCallback(async (objData: unknown) => { + const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; + const obj = new ContainerResource(objHandle, this._client); + await configure(obj); + }); + const rpcArgs: Record = { builder: this._handle, configure: configureId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/publishAsDockerFileWithConfigure', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withOtlpExporterInternal()); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ - private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { - const rpcArgs: Record = { builder: this._handle, protocol }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withOtlpExporterProtocol', + private async _withExecutableCommandInternal(command: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withExecutableCommand', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExecutableCommandInternal(command)); } /** @internal */ - private async _publishAsConnectionStringInternal(): Promise { - const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishAsConnectionString', + private async _withWorkingDirectoryInternal(workingDirectory: string): Promise { + const rpcArgs: Record = { builder: this._handle, workingDirectory }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withWorkingDirectory', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._publishAsConnectionStringInternal()); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withWorkingDirectoryInternal(workingDirectory)); } /** @internal */ - private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { - const rpcArgs: Record = { builder: this._handle, command }; - if (helpLink !== undefined) rpcArgs.helpLink = helpLink; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRequiredCommand', + private async _withMcpServerInternal(path?: string, endpointName?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (path !== undefined) rpcArgs.path = path; + if (endpointName !== undefined) rpcArgs.endpointName = endpointName; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerServerResourcePromise { - const helpLink = options?.helpLink; - return new SqlServerServerResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { + const path = options?.path; + const endpointName = options?.endpointName; + return new ViteAppResourcePromise(this._withMcpServerInternal(path, endpointName)); } /** @internal */ - private async _withEnvironmentInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', + private async _withOtlpExporterInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEnvironmentInternal(name, value)); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterInternal()); } /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', + private async _withOtlpExporterProtocolInternal(protocol: OtlpProtocol): Promise { + const rpcArgs: Record = { builder: this._handle, protocol }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallback', + private async _withRequiredCommandInternal(command: string, helpLink?: string): Promise { + const rpcArgs: Record = { builder: this._handle, command }; + if (helpLink !== undefined) rpcArgs.helpLink = helpLink; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { + const helpLink = options?.helpLink; + return new ViteAppResourcePromise(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; const arg = new EnvironmentCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets environment variables via callback */ + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, name, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); - } - - /** @internal */ - private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, name, parameter }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentParameter', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); - } - - /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, envVarName, resource }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentConnectionString', + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentInternal(name, value)); } /** @internal */ - private async _withConnectionPropertyInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionProperty', + private async _withEnvironmentParameterInternal(name: string, parameter: ParameterResource): Promise { + const rpcArgs: Record = { builder: this._handle, name, parameter }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withConnectionPropertyInternal(name, value)); + /** Sets an environment variable from a parameter resource */ + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withConnectionPropertyValueInternal(name: string, value: string): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withConnectionPropertyValue', + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, envVarName, resource }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withConnectionPropertyValueInternal(name, value)); + /** Sets an environment variable from a connection string resource */ + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withArgsInternal(args: string[]): Promise { + private async _withArgsInternal(args: string[]): Promise { const rpcArgs: Record = { builder: this._handle, args }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgs', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds arguments */ - withArgs(args: string[]): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withArgsInternal(args)); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsInternal(args)); } /** @internal */ - private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; const obj = new CommandLineArgsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withArgsCallbackInternal(callback)); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { + private async _withArgsCallbackAsyncInternal(callback: (arg: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as CommandLineArgsCallbackContextHandle; const arg = new CommandLineArgsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withArgsCallbackAsync', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withArgsCallbackAsyncInternal(callback)); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withArgsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean): Promise { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; - const result = await this._client.invokeCapability( + if (name !== undefined) rpcArgs.name = name; + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): SqlServerServerResourcePromise { + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; - return new SqlServerServerResourcePromise(this._withReferenceInternal(source, connectionName, optional)); - } - - /** @internal */ - private async _withServiceReferenceInternal(source: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ViteAppResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ - private async _withReferenceUriInternal(name: string, uri: string): Promise { + private async _withReferenceUriInternal(name: string, uri: string): Promise { const rpcArgs: Record = { builder: this._handle, name, uri }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withReferenceUriInternal(name, uri)); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceUriInternal(name, uri)); } /** @internal */ - private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { + private async _withReferenceExternalServiceInternal(externalService: ExternalServiceResource): Promise { const rpcArgs: Record = { builder: this._handle, externalService }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ - private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { + private async _withReferenceEndpointInternal(endpointReference: EndpointReference): Promise { const rpcArgs: Record = { builder: this._handle, endpointReference }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ - private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { + private async _withEndpointInternal(port?: number, targetPort?: number, scheme?: string, name?: string, env?: string, isProxied?: boolean, isExternal?: boolean, protocol?: ProtocolType): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; @@ -23837,15 +33979,15 @@ export class SqlServerServerResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): SqlServerServerResourcePromise { + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const scheme = options?.scheme; @@ -23854,72 +33996,72 @@ export class SqlServerServerResource extends ResourceBuilderBase { + private async _withHttpEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): SqlServerServerResourcePromise { + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new SqlServerServerResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { + private async _withHttpsEndpointInternal(port?: number, targetPort?: number, name?: string, env?: string, isProxied?: boolean): Promise { const rpcArgs: Record = { builder: this._handle }; if (port !== undefined) rpcArgs.port = port; if (targetPort !== undefined) rpcArgs.targetPort = targetPort; if (name !== undefined) rpcArgs.name = name; if (env !== undefined) rpcArgs.env = env; if (isProxied !== undefined) rpcArgs.isProxied = isProxied; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): SqlServerServerResourcePromise { + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { const port = options?.port; const targetPort = options?.targetPort; const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new SqlServerServerResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new ViteAppResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ - private async _withExternalHttpEndpointsInternal(): Promise { + private async _withExternalHttpEndpointsInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withExternalHttpEndpointsInternal()); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -23932,278 +34074,308 @@ export class SqlServerServerResource extends ResourceBuilderBase { + private async _asHttp2ServiceInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures resource for HTTP/2 */ - asHttp2Service(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._asHttp2ServiceInternal()); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._asHttp2ServiceInternal()); } /** @internal */ - private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; const obj = new ResourceUrlsCallbackContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withUrlsCallbackInternal(callback)); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackInternal(callback)); } /** @internal */ - private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { + private async _withUrlsCallbackAsyncInternal(callback: (arg: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceUrlsCallbackContextHandle; const arg = new ResourceUrlsCallbackContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlsCallbackAsync', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlsCallbackAsyncInternal(callback)); } /** @internal */ - private async _withUrlInternal(url: string, displayText?: string): Promise { + private async _withUrlInternal(url: string, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrl', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): SqlServerServerResourcePromise { + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new SqlServerServerResourcePromise(this._withUrlInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlInternal(url, displayText)); } /** @internal */ - private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { + private async _withUrlExpressionInternal(url: ReferenceExpression, displayText?: string): Promise { const rpcArgs: Record = { builder: this._handle, url }; if (displayText !== undefined) rpcArgs.displayText = displayText; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerServerResourcePromise { + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { const displayText = options?.displayText; - return new SqlServerServerResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ViteAppResourcePromise(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ - private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { + private async _withUrlForEndpointInternal(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const obj = wrapIfHandle(objData) as ResourceUrlAnnotation; await callback(obj); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ - private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { + private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; const arg = new EndpointReference(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _excludeFromManifestInternal(): Promise { + private async _withContainerFilesSourceInternal(sourcePath: string): Promise { + const rpcArgs: Record = { builder: this._handle, sourcePath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withContainerFilesSource', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withContainerFilesSourceInternal(sourcePath)); + } + + /** @internal */ + private async _clearContainerFilesSourcesInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( + 'Aspire.Hosting/clearContainerFilesSources', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._clearContainerFilesSourcesInternal()); + } + + /** @internal */ + private async _excludeFromManifestInternal(): Promise { + const rpcArgs: Record = { builder: this._handle }; + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._excludeFromManifestInternal()); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResource', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _withExplicitStartInternal(): Promise { + private async _withExplicitStartInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Prevents resource from starting automatically */ - withExplicitStart(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withExplicitStartInternal()); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): SqlServerServerResourcePromise { + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { const exitCode = options?.exitCode; - return new SqlServerServerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ViteAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ - private async _withHealthCheckInternal(key: string): Promise { + private async _withHealthCheckInternal(key: string): Promise { const rpcArgs: Record = { builder: this._handle, key }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a health check by key */ - withHealthCheck(key: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withHealthCheckInternal(key)); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withHealthCheckInternal(key)); } /** @internal */ - private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { + private async _withHttpHealthCheckInternal(path?: string, statusCode?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle }; if (path !== undefined) rpcArgs.path = path; if (statusCode !== undefined) rpcArgs.statusCode = statusCode; if (endpointName !== undefined) rpcArgs.endpointName = endpointName; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): SqlServerServerResourcePromise { + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new SqlServerServerResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new ViteAppResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ - private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { + private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; const arg = new ExecuteCommandContext(argHandle, this._client); @@ -24211,130 +34383,130 @@ export class SqlServerServerResource extends ResourceBuilderBase = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; if (commandOptions !== undefined) rpcArgs.commandOptions = commandOptions; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCommand', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerServerResourcePromise { + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { const commandOptions = options?.commandOptions; - return new SqlServerServerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ViteAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { + private async _withDeveloperCertificateTrustInternal(trust: boolean): Promise { const rpcArgs: Record = { builder: this._handle, trust }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ - private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { + private async _withCertificateTrustScopeInternal(scope: CertificateTrustScope): Promise { const rpcArgs: Record = { builder: this._handle, scope }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withCertificateTrustScopeInternal(scope)); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ - private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { + private async _withHttpsDeveloperCertificateInternal(password?: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): SqlServerServerResourcePromise { + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { const password = options?.password; - return new SqlServerServerResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new ViteAppResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ - private async _withoutHttpsCertificateInternal(): Promise { + private async _withoutHttpsCertificateInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withoutHttpsCertificateInternal()); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withChildRelationshipInternal(child)); } /** @internal */ - private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { + private async _withIconNameInternal(iconName: string, iconVariant?: IconVariant): Promise { const rpcArgs: Record = { builder: this._handle, iconName }; if (iconVariant !== undefined) rpcArgs.iconVariant = iconVariant; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withIconName', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): SqlServerServerResourcePromise { + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { const iconVariant = options?.iconVariant; - return new SqlServerServerResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ViteAppResourcePromise(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ - private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { + private async _withHttpProbeInternal(probeType: ProbeType, path?: string, initialDelaySeconds?: number, periodSeconds?: number, timeoutSeconds?: number, failureThreshold?: number, successThreshold?: number, endpointName?: string): Promise { const rpcArgs: Record = { builder: this._handle, probeType }; if (path !== undefined) rpcArgs.path = path; if (initialDelaySeconds !== undefined) rpcArgs.initialDelaySeconds = initialDelaySeconds; @@ -24343,15 +34515,15 @@ export class SqlServerServerResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): SqlServerServerResourcePromise { + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { const path = options?.path; const initialDelaySeconds = options?.initialDelaySeconds; const periodSeconds = options?.periodSeconds; @@ -24359,56 +34531,56 @@ export class SqlServerServerResource extends ResourceBuilderBase { + private async _excludeFromMcpInternal(): Promise { const rpcArgs: Record = { builder: this._handle }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._excludeFromMcpInternal()); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._excludeFromMcpInternal()); } /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ - private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { + private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; const arg = new PipelineStepContext(argHandle, this._client); @@ -24419,79 +34591,60 @@ export class SqlServerServerResource extends ResourceBuilderBase( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerServerResourcePromise { + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { const dependsOn = options?.dependsOn; const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new SqlServerServerResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ViteAppResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ - private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationAsyncInternal(callback: (arg: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineConfigurationContextHandle; const arg = new PipelineConfigurationContext(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfigurationAsync', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationAsyncInternal(callback)); } /** @internal */ - private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { + private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; const obj = new PipelineConfigurationContext(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; - const result = await this._client.invokeCapability( + const result = await this._client.invokeCapability( 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withPipelineConfigurationInternal(callback)); - } - - /** @internal */ - private async _withVolumeInternal(target: string, name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { resource: this._handle, target }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withVolume', - rpcArgs - ); - return new SqlServerServerResource(result, this._client); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): SqlServerServerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new SqlServerServerResourcePromise(this._withVolumeInternal(target, name, isReadOnly)); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -24504,390 +34657,454 @@ export class SqlServerServerResource extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name }; - if (databaseName !== undefined) rpcArgs.databaseName = databaseName; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.SqlServer/addDatabase', + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new SqlServerDatabaseResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a SQL Server database resource */ - addDatabase(name: string, options?: AddDatabaseOptions): SqlServerDatabaseResourcePromise { - const databaseName = options?.databaseName; - return new SqlServerDatabaseResourcePromise(this._addDatabaseInternal(name, databaseName)); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ - private async _withDataVolumeInternal(name?: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (name !== undefined) rpcArgs.name = name; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.SqlServer/withDataVolume', + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a named volume for the SQL Server data folder */ - withDataVolume(options?: WithDataVolumeOptions): SqlServerServerResourcePromise { - const name = options?.name; - const isReadOnly = options?.isReadOnly; - return new SqlServerServerResourcePromise(this._withDataVolumeInternal(name, isReadOnly)); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceStoppedInternal(callback)); } /** @internal */ - private async _withDataBindMountInternal(source: string, isReadOnly?: boolean): Promise { - const rpcArgs: Record = { builder: this._handle, source }; - if (isReadOnly !== undefined) rpcArgs.isReadOnly = isReadOnly; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.SqlServer/withDataBindMount', + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Adds a bind mount for the SQL Server data folder */ - withDataBindMount(source: string, options?: WithDataBindMountOptions): SqlServerServerResourcePromise { - const isReadOnly = options?.isReadOnly; - return new SqlServerServerResourcePromise(this._withDataBindMountInternal(source, isReadOnly)); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onInitializeResourceInternal(callback)); } /** @internal */ - private async _withPasswordInternal(password: ParameterResource): Promise { - const rpcArgs: Record = { builder: this._handle, password }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.SqlServer/withPassword', + private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Configures the password for the SQL Server resource */ - withPassword(password: ParameterResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withPasswordInternal(password)); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ - private async _withHostPortInternal(port?: number): Promise { - const rpcArgs: Record = { builder: this._handle }; - if (port !== undefined) rpcArgs.port = port; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.SqlServer/withHostPort', + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets the host port for the SQL Server resource */ - withHostPort(options?: WithHostPortOptions): SqlServerServerResourcePromise { - const port = options?.port; - return new SqlServerServerResourcePromise(this._withHostPortInternal(port)); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._onResourceReadyInternal(callback)); } /** @internal */ - private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { - const rpcArgs: Record = { builder: this._handle, target, roles }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + private async _withViteConfigInternal(configPath: string): Promise { + const rpcArgs: Record = { builder: this._handle, configPath }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withViteConfig', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withViteConfigInternal(configPath)); } /** @internal */ - private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + private async _withNpmInternal(install?: boolean, installCommand?: string, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installCommand !== undefined) rpcArgs.installCommand = installCommand; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withNpm', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installCommand = options?.installCommand; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withNpmInternal(install, installCommand, installArgs)); } /** @internal */ - private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { - const rpcArgs: Record = { builder: this._handle, name, secretReference }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + private async _withBunInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBun', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withBunInternal(install, installArgs)); } /** @internal */ - private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { - const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + private async _withYarnInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withYarn', rpcArgs ); - return new SqlServerServerResource(result, this._client); + return new ViteAppResource(result, this._client); } - /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withYarnInternal(install, installArgs)); } -} + /** @internal */ + private async _withPnpmInternal(install?: boolean, installArgs?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle }; + if (install !== undefined) rpcArgs.install = install; + if (installArgs !== undefined) rpcArgs.installArgs = installArgs; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withPnpm', + rpcArgs + ); + return new ViteAppResource(result, this._client); + } -/** - * Thenable wrapper for SqlServerServerResource that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class SqlServerServerResourcePromise implements PromiseLike { - constructor(private _promise: Promise) {} + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + const install = options?.install; + const installArgs = options?.installArgs; + return new ViteAppResourcePromise(this._withPnpmInternal(install, installArgs)); + } - then( - onfulfilled?: ((value: SqlServerServerResource) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); + /** @internal */ + private async _withBuildScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBuildScript', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withBuildScriptInternal(scriptName, args)); } - /** Adds a bind mount */ - withBindMount(source: string, target: string, options?: WithBindMountOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + /** @internal */ + private async _withRunScriptInternal(scriptName: string, args?: string[]): Promise { + const rpcArgs: Record = { resource: this._handle, scriptName }; + if (args !== undefined) rpcArgs.args = args; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withRunScript', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Sets the container entrypoint */ - withEntrypoint(entrypoint: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + const args = options?.args; + return new ViteAppResourcePromise(this._withRunScriptInternal(scriptName, args)); } - /** Sets the container image tag */ - withImageTag(tag: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + /** @internal */ + private async _withBrowserDebuggerInternal(browser?: string): Promise { + const rpcArgs: Record = { builder: this._handle }; + if (browser !== undefined) rpcArgs.browser = browser; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.JavaScript/withBrowserDebugger', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Sets the container image registry */ - withImageRegistry(registry: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + const browser = options?.browser; + return new ViteAppResourcePromise(this._withBrowserDebuggerInternal(browser)); } - /** Sets the container image */ - withImage(image: string, options?: WithImageOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + /** @internal */ + private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { + const rpcArgs: Record = { builder: this._handle, target, roles }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure.Storage/withStorageRoleAssignments', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Sets the image SHA256 digest */ - withImageSHA256(sha256: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + /** Assigns Azure Storage roles to a resource */ + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withStorageRoleAssignmentsInternal(target, roles)); } - /** Adds runtime arguments for the container */ - withContainerRuntimeArgs(args: string[]): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + /** @internal */ + private async _withEnvironmentFromOutputInternal(name: string, bicepOutputReference: BicepOutputReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, bicepOutputReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromOutput', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Sets the lifetime behavior of the container resource */ - withLifetime(lifetime: ContainerLifetime): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + /** Sets an environment variable from a Bicep output reference */ + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentFromOutputInternal(name, bicepOutputReference)); } - /** Sets the container image pull policy */ - withImagePullPolicy(pullPolicy: ImagePullPolicy): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + /** @internal */ + private async _withEnvironmentFromKeyVaultSecretInternal(name: string, secretReference: ResourceBuilderBase): Promise { + const rpcArgs: Record = { builder: this._handle, name, secretReference }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withEnvironmentFromKeyVaultSecret', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Configures the resource to be published as a container */ - publishAsContainer(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + /** Sets an environment variable from an Azure Key Vault secret reference */ + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withEnvironmentFromKeyVaultSecretInternal(name, secretReference)); } - /** Configures the resource to use a Dockerfile */ - withDockerfile(contextPath: string, options?: WithDockerfileOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + /** @internal */ + private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { + const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting.Azure/withUserAssignedIdentityAzureUserAssignedIdentity', + rpcArgs + ); + return new ViteAppResource(result, this._client); } - /** Sets the container name */ - withContainerName(name: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + /** Associates an Azure user-assigned identity with a compute resource */ + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._withAzureUserAssignedIdentityInternal(identityResourceBuilder)); } - /** Adds a build argument from a parameter resource */ - withBuildArg(name: string, value: ParameterResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); - } +} - /** Adds a build secret from a parameter resource */ - withBuildSecret(name: string, value: ParameterResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); +/** + * Thenable wrapper for ViteAppResource that enables fluent chaining. + * @example + * await builder.addSomething().withX().withY(); + */ +export class ViteAppResourcePromise implements PromiseLike { + constructor(private _promise: Promise) {} + + then( + onfulfilled?: ((value: ViteAppResource) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): PromiseLike { + return this._promise.then(onfulfilled, onrejected); } - /** Configures endpoint proxy support */ - withEndpointProxySupport(proxyEnabled: boolean): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + /** Configures a resource to use a container registry */ + withContainerRegistry(registry: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ - withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } - /** Adds a network alias for the container */ - withContainerNetworkAlias(alias: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + /** Publishes the executable as a Docker container */ + publishAsDockerFile(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); } - /** Configures an MCP server endpoint on the resource */ - withMcpServer(options?: WithMcpServerOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + /** Publishes an executable as a Docker file with optional container configuration */ + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } - /** Configures OTLP telemetry export */ - withOtlpExporter(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + /** Sets the executable command */ + withExecutableCommand(command: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); } - /** Configures OTLP telemetry export with specific protocol */ - withOtlpExporterProtocol(protocol: OtlpProtocol): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + /** Sets the executable working directory */ + withWorkingDirectory(workingDirectory: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } - /** Publishes the resource as a connection string */ - publishAsConnectionString(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + /** Configures an MCP server endpoint on the resource */ + withMcpServer(options?: WithMcpServerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); } - /** Adds a required command dependency */ - withRequiredCommand(command: string, options?: WithRequiredCommandOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + /** Configures OTLP telemetry export */ + withOtlpExporter(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + /** Configures OTLP telemetry export with specific protocol */ + withOtlpExporterProtocol(protocol: OtlpProtocol): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + /** Adds a required command dependency */ + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Sets an environment variable from a parameter resource */ - withEnvironmentParameter(name: string, parameter: ParameterResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + withEnvironmentParameter(name: string, parameter: ParameterResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); - } - - /** Adds a connection property with a reference expression */ - withConnectionProperty(name: string, value: ReferenceExpression): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); - } - - /** Adds a connection property with a string value */ - withConnectionPropertyValue(name: string, value: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ - withArgs(args: string[]): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + withArgs(args: string[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ - withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Sets command-line arguments via async callback */ - withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); + withArgsCallbackAsync(callback: (arg: CommandLineArgsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withArgsCallbackAsync(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); + withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ - withReferenceUri(name: string, uri: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + withReferenceUri(name: string, uri: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ - withReferenceExternalService(externalService: ExternalServiceResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + withReferenceExternalService(externalService: ExternalServiceResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ - withReferenceEndpoint(endpointReference: EndpointReference): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + withReferenceEndpoint(endpointReference: EndpointReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ - withEndpoint(options?: WithEndpointOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + withEndpoint(options?: WithEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ - withHttpEndpoint(options?: WithHttpEndpointOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + withHttpEndpoint(options?: WithHttpEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ - withHttpsEndpoint(options?: WithHttpsEndpointOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ - withExternalHttpEndpoints(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + withExternalHttpEndpoints(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -24896,163 +35113,168 @@ export class SqlServerServerResourcePromise implements PromiseLike obj.asHttp2Service())); + asHttp2Service(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ - withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Customizes displayed URLs via async callback */ - withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); + withUrlsCallbackAsync(callback: (arg: ResourceUrlsCallbackContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlsCallbackAsync(callback))); } /** Adds or modifies displayed URLs */ - withUrl(url: string, options?: WithUrlOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + withUrl(url: string, options?: WithUrlOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ - withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ - withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ - withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + } + + /** Sets the source directory for container files */ + withContainerFilesSource(sourcePath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); + } + + /** Clears all container file sources */ + clearContainerFilesSources(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.clearContainerFilesSources())); } /** Excludes the resource from the deployment manifest */ - excludeFromManifest(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + excludeFromManifest(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ - withExplicitStart(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + withExplicitStart(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ - withHealthCheck(key: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + withHealthCheck(key: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ - withHttpHealthCheck(options?: WithHttpHealthCheckOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ - withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ - withDeveloperCertificateTrust(trust: boolean): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + withDeveloperCertificateTrust(trust: boolean): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ - withCertificateTrustScope(scope: CertificateTrustScope): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + withCertificateTrustScope(scope: CertificateTrustScope): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ - withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ - withoutHttpsCertificate(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + withoutHttpsCertificate(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ - withIconName(iconName: string, options?: WithIconNameOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + withIconName(iconName: string, options?: WithIconNameOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ - withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ - excludeFromMcp(): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + excludeFromMcp(): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + withRemoteImageName(remoteImageName: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + withRemoteImageTag(remoteImageTag: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ - withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via an async callback */ - withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); + withPipelineConfigurationAsync(callback: (arg: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfigurationAsync(callback))); } /** Configures pipeline step dependencies via a callback */ - withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); - } - - /** Adds a volume */ - withVolume(target: string, options?: WithVolumeOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -25060,49 +35282,89 @@ export class SqlServerServerResourcePromise implements PromiseLike obj.getResourceName()); } - /** Adds a SQL Server database resource */ - addDatabase(name: string, options?: AddDatabaseOptions): SqlServerDatabaseResourcePromise { - return new SqlServerDatabaseResourcePromise(this._promise.then(obj => obj.addDatabase(name, options))); + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } - /** Adds a named volume for the SQL Server data folder */ - withDataVolume(options?: WithDataVolumeOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); } - /** Adds a bind mount for the SQL Server data folder */ - withDataBindMount(source: string, options?: WithDataBindMountOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withDataBindMount(source, options))); + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); } - /** Configures the password for the SQL Server resource */ - withPassword(password: ParameterResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withPassword(password))); + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } - /** Sets the host port for the SQL Server resource */ - withHostPort(options?: WithHostPortOptions): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withHostPort(options))); + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + + /** Configures a custom Vite configuration file */ + withViteConfig(configPath: string): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withViteConfig(configPath))); + } + + /** Configures npm as the package manager */ + withNpm(options?: WithNpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withNpm(options))); + } + + /** Configures Bun as the package manager */ + withBun(options?: WithBunOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBun(options))); + } + + /** Configures yarn as the package manager */ + withYarn(options?: WithYarnOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withYarn(options))); + } + + /** Configures pnpm as the package manager */ + withPnpm(options?: WithPnpmOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withPnpm(options))); + } + + /** Specifies an npm script to run before starting the application */ + withBuildScript(scriptName: string, options?: WithBuildScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBuildScript(scriptName, options))); + } + + /** Specifies an npm script to run during development */ + withRunScript(scriptName: string, options?: WithRunScriptOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withRunScript(scriptName, options))); + } + + /** Configures a browser debugger for the JavaScript application */ + withBrowserDebugger(options?: WithBrowserDebuggerOptions): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withBrowserDebugger(options))); } /** Assigns Azure Storage roles to a resource */ - withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); + withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); } /** Sets an environment variable from a Bicep output reference */ - withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); + withEnvironmentFromOutput(name: string, bicepOutputReference: BicepOutputReference): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentFromOutput(name, bicepOutputReference))); } /** Sets an environment variable from an Azure Key Vault secret reference */ - withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); + withEnvironmentFromKeyVaultSecret(name: string, secretReference: ResourceBuilderBase): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withEnvironmentFromKeyVaultSecret(name, secretReference))); } /** Associates an Azure user-assigned identity with a compute resource */ - withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): SqlServerServerResourcePromise { - return new SqlServerServerResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); + withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ViteAppResourcePromise { + return new ViteAppResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); } } @@ -25228,13 +35490,13 @@ export class AzureResource extends ResourceBuilderBase { private async _asExistingInternal(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): Promise { const rpcArgs: Record = { builder: this._handle, nameParameter, resourceGroupParameter }; const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/asExisting', + 'Aspire.Hosting.Azure/asExistingFromParameters', rpcArgs ); return new AzureResource(result, this._client); } - /** Marks an Azure resource as existing in both run and publish modes */ + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureResourcePromise { return new AzureResourcePromise(this._asExistingInternal(nameParameter, resourceGroupParameter)); } @@ -25296,27 +35558,57 @@ export class AzureResourcePromise implements PromiseLike { return new AzureResourcePromise(this._promise.then(obj => obj.publishAsExisting(name, resourceGroup))); } - /** Marks an Azure resource as existing in both run and publish modes */ + /** Marks an Azure resource as existing in both run and publish modes by using parameter resources */ asExisting(nameParameter: ParameterResource, resourceGroupParameter: ParameterResource): AzureResourcePromise { return new AzureResourcePromise(this._promise.then(obj => obj.asExisting(nameParameter, resourceGroupParameter))); } -} - -// ============================================================================ -// ComputeResource -// ============================================================================ +} + +// ============================================================================ +// ComputeResource +// ============================================================================ + +export class ComputeResource extends ResourceBuilderBase { + constructor(handle: IComputeResourceHandle, client: AspireClientRpc) { + super(handle, client); + } + + /** @internal */ + private async _withRemoteImageNameInternal(remoteImageName: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageName }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageName', + rpcArgs + ); + return new ComputeResource(result, this._client); + } + + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + } + + /** @internal */ + private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { + const rpcArgs: Record = { builder: this._handle, remoteImageTag }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/withRemoteImageTag', + rpcArgs + ); + return new ComputeResource(result, this._client); + } -export class ComputeResource extends ResourceBuilderBase { - constructor(handle: IComputeResourceHandle, client: AspireClientRpc) { - super(handle, client); + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ private async _withAzureUserAssignedIdentityInternal(identityResourceBuilder: AzureUserAssignedIdentityResource): Promise { const rpcArgs: Record = { builder: this._handle, identityResourceBuilder }; const result = await this._client.invokeCapability( - 'Aspire.Hosting.Azure/withAzureUserAssignedIdentity', + 'Aspire.Hosting.Azure/withUserAssignedIdentityAzureUserAssignedIdentity', rpcArgs ); return new ComputeResource(result, this._client); @@ -25344,6 +35636,16 @@ export class ComputeResourcePromise implements PromiseLike { return this._promise.then(onfulfilled, onrejected); } + /** Sets the remote image name for publishing */ + withRemoteImageName(remoteImageName: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + } + + /** Sets the remote image tag for publishing */ + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { + return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + } + /** Associates an Azure user-assigned identity with a compute resource */ withAzureUserAssignedIdentity(identityResourceBuilder: AzureUserAssignedIdentityResource): ComputeResourcePromise { return new ComputeResourcePromise(this._promise.then(obj => obj.withAzureUserAssignedIdentity(identityResourceBuilder))); @@ -25364,7 +35666,7 @@ export class ContainerFilesDestinationResource extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/publishWithContainerFiles', + 'Aspire.Hosting/publishWithContainerFilesFromResource', rpcArgs ); return new ContainerFilesDestinationResource(result, this._client); @@ -25623,7 +35925,7 @@ export class Resource extends ResourceBuilderBase { private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withParentRelationship', + 'Aspire.Hosting/withBuilderParentRelationship', rpcArgs ); return new Resource(result, this._client); @@ -25638,7 +35940,7 @@ export class Resource extends ResourceBuilderBase { private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withChildRelationship', + 'Aspire.Hosting/withBuilderChildRelationship', rpcArgs ); return new Resource(result, this._client); @@ -25681,36 +35983,6 @@ export class Resource extends ResourceBuilderBase { return new ResourcePromise(this._excludeFromMcpInternal()); } - /** @internal */ - private async _withRemoteImageNameInternal(remoteImageName: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageName }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageName', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); - } - - /** @internal */ - private async _withRemoteImageTagInternal(remoteImageTag: string): Promise { - const rpcArgs: Record = { builder: this._handle, remoteImageTag }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withRemoteImageTag', - rpcArgs - ); - return new Resource(result, this._client); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); - } - /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -25788,6 +36060,86 @@ export class Resource extends ResourceBuilderBase { ); } + /** @internal */ + private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; + const arg = new BeforeResourceStartedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onBeforeResourceStarted', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onBeforeResourceStartedInternal(callback)); + } + + /** @internal */ + private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; + const arg = new ResourceStoppedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceStopped', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceStoppedInternal(callback)); + } + + /** @internal */ + private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; + const arg = new InitializeResourceEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onInitializeResource', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onInitializeResourceInternal(callback)); + } + + /** @internal */ + private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; + const arg = new ResourceReadyEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceReady', + rpcArgs + ); + return new Resource(result, this._client); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._onResourceReadyInternal(callback)); + } + /** @internal */ private async _withStorageRoleAssignmentsInternal(target: AzureStorageResource, roles: AzureStorageRole[]): Promise { const rpcArgs: Record = { builder: this._handle, target, roles }; @@ -25900,16 +36252,6 @@ export class ResourcePromise implements PromiseLike { return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); } - /** Sets the remote image name for publishing */ - withRemoteImageName(remoteImageName: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); - } - - /** Sets the remote image tag for publishing */ - withRemoteImageTag(remoteImageTag: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); - } - /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); @@ -25930,6 +36272,26 @@ export class ResourcePromise implements PromiseLike { return this._promise.then(obj => obj.getResourceName()); } + /** Subscribes to the BeforeResourceStarted event */ + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + } + + /** Subscribes to the ResourceStopped event */ + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + } + + /** Subscribes to the InitializeResource event */ + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + } + + /** Subscribes to the ResourceReady event */ + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { + return new ResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + } + /** Assigns Azure Storage roles to a resource */ withStorageRoleAssignments(target: AzureStorageResource, roles: AzureStorageRole[]): ResourcePromise { return new ResourcePromise(this._promise.then(obj => obj.withStorageRoleAssignments(target, roles))); @@ -26074,6 +36436,35 @@ export class ResourceWithConnectionString extends ResourceBuilderBase { + const rpcArgs: Record = { resource: this._handle, key }; + return await this._client.invokeCapability( + 'Aspire.Hosting/getConnectionProperty', + rpcArgs + ); + } + + /** @internal */ + private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; + const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onConnectionStringAvailable', + rpcArgs + ); + return new ResourceWithConnectionString(result, this._client); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._onConnectionStringAvailableInternal(callback)); + } + } /** @@ -26101,6 +36492,16 @@ export class ResourceWithConnectionStringPromise implements PromiseLike obj.withConnectionPropertyValue(name, value))); } + /** Gets a connection property by key */ + getConnectionProperty(key: string): Promise { + return this._promise.then(obj => obj.getConnectionProperty(key)); + } + + /** Subscribes to the ConnectionStringAvailable event */ + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { + return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + } + } // ============================================================================ @@ -26389,6 +36790,26 @@ export class ResourceWithEndpoints extends ResourceBuilderBase Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; + const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + await callback(arg); + }); + const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/onResourceEndpointsAllocated', + rpcArgs + ); + return new ResourceWithEndpoints(result, this._client); + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._onResourceEndpointsAllocatedInternal(callback)); + } + } /** @@ -26456,6 +36877,11 @@ export class ResourceWithEndpointsPromise implements PromiseLike obj.withHttpProbe(probeType, options))); } + /** Subscribes to the ResourceEndpointsAllocated event */ + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { + return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + } + } // ============================================================================ @@ -26498,41 +36924,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironment', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentExpressionInternal(name: string, value: ReferenceExpression): Promise { - const rpcArgs: Record = { builder: this._handle, name, value }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentExpression', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentExpressionInternal(name, value)); - } - - /** @internal */ - private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (objData: unknown) => { - const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); - await callback(obj); + private async _withEnvironmentCallbackInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { + const callbackId = registerCallback(async (argData: unknown) => { + const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; + const arg = new EnvironmentCallbackContext(argHandle, this._client); + await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; const result = await this._client.invokeCapability( @@ -26543,43 +36939,38 @@ export class ResourceWithEnvironment extends ResourceBuilderBase Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ - private async _withEnvironmentCallbackAsyncInternal(callback: (arg: EnvironmentCallbackContext) => Promise): Promise { - const callbackId = registerCallback(async (argData: unknown) => { - const argHandle = wrapIfHandle(argData) as EnvironmentCallbackContextHandle; - const arg = new EnvironmentCallbackContext(argHandle, this._client); - await callback(arg); - }); - const rpcArgs: Record = { builder: this._handle, callback: callbackId }; + private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { + const rpcArgs: Record = { builder: this._handle, name, endpointReference }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentCallbackAsync', + 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackAsyncInternal(callback)); + /** Sets an environment variable from an endpoint reference */ + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ - private async _withEnvironmentEndpointInternal(name: string, endpointReference: EndpointReference): Promise { - const rpcArgs: Record = { builder: this._handle, name, endpointReference }; + private async _withEnvironmentInternal(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): Promise { + const rpcArgs: Record = { builder: this._handle, name, value }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withEnvironmentEndpoint', + 'Aspire.Hosting/withEnvironment', rpcArgs ); return new ResourceWithEnvironment(result, this._client); } - /** Sets an environment variable from an endpoint reference */ - withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -26613,10 +37004,11 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { + private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; + if (name !== undefined) rpcArgs.name = name; const result = await this._client.invokeCapability( 'Aspire.Hosting/withReference', rpcArgs @@ -26628,37 +37020,8 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { - const rpcArgs: Record = { builder: this._handle, source }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReference', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceInternal(source)); - } - - /** @internal */ - private async _withServiceReferenceNamedInternal(source: ResourceBuilderBase, name: string): Promise { - const rpcArgs: Record = { builder: this._handle, source, name }; - const result = await this._client.invokeCapability( - 'Aspire.Hosting/withServiceReferenceNamed', - rpcArgs - ); - return new ResourceWithEnvironment(result, this._client); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withServiceReferenceNamedInternal(source, name)); + const name = options?.name; + return new ResourceWithEnvironmentPromise(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -26741,7 +37104,7 @@ export class ResourceWithEnvironment extends ResourceBuilderBase = { builder: this._handle }; if (password !== undefined) rpcArgs.password = password; const result = await this._client.invokeCapability( - 'Aspire.Hosting/withHttpsDeveloperCertificate', + 'Aspire.Hosting/withParameterHttpsDeveloperCertificate', rpcArgs ); return new ResourceWithEnvironment(result, this._client); @@ -26825,31 +37188,21 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withOtlpExporterProtocol(protocol))); } - /** Sets an environment variable */ - withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); - } - - /** Adds an environment variable with a reference expression */ - withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); - } - /** Sets environment variables via callback */ - withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { + withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } - /** Sets environment variables via async callback */ - withEnvironmentCallbackAsync(callback: (arg: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallbackAsync(callback))); - } - /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } + /** Sets an environment variable on the resource */ + withEnvironment(name: string, value: string | ReferenceExpression | EndpointReference | ParameterResource | ResourceWithConnectionString): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + } + /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); @@ -26865,16 +37218,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withReference(source, options))); } - /** Adds a service discovery reference to another resource */ - withServiceReference(source: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReference(source))); - } - - /** Adds a named service discovery reference */ - withServiceReferenceNamed(source: ResourceBuilderBase, name: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withServiceReferenceNamed(source, name))); - } - /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); @@ -26922,34 +37265,6 @@ export class ResourceWithEnvironmentPromise implements PromiseLike { - constructor(handle: IResourceWithServiceDiscoveryHandle, client: AspireClientRpc) { - super(handle, client); - } - -} - -/** - * Thenable wrapper for ResourceWithServiceDiscovery that enables fluent chaining. - * @example - * await builder.addSomething().withX().withY(); - */ -export class ResourceWithServiceDiscoveryPromise implements PromiseLike { - constructor(private _promise: Promise) {} - - then( - onfulfilled?: ((value: ResourceWithServiceDiscovery) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): PromiseLike { - return this._promise.then(onfulfilled, onrejected); - } - -} - // ============================================================================ // ResourceWithWaitSupport // ============================================================================ @@ -26963,7 +37278,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitFor', + 'Aspire.Hosting/waitForResource', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -26993,7 +37308,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForStart', + 'Aspire.Hosting/waitForResourceStart', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -27024,7 +37339,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( - 'Aspire.Hosting/waitForCompletion', + 'Aspire.Hosting/waitForResourceCompletion', rpcArgs ); return new ResourceWithWaitSupport(result, this._client); @@ -27143,7 +37458,7 @@ export async function createBuilder(options?: CreateBuilderOptions): Promise { const error = reason instanceof Error ? reason : new Error(String(reason)); - if (reason instanceof CapabilityError) { + if (reason instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else if (reason instanceof CapabilityError) { console.error(`\n❌ Capability Error: ${error.message}`); console.error(` Code: ${(reason as CapabilityError).code}`); if ((reason as CapabilityError).capability) { @@ -27174,8 +37491,12 @@ process.on('unhandledRejection', (reason: unknown) => { }); process.on('uncaughtException', (error: Error) => { - console.error(`\n❌ Uncaught Exception: ${error.message}`); - if (error.stack) { + if (error instanceof AppHostUsageError) { + console.error(`\n❌ AppHost Error: ${error.message}`); + } else { + console.error(`\n❌ Uncaught Exception: ${error.message}`); + } + if (!(error instanceof AppHostUsageError) && error.stack) { console.error(error.stack); } process.exit(1); @@ -27186,23 +37507,46 @@ process.on('uncaughtException', (error: Error) => { // ============================================================================ // Register wrapper factories for typed handle wrapping in callbacks +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent', (handle, client) => new AfterResourcesCreatedEvent(handle as AfterResourcesCreatedEventHandle, client)); registerHandleWrapper('Aspire.Hosting.Azure/Aspire.Hosting.Azure.AzureResourceInfrastructure', (handle, client) => new AzureResourceInfrastructure(handle as AzureResourceInfrastructureHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent', (handle, client) => new BeforeResourceStartedEvent(handle as BeforeResourceStartedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent', (handle, client) => new BeforeStartEvent(handle as BeforeStartEventHandle, client)); registerHandleWrapper('Aspire.Hosting.Azure/Aspire.Hosting.Azure.BicepOutputReference', (handle, client) => new BicepOutputReference(handle as BicepOutputReferenceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent', (handle, client) => new ConnectionStringAvailableEvent(handle as ConnectionStringAvailableEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel', (handle, client) => new DistributedApplicationModel(handle as DistributedApplicationModelHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent', (handle, client) => new InitializeResourceEvent(handle as InitializeResourceEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext', (handle, client) => new PipelineContext(handle as PipelineContextHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext', (handle, client) => new PipelineStepFactoryContext(handle as PipelineStepFactoryContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary', (handle, client) => new PipelineSummary(handle as PipelineSummaryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent', (handle, client) => new ResourceEndpointsAllocatedEvent(handle as ResourceEndpointsAllocatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService', (handle, client) => new ResourceLoggerService(handle as ResourceLoggerServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService', (handle, client) => new ResourceNotificationService(handle as ResourceNotificationServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent', (handle, client) => new ResourceReadyEvent(handle as ResourceReadyEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent', (handle, client) => new ResourceStoppedEvent(handle as ResourceStoppedEventHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext', (handle, client) => new UpdateCommandStateContext(handle as UpdateCommandStateContextHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration', (handle, client) => new Configuration(handle as IConfigurationHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment', (handle, client) => new HostEnvironment(handle as IHostEnvironmentHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger', (handle, client) => new Logger(handle as ILoggerHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory', (handle, client) => new LoggerFactory(handle as ILoggerFactoryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep', (handle, client) => new ReportingStep(handle as IReportingStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask', (handle, client) => new ReportingTask(handle as IReportingTaskHandle, client)); +registerHandleWrapper('System.ComponentModel/System.IServiceProvider', (handle, client) => new ServiceProvider(handle as IServiceProviderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IUserSecretsManager', (handle, client) => new UserSecretsManager(handle as IUserSecretsManagerHandle, client)); registerHandleWrapper('Aspire.Hosting.Azure/Aspire.Hosting.Azure.AzureBicepResource', (handle, client) => new AzureBicepResource(handle as AzureBicepResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureBlobStorageContainerResource', (handle, client) => new AzureBlobStorageContainerResource(handle as AzureBlobStorageContainerResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.AzureBlobStorageResource', (handle, client) => new AzureBlobStorageResource(handle as AzureBlobStorageResourceHandle, client)); @@ -27223,10 +37567,13 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppR registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.JavaScriptAppResource', (handle, client) => new JavaScriptAppResource(handle as JavaScriptAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.NodeAppResource', (handle, client) => new NodeAppResource(handle as NodeAppResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.SqlServer/Aspire.Hosting.ApplicationModel.SqlServerDatabaseResource', (handle, client) => new SqlServerDatabaseResource(handle as SqlServerDatabaseResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.SqlServer/Aspire.Hosting.ApplicationModel.SqlServerServerResource', (handle, client) => new SqlServerServerResource(handle as SqlServerServerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.ViteAppResource', (handle, client) => new ViteAppResource(handle as ViteAppResourceHandle, client)); registerHandleWrapper('Aspire.Hosting.Azure/Aspire.Hosting.ApplicationModel.IAzureResource', (handle, client) => new AzureResource(handle as IAzureResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource', (handle, client) => new ComputeResource(handle as IComputeResourceHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); @@ -27236,6 +37583,5 @@ registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceW registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithServiceDiscovery', (handle, client) => new ResourceWithServiceDiscovery(handle as IResourceWithServiceDiscoveryHandle, client)); registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); diff --git a/samples/volume-mount/ts/.modules/base.ts b/samples/volume-mount/ts/.modules/base.ts index 7778b0f1..b3d8b8be 100644 --- a/samples/volume-mount/ts/.modules/base.ts +++ b/samples/volume-mount/ts/.modules/base.ts @@ -1,8 +1,8 @@ -// aspire.ts - Core Aspire types: base classes, ReferenceExpression -import { Handle, AspireClient, MarshalledHandle } from './transport.js'; +// base.ts - Core Aspire types: base classes, ReferenceExpression +import { Handle, AspireClient, MarshalledHandle, CancellationToken, registerCancellation, registerHandleWrapper, unregisterCancellation } from './transport.js'; // Re-export transport types for convenience -export { Handle, AspireClient, CapabilityError, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; +export { Handle, AspireClient, CapabilityError, CancellationToken, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; export type { MarshalledHandle, AtsError, AtsErrorDetails, CallbackFunction } from './transport.js'; export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './transport.js'; @@ -43,22 +43,46 @@ export class ReferenceExpression { private readonly _format?: string; private readonly _valueProviders?: unknown[]; + // Conditional mode fields + private readonly _condition?: unknown; + private readonly _whenTrue?: ReferenceExpression; + private readonly _whenFalse?: ReferenceExpression; + private readonly _matchValue?: string; + // Handle mode fields (when wrapping a server-returned handle) private readonly _handle?: Handle; private readonly _client?: AspireClient; constructor(format: string, valueProviders: unknown[]); constructor(handle: Handle, client: AspireClient); - constructor(handleOrFormat: Handle | string, clientOrValueProviders: AspireClient | unknown[]) { - if (typeof handleOrFormat === 'string') { - this._format = handleOrFormat; - this._valueProviders = clientOrValueProviders as unknown[]; + constructor(condition: unknown, matchValue: string, whenTrue: ReferenceExpression, whenFalse: ReferenceExpression); + constructor( + handleOrFormatOrCondition: Handle | string | unknown, + clientOrValueProvidersOrMatchValue: AspireClient | unknown[] | string, + whenTrueOrWhenFalse?: ReferenceExpression, + whenFalse?: ReferenceExpression + ) { + if (typeof handleOrFormatOrCondition === 'string') { + this._format = handleOrFormatOrCondition; + this._valueProviders = clientOrValueProvidersOrMatchValue as unknown[]; + } else if (handleOrFormatOrCondition instanceof Handle) { + this._handle = handleOrFormatOrCondition; + this._client = clientOrValueProvidersOrMatchValue as AspireClient; } else { - this._handle = handleOrFormat; - this._client = clientOrValueProviders as AspireClient; + this._condition = handleOrFormatOrCondition; + this._matchValue = (clientOrValueProvidersOrMatchValue as string) ?? 'True'; + this._whenTrue = whenTrueOrWhenFalse; + this._whenFalse = whenFalse; } } + /** + * Gets whether this reference expression is conditional. + */ + get isConditional(): boolean { + return this._condition !== undefined; + } + /** * Creates a reference expression from a tagged template literal. * @@ -82,16 +106,46 @@ export class ReferenceExpression { return new ReferenceExpression(format, valueProviders); } + /** + * Creates a conditional reference expression from its constituent parts. + * + * @param condition - A value provider whose result is compared to matchValue + * @param whenTrue - The expression to use when the condition matches + * @param whenFalse - The expression to use when the condition does not match + * @param matchValue - The value to compare the condition against (defaults to "True") + * @returns A ReferenceExpression instance in conditional mode + */ + static createConditional( + condition: unknown, + matchValue: string, + whenTrue: ReferenceExpression, + whenFalse: ReferenceExpression + ): ReferenceExpression { + return new ReferenceExpression(condition, matchValue, whenTrue, whenFalse); + } + /** * Serializes the reference expression for JSON-RPC transport. - * In template-literal mode, uses the $expr format. + * In expression mode, uses the $expr format with format + valueProviders. + * In conditional mode, uses the $expr format with condition + whenTrue + whenFalse. * In handle mode, delegates to the handle's serialization. */ - toJSON(): { $expr: { format: string; valueProviders?: unknown[] } } | MarshalledHandle { + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } | { condition: unknown; whenTrue: unknown; whenFalse: unknown; matchValue: string } } | MarshalledHandle { if (this._handle) { return this._handle.toJSON(); } + if (this.isConditional) { + return { + $expr: { + condition: extractHandleForExpr(this._condition), + whenTrue: this._whenTrue!.toJSON(), + whenFalse: this._whenFalse!.toJSON(), + matchValue: this._matchValue! + } + }; + } + return { $expr: { format: this._format!, @@ -100,6 +154,30 @@ export class ReferenceExpression { }; } + /** + * Resolves the expression to its string value on the server. + * Only available on server-returned ReferenceExpression instances (handle mode). + * + * @param cancellationToken - Optional AbortSignal or CancellationToken for cancellation support + * @returns The resolved string value, or null if the expression resolves to null + */ + async getValue(cancellationToken?: AbortSignal | CancellationToken): Promise { + if (!this._handle || !this._client) { + throw new Error('getValue is only available on server-returned ReferenceExpression instances'); + } + const cancellationTokenId = registerCancellation(this._client, cancellationToken); + try { + const rpcArgs: Record = { context: this._handle }; + if (cancellationTokenId !== undefined) rpcArgs.cancellationToken = cancellationTokenId; + return await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/getValue', + rpcArgs + ); + } finally { + unregisterCancellation(cancellationTokenId); + } + } + /** * String representation for debugging. */ @@ -107,10 +185,17 @@ export class ReferenceExpression { if (this._handle) { return `ReferenceExpression(handle)`; } + if (this.isConditional) { + return `ReferenceExpression(conditional)`; + } return `ReferenceExpression(${this._format})`; } } +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression', (handle, client) => + new ReferenceExpression(handle, client) +); + /** * Extracts a value for use in reference expressions. * Supports handles (objects) and string literals. @@ -136,15 +221,15 @@ function extractHandleForExpr(value: unknown): unknown { return value.toJSON(); } - // Objects with $handle property (already in handle format) - if (typeof value === 'object' && value !== null && '$handle' in value) { + // Objects with marshalled expression/handle payloads + if (typeof value === 'object' && value !== null && ('$handle' in value || '$expr' in value)) { return value; } - // Objects with toJSON that returns a handle + // Objects with toJSON that returns a marshalled expression or handle if (typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function') { const json = value.toJSON(); - if (json && typeof json === 'object' && '$handle' in json) { + if (json && typeof json === 'object' && ('$handle' in json || '$expr' in json)) { return json; } } @@ -307,11 +392,20 @@ export class AspireList { }) as T[]; } - toJSON(): MarshalledHandle { - if (this._resolvedHandle) { - return this._resolvedHandle.toJSON(); + async toTransportValue(): Promise { + const handle = await this._ensureHandle(); + return handle.toJSON(); + } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireList must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); } - return this._handleOrContext.toJSON(); + + return this._resolvedHandle.toJSON(); } } @@ -466,8 +560,19 @@ export class AspireDict { }) as Record; } - async toJSON(): Promise { + async toTransportValue(): Promise { const handle = await this._ensureHandle(); return handle.toJSON(); } + + toJSON(): MarshalledHandle { + if (!this._resolvedHandle) { + throw new Error( + 'AspireDict must be resolved before it can be serialized directly. ' + + 'Pass it to generated SDK methods instead of calling JSON.stringify directly.' + ); + } + + return this._resolvedHandle.toJSON(); + } } diff --git a/samples/volume-mount/ts/.modules/transport.ts b/samples/volume-mount/ts/.modules/transport.ts index 7bddd74b..6d29cf28 100644 --- a/samples/volume-mount/ts/.modules/transport.ts +++ b/samples/volume-mount/ts/.modules/transport.ts @@ -77,7 +77,8 @@ export function isAtsError(value: unknown): value is { $error: AtsError } { value !== null && typeof value === 'object' && '$error' in value && - typeof (value as { $error: unknown }).$error === 'object' + typeof (value as { $error: unknown }).$error === 'object' && + (value as { $error: unknown }).$error !== null ); } @@ -93,6 +94,47 @@ export function isMarshalledHandle(value: unknown): value is MarshalledHandle { ); } +function isAbortSignal(value: unknown): value is AbortSignal { + return ( + value !== null && + typeof value === 'object' && + 'aborted' in value && + 'addEventListener' in value && + 'removeEventListener' in value + ); +} + +function isPlainObject(value: unknown): value is Record { + if (value === null || typeof value !== 'object') { + return false; + } + + const prototype = Object.getPrototypeOf(value); + return prototype === Object.prototype || prototype === null; +} + +function hasTransportValue(value: unknown): value is { toTransportValue(): unknown | Promise } { + return ( + value !== null && + typeof value === 'object' && + 'toTransportValue' in value && + typeof (value as { toTransportValue?: unknown }).toTransportValue === 'function' + ); +} + +function createAbortError(message: string): Error { + const error = new Error(message); + error.name = 'AbortError'; + return error; +} + +function createCircularReferenceError(capabilityId: string, path: string): AppHostUsageError { + return new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' contains a circular reference. ` + + 'Circular references are not supported by the AppHost transport.' + ); +} + // ============================================================================ // Handle // ============================================================================ @@ -136,6 +178,92 @@ export class Handle { } } +// ============================================================================ +// CancellationToken +// ============================================================================ + +/** + * Represents a transport-safe cancellation token value for the generated SDK. + * + * Use a plain {@link AbortSignal} when you create cancellation in user code. + * Generated APIs accept either an {@link AbortSignal} or a {@link CancellationToken}. + * + * Values returned from generated callbacks and context/property getters are + * {@link CancellationToken} instances because they may reference remote + * cancellation token handles received from the AppHost. + * + * @example + * ```typescript + * const controller = new AbortController(); + * await connectionStringExpression.getValue(controller.signal); + * ``` + * + * @example + * ```typescript + * const cancellationToken = await context.cancellationToken.get(); + * const connectionStringExpression = await db.uriExpression.get(); + * const connectionString = await connectionStringExpression.getValue(cancellationToken); + * ``` + */ +export class CancellationToken { + private readonly _signal?: AbortSignal; + private readonly _remoteTokenId?: string; + + constructor(signal?: AbortSignal); + constructor(tokenId?: string); + constructor(value?: AbortSignal | string | null) { + if (typeof value === 'string') { + this._remoteTokenId = value; + } else if (isAbortSignal(value)) { + this._signal = value; + } + } + + /** + * Creates a cancellation token from a local {@link AbortSignal}. + */ + static from(signal?: AbortSignal): CancellationToken { + return new CancellationToken(signal); + } + + /** + * Creates a cancellation token from a transport value. + * Generated code uses this to materialize values that come from the AppHost. + */ + static fromValue(value: unknown): CancellationToken { + if (value instanceof CancellationToken) { + return value; + } + + if (typeof value === 'string') { + return new CancellationToken(value); + } + + if (isAbortSignal(value)) { + return new CancellationToken(value); + } + + return new CancellationToken(); + } + + /** + * Serializes the token for JSON-RPC transport. + */ + toJSON(): string | undefined { + return this._remoteTokenId; + } + + register(client?: AspireClient): string | undefined { + if (this._remoteTokenId !== undefined) { + return this._remoteTokenId; + } + + return client + ? registerCancellation(client, this._signal) + : registerCancellation(this._signal); + } +} + // ============================================================================ // Handle Wrapper Registry // ============================================================================ @@ -167,22 +295,35 @@ export function registerHandleWrapper(typeId: string, factory: HandleWrapperFact * @param client - Optional client for creating typed wrapper instances */ export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { - if (value && typeof value === 'object') { - if (isMarshalledHandle(value)) { - const handle = new Handle(value); - const typeId = value.$type; - - // Try to find a registered wrapper factory for this type - if (typeId && client) { - const factory = handleWrapperRegistry.get(typeId); - if (factory) { - return factory(handle, client); - } + if (isMarshalledHandle(value)) { + const handle = new Handle(value); + const typeId = value.$type; + + // Try to find a registered wrapper factory for this type + if (typeId && client) { + const factory = handleWrapperRegistry.get(typeId); + if (factory) { + return factory(handle, client); } + } + + return handle; + } - return handle; + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + value[i] = wrapIfHandle(value[i], client); + } + + return value; + } + + if (isPlainObject(value)) { + for (const [key, nestedValue] of Object.entries(value)) { + value[key] = wrapIfHandle(nestedValue, client); } } + return value; } @@ -213,6 +354,76 @@ export class CapabilityError extends Error { } } +/** + * Error thrown when the AppHost script uses the generated SDK incorrectly. + */ +export class AppHostUsageError extends Error { + constructor(message: string) { + super(message); + this.name = 'AppHostUsageError'; + } +} + +function isPromiseLike(value: unknown): value is PromiseLike { + return ( + value !== null && + (typeof value === 'object' || typeof value === 'function') && + 'then' in value && + typeof (value as { then?: unknown }).then === 'function' + ); +} + +function validateCapabilityArgs( + capabilityId: string, + args?: Record +): void { + if (!args) { + return; + } + + const validateValue = (value: unknown, path: string, ancestors: Set): void => { + if (value === null || value === undefined) { + return; + } + + if (isPromiseLike(value)) { + throw new AppHostUsageError( + `Argument '${path}' passed to capability '${capabilityId}' is a Promise-like value. ` + + `This usually means an async builder call was not awaited. ` + + `Did you forget 'await' on a call like builder.addPostgres(...) or resource.addDatabase(...)?` + ); + } + + if (typeof value !== 'object') { + return; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + ancestors.add(value); + try { + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + validateValue(value[i], `${path}[${i}]`, ancestors); + } + return; + } + + for (const [key, nestedValue] of Object.entries(value)) { + validateValue(nestedValue, `${path}.${key}`, ancestors); + } + } finally { + ancestors.delete(value); + } + }; + + for (const [key, value] of Object.entries(args)) { + validateValue(value, key, new Set()); + } +} + // ============================================================================ // Callback Registry // ============================================================================ @@ -324,21 +535,50 @@ export function getCallbackCount(): number { */ const cancellationRegistry = new Map void>(); let cancellationIdCounter = 0; +const connectedClients = new Set(); -/** - * A reference to the current AspireClient for sending cancel requests. - * Set by AspireClient.connect(). - */ -let currentClient: AspireClient | null = null; +function resolveCancellationClient(client?: AspireClient): AspireClient { + if (client) { + return client; + } + + if (connectedClients.size === 1) { + return connectedClients.values().next().value as AspireClient; + } + + if (connectedClients.size === 0) { + throw new Error( + 'registerCancellation(signal) requires a connected AspireClient. ' + + 'Pass the client explicitly or connect the client first.' + ); + } + + throw new Error( + 'registerCancellation(signal) is ambiguous when multiple AspireClient instances are connected. ' + + 'Pass the client explicitly.' + ); +} /** - * Register an AbortSignal for cancellation support. - * Returns a cancellation ID that should be passed to methods accepting CancellationToken. + * Registers cancellation support for a local signal or SDK cancellation token. + * Returns a cancellation ID that should be passed to methods accepting cancellation input. * * When the AbortSignal is aborted, sends a cancelToken request to the host. * - * @param signal - The AbortSignal to register (optional) - * @returns The cancellation ID, or undefined if no signal provided + * @param client - The AspireClient that should route the cancellation request + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + */ +export function registerCancellation(client: AspireClient, signalOrToken?: AbortSignal | CancellationToken): string | undefined; +/** + * Registers cancellation support using the single connected AspireClient. + * + * @param signalOrToken - The signal or token to register (optional) + * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + * + * @example + * const controller = new AbortController(); + * await expression.getValue(controller.signal); * * @example * const controller = new AbortController(); @@ -346,14 +586,29 @@ let currentClient: AspireClient | null = null; * // Pass id to capability invocation * // Later: controller.abort() will cancel the operation */ -export function registerCancellation(signal?: AbortSignal): string | undefined { - if (!signal) { +export function registerCancellation(signalOrToken?: AbortSignal | CancellationToken): string | undefined; +export function registerCancellation( + clientOrSignalOrToken?: AspireClient | AbortSignal | CancellationToken, + maybeSignalOrToken?: AbortSignal | CancellationToken +): string | undefined { + const client = clientOrSignalOrToken instanceof AspireClient ? clientOrSignalOrToken : undefined; + const signalOrToken = client + ? maybeSignalOrToken + : clientOrSignalOrToken as AbortSignal | CancellationToken | undefined; + + if (!signalOrToken) { return undefined; } - // Already aborted? Don't register + if (signalOrToken instanceof CancellationToken) { + return signalOrToken.register(client); + } + + const signal = signalOrToken; + const cancellationClient = resolveCancellationClient(client); + if (signal.aborted) { - return undefined; + throw createAbortError('The operation was aborted before it was sent to the AppHost.'); } const cancellationId = `ct_${++cancellationIdCounter}_${Date.now()}`; @@ -361,8 +616,8 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { // Set up the abort listener const onAbort = () => { // Send cancel request to host - if (currentClient?.connected) { - currentClient.cancelToken(cancellationId).catch(() => { + if (cancellationClient.connected) { + cancellationClient.cancelToken(cancellationId).catch(() => { // Ignore errors - the operation may have already completed }); } @@ -381,6 +636,56 @@ export function registerCancellation(signal?: AbortSignal): string | undefined { return cancellationId; } +async function marshalTransportValue( + value: unknown, + client: AspireClient, + cancellationIds: string[], + capabilityId: string, + path: string = 'args', + ancestors: Set = new Set() +): Promise { + if (value === null || value === undefined || typeof value !== 'object') { + return value; + } + + if (value instanceof CancellationToken) { + const cancellationId = value.register(client); + if (cancellationId !== undefined) { + cancellationIds.push(cancellationId); + } + + return cancellationId; + } + + if (ancestors.has(value)) { + throw createCircularReferenceError(capabilityId, path); + } + + const nextAncestors = new Set(ancestors); + nextAncestors.add(value); + + if (hasTransportValue(value)) { + return await marshalTransportValue(await value.toTransportValue(), client, cancellationIds, capabilityId, path, nextAncestors); + } + + if (Array.isArray(value)) { + return await Promise.all( + value.map((item, index) => marshalTransportValue(item, client, cancellationIds, capabilityId, `${path}[${index}]`, nextAncestors)) + ); + } + + if (isPlainObject(value)) { + const entries = await Promise.all( + Object.entries(value).map(async ([key, nestedValue]) => + [key, await marshalTransportValue(nestedValue, client, cancellationIds, capabilityId, `${path}.${key}`, nextAncestors)] as const) + ); + + return Object.fromEntries(entries); + } + + return value; +} + /** * Unregister a cancellation token by its ID. * Call this when the operation completes to clean up resources. @@ -411,6 +716,8 @@ export class AspireClient { private socket: net.Socket | null = null; private disconnectCallbacks: (() => void)[] = []; private _pendingCalls = 0; + private _connectPromise: Promise | null = null; + private _disconnectNotified = false; constructor(private socketPath: string) { } @@ -422,6 +729,12 @@ export class AspireClient { } private notifyDisconnect(): void { + if (this._disconnectNotified) { + return; + } + + this._disconnectNotified = true; + for (const callback of this.disconnectCallbacks) { try { callback(); @@ -432,30 +745,106 @@ export class AspireClient { } connect(timeoutMs: number = 5000): Promise { - return new Promise((resolve, reject) => { - const timeout = setTimeout(() => reject(new Error('Connection timeout')), timeoutMs); + if (this.connected) { + return Promise.resolve(); + } + + if (this._connectPromise) { + return this._connectPromise; + } + + this._disconnectNotified = false; + + // On Windows, use named pipes; on Unix, use Unix domain sockets + const isWindows = process.platform === 'win32'; + const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + + this._connectPromise = new Promise((resolve, reject) => { + const socket = net.createConnection(pipePath); + this.socket = socket; - // On Windows, use named pipes; on Unix, use Unix domain sockets - const isWindows = process.platform === 'win32'; - const pipePath = isWindows ? `\\\\.\\pipe\\${this.socketPath}` : this.socketPath; + let settled = false; - this.socket = net.createConnection(pipePath); + const cleanupPendingListeners = () => { + socket.removeListener('connect', onConnect); + socket.removeListener('error', onPendingError); + socket.removeListener('close', onPendingClose); + }; - this.socket.once('error', (error: Error) => { + const failConnect = (error: Error) => { + if (settled) { + return; + } + + settled = true; clearTimeout(timeout); + cleanupPendingListeners(); + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + if (!socket.destroyed) { + socket.destroy(); + } + reject(error); - }); + }; + + const onConnectedSocketError = (error: Error) => { + console.error('Socket error:', error); + }; + + const onConnectedSocketClose = () => { + socket.removeListener('error', onConnectedSocketError); + + if (this.socket && this.socket !== socket) { + return; + } + + const connection = this.connection; + this.connection = null; + this._connectPromise = null; + + if (this.socket === socket) { + this.socket = null; + } + + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + this.notifyDisconnect(); + }; + + const onPendingError = (error: Error) => { + failConnect(error); + }; + + const onPendingClose = () => { + failConnect(new Error('Connection closed before JSON-RPC was established')); + }; + + const onConnect = async () => { + if (settled) { + return; + } - this.socket.once('connect', () => { clearTimeout(timeout); + cleanupPendingListeners(); + try { - const reader = new rpc.SocketMessageReader(this.socket!); - const writer = new rpc.SocketMessageWriter(this.socket!); + const reader = new rpc.SocketMessageReader(socket); + const writer = new rpc.SocketMessageWriter(socket); this.connection = rpc.createMessageConnection(reader, writer); this.connection.onClose(() => { this.connection = null; - this.notifyDisconnect(); }); this.connection.onError((err: any) => console.error('JsonRpc connection error:', err)); @@ -475,26 +864,39 @@ export class AspireClient { } }); + socket.on('error', onConnectedSocketError); + socket.on('close', onConnectedSocketClose); + + const authToken = process.env.ASPIRE_REMOTE_APPHOST_TOKEN; + if (!authToken) { + throw new Error('ASPIRE_REMOTE_APPHOST_TOKEN environment variable is not set.'); + } this.connection.listen(); + const authenticated = await this.connection.sendRequest('authenticate', authToken); + if (!authenticated) { + throw new Error('Failed to authenticate to the AppHost server.'); + } - // Set the current client for cancellation registry - currentClient = this; + connectedClients.add(this); + this._connectPromise = null; + settled = true; resolve(); - } catch (e) { - reject(e); + } catch (error) { + failConnect(error instanceof Error ? error : new Error(String(error))); } - }); + }; - this.socket.on('close', () => { - this.connection?.dispose(); - this.connection = null; - if (currentClient === this) { - currentClient = null; - } - this.notifyDisconnect(); - }); + const timeout = setTimeout(() => { + failConnect(new Error('Connection timeout')); + }, timeoutMs); + + socket.once('error', onPendingError); + socket.once('close', onPendingClose); + socket.once('connect', onConnect); }); + + return this._connectPromise; } ping(): Promise { @@ -533,39 +935,66 @@ export class AspireClient { throw new Error('Not connected to AppHost'); } - // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. - // We ref() during RPC calls so the process doesn't exit mid-call, and - // unref() when idle so the process can exit naturally after all work completes. - if (this._pendingCalls === 0) { - this.socket?.ref(); - } - this._pendingCalls++; + validateCapabilityArgs(capabilityId, args); + const cancellationIds: string[] = []; try { - const result = await this.connection.sendRequest( - 'invokeCapability', - capabilityId, - args ?? null - ); + const rpcArgs = await marshalTransportValue(args ?? null, this, cancellationIds, capabilityId); - // Check for structured error response - if (isAtsError(result)) { - throw new CapabilityError(result.$error); + // Ref counting: The vscode-jsonrpc socket keeps Node's event loop alive. + // We ref() during RPC calls so the process doesn't exit mid-call, and + // unref() when idle so the process can exit naturally after all work completes. + if (this._pendingCalls === 0) { + this.socket?.ref(); } + this._pendingCalls++; - // Wrap handles automatically - return wrapIfHandle(result, this) as T; + try { + const result = await this.connection.sendRequest( + 'invokeCapability', + capabilityId, + rpcArgs + ); + + // Check for structured error response + if (isAtsError(result)) { + throw new CapabilityError(result.$error); + } + + // Wrap handles automatically + return wrapIfHandle(result, this) as T; + } finally { + this._pendingCalls--; + if (this._pendingCalls === 0) { + this.socket?.unref(); + } + } } finally { - this._pendingCalls--; - if (this._pendingCalls === 0) { - this.socket?.unref(); + for (const cancellationId of cancellationIds) { + unregisterCancellation(cancellationId); } } } disconnect(): void { - try { this.connection?.dispose(); } finally { this.connection = null; } - try { this.socket?.end(); } finally { this.socket = null; } + const connection = this.connection; + const socket = this.socket; + + this.connection = null; + this.socket = null; + this._connectPromise = null; + connectedClients.delete(this); + + try { + connection?.dispose(); + } catch { + // Ignore connection disposal errors during shutdown. + } + + if (socket && !socket.destroyed) { + socket.end(); + socket.destroy(); + } } get connected(): boolean { diff --git a/samples/volume-mount/ts/apphost.run.json b/samples/volume-mount/ts/aspire.config.json similarity index 56% rename from samples/volume-mount/ts/apphost.run.json rename to samples/volume-mount/ts/aspire.config.json index f23fa5b7..cfc98191 100644 --- a/samples/volume-mount/ts/apphost.run.json +++ b/samples/volume-mount/ts/aspire.config.json @@ -1,4 +1,13 @@ { + "appHost": { + "path": "apphost.ts", + "language": "typescript/nodejs" + }, + "packages": { + "Aspire.Hosting.JavaScript": "13.2.0", + "Aspire.Hosting.SqlServer": "13.2.0", + "Aspire.Hosting.Azure.Storage": "13.2.0" + }, "profiles": { "https": { "applicationUrl": "https://localhost:19627;http://localhost:29714", @@ -8,4 +17,4 @@ } } } -} \ No newline at end of file +}